
:root {
  color-scheme: dark;
  /* Multiplier for root font size; 1 = browser default; tuned in Settings → Appearance. */
  --ui-font-scale: 1;
  --bg: #0f1419;
  --panel: #1a2332;
  --border: #2d3a4f;
  --text: #e8edf4;
  --muted: #8b9cb3;
  --accent: #3d8fd1;
  --accent-dim: #2a6394;
  --warn: #c9a227;
  --danger-bg: rgba(201, 82, 82, 0.15);
  --font: "Segoe UI", system-ui, sans-serif;
  --radius: 8px;
  /* Barres de défilement (nuances de bleu, cohérentes avec l’UI) */
  --scrollbar-track: #141c28;
  --scrollbar-thumb: #2a4f73;
  --scrollbar-thumb-hover: #3d6f9e;
  --scrollbar-thumb-active: #4a8bc4;
  --menu-bar-bg: #101927;
  --dropdown-bg: #111c2c;
  --dropdown-border: #2a3a52;
  --menu-item-hover-bg: #0d1826;
  --doctype-select-border: #1f4f73;
  --doctype-select-bg: #0a2a45;
  --doctype-select-color: #9fc7e8;
  --settings-dialog-bg: #121d2b;
  --settings-head-bg: #162133;
  --settings-side-nav-bg: #0f1826;
  --input-surface: #0e1520;
  --card-surface: #0d1722;
  --table-header-bg: #151d28;
  --shortcuts-header-row-bg: #141f2d;
  --shortcuts-panel-border: #2a3a52;
  --status-bar-bg: #101927;
  --status-chip-border: #23344b;
  --status-chip-bg: #0c1420;
  --status-chip-fg: #a8bdd8;
  --sidebar-bg: #121820;
  --image-well-bg: #0a0d11;
  --success-feedback: #72d08b;
  --tab-active-text: #ffffff;
  --settings-tab-active-bg: #14304a;
  --kind-census: #90caf9;
  --kind-bdm: #a5d6a7;
  --badge-census-fg: #9fc7e8;
  --badge-bdm-fg: #b7dfba;
  --shortcut-keys-fg: #9fc7e8;
  --tooltip-bg: #111c2c;
  --tooltip-fg: #9fb2c9;
  --fields-empty-inline: #8aa0b8;
  --modal-backdrop: rgba(6, 10, 16, 0.6);
  --confirm-panel-border: rgba(255, 255, 255, 0.08);
  --confirm-panel-bg: rgba(12, 25, 45, 0.96);
  --confirm-panel-shadow: 0 22px 48px rgba(0, 0, 0, 0.45);
  --confirm-title: #e7f0ff;
  --confirm-text: #d6e2f7;
  --confirm-btn-border: rgba(255, 255, 255, 0.26);
  --confirm-btn-bg: rgba(255, 255, 255, 0.12);
  --confirm-btn-text: #f5f8ff;
  --confirm-btn-border-hover: rgba(255, 255, 255, 0.45);
  --confirm-btn-bg-hover: rgba(255, 255, 255, 0.18);
  --confirm-btn-primary-border: rgba(255, 255, 255, 0.45);
  --confirm-btn-primary-bg: rgba(255, 255, 255, 0.86);
  --confirm-btn-primary-text: #1d283a;
  --confirm-btn-primary-bg-hover: rgba(255, 255, 255, 0.96);
  --shortcuts-backdrop: rgba(6, 10, 16, 0.22);
  --suggest-bg: #172131;
  --suggest-border: #2c3f58;
  --suggest-divider: #223248;
  --suggest-fg: #dce6f2;
  --suggest-hover-bg: #2c4562;
  --suggest-hover-fg: #ffffff;
  --fields-doctype-title: #9fc7e8;
  --drag-target-outline: #2d7db9;
  --drag-handle-dot: #8ea4bd;
  --btn-primary-fg: #ffffff;
  --toggle-active-border: #d09a00;
  --toggle-active-bg: rgba(255, 204, 0, 0.16);
  --toggle-active-fg: #ffd86b;
  --record-remove-fg: #ffd6d6;
  --record-remove-border: #8f3a3a;
  --record-remove-bg: #3a1518;
  --record-remove-hover-bg: #5a2025;
  --record-remove-hover-border: #b14a4a;
  --record-transfer-fg: #b7dfba;
  --record-transfer-border: #3a7a48;
  --record-transfer-bg: #152518;
  --record-transfer-hover-bg: #1f3822;
  --record-transfer-hover-border: #4a9a58;
  --record-merge-fg: #9fc7e8;
  --record-merge-border: #2a6394;
  --record-merge-bg: #0d2438;
  --record-merge-hover-bg: #14304a;
  --record-merge-hover-border: #3d8fd1;
  --shadow-dropdown: 0 8px 18px rgba(0, 0, 0, 0.4);
  --shadow-shortcuts-panel: 0 16px 40px rgba(0, 0, 0, 0.45);
  --img-list-active-bg: rgba(61, 143, 209, 0.12);
  --img-list-hover-bg: rgba(255, 255, 255, 0.05);
}

html[data-theme="light"] {
  color-scheme: light;
  --bg: #f5f7fa;
  --panel: #ffffff;
  --border: #c9d4e3;
  --text: #1a2332;
  --muted: #5a6b80;
  --accent: #1a6cbd;
  --accent-dim: #155a9e;
  --warn: #9a7a18;
  --danger-bg: rgba(180, 60, 60, 0.1);
  --scrollbar-track: #e8eef5;
  --scrollbar-thumb: #9db4ce;
  --scrollbar-thumb-hover: #7e9ab8;
  --scrollbar-thumb-active: #5f7fa0;
  --menu-bar-bg: #ffffff;
  --dropdown-bg: #ffffff;
  --dropdown-border: #c9d4e3;
  --menu-item-hover-bg: #eef3f9;
  --doctype-select-border: #8eb4d4;
  --doctype-select-bg: #e8f2fb;
  --doctype-select-color: #1a4a70;
  --settings-dialog-bg: #ffffff;
  --settings-head-bg: #f0f4f9;
  --settings-side-nav-bg: #f5f8fc;
  --input-surface: #ffffff;
  --card-surface: #f5f8fc;
  --table-header-bg: #e8eef5;
  --shortcuts-header-row-bg: #eef3f9;
  --shortcuts-panel-border: #c9d4e3;
  --status-bar-bg: #ffffff;
  --status-chip-border: #c9d4e3;
  --status-chip-bg: #f0f4f9;
  --status-chip-fg: #3d4d63;
  --sidebar-bg: #f8fafc;
  --image-well-bg: #e4e9f0;
  --success-feedback: #2e8b57;
  --tab-active-text: #0d3a5c;
  --settings-tab-active-bg: #d6e8f8;
  --kind-census: #1565c0;
  --kind-bdm: #2e7d32;
  --badge-census-fg: #1565c0;
  --badge-bdm-fg: #2e7d32;
  --shortcut-keys-fg: #1565c0;
  --tooltip-bg: #ffffff;
  --tooltip-fg: #3d4d63;
  --fields-empty-inline: #6b7c91;
  --modal-backdrop: rgba(15, 23, 42, 0.35);
  --confirm-panel-border: #c9d4e3;
  --confirm-panel-bg: #ffffff;
  --confirm-panel-shadow: 0 22px 48px rgba(15, 23, 42, 0.2);
  --confirm-title: #1a2332;
  --confirm-text: #2f3f55;
  --confirm-btn-border: #c9d4e3;
  --confirm-btn-bg: #f5f8fc;
  --confirm-btn-text: #1a2332;
  --confirm-btn-border-hover: #b7c6d9;
  --confirm-btn-bg-hover: #eaf1f8;
  --confirm-btn-primary-border: #1a6cbd;
  --confirm-btn-primary-bg: #1a6cbd;
  --confirm-btn-primary-text: #ffffff;
  --confirm-btn-primary-bg-hover: #155a9e;
  --shortcuts-backdrop: rgba(15, 23, 42, 0.12);
  --suggest-bg: #ffffff;
  --suggest-border: #c9d4e3;
  --suggest-divider: #e0e7f0;
  --suggest-fg: #1a2332;
  --suggest-hover-bg: #e8f2fb;
  --suggest-hover-fg: #0d3a5c;
  --fields-doctype-title: #1565c0;
  --drag-target-outline: #1565c0;
  --drag-handle-dot: #7a8fa3;
  --btn-primary-fg: #ffffff;
  --toggle-active-border: #c9a227;
  --toggle-active-bg: rgba(201, 162, 39, 0.18);
  --toggle-active-fg: #7a5f00;
  --record-remove-fg: #8b1c1c;
  --record-remove-border: #c97a7a;
  --record-remove-bg: #fdecec;
  --record-remove-hover-bg: #f8d4d4;
  --record-remove-hover-border: #a33;
  --record-transfer-fg: #2e7d32;
  --record-transfer-border: #7ab87a;
  --record-transfer-bg: #ecf8ed;
  --record-transfer-hover-bg: #d4f0d6;
  --record-transfer-hover-border: #2e7d32;
  --record-merge-fg: #1565c0;
  --record-merge-border: #8eb4d4;
  --record-merge-bg: #e8f2fb;
  --record-merge-hover-bg: #d6e8f8;
  --record-merge-hover-border: #1a6cbd;
  --shadow-dropdown: 0 8px 18px rgba(15, 23, 42, 0.12);
  --shadow-shortcuts-panel: 0 16px 40px rgba(15, 23, 42, 0.15);
  --img-list-active-bg: rgba(26, 108, 189, 0.12);
  --img-list-hover-bg: rgba(15, 23, 42, 0.05);
}

* {
  box-sizing: border-box;
}

html {
  height: 100%;
  overflow: hidden;
  font-size: calc(100% * var(--ui-font-scale));
}



body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100%;
  height: 100%;
  max-height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.menu-bar {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  padding: 0.42rem 0.75rem;
  background: var(--menu-bar-bg);
  border-bottom: 1px solid var(--border);
  flex-wrap: nowrap;
}

.menu-group__title {
  font-size: 0.74rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  padding-right: 0.15rem;
  line-height: 1.2;
}

.menu-group__title--btn {
  border: 0;
  background: transparent;
  cursor: pointer;
  padding: 0;
}

