/* Components: buttons, fields, tabs, badges, key-value lists, tree and table rows,
   toolbars, progress, toasts, command palette. No decorative cards, no gradients. */

/* Buttons. Accent colour = the one primary action, nothing else. */
.primary-action, .secondary-action, .icon-button, .tool {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  border-radius: var(--r-2);
  white-space: nowrap;
  transition: background-color var(--dur-1) var(--ease), color var(--dur-1) var(--ease), border-color var(--dur-1) var(--ease);
}
.primary-action {
  height: var(--control-h);
  padding: 0 var(--s-3);
  border: 0;
  background: var(--accent-strong);
  color: var(--on-accent);
  font-size: var(--t-md);
  font-weight: var(--w-semibold);
}
.primary-action:hover { background: var(--accent-hover); }
.secondary-action {
  height: var(--control-h);
  padding: 0 var(--s-3);
  border: 1px solid var(--line-2);
  background: transparent;
  color: var(--text-1);
  font-size: var(--t-sm);
  font-weight: var(--w-medium);
}
.secondary-action:hover { background: var(--bg-2); }
.icon-button {
  width: var(--control-h);
  height: var(--control-h);
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text-2);
}
.icon-button:hover { background: var(--bg-2); color: var(--text-1); }

/* Text fields */
.field {
  width: 100%;
  height: 26px;
  padding: 0 var(--s-2);
  border: 1px solid var(--line);
  border-radius: var(--r-2);
  background: var(--bg-2);
  color: var(--text-1);
  font-size: var(--t-sm);
}
.field::placeholder { color: var(--text-3); }
.field:hover { border-color: var(--line-2); }
.field:focus-visible { outline-offset: 0; border-color: var(--line-2); }
input[type="search"]::-webkit-search-cancel-button { filter: grayscale(1); opacity: .6; }

/* Tabs — sub-tab bars carry the DEPLOYED app's .tabs/.tab shape (audit 1256-1310): a
   padded 8 px-radius surface strip of 6 px-radius pills (gap .25rem, tab padding
   .5rem/.75rem, weight 500, nowrap scroll-x), ink fill when active. Geometry verbatim;
   palette and type scale stay ours, motion 120–200 ms. */
.tabs {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.25rem;
  padding: 0.5rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg-2);
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
}
.tabs [role="tab"] {
  display: flex;
  align-items: center;
  padding: 0.5rem 0.75rem;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-2);
  font-size: var(--t-body);
  font-weight: var(--w-medium);
  white-space: nowrap;
  flex-shrink: 0;
  transition: background-color var(--dur-2) var(--ease), color var(--dur-2) var(--ease);
}
.tabs [role="tab"]:hover:not([aria-selected="true"]) { background: var(--bg-3); color: var(--text-1); }
.tabs [role="tab"][aria-selected="true"] { background: var(--text-1); color: var(--text-inverse); }
.tabs [role="tab"]:focus-visible { outline-offset: 2px; }