.menu-dropdown {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.menu-dropdown__panel {
  display: none;
  position: absolute;
  top: calc(100% + 0.35rem);
  left: 0;
  min-width: 220px;
  background: var(--dropdown-bg);
  border: 1px solid var(--dropdown-border);
  border-radius: 6px;
  padding: 0.3rem;
  z-index: 20;
  box-shadow: var(--shadow-dropdown);
}

.menu-dropdown.is-open .menu-dropdown__panel {
  display: block;
}

.menu-item {
  width: 100%;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  padding: 0.32rem 0.45rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.82rem;
}

.menu-item:hover {
  border-color: var(--accent);
  background: var(--menu-item-hover-bg);
}

.menu-item__shortcut {
  color: var(--muted);
  font-size: 0.74rem;
}

.topbar {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.6rem 1rem;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}

.topbar__left,
.topbar__middle,
.topbar__right {
  display: flex;
  align-items: center;
  min-width: 0;
}

.topbar__left {
  flex: 1 1 0;
  justify-content: flex-start;
  gap: 0.85rem;
}

.topbar__middle {
  flex: 0 1 auto;
  justify-content: center;
}

.topbar__middle-actions {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.topbar-action-group {
  display: inline-flex;
  align-items: stretch;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--card-surface);
  overflow: hidden;
}

.topbar-action-group .bdm-view-toolbar {
  display: inline-flex;
  align-items: stretch;
  gap: 0;
  flex-wrap: nowrap;
}

.topbar-action-group .topbar-icon-toggle,
.topbar-action-group .topbar-action-group__btn {
  border: none;
  border-radius: 0;
  border-right: 1px solid var(--border);
  background: transparent;
  min-height: 2rem;
}

.topbar-action-group > .topbar-icon-toggle:last-child,
.topbar-action-group > .topbar-action-group__btn:last-child {
  border-right: none;
}

.topbar-action-group .topbar-icon-toggle:has(input:checked),
.topbar-action-group .topbar-action-group__btn.is-active {
  background: var(--toggle-active-bg);
  color: var(--toggle-active-fg);
}

.topbar-action-group .btn--autocorrect {
  background: #2e8b57;
  color: #fff;
  font-weight: 500;
}

.topbar-action-group .btn--autocorrect:hover:not(:disabled),
.topbar-action-group .btn--autocorrect:focus-visible:not(:disabled) {
  background: #3aa06a;
  color: #fff;
}

.topbar-action-group .btn--autocorrect:disabled {
  background: rgba(46, 139, 87, 0.45);
  color: rgba(255, 255, 255, 0.75);
}

.topbar-action-group .btn--ai-page-fill {
  background: #7b4db8;
  color: #fff;
  font-weight: 500;
}

.topbar-action-group .btn--ai-page-fill:hover:not(:disabled),
.topbar-action-group .btn--ai-page-fill:focus-visible:not(:disabled) {
  background: #8b5fca;
  color: #fff;
}

.topbar-action-group .btn--ai-page-fill:disabled {
  background: rgba(123, 77, 184, 0.42);
  color: rgba(255, 255, 255, 0.72);
}

.topbar-icon-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  height: 2rem;
  padding: 0 0.45rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--card-surface);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  color: var(--text);
}

.topbar-icon-toggle__glyph {
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1;
}

.topbar-icon-toggle input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.topbar-icon-toggle:has(input:checked) {
  border-color: var(--toggle-active-border);
  background: var(--toggle-active-bg);
  color: var(--toggle-active-fg);
}

.topbar-icon-toggle:has(input:disabled) {
  opacity: 0.45;
  cursor: not-allowed;
}

.topbar__right {
  flex: 1 1 0;
  justify-content: flex-end;
  gap: 0.5rem;
}

.topbar__menu {
  display: inline-flex;
  align-items: center;
}

.topbar__history {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.topbar__menu-toggle {
  min-width: 2rem;
  height: 2rem;
  padding-left: 0.5rem;
  padding-right: 0.5rem;
  font-size: 1rem;
}

.topbar__brand {
  font-weight: 600;
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.1rem;
}


.brand-logo {
  height: 44px;
  margin: -12px 0;
  width: auto;
  border-radius: 4px;

}

.brand-name {
  font-weight: 800;
  color: var(--text);
}

.brand-fix {
  font-weight: 300;
  color: var(--text);
}

.brand-dev {
  font-weight: 400;
  color: var(--muted);
  font-size: 0.85em;
}

.topbar__path {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.5rem;
}

.topbar__doctype {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-left: 0;
  color: var(--muted);
  white-space: nowrap;
}

.topbar__doctype--loading::after {
  content: "";
  width: 0.82rem;
  height: 0.82rem;
  border-radius: 999px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  animation: doctype-spinner 0.7s linear infinite;
  opacity: 0.9;
}

.topbar__tail {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.topbar__nav {
  margin-left: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.topbar__doctype select {
  min-width: 140px;
  padding: 0.35rem 0.6rem;
  border-radius: 6px;
  border: 1px solid var(--doctype-select-border);
  background: var(--doctype-select-bg);
  color: var(--doctype-select-color);
}

.topbar__doctype select:focus {
  outline: none;
  border-color: var(--accent);
}

.topbar__doctype--loading select {
  cursor: wait;
  opacity: 0.82;
}

@keyframes doctype-spinner {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.topbar__settings {
  display: flex;
  align-items: center;
}

.btn--icon {
  min-width: 2.2rem;
  height: 2.2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  line-height: 1;
  gap: 0.35rem;
  padding-left: 0.55rem;
  padding-right: 0.55rem;
  white-space: nowrap;
}

.topbar__settings--inline {
  margin-left: 0.25rem;
}

.topbar__path input[type="text"] {
  flex: 1;
  min-width: 200px;
  max-width: min(520px, 45vw);
  padding: 0.35rem 0.5rem;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 0.85rem;
}

.topbar__batch {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--muted);
  white-space: nowrap;
}

.btn--folder {
  white-space: nowrap;
}

.topbar__batch select {
  min-width: 220px;
  padding: 0.35rem 0.5rem;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
}

@media (max-width: 900px) {
  .topbar {
    flex-wrap: wrap;
  }

  .topbar__left,
  .topbar__middle,
  .topbar__right {
    flex: 1 1 100%;
  }

  .topbar__middle {
    justify-content: flex-start;
  }
}

.topbar__status {
  flex: 1;
  font-size: 0.9rem;
  color: var(--muted);
  min-width: 120px;
}

.btn {
  padding: 0.4rem 0.75rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  font-size: 0.9rem;
}

.btn:hover {
  border-color: var(--accent);
}

.btn--small {
  padding: 0.25rem 0.5rem;
  font-size: 0.8rem;
}

.btn--primary {
  background: var(--accent);
  border-color: var(--accent-dim);
  color: var(--btn-primary-fg);
}

.btn--primary:hover {
  filter: brightness(1.08);
}

.btn--danger {
  background: #c62828;
  border-color: #b71c1c;
  color: #fff;
}

.btn--danger:hover,
.btn--danger:focus-visible {
  background: #d32f2f;
  border-color: #c62828;
}

.settings-panel {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--settings-dialog-bg);
  border-top: 1px solid var(--border);
}

.settings-panel[hidden] {
  display: none !important;
}

.settings-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  padding: 0.6rem 0.85rem;
  border-bottom: 1px solid var(--border);
  background: var(--settings-head-bg);
}

.settings-panel__head h2 {
  margin: 0;
  font-size: 1rem;
  color: var(--text);
}

.settings-panel__content {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  min-height: 0;
  flex: 1;
}

#mainLayout[hidden] {
  display: none !important;
}

.settings-tabs {
  display: flex;
  gap: 0.35rem;
  margin-bottom: 0.6rem;
  overflow-x: auto;
  overflow-y: hidden;
  white-space: nowrap;
  padding-bottom: 0.15rem;
}

.settings-tabs--side {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin: 0;
  padding: 0.75rem 0.55rem;
  border-right: 1px solid var(--border);
  background: var(--settings-side-nav-bg);
  overflow-y: auto;
  overflow-x: hidden;
}

.settings-tab {
  flex: 0 0 auto;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--input-surface);
  color: var(--muted);
  padding: 0.3rem 0.65rem;
  cursor: pointer;
}

.settings-tab.is-active {
  color: var(--tab-active-text);
  border-color: var(--accent);
  background: var(--settings-tab-active-bg);
}

.settings-page {
  display: none;
}

.settings-page.is-active {
  display: block;
  width: 100%;
  min-width: 0;
}

.settings-page[data-settings-page="shortcuts"].is-active {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.settings-body {
  max-height: none;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0.75rem 0.75rem 0.85rem;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.kinds-summary {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.65rem;
}

.kinds-summary h3 {
  margin: 0;
  font-size: 0.92rem;
}

.kinds-summary__count {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text);
}

.kinds-table-wrap {
  max-height: 220px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.kinds-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 0.82rem;
}

.kinds-table th,
.kinds-table td {
  padding: 0.36rem 0.45rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.kinds-table th {
  position: sticky;
  top: 0;
  background: var(--table-header-bg);
  color: var(--muted);
  z-index: 1;
}

.kinds-table tbody tr:last-child td {
  border-bottom: none;
}

.kinds-subproject-cell {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.kinds-subproject-name {
  min-width: 0;
  overflow-wrap: anywhere;
}

.kinds-subproject-edit {
  width: 1.45rem;
  min-width: 1.45rem;
  height: 1.45rem;
  font-size: 0.8rem;
  padding: 0;
  flex-shrink: 0;
}

.kinds-subproject-edit svg {
  width: 0.85rem;
  height: 0.85rem;
  fill: currentColor;
}

.kind-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 62px;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 0.74rem;
  font-weight: 600;
}

.kind-badge--census {
  background: rgba(61, 143, 209, 0.16);
  border-color: rgba(61, 143, 209, 0.42);
  color: var(--badge-census-fg);
}

.kind-badge--bdm {
  background: rgba(76, 175, 80, 0.16);
  border-color: rgba(76, 175, 80, 0.4);
  color: var(--badge-bdm-fg);
}

.sub-projects-section {
  margin-top: 1rem;
}

.sub-projects-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.4rem;
}

.sub-projects-head h3 {
  margin: 0;
  font-size: 0.92rem;
}

.kinds-table-wrap--sub-projects {
  max-height: 240px;
}

.sub-project-form-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.65rem 0.75rem;
  margin-bottom: 0.55rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.sub-project-editor-title {
  margin: 0 0 0.15rem;
  font-size: 0.82rem;
  font-weight: 600;
}

.sub-project-field {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 0.8rem;
}

.sub-project-root-fieldset {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.4rem 0.55rem;
  margin: 0;
  font-size: 0.8rem;
}

.sub-project-root-fieldset legend {
  padding: 0 0.25rem;
  font-size: 0.75rem;
}

.sub-project-radio {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-right: 1rem;
}

.sub-project-editor-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.15rem;
}

.ci-import-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.3rem;
}

.ci-import-status {
  font-size: 0.78rem;
  color: var(--muted);
}

.ci-import-status.is-error {
  color: var(--danger, #d32f2f);
}

.doctype-tags-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  min-height: 1.8rem;
  padding: 0.25rem 0;
}

.doctype-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: 0.75rem;
  background: var(--input-bg, var(--surface));
}

.doctype-tag--data {
  border-color: rgba(61, 143, 209, 0.45);
  background: rgba(61, 143, 209, 0.1);
  color: var(--badge-census-fg);
}

.doctype-tag--non-data {
  border-color: rgba(76, 175, 80, 0.45);
  background: rgba(76, 175, 80, 0.1);
  color: var(--badge-bdm-fg);
}

.doctype-tag__cat {
  font-size: 0.68rem;
  opacity: 0.75;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.doctype-tag__remove {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  color: inherit;
  opacity: 0.55;
  font-size: 0.85rem;
}

.doctype-tag__remove:hover {
  opacity: 1;
}

/* ----- Sub-project clickable row ----- */
.sub-project-row {
  cursor: pointer;
  transition: background 0.12s;
}
.sub-project-row:hover td {
  background: var(--settings-tab-active-bg);
}
.sub-project-row:focus-visible td {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

/* ----- Sub-project profile panel ----- */
.sub-profile-backdrop {
  position: fixed;
  inset: 0;
  z-index: 64;
  background: var(--modal-backdrop);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

.sub-profile-panel {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 65;
  width: 70vw;
  max-width: 1100px;
  min-width: 520px;
  height: 80vh;
  display: flex;
  flex-direction: column;
  background: var(--settings-dialog-bg);
  border: 1px solid var(--shortcuts-panel-border);
  border-radius: 12px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  overflow: hidden;
}

.sub-profile-panel[hidden] {
  display: none !important;
}

.sub-profile-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--settings-head-bg);
  flex-shrink: 0;
}

.sub-profile-panel__title-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-width: 0;
}

.sub-profile-panel__title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sub-profile-panel__title-input {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  padding: 0.2rem 0.45rem;
  font: inherit;
  font-weight: 600;
  color: inherit;
  background: var(--input-bg, var(--bg));
  border: 1px solid var(--border);
  border-radius: 6px;
}

.sub-profile-panel__title-input:focus {
  outline: none;
  border-color: var(--accent, #4a90d9);
  box-shadow: 0 0 0 2px rgba(74, 144, 217, 0.25);
}

.sub-profile-panel__actions {
  display: flex;
  gap: 0.4rem;
  flex-shrink: 0;
}

.sub-profile-panel__footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 1rem;
  border-top: 1px solid var(--border);
  background: var(--settings-head-bg);
  flex-shrink: 0;
}

.sub-profile-panel__footer-search {
  flex: 1 1 14rem;
  min-width: 10rem;
  max-width: 32rem;
}

.sub-profile-panel__footer-search .sub-profile-field-search {
  width: 100%;
  max-width: none;
}

.sub-profile-fields-search-wrap {
  width: min(100%, 32rem);
  margin-bottom: 0.45rem;
}

.sub-profile-panel__footer-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin-left: auto;
}

.sub-profile-ci-import-wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
}

.sub-profile-section--keying-instructions .sub-profile-ci-import-wrap {
  margin-bottom: 0.45rem;
}

.sub-profile-panel__body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 0.9rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.sub-profile-section__title {
  margin: 0 0 0.45rem;
  font-size: 0.82rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.sub-profile-language-value {
  min-height: 2rem;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--input-surface);
  color: var(--text);
  padding: 0.35rem 0.55rem;
  font-size: 0.9rem;
}

.sub-profile-language-input {
  width: min(100%, 22rem);
  padding: 0.35rem 0.55rem;
  font-size: 0.9rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--input-surface);
  color: var(--text);
}

.sub-profile-doctype-group {
  margin-bottom: 0.65rem;
}

.sub-profile-doctype-group:last-child {
  margin-bottom: 0;
}

.sub-profile-doctype-group__title {
  margin: 0 0 0.35rem;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.sub-profile-doctype-group__title--data {
  color: var(--accent);
}

.sub-profile-doctype-group__title--non-data {
  color: #ffb74d;
}

html[data-theme="light"] .sub-profile-doctype-group__title--non-data {
  color: #ef6c00;
}

.sub-profile-doctype-group .doctype-tags-wrap {
  min-height: 0;
}

/* Pill colours inside profile panel (Data = blue, Non-Data = orange; Autre = default) */
.sub-profile-doctype-group--data .doctype-tag {
  border-color: color-mix(in srgb, var(--accent) 55%, transparent);
  background: color-mix(in srgb, var(--accent) 14%, var(--input-surface));
  color: var(--accent);
}

.sub-profile-doctype-group--non-data .doctype-tag {
  border-color: rgba(255, 152, 0, 0.5);
  background: rgba(255, 152, 0, 0.12);
  color: #ffb74d;
}

html[data-theme="light"] .sub-profile-doctype-group--non-data .doctype-tag {
  border-color: rgba(230, 81, 0, 0.4);
  background: rgba(230, 81, 0, 0.08);
  color: #e65100;
}

.sub-profile-doctypes {
  min-height: 2rem;
}

.sub-profile-doctype-add-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  width: 100%;
  margin-top: 0.35rem;
}

.sub-profile-doctype-add-input {
  flex: 1 1 8rem;
  min-width: 6rem;
  max-width: 14rem;
  padding: 0.25rem 0.45rem;
  font-size: 0.78rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--input-surface);
  color: var(--text);
}

.sub-profile-doctype-add-btn {
  flex-shrink: 0;
}

.sub-profile-field-search {
  flex: 1 1 12rem;
  min-width: 10rem;
  max-width: 24rem;
  padding: 0.35rem 0.55rem;
  font-size: 0.82rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--input-surface);
  color: var(--text);
}

.sub-profile-field-search::placeholder {
  color: var(--muted);
}

.sub-profile-fields-threshold-input {
  width: 4.25rem;
  padding: 0.22rem 0.4rem;
  font-size: 0.78rem;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--input-surface);
  color: var(--text);
}

.sub-profile-fields-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.sub-profile-fields-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
  min-width: 540px;
}

.sub-profile-fields-table th,
.sub-profile-fields-table td {
  padding: 0.32rem 0.55rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
}

.sub-profile-fields-table th {
  position: sticky;
  top: 0;
  background: var(--table-header-bg);
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
  z-index: 1;
}

.sub-profile-fields-table tbody tr:last-child td {
  border-bottom: none;
}

.sub-profile-fields-table .field-name-cell {
  color: var(--muted);
  font-size: 0.76rem;
  font-family: monospace;
}

.sub-profile-bool-yes {
  display: inline-block;
  width: 0.8rem;
  height: 0.8rem;
  border-radius: 50%;
  background: var(--kind-bdm);
  opacity: 0.85;
}

.sub-profile-bool-no {
  color: var(--muted);
  font-size: 0.78rem;
}

.sub-profile-fields-empty {
  color: var(--muted);
  font-size: 0.82rem;
  padding: 0.5rem 0;
}

.sub-profile-keying-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.sub-profile-keying-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
  min-width: 640px;
}

.sub-profile-keying-table th,
.sub-profile-keying-table td {
  padding: 0.38rem 0.55rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.sub-profile-keying-table th {
  position: sticky;
  top: 0;
  background: var(--table-header-bg);
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
  z-index: 1;
}

.sub-profile-keying-table tbody tr:last-child td {
  border-bottom: none;
}

.sub-profile-keying-label {
  width: 12rem;
  font-weight: 600;
  color: var(--text);
}

.sub-profile-keying-text {
  white-space: pre-wrap;
  line-height: 1.42;
}

.doc-types-list {
  color: var(--text);
  word-break: break-word;
}

.fields-kind-tabs {
  display: flex;
  gap: 0.35rem;
  margin-bottom: 0.6rem;
  overflow-x: auto;
  overflow-y: hidden;
  white-space: nowrap;
  padding-bottom: 0.15rem;
}

.fields-toolbar {
  margin: 0.35rem;
  margin-left: 0;
}

.fields-toolbar .fields-kind-tabs {
  margin-bottom: 0.35rem;
  flex: 1;
}

.wrap-for-toolbar-search-and-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}

.fields-toolbar__search {
  flex: 0 1 260px;
}

.fields-toolbar__search input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--input-surface);
  color: var(--text);
  padding: 0.32rem 0.6rem;
  font-size: 0.82rem;
}

.fields-toolbar__search input:focus {
  outline: none;
  border-color: var(--accent);
}

.fields-toolbar__actions {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.fields-save-feedback {
  min-width: 72px;
  font-size: 0.8rem;
  color: var(--success-feedback);
}

.fields-options {
  margin: 0 0 0.55rem;
  width: 100%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.45rem;
}

.fields-option {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.82rem;
  color: var(--text);
}

.fields-option--inline {
  align-items: center;
}

.fields-option--inline .input {
  width: min(100%, 24rem);
}

.fields-by-kind {
  width: 100%;
  min-width: 0;
}

.shortcuts-settings {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 0.65rem;
  width: 100%;
  min-width: 0;
  flex: 1;
  min-height: 0;
  align-self: stretch;
}

.appearance-settings {
  max-width: 42rem;
}

.ai-settings-page {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.ai-activation-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  max-width: 76rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card-surface);
}

.ai-activation-card h3,
.ai-activation-card p {
  margin: 0;
}

.ai-activation-card .muted {
  margin-top: 0.35rem;
}

.ai-activation-card__status {
  font-weight: 650;
}

.ai-activation-card__status[data-kind="success"],
.gateway-activation__status[data-kind="success"] {
  color: #2e8b57;
}