/* Severity badges and dots */
.badge {
  display: inline-flex;
  align-items: center;
  flex: none;
  height: 18px;
  padding: 0 6px;
  border-radius: var(--r-1);
  background: var(--sev-info-bg);
  color: var(--sev-info);
  font-size: var(--t-xs);
  font-weight: var(--w-semibold);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.badge[data-severity="blocking"] { background: var(--sev-blocking-bg); color: var(--sev-blocking); }
.badge[data-severity="review"] { background: var(--sev-review-bg); color: var(--sev-review); }
.sev-dot { display: inline-block; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--sev-info); }
[data-severity="blocking"] > .sev-dot { background: var(--sev-blocking); }
[data-severity="review"] > .sev-dot { background: var(--sev-review); }
[data-severity="none"] > .sev-dot { background: #c7ccd3; }

/* Key-value lists (facts, properties) */
.kv { display: grid; }
.kv-row { display: grid; grid-template-columns: minmax(0, 40%) minmax(0, 1fr); gap: var(--s-3); padding: 5px 0; border-bottom: 1px solid var(--line); font-size: var(--t-sm); }
.kv-row:last-child { border-bottom: 0; }
.kv dt { min-width: 0; color: var(--text-3); overflow-wrap: anywhere; hyphens: auto; } /* « Standortplatzierung » at 390 px */
.kv dd { color: var(--text-1); overflow-wrap: anywhere; }
.kv dd.mono { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Wave 05 — plan panel */
.plan-storeys { display: grid; gap: 2px; max-height: 180px; overflow: auto; margin: var(--s-2) 0; }
.plan-storeys .link-row { display: flex; justify-content: space-between; gap: var(--s-2); width: 100%; }

/* Wave 05 — recent projects on the welcome stage */
.session-list { display: grid; gap: 2px; margin: var(--s-2) auto; max-width: 420px; }
.session-list .link-row { display: flex; justify-content: space-between; gap: var(--s-2); width: 100%; }

.section-title { margin: var(--s-5) 0 var(--s-2); color: var(--text-1); font-size: var(--t-section-title); font-weight: var(--w-semibold); letter-spacing: -.005em; }
.panel-note { color: var(--text-2); font-size: var(--t-sm); line-height: var(--lh); }
/* Inline loading notes: spinner sits with the text, never on its own line. */
.inline-note .spinner, .model-row .panel-note .spinner { vertical-align: -2px; margin-right: 6px; }

/* Virtualised lists */
.vlist { position: relative; overflow: auto; overscroll-behavior: contain; contain: strict; }
.vlist-spacer { width: 1px; }
.vlist-window { position: absolute; top: 0; left: 0; right: 0; will-change: transform; }

/* Tree rows */
.tree-row {
  display: flex;
  align-items: center;
  gap: 6px;
  height: var(--row-h);
  padding-right: var(--s-1);
  color: var(--text-2);
  font-size: var(--t-sm);
  white-space: nowrap;
  cursor: default;
  user-select: none;
}
.tree-row.lvl-1 { padding-left: 6px; color: var(--text-1); font-weight: var(--w-medium); }
.tree-row.lvl-2 { padding-left: 20px; }
.tree-row.lvl-3 { padding-left: 38px; }
.tree-row:hover { background: var(--bg-2); color: var(--text-1); }
.tree-row.is-selected { background: var(--sel-bg); color: var(--text-1); box-shadow: inset 2px 0 0 var(--sel-line); }
.tree-row[data-vis="hidden"] .tree-label, .tree-row[data-vis="hidden"] .kind-element, .tree-row[data-vis="hidden"] .kind-type, .tree-row[data-vis="hidden"] .kind-storey { opacity: .45; }
.twisty { display: inline-flex; flex: none; width: 16px; height: 16px; color: var(--text-3); cursor: pointer; }
.twisty .icon { width: 14px; height: 14px; margin: 1px; }
.twisty:hover { color: var(--text-1); }
.tree-row .icon[class*="kind-"] { width: 14px; height: 14px; color: var(--text-3); }
.tree-label { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.tree-detail { margin-left: 6px; color: var(--text-3); font-weight: var(--w-regular); }
.tree-meta { flex: none; color: var(--text-3); font-size: var(--t-xs); }
.eye { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 22px; height: 20px; padding: 0; border: 0; border-radius: var(--r-1); background: transparent; color: var(--text-3); opacity: 0; }
.eye .icon { width: 14px; height: 14px; }
.tree-row:hover .eye, .tree-row:focus-within .eye, .eye[data-vis="hidden"], .eye[data-vis="partial"] { opacity: 1; }
.eye:hover { background: var(--bg-3); color: var(--text-1); }
.eye[data-vis="partial"] { color: var(--text-2); }
.tree-empty { padding: var(--s-3); }

/* Table rows (drawer) */
.tr { display: grid; align-items: center; height: var(--row-h); padding: 0 var(--s-3); column-gap: var(--s-3); font-size: var(--t-sm); color: var(--text-2); }
.table-body .tr { cursor: default; }
.table-body .tr:hover { background: var(--bg-2); color: var(--text-1); }
.table-body .tr.is-selected { background: var(--sel-bg); color: var(--text-1); box-shadow: inset 2px 0 0 var(--sel-line); }
.td { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.td:first-child { color: var(--text-1); }
.td.num { text-align: right; }
.th { height: 26px; border-bottom: 1px solid var(--line); color: var(--text-3); font-size: var(--t-xs); font-weight: var(--w-semibold); letter-spacing: .02em; }
[data-table="elements"] .tr { grid-template-columns: minmax(160px, 2.2fr) minmax(120px, 1.2fr) minmax(100px, 1fr) minmax(170px, 1.3fr) 64px; }
[data-table="findings"] .tr { grid-template-columns: 84px minmax(150px, 1.5fr) minmax(150px, 1.8fr) minmax(110px, 1fr) minmax(90px, .9fr) minmax(170px, 1.2fr); }
[data-table="storeys"] .tr { grid-template-columns: minmax(200px, 2fr) 120px 120px; }

/* Progress and spinner */
.progress { position: relative; display: inline-block; width: 96px; height: 4px; overflow: hidden; border-radius: 2px; background: var(--bg-3); }
.progress-bar { position: absolute; inset: 0; background: var(--text-2); transform-origin: left; transform: scaleX(var(--p, 0)); transition: transform var(--dur-2) linear; }
.progress[data-determinate="false"] .progress-bar { width: 30%; transform: none; animation: slide 1.1s var(--ease) infinite; }
@keyframes slide { from { translate: -100% 0; } to { translate: 340% 0; } }
.spinner { display: inline-block; flex: none; width: 12px; height: 12px; border: 1.5px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { rotate: 360deg; } }
@media (prefers-reduced-motion: reduce) { .spinner, .progress-bar { animation: none; } }

/* Working overlay: floating feedback for async effects (exports, IDS…) */
.working-zone:empty { display: none; }
.working-overlay {
  position: fixed; bottom: 48px; left: 50%; transform: translateX(-50%);
  display: grid; gap: 8px; width: min(360px, calc(100vw - 32px));
  padding: 8px 20px;
  background: var(--surface-1, #fff); border: 1px solid var(--border, #e0e0e0); border-radius: 8px;
  box-shadow: 0 2px 12px rgba(0,0,0,.12);
  z-index: 900; font-size: var(--t-sm); color: var(--text-1, #172437);
  animation: working-in 200ms ease-out;
}
.working-label { display: flex; align-items: center; gap: 8px; min-width: 0; }
.working-label .spinner { flex: none; }
.working-progress { display: block; width: 100%; height: 3px; }
.working-overlay .spinner { width: 16px; height: 16px; border-width: 2px; }
@keyframes working-in {
  from { opacity: 0; transform: translateX(-50%) translateY(8px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* Disclosure */
details > summary { display: flex; align-items: center; gap: 6px; list-style: none; cursor: pointer; }
details > summary::-webkit-details-marker { display: none; }
.summary-icon { width: 12px; height: 12px; color: var(--text-3); transition: rotate var(--dur-1) var(--ease); }
details[open] > summary .summary-icon { rotate: 90deg; }

/* Classification rows (inspector): system/code/provenance, then the crosswalk quality word. */
.classif-row { display: grid; grid-template-columns: auto auto 1fr; gap: 2px 10px; padding: 6px 0; border-top: 1px solid var(--border); align-items: baseline; }
.classif-system { font-weight: 600; }
.classif-code { font-size: .92em; }
.classif-label { grid-column: 1 / -1; color: var(--text-2); font-size: .92em; }
.classif-provenance { grid-column: 1 / -1; font-size: .82em; color: var(--text-3); }
.classif-map { grid-column: 1 / -1; font-size: .92em; }
.classif-quality[data-quality="Parfait"] { color: var(--ok, #6ecf8b); }
.classif-quality[data-quality="Multiple"], .classif-quality[data-quality="Approximatif"] { color: var(--warn, #e0b152); }

/* BCF issues + row actions. */
.issue-row { display: flex; gap: 8px; align-items: baseline; padding: 4px 0; }
.issue-row .issue-title { flex: 1 1 auto; }
.row-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }

/* RC1.2 PREMIUM — metric cards (quality/data heroes), deliverable cards, clash brief and
   the loading sequence. N1 answers are cards: label, one big number, meaning on hover. */
.hero-title { margin: var(--s-2) 0 var(--s-3); font-size: var(--t-page-title); font-weight: var(--w-semibold); letter-spacing: -.015em; color: var(--text-1); }
.metric-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(108px, 1fr)); gap: var(--s-2); margin: var(--s-2) 0 var(--s-3); }
.metric-card { min-width: 0; display: flex; flex-direction: column; gap: 2px; padding: var(--s-3); border: 1px solid var(--card-line, var(--line)); border-radius: var(--r-2); background: var(--bg-1); }
.metric-value { font-size: var(--t-metric); font-weight: var(--w-semibold); line-height: 1.1; letter-spacing: -.02em; color: var(--text-1); font-variant-numeric: tabular-nums; }
.metric-label { font-size: var(--t-caption); color: var(--text-3); overflow-wrap: anywhere; hyphens: auto; }
.metric-card[data-quality="blocking"] .metric-value { color: var(--sev-blocking); }
.metric-card[data-quality="review"] .metric-value { color: var(--sev-review); }
.metric-card[data-quality="ok"] .metric-value { color: var(--ok); }
.metric-card[data-quality="info"] .metric-value { color: var(--text-2); }

.livrables-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: var(--s-3); }
.livrable-card { display: flex; flex-direction: column; gap: var(--s-2); padding: var(--s-4); border: 1px solid var(--card-line, var(--line)); border-radius: var(--r-3); background: var(--bg-1); transition: box-shadow var(--dur-2) var(--ease), transform var(--dur-1) var(--ease); }
.livrable-card:hover { box-shadow: var(--shadow-float); }
.livrable-card:active .secondary-action { transform: scale(.97); }
.livrable-card-head { display: flex; align-items: center; gap: var(--s-2); }
.livrable-mark { width: 10px; height: 10px; border-radius: 3px; background: var(--accent); flex: none; }
.livrable-name { font-size: var(--t-body-strong); color: var(--text-1); }
.livrable-hint { margin: 0; font-size: var(--t-caption); color: var(--text-2); line-height: var(--lh); flex: 1 1 auto; }
.livrable-card .secondary-action { align-self: flex-start; }

.clash-brief { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: var(--s-2) var(--s-4); margin: var(--s-2) 0 var(--s-3); padding: var(--s-3); border: 1px solid var(--card-line, var(--line)); border-radius: var(--r-2); background: var(--bg-2); }
.brief-item { margin: 0; }
.brief-item dt { font-size: var(--t-caption); color: var(--text-3); }
.brief-item dd { margin: 2px 0 0; font-size: var(--t-body); font-weight: var(--w-medium); color: var(--text-1); }

.load-sequence { display: grid; gap: var(--s-1); justify-items: start; }
.phase-track { display: flex; gap: var(--s-3); font-size: var(--t-caption); color: var(--text-3); }
.phase-step.is-current { color: var(--text-1); font-weight: var(--w-semibold); }
.phase-step.is-current::before { content: "→ "; color: var(--accent); }

/* ── RC1.3 shared form + disclosure vocabulary (QC identity) ───────────────── */
.search-field, .text-input, select, input[type="number"], input[type="text"] { height: 38px; min-width: 0; padding: 0 12px; border: 1px solid var(--line-2); border-radius: var(--r-1); background: var(--bg-1); color: var(--text-1); font-size: var(--t-body); transition: border-color var(--dur-1) var(--ease), box-shadow var(--dur-1) var(--ease); }
.search-field::placeholder, .text-input::placeholder { color: var(--text-3); }
.search-field:hover, .text-input:hover, select:hover { border-color: var(--brand-a); }
.search-field:focus-visible, .text-input:focus-visible, select:focus-visible, input[type="number"]:focus-visible { outline: none; border-color: var(--brand-a); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-a) 22%, transparent); }
.secondary-action { height: 38px; padding: 0 16px; border: 1px solid var(--line-2); border-radius: var(--r-2); background: var(--bg-1); color: var(--text-1); font-size: var(--t-xs); font-weight: 700; transition: border-color var(--dur-1) var(--ease), background-color var(--dur-1) var(--ease), transform var(--dur-1) var(--ease); }
.secondary-action:hover { border-color: var(--brand-a); background: color-mix(in srgb, var(--brand-a) 6%, var(--bg-1)); }
.secondary-action:active { transform: scale(.98); }
.secondary-action:disabled, .secondary-action[aria-disabled="true"] { opacity: .55; }
.secondary-action.compact { height: 30px; padding: 0 12px; }
.section-title { margin: var(--s-4) 0 var(--s-2); }
.row-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2); }

/* Maquette sub-pages that are plain forms/lists read as one calm card */
.shell[data-layout="document"][data-view="explore"] .panel-body > .filters { display: grid; gap: var(--s-3); align-content: start; padding: 22px 24px; border: 1px solid var(--line); border-radius: var(--r-3); background: var(--bg-1); box-shadow: var(--shadow-1); }
.shell[data-table="page"][data-view="explore"] .panel { padding: 16px; border: 1px solid var(--line); border-radius: var(--r-3); background: var(--bg-1); box-shadow: var(--shadow-1); }
.shell[data-table="page"][data-view="explore"] .panel-body { padding: 0; }

/* « Détails techniques » : a quiet footer disclosure, never first-level reading */
.capability-panel { margin-top: var(--s-2); padding: 0 4px; }
.capability-panel details { border-top: 1px dashed var(--line-2); padding-top: var(--s-3); }
.tech-summary { color: var(--text-3); font-size: var(--t-xs); font-weight: 700; letter-spacing: .02em; }
.tech-summary::before { content: "▸"; display: inline-block; margin-right: 6px; transition: transform var(--dur-1) var(--ease); }
details[open] > .tech-summary::before { transform: rotate(90deg); }
.capabilities { display: grid; gap: var(--s-1); padding-top: var(--s-3); color: var(--text-2); font-size: var(--t-xs); }
details.tech { padding: 14px 18px; border: 1px dashed var(--line-2); border-radius: var(--r-3); background: color-mix(in srgb, var(--bg-1) 70%, transparent); }
details.tech > summary { color: var(--text-3); font-size: var(--t-xs); font-weight: 700; cursor: pointer; }
.expert { margin-top: var(--s-2); padding: 0 4px; border: 0; }
.expert summary { color: var(--text-3); font-size: var(--t-xs); font-weight: 700; }
.shell[data-table="page"][data-view="explore"] .panel .filters { padding: 0; border: 0; background: transparent; box-shadow: none; }
.shell[data-table="page"][data-view="explore"] .filter-summary { margin: 0; padding: 0 0 var(--s-3); border-bottom: 1px solid var(--line); } /* D-S1-03: no bleed past an unpadded panel (the count and « Tout effacer » were cut) */
/* Inspector rows with a source: value on its own line, source below it (never glued). */
.kv dd.kv-sourced { display: grid; gap: 2px; min-width: 0; }
.kv dd.kv-sourced .kv-value { min-width: 0; overflow-wrap: anywhere; }
.kv dd.kv-sourced .kv-value.mono { word-break: break-all; }
.kv dd.kv-sourced .kv-source { display: block; font-size: var(--t-xs); }