.ai-activation-card__status[data-kind="warning"],
.gateway-activation__status[data-kind="warning"] {
  color: var(--warning, #a66d00);
}

.ai-activation-card__status[data-kind="error"],
.gateway-activation__status[data-kind="error"] {
  color: var(--danger, #c43d3d);
}

.ai-settings {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-width: 76rem;
}

.ai-settings__controls {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.ai-settings__provider h3 {
  margin: 0 0 0.25rem;
  font-size: 1rem;
}

.ai-settings__provider p {
  margin: 0;
}

.ai-model-picker {
  display: grid;
  grid-template-columns: minmax(26rem, 32rem) minmax(18rem, 1fr);
  gap: 1rem;
  align-items: stretch;
}

.ai-model-picker__left,
.ai-model-picker__details {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card-surface);
  padding: 0.9rem;
}

.ai-model-picker__left {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  min-width: 0;
}

.ai-model-picker__label {
  font-size: 0.82rem;
  font-weight: 700;
}

.ai-model-picker__select {
  min-height: 2rem;
}

.ai-model-picker__select option {
  padding: 0.45rem 0.5rem;
}

.ai-model-picker__actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-height: 2rem;
}

.ai-model-picker__details {
  min-width: 0;
}

.ai-model-details__eyebrow {
  margin-bottom: 0.35rem;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.ai-model-picker__details h3 {
  margin: 0;
  font-size: 1rem;
}

.ai-model-details__id {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 0.78rem;
  overflow-wrap: anywhere;
}

.ai-model-details__description {
  margin: 0.9rem 0;
  line-height: 1.45;
}

.ai-model-details__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
}

.ai-model-details__grid > div {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.65rem;
  background: var(--input-surface);
}

.ai-model-details__grid span {
  display: block;
  margin-bottom: 0.25rem;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
}

.ai-model-details__grid strong {
  display: block;
  font-size: 0.9rem;
  font-weight: 650;
  overflow-wrap: anywhere;
}

@media (max-width: 900px) {
  .ai-settings__controls {
    flex-direction: column;
  }

  .ai-model-picker {
    grid-template-columns: 1fr;
  }

  .ai-model-details__grid {
    grid-template-columns: 1fr;
  }
}

.appearance-panel {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card-surface);
  padding: 0.55rem 0.65rem;
  margin-bottom: 0.75rem;
}

.appearance-panel__head h3 {
  margin: 0 0 0.2rem;
  font-size: 0.9rem;
}

.appearance-panel__head p {
  margin: 0;
  font-size: 0.8rem;
}

.appearance-theme-picker {
  margin-top: 0.55rem;
  display: inline-flex;
  gap: 0.4rem;
}

.appearance-theme-picker .btn.is-active {
  border-color: var(--accent);
  background: var(--settings-tab-active-bg);
  color: var(--tab-active-text);
}

.appearance-font-presets {
  margin-top: 0.55rem;
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.appearance-font-presets__btn.is-active {
  border-color: var(--accent);
  background: var(--settings-tab-active-bg);
  color: var(--tab-active-text);
}

.appearance-panel__option {
  margin-top: 0.55rem;
}

.appearance-panel__control {
  margin-top: 0.55rem;
}

.appearance-panel__subhint {
  margin: 0.35rem 0 0;
}

.appearance-settings__subhint {
  margin: -0.35rem 0 0.75rem;
  font-size: 0.76rem;
  line-height: 1.35;
}

.appearance-settings__hint {
  margin: 0 0 0.85rem;
  font-size: 0.82rem;
  line-height: 1.45;
}

.appearance-settings__row {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.5rem;
}

.appearance-settings__label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
}

.appearance-settings__control {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.appearance-settings__bound {
  font-size: 0.72rem;
  color: var(--muted);
  min-width: 2.25rem;
}

.appearance-settings__bound:last-of-type {
  text-align: right;
}

.appearance-settings__range {
  flex: 1;
  min-width: 0;
  accent-color: var(--accent);
}

.shortcuts-settings__controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.shortcuts-list {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card-surface);
  min-height: 0;
  overflow: auto;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.shortcuts-list__row {
  display: grid;
  grid-template-columns: minmax(120px, 190px) minmax(0, 1fr) minmax(140px, 180px);
  gap: 0.55rem;
  padding: 0.45rem 0.55rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.82rem;
  align-items: start;
}

.shortcuts-list__row:last-child {
  border-bottom: none;
}

.shortcuts-list__row--head {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--shortcuts-header-row-bg);
  color: var(--muted);
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.shortcuts-list__keys code {
  font-size: 0.78rem;
  color: var(--shortcut-keys-fg);
}

.shortcuts-list__context {
  color: var(--muted);
  font-size: 0.76rem;
}

.shortcuts-list__row--rebindable {
  cursor: pointer;
}

.shortcuts-list__row--rebindable:hover {
  background: var(--settings-tab-active-bg);
}

.shortcuts-list__row--rebindable:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.shortcut-rebind-popover {
  position: fixed;
  z-index: 80;
  max-width: min(22rem, calc(100vw - 2rem));
  padding: 0.75rem 0.85rem;
  border-radius: 10px;
  border: 1px solid var(--shortcuts-panel-border);
  background: var(--settings-dialog-bg);
  box-shadow: var(--shadow-shortcuts-panel);
}

.shortcut-rebind-popover[hidden] {
  display: none !important;
}

.shortcut-rebind-popover__title {
  margin: 0;
  font-size: 0.92rem;
  color: var(--text);
}

.shortcut-rebind-popover__hint {
  margin: 0.45rem 0 0;
  font-size: 0.8rem;
  line-height: 1.38;
  color: var(--muted);
}

.shortcut-rebind-popover__live {
  margin: 0.5rem 0 0;
  min-height: 1.85rem;
  padding: 0.35rem 0.45rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--input-surface);
  font-family: ui-monospace, "Cascadia Code", SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.02em;
}

.shortcut-rebind-popover__feedback {
  margin: 0.45rem 0 0;
  font-size: 0.78rem;
}

.shortcut-rebind-popover__feedback--error {
  color: #e57373;
}

.shortcut-rebind-popover__actions {
  margin-top: 0.65rem;
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

.ui-toast {
  position: fixed;
  bottom: 1.35rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2850;
  max-width: min(28rem, calc(100vw - 2rem));
  padding: 0.55rem 1rem;
  border-radius: 10px;
  border: 1px solid var(--shortcuts-panel-border);
  background: var(--settings-dialog-bg);
  box-shadow: var(--shadow-shortcuts-panel);
  font-size: 0.84rem;
  line-height: 1.38;
  color: var(--text);
  text-align: center;
  pointer-events: none;
}

.ui-toast[hidden] {
  display: none !important;
}

.shortcuts-panel {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(720px, calc(100vw - 2rem));
  max-height: calc(100vh - 2rem);
  z-index: 55;
  border: 1px solid var(--shortcuts-panel-border);
  border-radius: 10px;
  background: var(--settings-dialog-bg);
  box-shadow: var(--shadow-shortcuts-panel);
  overflow: hidden;
}

.shortcuts-panel__backdrop {
  position: fixed;
  inset: 0;
  z-index: 54;
  background: var(--shortcuts-backdrop);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

.shortcuts-panel__backdrop[hidden] {
  display: none !important;
}

.shortcuts-panel[hidden] {
  display: none !important;
}

.record-insert-overlay__backdrop {
  position: fixed;
  inset: 0;
  z-index: 56;
  background: var(--shortcuts-backdrop);
  backdrop-filter: blur(2.5px);
  -webkit-backdrop-filter: blur(2.5px);
}

.record-insert-overlay__backdrop[hidden] {
  display: none !important;
}

.record-insert-overlay {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 57;
  width: min(540px, calc(100vw - 2rem));
  border: 1px solid var(--shortcuts-panel-border);
  border-radius: 10px;
  background: var(--settings-dialog-bg);
  box-shadow: var(--shadow-shortcuts-panel);
  padding: 0.9rem 1rem;
}

.record-insert-overlay[hidden] {
  display: none !important;
}

.record-insert-overlay h2 {
  margin: 0;
  font-size: 1rem;
  color: var(--text);
}

.record-insert-overlay p {
  margin: 0.45rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.header-add-overlay__backdrop {
  position: fixed;
  inset: 0;
  z-index: 56;
  background: var(--shortcuts-backdrop);
  backdrop-filter: blur(2.5px);
  -webkit-backdrop-filter: blur(2.5px);
}

.header-add-overlay__backdrop[hidden] {
  display: none !important;
}

.header-add-overlay {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 57;
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  border: 1px solid var(--shortcuts-panel-border);
  border-radius: 999px;
  background: var(--settings-dialog-bg);
  box-shadow: var(--shadow-shortcuts-panel);
  padding: 0.55rem 0.85rem;
}

.header-add-overlay[hidden] {
  display: none !important;
}

.header-add-overlay__spinner {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--border);
  border-top-color: var(--text);
  animation: header-add-spin 0.9s linear infinite;
}

.header-add-overlay__text {
  font-size: 0.88rem;
  color: var(--text);
  white-space: nowrap;
}

.header-delete-overlay__backdrop,
.record-delete-overlay__backdrop,
.doc-type-change-overlay__backdrop,
.reorder-overlay__backdrop,
.dict-autocorrect-overlay__backdrop,
.confirm-action__backdrop {
  position: fixed;
  inset: 0;
  z-index: 56;
  background: var(--shortcuts-backdrop);
  backdrop-filter: blur(2.5px);
  -webkit-backdrop-filter: blur(2.5px);
}

.header-delete-overlay__backdrop[hidden],
.record-delete-overlay__backdrop[hidden],
.doc-type-change-overlay__backdrop[hidden],
.reorder-overlay__backdrop[hidden],
.dict-autocorrect-overlay__backdrop[hidden],
.confirm-action__backdrop[hidden] {
  display: none !important;
}

.confirm-action__backdrop {
  background: var(--modal-backdrop);
  backdrop-filter: blur(3.5px);
  -webkit-backdrop-filter: blur(3.5px);
}

.header-delete-overlay,
.record-delete-overlay,
.doc-type-change-overlay,
.reorder-overlay,
.dict-autocorrect-overlay {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 57;
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  border: 1px solid var(--shortcuts-panel-border);
  border-radius: 999px;
  background: var(--settings-dialog-bg);
  box-shadow: var(--shadow-shortcuts-panel);
  padding: 0.55rem 0.85rem;
}

.header-delete-overlay[hidden],
.record-delete-overlay[hidden],
.doc-type-change-overlay[hidden],
.reorder-overlay[hidden],
.dict-autocorrect-overlay[hidden] {
  display: none !important;
}

.header-delete-overlay__spinner,
.record-delete-overlay__spinner,
.doc-type-change-overlay__spinner,
.reorder-overlay__spinner,
.dict-autocorrect-overlay__spinner {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--border);
  border-top-color: var(--text);
  animation: header-add-spin 0.9s linear infinite;
}

.header-delete-overlay__text,
.record-delete-overlay__text,
.doc-type-change-overlay__text,
.reorder-overlay__text,
.dict-autocorrect-overlay__header {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
}

.dict-autocorrect-overlay__text {
  font-size: 0.88rem;
  color: var(--text);
  white-space: nowrap;
}

.dict-autocorrect-overlay--detailed {
  flex-direction: column;
  align-items: stretch;
  border-radius: 12px;
  padding: 0.85rem 1rem;
  min-width: min(420px, calc(100vw - 2rem));
  max-width: min(480px, calc(100vw - 2rem));
  gap: 0.55rem;
}

.dict-autocorrect-overlay--detailed .dict-autocorrect-overlay__header {
  display: flex;
}

.dict-autocorrect-overlay--detailed .dict-autocorrect-overlay__text {
  white-space: normal;
  font-weight: 600;
}

.dict-autocorrect-overlay__steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.dict-autocorrect-overlay__step {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 0.35rem 0.5rem;
  align-items: center;
  font-size: 0.82rem;
  padding: 0.35rem 0.45rem;
  border-radius: 8px;
  border: 1px solid transparent;
  background: color-mix(in srgb, var(--text) 4%, transparent);
}

.dict-autocorrect-overlay__step--pending {
  opacity: 0.72;
}

.dict-autocorrect-overlay__step--active {
  border-color: color-mix(in srgb, var(--accent, #4a7fd4) 45%, var(--border));
  background: color-mix(in srgb, var(--accent, #4a7fd4) 8%, transparent);
}

.dict-autocorrect-overlay__step--slowest {
  border-color: color-mix(in srgb, var(--warning, #c58a00) 40%, var(--border));
}

.dict-autocorrect-overlay__step-index {
  font-variant-numeric: tabular-nums;
  color: var(--text-muted, var(--text));
  opacity: 0.85;
}

.dict-autocorrect-overlay__step-label {
  min-width: 0;
}

.dict-autocorrect-overlay__step-meta {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  justify-self: end;
  white-space: nowrap;
}

.dict-autocorrect-overlay__step-status {
  font-size: 0.74rem;
  color: var(--text-muted, var(--text));
}

.dict-autocorrect-overlay__step-duration {
  font-variant-numeric: tabular-nums;
  font-size: 0.78rem;
  font-weight: 600;
}

.dict-autocorrect-overlay__step-badge {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--warning, #a66d00);
}

.dict-autocorrect-overlay__total {
  font-size: 0.78rem;
  color: var(--text-muted, var(--text));
  border-top: 1px solid var(--border);
  padding-top: 0.45rem;
  font-variant-numeric: tabular-nums;
}

.dict-autocorrect-results__backdrop {
  position: fixed;
  inset: 0;
  z-index: 58;
  background: var(--modal-backdrop);
  backdrop-filter: blur(3.5px);
  -webkit-backdrop-filter: blur(3.5px);
}

.dict-autocorrect-results__backdrop[hidden] {
  display: none !important;
}

.dict-autocorrect-results {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 59;
  width: min(640px, calc(100vw - 2rem));
  max-height: min(80vh, 520px);
  display: flex;
  flex-direction: column;
  border: 1px solid var(--confirm-panel-border);
  border-radius: 14px;
  background: var(--confirm-panel-bg);
  box-shadow: var(--confirm-panel-shadow);
  padding: 1rem 1.05rem;
}

.dict-autocorrect-results[hidden] {
  display: none !important;
}

.dict-autocorrect-results h2 {
  margin: 0;
  font-size: 1.05rem;
  color: var(--confirm-title);
}

.dict-autocorrect-results__summary {
  margin: 0.55rem 0 0;
  color: var(--confirm-text);
  font-size: 0.95rem;
  line-height: 1.45;
}

.dict-autocorrect-results__ai-stats {
  margin: 0.35rem 0 0;
  color: var(--muted, #888);
  font-size: 0.86rem;
  line-height: 1.35;
}

.dict-autocorrect-results__list {
  margin-top: 0.75rem;
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card-surface);
  padding: 0.5rem 0.65rem;
  font-size: 0.88rem;
  line-height: 1.4;
}

.dict-autocorrect-results__list ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.dict-autocorrect-results__list li + li {
  margin-top: 0.45rem;
  padding-top: 0.45rem;
  border-top: 1px solid var(--border);
}

.dict-autocorrect-results__item--link {
  cursor: pointer;
  border-radius: 8px;
  padding: 0.35rem 0.45rem;
  margin-left: -0.45rem;
  margin-right: -0.45rem;
  transition: background-color 0.15s ease;
}

.dict-autocorrect-results__item--link:hover,
.dict-autocorrect-results__item--link:focus-visible {
  background: color-mix(in srgb, var(--accent, #4a7fd4) 10%, transparent);
  outline: 2px solid color-mix(in srgb, var(--accent, #4a7fd4) 35%, transparent);
  outline-offset: 1px;
}

.dict-autocorrect-results__list li:first-child {
  border-top: none;
  padding-top: 0;
  margin-top: 0;
}

.dict-autocorrect-results__item-title {
  font-weight: 600;
  color: var(--text);
}

.dict-autocorrect-results__item-meta {
  color: var(--muted, #888);
  font-size: 0.82rem;
}

.dict-autocorrect-results__item-detail {
  margin-top: 0.2rem;
  color: var(--confirm-text);
}

.dict-autocorrect-results__item-detail--ok {
  color: #2e8b57;
}

.dict-autocorrect-results__item-detail--skip {
  color: var(--text);
}

.dict-autocorrect-results__buttons {
  margin-top: 0.85rem;
  display: flex;
  justify-content: flex-end;
}

.confirm-action {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 57;
  width: min(620px, calc(100vw - 2rem));
  border: 1px solid var(--confirm-panel-border);
  border-radius: 14px;
  background: var(--confirm-panel-bg);
  box-shadow: var(--confirm-panel-shadow);
  padding: 1rem 1.05rem;
}

.confirm-action[hidden] {
  display: none !important;
}

.confirm-action h2 {
  margin: 0;
  font-size: 1.05rem;
  color: var(--confirm-title);
}

.autocorrect-choice__hint {
  min-height: 1.2rem;
  margin-top: 0.45rem;
  color: var(--muted, #888);
  font-size: 0.88rem;
}

.autocorrect-choice__buttons {
  flex-wrap: wrap;
  gap: 0.5rem;
}

.sub-profile-panel__language-input {
  max-width: 180px;
}

.confirm-action p {
  margin: 0.55rem 0 0;
  color: var(--confirm-text);
  font-size: 1rem;
  white-space: pre-line;
  line-height: 1.45;
}

.confirm-action__buttons {
  margin-top: 1.05rem;
  display: flex;
  justify-content: flex-end;
  gap: 0.55rem;
}

.confirm-action .btn {
  border-color: var(--confirm-btn-border);
  background: var(--confirm-btn-bg);
  color: var(--confirm-btn-text);
}

.confirm-action .btn:hover {
  border-color: var(--confirm-btn-border-hover);
  background: var(--confirm-btn-bg-hover);
}

.confirm-action .btn--primary {
  border-color: var(--confirm-btn-primary-border);
  background: var(--confirm-btn-primary-bg);
  color: var(--confirm-btn-primary-text);
}

.confirm-action .btn--primary:hover {
  filter: none;
  background: var(--confirm-btn-primary-bg-hover);
}

.gateway-activation__backdrop {
  z-index: 60;
}

.gateway-activation {
  z-index: 61;
  width: min(540px, calc(100vw - 2rem));
}

.gateway-activation__field {
  display: block;
  margin-top: 0.9rem;
  margin-bottom: 0.35rem;
  color: var(--confirm-text);
  font-size: 0.9rem;
  font-weight: 650;
}

.gateway-activation__input {
  width: 100%;
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  letter-spacing: 0.02em;
}

.gateway-activation__status {
  min-height: 1.3rem;
  margin-top: 0.55rem !important;
  font-size: 0.88rem !important;
}

.lot-assignment-panel__field {
  display: block;
  margin-top: 0.85rem;
  margin-bottom: 0.35rem;
  font-size: 0.92rem;
  color: var(--muted);
}

.lot-assignment-panel__hint {
  margin: 0.45rem 0 0;
  color: var(--muted);
  font-size: 0.93rem;
  line-height: 1.4;
}

.lot-assignment-panel__settings-note {
  margin: 0.3rem 0 0;
  color: #f1c40f;
  font-size: 0.78rem;
  font-style: italic;
  line-height: 1.35;
}

.lot-assignment-panel__select {
  width: 100%;
  min-height: 2rem;
  border-radius: 8px;
}

.lot-assignment-panel__never-show {
  margin-top: 0.75rem;
}

.sub-project-assign-panel {
  width: min(460px, 92vw);
}

.sub-project-assign-panel .confirm-action__buttons {
  justify-content: flex-end;
}

@keyframes header-add-spin {
  to {
    transform: rotate(360deg);
  }
}

.shortcuts-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--border);
  background: var(--settings-head-bg);
}

.shortcuts-panel__head h2 {
  margin: 0;
  font-size: 0.95rem;
}

.shortcuts-panel .shortcuts-list {
  border: none;
  border-radius: 0;
  max-height: calc(100vh - 8.5rem);
}

.importer-panel {
  max-width: min(840px, calc(100vw - 2rem));
}

.importer-panel__body {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  padding: 0.85rem 0.95rem 0.95rem;
}

.importer-panel__intro {
  margin: 0.15rem 0 0.2rem;
}

.importer-panel__label {
  font-size: 0.84rem;
  color: var(--muted);
}

.importer-dropzone {
  width: 100%;
  min-height: 10rem;
  border: 1px dashed var(--accent);
  border-radius: 6px;
  background: var(--input-surface);
  color: var(--text);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-items: center;
  justify-content: center;
  text-align: center;
  cursor: pointer;
  transition: border-color 120ms ease, background 120ms ease;
}

.importer-dropzone:hover,
.importer-dropzone.is-dragover {
  border-color: var(--accent-dim);
  background: var(--menu-item-hover-bg);
}

.importer-dropzone__title {
  font-weight: 700;
}

.importer-dropzone__hint {
  color: var(--muted);
  font-size: 0.84rem;
}

.importer-preview {
  max-height: 13rem;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--input-surface);
}

.importer-preview__summary {
  padding: 0.55rem 0.65rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font-size: 0.84rem;
}

.importer-preview__errors {
  padding: 0.55rem 0.65rem;
  border-bottom: 1px solid var(--border);
  color: var(--danger, #c0392b);
  font-size: 0.82rem;
}

.importer-preview__errors ul {
  margin: 0.35rem 0 0;
  padding-left: 1.1rem;
}

.importer-preview__table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.importer-preview__table th,
.importer-preview__table td {
  padding: 0.42rem 0.55rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.importer-preview__table th {
  color: var(--muted);
  font-weight: 600;
}

.importer-preview__table tr:last-child td {
  border-bottom: 0;
}

.importer-panel__actions {
  display: flex;
  justify-content: flex-end;
}

.importer-feedback {
  min-height: 2.1rem;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--input-surface);
  font-size: 0.84rem;
}

.importer-feedback--success {
  border-color: #2e8b57;
  color: #2e8b57;
}

.importer-feedback--error {
  border-color: #a33;
  color: #a33;
}

.fields-kind-tab {
  flex: 0 0 auto;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--input-surface);
  color: var(--muted);
  padding: 0.3rem 0.65rem;
  cursor: pointer;
}

.fields-kind-tab.is-active {
  color: var(--tab-active-text);
  border-color: var(--accent);
  background: var(--settings-tab-active-bg);
}

.fields-doctype-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.6rem;
  align-items: stretch;
  width: 100%;
  min-width: 0;
}

/* Colonnes DocType : hauteur uniforme, liste défilante verticalement */
.fields-doctype-card {
  --fields-doctype-col-height: min(480px, 58vh);
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: var(--fields-doctype-col-height);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card-surface);
  padding: 0.45rem 0.55rem;
  box-sizing: border-box;
}

.fields-doctype-card--header {
  border-color: color-mix(in srgb, var(--accent) 35%, var(--border));
}

.fields-doctype-title {
  margin: 0 0 0.35rem;
  flex: 0 0 auto;
  font-size: 0.9rem;
  color: var(--fields-doctype-title);
}

.fields-doctype-title--mixed-eventtype {
  display: inline-block;
  padding: 0.12rem 0.5rem;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(255, 196, 0, 0.22), rgba(255, 149, 0, 0.26));
  color: #7a3f00;
  font-weight: 700;
  box-shadow: inset 0 0 0 1px rgba(199, 114, 0, 0.35);
}

[data-theme="dark"] .fields-doctype-title--mixed-eventtype {
  background: linear-gradient(90deg, rgba(255, 196, 0, 0.28), rgba(255, 149, 0, 0.3));
  color: #ffd089;
  box-shadow: inset 0 0 0 1px rgba(255, 173, 74, 0.5);
}

.fields-check-list {
  display: grid;
  gap: 0.28rem;
  flex: 1 1 auto;
  min-height: 0;
  align-content: start; /* ne pas étirer les lignes quand la colonne est haute */
  grid-auto-rows: min-content;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  padding-right: 2px; /* space for scrollbar so text doesn’t touch it */
}

.fields-check {
  display: grid;
  grid-template-columns: 14px 18px minmax(0, 1fr);
  align-items: center;
  align-self: start; /* une rangée = hauteur du contenu, pas 1fr implicite */
  gap: 0.45rem;
  color: var(--text);
  font-size: 0.82rem;
}

.fields-check--draggable {
  cursor: default;
}

.fields-check--draggable.is-dragging {
  opacity: 0.5;
}

.fields-check--draggable.is-drop-target {
  outline: 1px dashed var(--drag-target-outline);
  border-radius: 4px;
}

.fields-check__label {
  word-break: break-word;
  position: relative;
  display: inline-block;
  justify-self: start;
  max-width: 100%;
}

.fields-check__drag {
  width: 12px;
  height: 14px;
  position: relative;
  cursor: grab;
  user-select: none;
  -webkit-user-drag: element;
}

.fields-check__drag:active {
  cursor: grabbing;
}

.fields-check__drag::before {
  content: "";
  position: absolute;
  left: 1px;
  top: 1px;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--drag-handle-dot);
  box-shadow:
    0 4px 0 var(--drag-handle-dot),
    0 8px 0 var(--drag-handle-dot),
    5px 0 0 var(--drag-handle-dot),
    5px 4px 0 var(--drag-handle-dot),
    5px 8px 0 var(--drag-handle-dot);
}

.fields-check__label[data-field-name] {
  cursor: help;
}

.fields-check__label[data-field-name]:hover::after {
  content: attr(data-field-name);
  position: absolute;
  left: calc(100% + 0.12rem);
  top: 50%;
  transform: translateY(-50%);
  z-index: 4;
  padding: 0.2rem 0.38rem;
  border-radius: 4px;
  border: 1px solid var(--dropdown-border);
  background: var(--tooltip-bg);
  color: var(--tooltip-fg);
  font-size: 0.75rem;
  line-height: 1.2;
  white-space: nowrap;
  pointer-events: none;
}

.fields-empty {
  color: var(--muted);
  font-size: 0.84rem;
}

.fields-empty--inline {
  font-size: 0.78rem;
  color: var(--fields-empty-inline);
}

.layout {
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  /* liste | sép. | aperçu | sép. | formulaire */
  grid-template-columns: 168px 6px minmax(0, 1.55fr) 6px minmax(400px, 1fr);
  gap: 0;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.topbar__tools {
  margin: 0;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  flex: 0 0 auto;
  min-width: auto;
}

.status-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 0.65rem;
  min-height: 2rem;
  font-size: 0.78rem;
  background: var(--status-bar-bg);
  border-top: 1px solid var(--border);
  color: var(--muted);
  flex-wrap: wrap;
}

.status-segment {
  border: 1px solid var(--status-chip-border);
  border-radius: 4px;
  background: var(--status-chip-bg);
  color: var(--status-chip-fg);
  padding: 0.18rem 0.45rem;
  max-width: min(100%, 38rem);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.status-segment--button {
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.status-segment--right {
  margin-left: auto;
}

.status-segment--pan {
  padding-top: 0.18rem;
  padding-bottom: 0.18rem;
}

.status-segment--zoom {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding-top: 0.16rem;
  padding-bottom: 0.16rem;
}

.status-details__backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: var(--shortcuts-backdrop);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

.status-details__backdrop[hidden] {
  display: none !important;
}

.status-details {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(52rem, calc(100vw - 2rem));
  max-height: min(80vh, 44rem);
  z-index: 61;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel);
  box-shadow: 0 26px 52px rgba(0, 0, 0, 0.35);
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  padding: 0.85rem 0.95rem;
}

.status-details[hidden] {
  display: none !important;
}

.status-details__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}

.status-details__head h2 {
  margin: 0;
  font-size: 1rem;
}

.status-details__text {
  width: 100%;
  min-height: 12rem;
  max-height: 56vh;
  resize: vertical;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.6rem 0.7rem;
  font: 500 0.88rem/1.42 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  color: var(--text);
  background: var(--bg);
}

.status-details__actions {
  display: flex;
  justify-content: flex-end;
}

.status-zoom-label {
  color: var(--status-chip-fg);
  line-height: 1;
}

.status-zoom-value-input {
  width: 3.2rem;
  height: 1rem;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  font-size: 0.78rem;
  font-family: inherit;
  font-weight: 400;
  color: var(--status-chip-fg);
  line-height: 1;
  box-shadow: none;
  text-align: left;
}

.status-zoom-value-input::-webkit-outer-spin-button,
.status-zoom-value-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.status-zoom-value-input[type="number"] {
  appearance: textfield;
  -moz-appearance: textfield;
}

.status-zoom-value-input:focus {
  outline: none;
  border: 0;
  box-shadow: none;
}

.status-zoom-slider {
  width: min(170px, 28vw);
  margin: 0;
  accent-color: var(--accent);
}

.bdm-view-toolbar__coords--status {
  display: inline-flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 0.35rem;
}

.bdm-view-toolbar__coords--status .bdm-coord {
  flex-direction: row;
  align-items: center;
  gap: 0.26rem;
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 0;
}

.bdm-view-toolbar__coords--status .bdm-coord .muted {
  font-size: 0.78rem;
  font-family: inherit;
  font-weight: 400;
  line-height: 1;
  letter-spacing: 0;
  color: var(--status-chip-fg);
}

.bdm-view-toolbar__coords--status .bdm-coord-input {
  width: 2.3rem;
  height: 1rem;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  font-size: 0.78rem;
  font-family: inherit;
  font-weight: 400;
  color: var(--status-chip-fg);
  line-height: 1;
  box-shadow: none;
}

.bdm-view-toolbar__coords--status .bdm-coord-input:focus {
  outline: none;
  border: 0;
  box-shadow: none;
}

@media (max-width: 900px) {
  .bdm-view-toolbar__coords--status .bdm-coord-input {
    width: 2.05rem;
  }
}

.resizer {
  width: 6px;
  margin: 0 -3px;
  z-index: 2;
  cursor: col-resize;
  background: var(--border);
  align-self: stretch;
  flex-shrink: 0;
  transition: background 0.12s ease;
}

.resizer:hover,
.resizer:focus-visible {
  background: var(--accent);
}

.resizer.is-dragging {
  background: var(--accent);
}

.sidebar {
  border-right: 1px solid var(--border);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.sidebar__head {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
  padding: 0.5rem 0.75rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
}

.sidebar__head-title {
  flex: 1 1 0;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#btnImagesPanelToggle {
  flex: 0 0 auto;
}

.layout--images-panel-collapsed .sidebar__head {
  padding-left: 0.35rem;
  padding-right: 0.35rem;
  gap: 0.3rem;
}

.layout--images-panel-collapsed .sidebar__head-title {
  display: none;
}


.layout--images-panel-collapsed .img-list {
  display: block;
}

.layout--images-panel-collapsed .img-list li button {
  display: block;
  width: 100%;
  text-align: center;
  padding: 0.25rem 0.2rem;
  font-size: 0.68rem;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--text);
  box-shadow: none;
  min-height: 1.25rem;
}

.layout--images-panel-collapsed .img-list li button:hover,
.layout--images-panel-collapsed .img-list li button:focus-visible {
  background: color-mix(in srgb, var(--accent), transparent 88%);
  outline: 0;
}

.layout--images-panel-collapsed .img-list li button.active {
  background: color-mix(in srgb, var(--accent), transparent 80%);
  color: var(--text);
}

/* Emplacement de secours quand le panneau images est replié (colonne 0). */
.images-panel-toggle-host {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  flex-shrink: 0;
}

/* Défilement vertical + style (Firefox) */
.img-list,
.form-pane__scroll {
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}

/* WebKit (Chrome, Edge, Safari) */
.img-list::-webkit-scrollbar,
.form-pane__scroll::-webkit-scrollbar {
  width: 10px;
}

.img-list::-webkit-scrollbar-track,
.form-pane__scroll::-webkit-scrollbar-track {
  background: var(--scrollbar-track);
  border-radius: 6px;
  margin: 2px 0;
}

.img-list::-webkit-scrollbar-thumb,
.form-pane__scroll::-webkit-scrollbar-thumb {
  background: linear-gradient(
    180deg,
    var(--scrollbar-thumb) 0%,
    var(--accent-dim) 100%
  );
  border-radius: 6px;
  border: 2px solid var(--scrollbar-track);
}

.img-list::-webkit-scrollbar-thumb:hover,
.form-pane__scroll::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(
    180deg,
    var(--scrollbar-thumb-hover) 0%,
    var(--accent) 100%
  );
}

.img-list::-webkit-scrollbar-thumb:active,
.form-pane__scroll::-webkit-scrollbar-thumb:active {
  background: var(--scrollbar-thumb-active);
}

.img-list {
  list-style: none;
  margin: 0;
  padding: 0.25rem 0;
  overflow-y: auto;
  flex: 1;
}

.img-list li button {
  width: 100%;
  text-align: left;
  padding: 0.45rem 0.65rem;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 0.8rem;
  cursor: pointer;
  border-left: 3px solid transparent;
}

.img-list li button:hover {
  background: var(--img-list-hover-bg);
}

.img-list li button.active {
  background: var(--img-list-active-bg);
  border-left-color: var(--accent);
}


.image-list-context-menu {
  position: fixed;
  z-index: 2000;
  min-width: 12rem;
  padding: 0.25rem 0;
  margin: 0;
  border: 1px solid var(--dropdown-border);
  border-radius: var(--radius);
  background: var(--dropdown-bg);
  box-shadow: var(--shadow-dropdown);
}

.image-list-context-menu__item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.45rem 0.75rem;
  border: none;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}

.image-list-context-menu__item:hover,
.image-list-context-menu__item:focus-visible {
  background: var(--menu-item-hover-bg);
  outline: none;
}

.pane {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-right: 1px solid var(--border);
}

.pane--image {
  border-right: none;
}

.pane--form {
  border-right: none;
  min-width: 380px;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 0;
}

.pane--form > #formEmpty {
  padding: 0.75rem 1rem;
  flex-shrink: 0;
}

.pane--form #formContent {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.form-record-count-bar {
  margin: 0.65rem 0 0.15rem;
  padding: 0;
}

.form-record-count {
  display: inline-flex;
  align-items: baseline;
  gap: 0.45rem;
  padding: 0.35rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--accent), transparent 92%);
  font-size: 0.85rem;
  line-height: 1.25;
}

.form-record-count__label {
  color: var(--muted);
  font-weight: 500;
}

.form-record-count__value {
  font-weight: 700;
  font-size: 1rem;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.form-pane__scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  /* Marges latérales réduites pour élargir le tableau au max dans le panneau */
  padding: 0.55rem 0.35rem;
  scrollbar-gutter: stable;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.pane__toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  padding: 0.4rem 0.75rem;
  gap: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
}

.pane__toolbar-start {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
  flex: 1 1 0;
}

.pane__toolbar-title {
  flex: 1 1 0;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: block;
}

.zoom-toolbar {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.zoom__label {
  white-space: nowrap;
}

.zoom__value {
  font-weight: 600;
  min-width: 3rem;
  color: var(--accent);
  font-size: 0.9rem;
}

.zoom__value-input {
  width: 3.5rem;
  padding: 0.15rem 0.35rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--input-surface);
  color: var(--accent);
  font: inherit;
  font-weight: 600;
  text-align: center;
}

.zoom__value-input::-webkit-outer-spin-button,
.zoom__value-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.zoom__value-input[type="number"] {
  appearance: textfield;
  -moz-appearance: textfield;
}

.zoom__bound {
  font-size: 0.72rem;
  color: var(--muted);
  min-width: 2.25rem;
  text-align: center;
}

.zoom-toolbar input[type="range"] {
  width: min(140px, 22vw);
  vertical-align: middle;
}

.bdm-view-toolbar {
  display: flex;
  align-items: center;
  gap: 0.5rem 0.75rem;
  flex-wrap: wrap;
}

.topbar-toggle-check {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  font-size: 0.8rem;
  color: var(--text);
}

.topbar-toggle-check input[type="checkbox"] {
  width: 0.95rem;
  height: 0.95rem;
  accent-color: var(--accent);
}

.topbar-toggle-check:has(input:disabled) {
  color: var(--muted);
}

.bdm-auto-zoom {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
  white-space: nowrap;
  font-size: 0.8rem;
  user-select: none;
}

.bdm-auto-zoom input {
  width: 0.95rem;
  height: 0.95rem;
  accent-color: var(--accent);
}

.bdm-auto-zoom:has(input:disabled) {
  cursor: not-allowed;
  opacity: 0.52;
}

.topbar-icon-toggle.topbar-toggle-check,
.topbar-icon-toggle.bdm-auto-zoom {
  gap: 0;
  font-size: inherit;
}

.topbar-icon-toggle.topbar-toggle-check input[type="checkbox"],
.topbar-icon-toggle.bdm-auto-zoom input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.bdm-view-toolbar__coords {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 0.35rem 0.65rem;
}

.bdm-coord {
  display: inline-flex;
  flex-direction: column;
  gap: 0.1rem;
  font-size: 0.68rem;
}

.bdm-coord .muted {
  font-size: 0.68rem;
}

.bdm-coord-input {
  width: 3.75rem;
  padding: 0.15rem 0.3rem;
  font-size: 0.8rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--input-surface);
  color: var(--text);
  text-align: center;
}

.crop-draw-overlay {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  z-index: 500;
  pointer-events: none;
}

.crop-draw-overlay.is-active {
  pointer-events: auto;
  cursor: crosshair;
}

.crop-draw-overlay__preview {
  position: absolute;
  border: 2px dashed var(--accent);
  background: rgba(61, 143, 209, 0.15);
  display: none;
  box-sizing: border-box;
}

.img-wrap {
  flex: 1;
  min-height: 200px;
  min-width: 0;
  overflow: hidden;
  padding: 0.75rem;
  background: var(--image-well-bg);
  position: relative;
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.img-wrap.is-panning {
  cursor: grabbing;
}

.img-pan {
  position: absolute;
  left: 0;
  top: 0;
  display: block; /* Changé de flex à block pour un calcul de pan précis */
  will-change: transform;
  transform-origin: 0 0; /* Important pour les calculs de centrage */
  backface-visibility: hidden;
  /* Nouveau : pour que le rectangle soit bien positionné par rapport à l'image */
  transform-style: preserve-3d;
}

.img-canvas {
  position: relative;
  display: inline-block;
  line-height: 0;
}

.act-rects-layer {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 850;
}

.act-rect {
  position: absolute;
  box-sizing: border-box;
  border: 2px solid rgba(44, 181, 73, 0.95);
  background: rgba(44, 181, 73, 0.1);
  border-radius: 2px;
}

.act-rect__label {
  position: absolute;
  left: 0;
  top: -20px;
  font-size: 11px;
  line-height: 1.2;
  padding: 1px 5px;
  border-radius: 999px;
  color: #fff;
  background: rgba(44, 181, 73, 0.95);
  white-space: nowrap;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
}

/* Surlignage du champ actif */
.highlight-rect {
  position: absolute;
  border: 3px solid #ffcc00; /* Jaune/Ambre professionnel */
  background-color: rgba(255, 204, 0, 0.2);
  pointer-events: none;
  box-shadow: 0 0 15px rgba(255, 204, 0, 0.5), 0 0 2px rgba(0, 0, 0, 0.8);
  z-index: 1000;
  border-radius: 2px;
  display: none;
  /* Correction décalage systématique constaté (4px) */
  margin-left: 4px;
  margin-top: 4px;
  opacity: 0;
  transition: opacity 0.9s ease-out, left 0.3s cubic-bezier(0.4, 0, 0.2, 1), top 0.3s cubic-bezier(0.4, 0, 0.2, 1), width 0.3s, height 0.3s;
  box-sizing: border-box;
}

.highlight-rect.is-visible {
  opacity: 1;
}

.highlight-rect.is-fading {
  opacity: 0;
}

.floating-input {
  position: absolute;
  border: 4px solid #ffcc00;
  background-color: #fff;
  color: #0f1419;
  font-size: 20pt;
  text-align: center;
  font-weight: bold;
  padding: 4px 8px;
  line-height: 1;
  z-index: 1001;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.8);
  border-radius: 4px;
  outline: none;
  box-sizing: border-box; /* Pour que width inclut les bordures/padding */
  margin-left: 4px; /* S'aligner avec le décalage de highlightRect */
  min-width: 60px; /* Minimum syndical pour taper 1-2 lettres si le cadre est riquiqui */
  pointer-events: none;
  /* La position 'top' et 'left' sera gérée en JS */
}

.field-table__row.row-active {
  outline: 2px solid #ffcc00;
  outline-offset: -2px;
  position: relative;
  z-index: 10;
  background-color: rgba(255, 204, 0, 0.05);
}

.img-wrap img {
  display: block;
  width: auto;
  height: auto;
  max-width: none;
  max-height: none;
  flex-shrink: 0;
  flex-grow: 0;
  vertical-align: top;
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.35);
  border-radius: 4px;
  pointer-events: none;
  /* Rendu niveaux de gris : fond blanc + texte noir, proche de l'aperçu Windows */
  filter: grayscale(1) contrast(1.09);
  image-rendering: auto;
  -webkit-backface-visibility: hidden;
  user-select: none;
  -webkit-user-drag: none;
}

.muted {
  color: var(--muted);
}

.form-toolbar {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-bottom: 0;
  padding: 0.4rem 0.45rem;
  background: var(--panel);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  font-size: 0.85rem;
}

.form-toolbar__spacer {
  flex: 1 1 auto;
}

.form-toolbar .btn[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn--toggle.is-active {
  border-color: var(--toggle-active-border);
  background: var(--toggle-active-bg);
  color: var(--toggle-active-fg);
}

.form-toolbar__filter {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  cursor: pointer;
  color: var(--muted);
}

.form-toolbar__filter input {
  margin-top: 0.2rem;
}

.block h2 {
  margin: 0 0 0.45rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--muted);
  line-height: 1.25;
  word-wrap: break-word;
}

.fields {
  margin-bottom: 0.55rem;
}

.fields--table {
  overflow-x: hidden;
  max-width: 100%;
}

.field-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 0.78rem;
  background: var(--panel);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.field-table thead th {
  text-align: left;
  padding: 0.1rem 0.2rem;
  background: var(--table-header-bg);
  color: var(--muted);
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  line-height: 1.15;
}

/*
 * Colonne « Champ » : --col-champ-px = plus long libellé + 4px (voir applyFieldTableColumnWidths).
 * Avant mesure : repli 10rem.
 */
.field-table thead th:nth-child(1),
.field-table td:first-child {
  width: var(--col-champ-px, 10rem);
  min-width: 0;
}

.field-table thead th:nth-child(2),
.field-table thead th:nth-child(3),
.field-table td:nth-child(2),
.field-table td:nth-child(3) {
  min-width: 0;
  width: auto;
}

/* Colonne « conf » : largeur fixe 3.75rem */
.field-table thead th:nth-child(4),
.field-table td:nth-child(4) {
  width: 3.75rem;
  min-width: 3.75rem;
  max-width: 3.75rem;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.field-table td {
  padding: 0.06rem 0.2rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.floating-orig-snippet {
  position: fixed;
  z-index: 1200;
  border: 2px solid #ffcc00;
  border-radius: 3px;
  background: #efe9c7;
  overflow: hidden;
  pointer-events: none;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.35);
}

.floating-orig-snippet[hidden] {
  display: none !important;
}

.floating-orig-snippet__img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: fill;
}

.field-table td:nth-child(4) .field-table__input {
  text-align: center;
  padding-left: 0.2rem;
  padding-right: 0.2rem;
}

.field-table.field-table--hide-conf-column thead th:nth-child(4),
.field-table.field-table--hide-conf-column td:nth-child(4) {
  display: none;
}

.field-table.field-table--merge-hwr-orig thead th:nth-child(2),
.field-table.field-table--merge-hwr-orig td:nth-child(2) {
  display: none;
}

.field-table__readonly-badge-wrap {
  position: relative;
}

.field-table__readonly-badge-cell .field-table__input {
  padding-right: 4.3rem;
}

.field-table__conf-badge {
  position: absolute;
  top: 50%;
  right: 0.28rem;
  transform: translateY(-50%);
  display: inline-block;
  min-width: 3.5rem;
  padding: 0.06rem 0.26rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.68rem;
  line-height: 1.05;
  text-align: center;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}

.field-table__orig-merged-input-wrap {
  position: relative;
}

.field-table__ai-conf-cell {
  position: relative;
}

.field-table__conf-badge--inline {
  position: absolute;
  top: 50%;
  right: 0.28rem;
  transform: translateY(-50%);
  min-width: 3rem;
}

.field-table__conf-badge--ai {
  position: absolute;
  top: 50%;
  right: 0.28rem;
  transform: translateY(-50%);
  min-width: 3rem;
  color: #d7f5df;
  border-color: rgba(46, 139, 87, 0.65);
  background: rgba(46, 139, 87, 0.2);
}

.field-table__conf-badge--ai-high {
  color: #d7f5df;
  border-color: rgba(46, 139, 87, 0.75);
  background: rgba(46, 139, 87, 0.24);
}

.field-table__conf-badge--ai-medium {
  color: #ffe7b5;
  border-color: rgba(255, 183, 77, 0.7);
  background: rgba(255, 183, 77, 0.18);
}

.field-table__conf-badge--ai-low {
  color: #ffd0d0;
  border-color: rgba(229, 57, 53, 0.68);
  background: rgba(229, 57, 53, 0.18);
}

.field-table__orig-merged-input-wrap:has(.field-table__conf-badge--ai) .field-table__input,
.field-table__ai-conf-cell:has(.field-table__conf-badge--ai) .field-table__input {
  padding-right: 3.9rem;
}

.field-table__orig-merged-hwr-line {
  margin-top: 0.16rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--muted);
  font-size: 0.68rem;
  line-height: 1.35;
  white-space: nowrap;
  overflow-x: hidden;
  overflow-y: visible;
  text-overflow: ellipsis;
}

.field-table__orig-merged-hwr-line > span:first-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.field-table__conf-badge--hwr-line {
  position: static;
  transform: none;
  flex: 0 0 auto;
  min-width: 2.8rem;
}

.field-table tbody tr:last-child td {
  border-bottom: none;
}

.field-table__row--override-ok td {
  background: rgba(46, 139, 87, 0.12);
}

[data-theme="dark"] .field-table__row--override-ok td {
  background: rgba(46, 139, 87, 0.16);
}

.field-table__row--dict-corrected td {
  background: rgba(56, 132, 255, 0.28);
}

[data-theme="dark"] .field-table__row--dict-corrected td {
  background: rgba(56, 132, 255, 0.35);
}

.field-table__label {
  color: var(--text);
  font-weight: 500;
  line-height: 1.25;
  word-break: normal;
  overflow-wrap: break-word;
  hyphens: auto;
}

.field-table__warn {
  color: var(--warn);
  font-weight: normal;
}

.field-table__input {
  width: 100%;
  box-sizing: border-box;
  padding: 0.06rem 0.25rem;
  border-radius: 3px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 0.78rem;
  font-family: inherit;
  line-height: 1.15;
  height: 1.55rem;
}

.field-table input.field-table__input[readonly] {
  opacity: 0.92;
}

.field-suggest {
  position: fixed;
  z-index: 1300;
  background: var(--suggest-bg);
  border: 1px solid var(--suggest-border);
  border-radius: 4px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
  max-height: 210px;
  overflow-y: auto;
}

.field-suggest[hidden] {
  display: none !important;
}

.field-suggest__item {
  display: block;
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--suggest-divider);
  background: transparent;
  color: var(--suggest-fg);
  text-align: left;
  padding: 0.28rem 0.38rem;
  font-size: 0.8rem;
  line-height: 1.2;
  cursor: pointer;
}

.field-suggest__item:last-child {
  border-bottom: 0;
}

.field-suggest__item:hover,
.field-suggest__item.is-active {
  background: var(--suggest-hover-bg);
  color: var(--suggest-hover-fg);
}

/* Multi-header: blocs Header (sections) + déplacer / supprimer */
.header-fields-root {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.header-section {
  padding-bottom: 0.65rem;
  border-bottom: 1px solid var(--border);
}

.header-section:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.header-section__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.header-section__head .header-section__title {
  margin: 0;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--muted);
  flex: 1 1 auto;
  min-width: 8rem;
  line-height: 1.2;
}

.header-section__actions {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  flex-shrink: 0;
}

.header-section-move-btn {
  min-width: 1.8rem;
  padding-left: 0.45rem;
  padding-right: 0.45rem;
  font-weight: 700;
}

.header-section-delete-btn {
  min-width: 5.5rem;
  color: var(--record-remove-fg);
  border-color: var(--record-remove-border);
  background: var(--record-remove-bg);
}

.header-section-delete-btn:hover,
.header-section-delete-btn:focus-visible {
  background: var(--record-remove-hover-bg);
  border-color: var(--record-remove-hover-border);
}

.record-header-sel-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0 0.5rem 0 0;
  font-size: 0.8rem;
  flex: 0 0 auto;
}

.record-header-sel-label {
  color: var(--muted);
  white-space: nowrap;
}

select.record-header-sel {
  max-width: 10rem;
  font-size: 0.8rem;
  padding: 0.2rem 0.35rem;
  border-radius: 3px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  line-height: 1.15;
  cursor: pointer;
}

select.record-header-sel:focus-visible {
  outline: 2px solid var(--border);
  outline-offset: 1px;
}

.header-add-section-wrap {
  margin-top: 0.5rem;
  padding-top: 0.45rem;
  border-top: 1px dashed var(--border);
}

.header-add-section-wrap .btn {
  width: 100%;
  max-width: 22rem;
  border-style: dashed;
}

.header-add-section-wrap--inline {
  margin-top: -0.2rem;
  margin-bottom: 0.15rem;
  padding-top: 0;
  border-top: 0;
}

.header-add-section-wrap--inline .btn {
  border-style: solid;
}

.bdm-mixed-add-wrap {
  margin-top: 0.5rem;
  padding-top: 0.45rem;
  border-top: 1px dashed var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.bdm-mixed-add-wrap[hidden] {
  display: none !important;
}

.bdm-mixed-add-wrap .btn {
  width: 100%;
  max-width: 22rem;
}

.bdm-mixed-add-wrap__cover-btn {
  border-style: dashed;
}

.record-card {
  margin-top: 0.75rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
}

.record-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
}

.record-card h3 {
  margin: 0 0 0.4rem;
  font-size: 0.92rem;
  line-height: 1.2;
}

.record-card__head h3 {
  margin: 0;
}

.record-card__move {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  margin-left: auto;
  margin-right: 0.35rem;
}

.record-move-btn,
.record-transfer-btn,
.record-merge-btn {
  min-width: 1.8rem;
  padding-left: 0.45rem;
  padding-right: 0.45rem;
  font-weight: 700;
  line-height: 1;
}

.record-transfer-btn {
  color: var(--record-transfer-fg);
  border-color: var(--record-transfer-border);
  background: var(--record-transfer-bg);
}

.record-transfer-btn:hover,
.record-transfer-btn:focus-visible {
  background: var(--record-transfer-hover-bg);
  border-color: var(--record-transfer-hover-border);
}

.record-merge-btn {
  color: var(--record-merge-fg);
  border-color: var(--record-merge-border);
  background: var(--record-merge-bg);
}

.record-merge-btn:hover,
.record-merge-btn:focus-visible {
  background: var(--record-merge-hover-bg);
  border-color: var(--record-merge-hover-border);
}

.record-remove-btn {
  min-width: 5.5rem;
  color: var(--record-remove-fg);
  border-color: var(--record-remove-border);
  background: var(--record-remove-bg);
}

.record-remove-btn:hover,
.record-remove-btn:focus-visible {
  background: var(--record-remove-hover-bg);
  border-color: var(--record-remove-hover-border);
}

.record-insert-wrap {
  display: flex;
  justify-content: center;
  margin: 0.35rem 0 0.1rem;
}

.record-insert-btn {
  border-style: dashed;
  min-width: 10rem;
}

@media (max-width: 1100px) {
  .layout {
    grid-template-columns: 148px 6px minmax(0, 1fr) 6px minmax(360px, 1fr);
  }
}

@media (max-width: 900px) {
  .shortcuts-panel {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: calc(100vw - 1.3rem);
    max-height: calc(100vh - 1.3rem);
  }

  .shortcuts-list__row {
    grid-template-columns: minmax(96px, 130px) minmax(0, 1fr);
  }

  .shortcuts-list__context {
    grid-column: 1 / -1;
  }
}
