/* KARL Support design system (porte tel quel depuis KARLTimeLens, KARL_Support_UIX.md paragraphe 2). Logical properties only: the layout mirrors in RTL. */

:root {
  --font-sans: "Segoe UI", "Inter", system-ui, -apple-system, "Noto Sans", "Noto Sans Hebrew", "Arial Hebrew", sans-serif;
  --font-mono: "Cascadia Mono", "Consolas", "DejaVu Sans Mono", ui-monospace, monospace;

  --c-bg: #f5f6f8;
  --c-surface: #ffffff;
  --c-surface-2: #eef0f3;
  --c-border: #d9dde3;
  --c-border-strong: #b8bec8;
  --c-text: #1b1f24;
  --c-text-2: #4a525d;
  --c-text-3: #6b7380;
  --c-accent: #1f5f8b;
  --c-accent-strong: #174a6d;
  --c-accent-soft: #e3eef6;
  --c-focus: #0b63c4;
  --c-danger: #a3261d;
  --c-danger-soft: #fbeceb;
  --c-warning: #7a5200;
  --c-warning-soft: #fff4dc;
  --c-ok: #1d6b44;
  --c-ok-soft: #e4f3ea;

  --ev-observed: #1d6b44;
  --ev-observed-soft: #e4f3ea;
  --ev-measured: #2d5a8e;
  --ev-measured-soft: #e5edf7;
  --ev-corroborated: #5d3f8c;
  --ev-corroborated-soft: #eee8f6;
  --ev-hypothesis: #7a5200;
  --ev-hypothesis-soft: #fff4dc;

  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 24px;
  --sp-6: 32px;
  --sp-7: 48px;

  --r-1: 4px;
  --r-2: 8px;
  --r-3: 12px;
  --r-pill: 999px;

  --e-1: 0 1px 2px rgba(20, 28, 38, 0.08);
  --e-2: 0 4px 14px rgba(20, 28, 38, 0.10);
  --e-3: 0 12px 36px rgba(20, 28, 38, 0.18);

  --fs-xs: 12px;
  --fs-sm: 13px;
  --fs-md: 14px;
  --fs-lg: 16px;
  --fs-xl: 20px;
  --fs-2xl: 28px;

  --sidebar-w: 256px;
  --sidebar-w-compact: 68px;
  --topbar-h: 60px;
  --touch: 36px;
  --motion: 160ms;
}

@media (prefers-reduced-motion: reduce) {
  :root { --motion: 0ms; }
  *, *::before, *::after { animation-duration: 0ms !important; transition-duration: 0ms !important; }
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--font-sans);
  font-size: var(--fs-md);
  line-height: 1.45;
  color: var(--c-text);
  background: var(--c-bg);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { margin: 0; font-weight: 600; line-height: 1.25; }
h1 { font-size: var(--fs-2xl); }
h2 { font-size: var(--fs-xl); }
h3 { font-size: var(--fs-lg); }
p { margin: 0; }
a { color: var(--c-accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--c-focus); outline-offset: 2px; border-radius: var(--r-1); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; inset-inline-start: var(--sp-2); inset-block-start: -40px; z-index: 100; background: var(--c-surface); padding: var(--sp-2) var(--sp-3); border-radius: var(--r-2); box-shadow: var(--e-2); }
.skip-link:focus { inset-block-start: var(--sp-2); }

/* Technical data keeps its logical direction (hash, ids, coordinates). */
.tech { font-family: var(--font-mono); font-size: var(--fs-xs); unicode-bidi: isolate; direction: ltr; word-break: break-all; color: var(--c-text-2); }
bdi.tech { display: inline; }
/* Copyable code/config block (one click selects all, horizontal scroll on overflow). */
.code-block { font-family: var(--font-mono); font-size: var(--fs-xs); unicode-bidi: isolate; direction: ltr; white-space: pre; overflow-x: auto; background: var(--c-surface-2); border: 1px solid var(--c-border); border-radius: var(--r-2); padding: var(--sp-3); margin: 0; color: var(--c-text-2); user-select: all; }
/* Contenu Markdown rendu (corps des articles KB, cf. `render_markdown`). */
.md { line-height: 1.55; }
.md > * + * { margin-block-start: var(--sp-2); }
.md h1, .md h2, .md h3, .md h4, .md h5, .md h6 { font-weight: 600; line-height: 1.25; }
.md h1 { font-size: var(--fs-xl, 1.35rem); }
.md h2 { font-size: var(--fs-lg, 1.2rem); }
.md h3 { font-size: var(--fs-md, 1.05rem); }
.md h4, .md h5, .md h6 { font-size: var(--fs-sm); }
.md ul, .md ol { padding-inline-start: var(--sp-5, 1.4rem); }
.md li + li { margin-block-start: var(--sp-1); }
.md code { font-family: var(--font-mono); font-size: var(--fs-xs); background: var(--c-surface-2); border: 1px solid var(--c-border); border-radius: var(--r-1, 4px); padding: 0 var(--sp-1); }
.md pre { background: var(--c-surface-2); border: 1px solid var(--c-border); border-radius: var(--r-2); padding: var(--sp-3); overflow-x: auto; }
.md pre code { background: none; border: none; padding: 0; }
.md blockquote { border-inline-start: 3px solid var(--c-border); padding-inline-start: var(--sp-3); color: var(--c-text-3); margin-inline-start: 0; }
.md a { color: var(--c-accent); text-decoration: underline; }
.md table { border-collapse: collapse; }
.md th, .md td { border: 1px solid var(--c-border); padding: var(--sp-1) var(--sp-2); text-align: start; }
.md th { background: var(--c-surface-2); }
.md hr { border: none; border-block-start: 1px solid var(--c-border); }
.md img { max-width: 100%; }
.muted { color: var(--c-text-3); }
.small { font-size: var(--fs-sm); }
.xs { font-size: var(--fs-xs); }
.row { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row.nowrap { flex-wrap: nowrap; }
.col { display: flex; flex-direction: column; gap: var(--sp-2); }
.grow { flex: 1 1 auto; min-width: 0; }
.stack-4 > * + * { margin-block-start: var(--sp-4); }
.stack-3 > * + * { margin-block-start: var(--sp-3); }
.stack-2 > * + * { margin-block-start: var(--sp-2); }
.divider { border: 0; border-block-start: 1px solid var(--c-border); margin: var(--sp-3) 0; }

/* Directional icons flip in RTL. */
[dir="rtl"] .icon.dir { transform: scaleX(-1); }
.icon { width: 18px; height: 18px; flex: none; display: inline-block; vertical-align: middle; }
.icon.sm { width: 14px; height: 14px; }
.icon.lg { width: 22px; height: 22px; }

/* ---------- Shell ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); grid-template-rows: var(--topbar-h) minmax(0, 1fr); height: 100vh; }
.shell.compact { grid-template-columns: var(--sidebar-w-compact) minmax(0, 1fr); }
.topbar { grid-column: 1 / -1; display: flex; align-items: center; gap: var(--sp-3); padding-inline: var(--sp-4); background: var(--c-surface) url("/topbar-bg.webp") center / cover no-repeat; border-block-end: 1px solid var(--c-border); z-index: 20; }
.brand { display: flex; align-items: center; gap: var(--sp-2); min-width: calc(var(--sidebar-w) - var(--sp-5)); }
.shell.compact .brand { min-width: auto; }
.brand-mark { width: 30px; height: 30px; border-radius: var(--r-2); background: var(--c-accent); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 13px; letter-spacing: 0.5px; }
.brand-name { font-weight: 650; font-size: var(--fs-lg); white-space: nowrap; }
.brand-sub { font-size: 11px; color: var(--c-text-3); white-space: nowrap; }
.topbar-search { flex: 1 1 220px; min-width: 160px; max-width: 560px; }
.topbar-search input { width: 100%; height: 36px; border: 1px solid var(--c-border); border-radius: var(--r-pill); padding-inline: var(--sp-4); background: var(--c-surface-2); }
.topbar-tools { display: flex; align-items: center; gap: var(--sp-2); margin-inline-start: auto; min-width: 0; }
.topbar { overflow: hidden; }
@media (max-width: 1360px) { .health { display: none; } .brand-sub { display: none; } }
@media (max-width: 1100px) { .brand-text { display: none; } .brand { min-width: auto; } }
.health { display: flex; gap: var(--sp-1); align-items: center; }
.health-dot { display: inline-flex; align-items: center; gap: 4px; font-size: var(--fs-xs); padding: 2px 8px; border-radius: var(--r-pill); background: var(--c-surface-2); color: var(--c-text-2); }
.health-dot::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--c-ok); }
.health-dot.degraded::before { background: #c28a00; border-radius: 1px; }
.health-dot.down::before { background: var(--c-danger); border-radius: 0; transform: rotate(45deg); }

.sidebar { background: var(--c-surface) url("/sidebar-bg.webp") center bottom / cover no-repeat; border-inline-end: 1px solid var(--c-border); display: flex; flex-direction: column; overflow-y: auto; padding: var(--sp-3) var(--sp-2); gap: 2px; }
.nav-link { display: flex; align-items: center; gap: var(--sp-3); min-height: var(--touch); padding-inline: var(--sp-3); border-radius: var(--r-2); color: var(--c-text-2); font-weight: 500; }
.nav-link:hover { background: var(--c-surface-2); text-decoration: none; color: var(--c-text); }
.nav-link[aria-current="page"] { background: var(--c-accent-soft); color: var(--c-accent-strong); }
.nav-sep { border-block-start: 1px solid var(--c-border); margin: var(--sp-3) var(--sp-2); }
.nav-badge { margin-inline-start: auto; font-size: 11px; background: var(--c-surface-2); border-radius: var(--r-pill); padding: 0 6px; }
.shell.compact .nav-label, .shell.compact .nav-badge, .shell.compact .brand-text { display: none; }
.shell.compact .nav-link { justify-content: center; padding-inline: 0; }
.main { overflow: auto; min-width: 0; position: relative; }
.page { padding: var(--sp-5) var(--sp-6); max-width: 1680px; margin-inline: auto; }
/* Page de connexion (hors coque) : fond plein viewport "memory layer",
   la carte de formulaire reste centree au-dessus de la zone calme. */
.login-page { min-height: 100vh; background: var(--c-bg) url("/login-bg.webp") center / cover no-repeat fixed; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--sp-4); margin-block-end: var(--sp-5); flex-wrap: wrap; }
.page-head p { color: var(--c-text-2); margin-block-start: var(--sp-1); }
.breadcrumbs { display: flex; gap: var(--sp-1); align-items: center; font-size: var(--fs-sm); color: var(--c-text-3); margin-block-end: var(--sp-2); }

.banner { display: flex; align-items: center; gap: var(--sp-2); padding: var(--sp-2) var(--sp-4); font-size: var(--fs-sm); border-block-end: 1px solid var(--c-border); }
.banner.warn { background: var(--c-warning-soft); color: var(--c-warning); }
.banner.error { background: var(--c-danger-soft); color: var(--c-danger); }
.banner.info { background: var(--c-accent-soft); color: var(--c-accent-strong); }

/* ---------- Controls ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2); min-height: var(--touch); padding: 0 var(--sp-4); border-radius: var(--r-2); border: 1px solid var(--c-border-strong); background: var(--c-surface); cursor: pointer; font-weight: 500; white-space: nowrap; transition: background var(--motion); }
.btn:hover { background: var(--c-surface-2); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.primary { background: var(--c-accent); border-color: var(--c-accent); color: #fff; }
.btn.primary:hover { background: var(--c-accent-strong); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--c-surface-2); }
.btn.sm { min-height: 28px; padding: 0 var(--sp-3); font-size: var(--fs-sm); }
.btn.icon-only { padding: 0; width: var(--touch); }
.btn.sm.icon-only { width: 28px; }
.btn[aria-pressed="true"] { background: var(--c-accent-soft); border-color: var(--c-accent); color: var(--c-accent-strong); }
.btn.danger { color: var(--c-danger); }
/* Decision buttons share one neutral style: no bias towards "confirm". */
.btn.decision { min-width: 150px; }
.seg { display: inline-flex; border: 1px solid var(--c-border-strong); border-radius: var(--r-2); overflow: hidden; }
.seg .btn { border: 0; border-radius: 0; border-inline-end: 1px solid var(--c-border); }
.seg .btn:last-child { border-inline-end: 0; }

.input, .select, .textarea { min-height: var(--touch); border: 1px solid var(--c-border-strong); border-radius: var(--r-2); padding: 0 var(--sp-3); background: var(--c-surface); }
.textarea { padding: var(--sp-2) var(--sp-3); resize: vertical; }
.input.sm, .select.sm { min-height: 28px; font-size: var(--fs-sm); }
.field { display: flex; flex-direction: column; gap: 4px; font-size: var(--fs-sm); color: var(--c-text-2); }
.field > span { font-weight: 500; }
.check { display: inline-flex; align-items: center; gap: var(--sp-2); cursor: pointer; min-height: 28px; }
.check input { width: 16px; height: 16px; }

.chip { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding-inline: var(--sp-3) var(--sp-1); border-radius: var(--r-pill); background: var(--c-accent-soft); color: var(--c-accent-strong); font-size: var(--fs-sm); border: 1px solid transparent; }
.chip button { border: 0; background: transparent; cursor: pointer; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; color: inherit; }
.chip button:hover { background: rgba(0, 0, 0, 0.08); }
.chip.plain { background: var(--c-surface-2); color: var(--c-text-2); padding-inline: var(--sp-3); }
.tag { display: inline-flex; align-items: center; gap: 4px; font-size: var(--fs-xs); padding: 1px 8px; border-radius: var(--r-pill); background: var(--c-surface-2); color: var(--c-text-2); border: 1px solid var(--c-border); white-space: nowrap; }
.tag.warn { background: var(--c-warning-soft); color: var(--c-warning); border-color: #eed9a8; }
.tag.error { background: var(--c-danger-soft); color: var(--c-danger); border-color: #efc4c0; }
.tag.ok { background: var(--c-ok-soft); color: var(--c-ok); border-color: #bfe0cc; }

/* Evidence badges: icon + label + tooltip, never color alone. */
.evidence { display: inline-flex; align-items: center; gap: 4px; font-size: var(--fs-xs); font-weight: 600; padding: 2px 8px 2px 6px; border-radius: var(--r-1); border: 1px solid; position: relative; white-space: nowrap; }
.evidence.observed { color: var(--ev-observed); background: var(--ev-observed-soft); border-color: currentColor; }
.evidence.measured { color: var(--ev-measured); background: var(--ev-measured-soft); border-color: currentColor; border-style: dashed; }
.evidence.corroborated { color: var(--ev-corroborated); background: var(--ev-corroborated-soft); border-color: currentColor; border-style: double; border-width: 3px; padding-block: 0; }
.evidence.hypothesis { color: var(--ev-hypothesis); background: var(--ev-hypothesis-soft); border-color: currentColor; border-style: dotted; }
.evidence-filter { border: 1px solid transparent; background: transparent; padding: 0; cursor: pointer; border-radius: var(--r-1); }
.evidence-filter.active { outline: 2px solid var(--c-accent); outline-offset: 1px; }
.validation { display: inline-flex; align-items: center; gap: 4px; font-size: var(--fs-xs); color: var(--c-text-2); }
.validation.confirmed { color: var(--c-ok); font-weight: 600; }
.validation.rejected { color: var(--c-danger); text-decoration: line-through; }

.tooltip-wrap { position: relative; display: inline-flex; }
.tooltip { position: absolute; inset-block-end: calc(100% + 6px); inset-inline-start: 0; z-index: 50; background: #1b1f24; color: #fff; font-size: var(--fs-xs); font-weight: 400; padding: 6px 10px; border-radius: var(--r-1); width: max-content; max-width: 280px; white-space: normal; opacity: 0; pointer-events: none; transition: opacity var(--motion); }
.tooltip-wrap:hover .tooltip, .tooltip-wrap:focus-within .tooltip { opacity: 1; }

.card { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--r-3); box-shadow: var(--e-1); }
.card.pad { padding: var(--sp-4); }
a.card { display: block; color: inherit; }
a.card:hover { border-color: var(--c-accent); text-decoration: none; }
.card-title { font-weight: 600; margin-block-end: var(--sp-2); display: flex; align-items: center; gap: var(--sp-2); }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-4); }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-4); }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--sp-4); }
@media (max-width: 1200px) { .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 800px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: minmax(0, 1fr); } .page { padding: var(--sp-4); } }

.kv { display: grid; grid-template-columns: minmax(120px, max-content) minmax(0, 1fr); gap: 6px var(--sp-4); font-size: var(--fs-sm); }
.kv dt { color: var(--c-text-3); }
.kv dd { margin: 0; min-width: 0; }
.json-nested { border-inline-start: 2px solid var(--c-border); padding-inline-start: var(--sp-3); margin-block-start: 2px; }

.table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.table th { text-align: start; font-weight: 600; color: var(--c-text-2); padding: var(--sp-2) var(--sp-3); border-block-end: 1px solid var(--c-border); background: var(--c-surface-2); position: sticky; inset-block-start: 0; }
.table td { padding: var(--sp-2) var(--sp-3); border-block-end: 1px solid var(--c-border); vertical-align: middle; }
.table tr:hover td { background: #fafbfc; }
.table-wrap { overflow: auto; border: 1px solid var(--c-border); border-radius: var(--r-2); background: var(--c-surface); }

.tabs { display: flex; gap: 2px; border-block-end: 1px solid var(--c-border); overflow-x: auto; }
.tab { border: 0; background: transparent; padding: var(--sp-2) var(--sp-3); min-height: var(--touch); cursor: pointer; color: var(--c-text-2); border-block-end: 2px solid transparent; white-space: nowrap; font-weight: 500; }
.tab[aria-selected="true"] { color: var(--c-accent-strong); border-block-end-color: var(--c-accent); }
.tab-panel { padding-block: var(--sp-4); }
.tab-count { display: inline-flex; align-items: center; justify-content: center; min-inline-size: 20px; block-size: 18px; margin-inline-start: 6px; padding: 0 6px; border-radius: var(--r-pill); background: var(--c-surface-2); font-size: var(--fs-xs); font-weight: 600; color: var(--c-text-2); }
.tab[aria-selected="true"] .tab-count { background: var(--c-accent-soft); color: var(--c-accent-strong); }

/* En-tete Tickets : actions groupees, formulaire Nouveau dossier, retours d'action. */
.page-actions { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }
.page-actions .btn.sm { min-height: var(--touch); padding: 0 var(--sp-3); color: var(--c-text-2); }
.page-actions .btn.sm:hover { color: var(--c-text); border-color: var(--c-accent); }
.page-actions .btn.primary[aria-expanded="true"] { background: var(--c-accent-strong); box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.25); }

.new-case-card { margin-block-end: var(--sp-5); overflow: hidden; box-shadow: var(--e-2); border-color: var(--c-border-strong); }
.new-case-head { display: flex; align-items: center; gap: var(--sp-2); padding: var(--sp-3) var(--sp-5); font-size: var(--fs-lg); font-weight: 600; color: var(--c-accent-strong); background: var(--c-accent-soft); border-block-end: 1px solid var(--c-border); }
.new-case-body { display: flex; flex-direction: column; gap: var(--sp-4); padding: var(--sp-5); }
.new-case-body .field > span { font-size: var(--fs-xs); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--c-text-3); }
.new-case-body .input, .new-case-body .select, .new-case-body .textarea { width: 100%; font-size: var(--fs-md); transition: border-color var(--motion), box-shadow var(--motion); }
.new-case-body .input:focus, .new-case-body .select:focus, .new-case-body .textarea:focus { outline: none; border-color: var(--c-focus); box-shadow: 0 0 0 3px var(--c-accent-soft); }
.new-case-row { display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap; }
.new-case-label { min-inline-size: 160px; font-size: var(--fs-xs); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--c-text-3); }
.new-case-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr); gap: var(--sp-4); }
@media (max-width: 900px) { .new-case-grid { grid-template-columns: minmax(0, 1fr); } }
.new-case-description { min-height: 140px; line-height: 1.5; }
.new-case-files { padding: var(--sp-2) var(--sp-3); border-style: dashed; background: var(--c-surface-2); cursor: pointer; }
.new-case-files:hover { border-color: var(--c-accent); }
.new-case-hint { display: flex; align-items: flex-start; gap: var(--sp-2); margin: 0; padding: var(--sp-2) var(--sp-3); font-size: var(--fs-sm); color: var(--c-text-2); background: var(--c-surface-2); border-inline-start: 3px solid var(--c-accent); border-radius: var(--r-1); }
.new-case-hint .icon { margin-block-start: 2px; color: var(--c-accent); }
.new-case-foot { display: flex; align-items: center; justify-content: flex-end; gap: var(--sp-3); padding: var(--sp-3) var(--sp-5); background: var(--c-surface-2); border-block-start: 1px solid var(--c-border); }

.seg .btn { min-height: 32px; padding: 0 var(--sp-4); background: var(--c-surface); color: var(--c-text-2); font-weight: 500; }
.seg .btn:hover { background: var(--c-surface-2); }
.seg .btn[aria-pressed="true"] { background: var(--c-accent); color: #fff; font-weight: 600; }
.seg .sev-choice { min-width: 52px; font-family: var(--font-mono); font-weight: 700; }
.seg .sev-choice-p1[aria-pressed="true"] { background: var(--c-danger); }
.seg .sev-choice-p2[aria-pressed="true"] { background: #b85400; }
.seg .sev-choice-p3[aria-pressed="true"] { background: #a67000; }
.seg .sev-choice-p4[aria-pressed="true"] { background: var(--c-text-2); }

.banner.notice { border: 1px solid; border-radius: var(--r-2); margin-block: 0 var(--sp-4); padding-block: var(--sp-3); }
.banner.info.notice { border-color: #bcd4e6; }
.banner.error.notice { border-color: #efc4c0; }
.banner.ok { background: var(--c-ok-soft); color: var(--c-ok); }
.banner.ok.notice { border-color: #bfe0cc; }
.notice-id { font-size: var(--fs-sm); font-weight: 700; color: var(--c-accent-strong); word-break: normal; }

/* Liste des tickets : filtres, tableau et badges type/gravite/produit/statut. */
.ticket-filters { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: var(--sp-3) var(--sp-4); align-items: center; padding: var(--sp-3) var(--sp-4); background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--r-2); box-shadow: var(--e-1); }
.ticket-filters-label { font-size: var(--fs-xs); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--c-text-3); }
.ticket-filters-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-toggle { display: inline-flex; align-items: center; height: 28px; padding: 0 var(--sp-3); border-radius: var(--r-pill); border: 1px solid var(--c-border); background: var(--c-surface); color: var(--c-text-2); font-size: var(--fs-sm); font-weight: 500; cursor: pointer; white-space: nowrap; transition: background var(--motion), border-color var(--motion), color var(--motion); }
.chip-toggle:hover { border-color: var(--c-border-strong); background: var(--c-surface-2); color: var(--c-text); }
.chip-toggle[aria-pressed="true"] { background: var(--c-accent); border-color: var(--c-accent); color: #fff; font-weight: 600; }
.chip-toggle:focus-visible { outline: 2px solid var(--c-focus); outline-offset: 2px; }
@media (max-width: 700px) { .ticket-filters { grid-template-columns: minmax(0, 1fr); gap: var(--sp-2); } }

.tickets-table th { font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: 0.04em; color: var(--c-text-3); padding-block: var(--sp-3); white-space: nowrap; z-index: 1; }
.tickets-table td { padding-block: var(--sp-3); }
.tickets-table tbody tr:nth-child(even) td { background: #fafbfc; }
.tickets-table tbody tr:hover td { background: var(--c-accent-soft); }
.tickets-table tbody tr:last-child td { border-block-end: 0; }
.tickets-table .col-id { white-space: nowrap; }
.tickets-table .col-id .tech { word-break: normal; font-size: var(--fs-sm); font-weight: 600; color: var(--c-accent-strong); }
.tickets-table .col-title { min-width: 220px; font-size: var(--fs-md); font-weight: 500; color: var(--c-text); line-height: 1.4; }
.tickets-table .col-actions { text-align: end; white-space: nowrap; }
.tickets-table .tag { font-size: var(--fs-xs); font-weight: 600; padding: 2px 10px; }
.cell-empty { color: var(--c-text-3); }
.row-actions { display: inline-flex; align-items: center; justify-content: flex-end; gap: var(--sp-1); flex-wrap: nowrap; }

.tag.kind-incident { background: var(--c-danger-soft); color: var(--c-danger); border-color: #efc4c0; }
.tag.kind-improvement { background: var(--c-accent-soft); color: var(--c-accent-strong); border-color: #bcd4e6; }

.sev { display: inline-flex; align-items: center; justify-content: center; min-width: 34px; height: 22px; padding: 0 var(--sp-2); border-radius: var(--r-1); border: 1px solid; font-family: var(--font-mono); font-size: var(--fs-xs); font-weight: 700; letter-spacing: 0.02em; }
.sev-p1 { background: var(--c-danger); border-color: var(--c-danger); color: #fff; }
.sev-p2 { background: #fde9d9; border-color: #f0c29c; color: #9a3d00; }
.sev-p3 { background: var(--c-warning-soft); border-color: #eed9a8; color: var(--c-warning); }
.sev-p4 { background: var(--c-surface-2); border-color: var(--c-border); color: var(--c-text-2); }

.product-label { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; color: var(--c-text); white-space: nowrap; }
.product-label::before { content: ""; inline-size: 8px; block-size: 8px; border-radius: 2px; background: var(--c-accent); opacity: 0.7; flex: none; }

.status-tag::before { content: ""; inline-size: 6px; block-size: 6px; border-radius: 50%; background: currentColor; flex: none; }
.tag.status-open { background: var(--c-accent-soft); color: var(--c-accent-strong); border-color: #bcd4e6; }

.progress { height: 6px; background: var(--c-surface-2); border-radius: var(--r-pill); overflow: hidden; }
.progress > div { height: 100%; background: var(--c-accent); }
.meter { display: flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-xs); }
.meter .progress { flex: 1; min-width: 60px; }

.skeleton { background: linear-gradient(90deg, var(--c-surface-2), #f7f8fa, var(--c-surface-2)); background-size: 200% 100%; animation: shimmer 1.3s infinite linear; border-radius: var(--r-2); }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.state { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: var(--sp-3); padding: var(--sp-7) var(--sp-4); color: var(--c-text-2); }
.state .icon { width: 36px; height: 36px; color: var(--c-text-3); }
.state.error .icon { color: var(--c-danger); }
.state h3 { color: var(--c-text); }

/* ---------- Overlays ---------- */
.backdrop { position: fixed; inset: 0; background: rgba(15, 20, 28, 0.42); z-index: 60; display: grid; place-items: center; }
.modal { background: var(--c-surface); border-radius: var(--r-3); box-shadow: var(--e-3); width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 64px); overflow: auto; padding: var(--sp-5); }
.modal.wide { width: min(1080px, calc(100vw - 32px)); }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-block-end: var(--sp-4); gap: var(--sp-3); }
.drawer { position: fixed; inset-block: 0; inset-inline-end: 0; width: min(480px, 100vw); background: var(--c-surface); box-shadow: var(--e-3); z-index: 70; display: flex; flex-direction: column; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: var(--sp-4) var(--sp-5); border-block-end: 1px solid var(--c-border); gap: var(--sp-3); }
.drawer-body { padding: var(--sp-4) var(--sp-5); overflow: auto; flex: 1; }
.toasts { position: fixed; inset-block-end: var(--sp-4); inset-inline-end: var(--sp-4); display: flex; flex-direction: column; gap: var(--sp-2); z-index: 80; }
.toast { background: #1b1f24; color: #fff; padding: var(--sp-3) var(--sp-4); border-radius: var(--r-2); box-shadow: var(--e-2); font-size: var(--fs-sm); max-width: 420px; display: flex; gap: var(--sp-3); align-items: center; }

/* ---------- Photos ---------- */
.thumb { position: relative; background: var(--c-surface-2); border-radius: var(--r-2); overflow: hidden; aspect-ratio: 4 / 3; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .placeholder-flag { position: absolute; inset-block-start: 6px; inset-inline-start: 6px; }
.crop { background-repeat: no-repeat; border-radius: var(--r-2); background-color: var(--c-surface-2); border: 1px solid var(--c-border); flex: none; }
.crop.face { border-radius: 50%; }
.box { position: absolute; border: 2px solid; border-radius: 2px; pointer-events: none; }
.box.face { border-color: #ffffff; box-shadow: 0 0 0 1px rgba(0,0,0,0.55); border-radius: 40%; }
.box.person { border-color: rgba(255,255,255,0.8); border-style: dashed; }
.box.building, .box.monument { border-color: #f3c34a; box-shadow: 0 0 0 1px rgba(0,0,0,0.5); }
.box.inscription { border-color: #7fd1ff; box-shadow: 0 0 0 1px rgba(0,0,0,0.5); }
.box.custom { border-color: #ff8ad1; }
.box.match { border-color: #ffffff; border-width: 3px; box-shadow: 0 0 0 2px var(--c-accent), 0 0 18px rgba(31, 95, 139, 0.6); }
.box.selected { border-color: #ffffff; background: rgba(31, 95, 139, 0.18); box-shadow: 0 0 0 2px var(--c-accent); }
.box-label { position: absolute; inset-block-start: -20px; inset-inline-start: -2px; font-size: 11px; background: rgba(15,20,28,0.8); color: #fff; padding: 1px 6px; border-radius: 3px; white-space: nowrap; }
.match-point { position: absolute; width: 7px; height: 7px; margin: -3px 0 0 -3px; border-radius: 50%; background: #fff; border: 2px solid var(--c-accent); pointer-events: none; }

/* ---------- Search ---------- */
.search-hero { max-width: 920px; margin: var(--sp-6) auto var(--sp-5); text-align: center; }
.search-hero h1 { font-size: 32px; margin-block-end: var(--sp-4); letter-spacing: -0.2px; }
.search-box { background: var(--c-surface); border: 1px solid var(--c-border-strong); border-radius: var(--r-3); box-shadow: var(--e-2); padding: var(--sp-3); text-align: start; }
.search-box:focus-within { border-color: var(--c-accent); box-shadow: 0 0 0 3px var(--c-accent-soft), var(--e-2); }
.search-box textarea { width: 100%; border: 0; resize: none; min-height: 64px; font-size: 18px; padding: var(--sp-2); background: transparent; outline: none; }
.search-actions { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; border-block-start: 1px solid var(--c-border); padding-block-start: var(--sp-3); margin-block-start: var(--sp-2); }
.examples { display: flex; gap: var(--sp-2); justify-content: center; flex-wrap: wrap; margin-block-start: var(--sp-3); }
.example { border: 1px solid var(--c-border); background: transparent; border-radius: var(--r-pill); padding: 4px 12px; font-size: var(--fs-sm); color: var(--c-text-2); cursor: pointer; }
.example:hover { background: var(--c-surface); color: var(--c-text); }
.ref-strip { display: flex; gap: var(--sp-3); align-items: center; padding: var(--sp-2); border-radius: var(--r-2); background: var(--c-surface-2); margin-block-end: var(--sp-2); }
.ref-strip .thumb { width: 96px; flex: none; }
.filters { display: flex; gap: var(--sp-2); flex-wrap: wrap; align-items: flex-end; margin-block: var(--sp-3); }
.filters .field { min-width: 150px; }
.adv-panel { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--sp-3); padding: var(--sp-4); background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--r-2); margin-block-end: var(--sp-3); }
@media (max-width: 1100px) { .adv-panel { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.interpretation { display: flex; gap: var(--sp-3); align-items: flex-start; padding: var(--sp-3) var(--sp-4); background: var(--c-accent-soft); border-radius: var(--r-2); margin-block-end: var(--sp-3); }
.interpretation .segments { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.phases { display: flex; gap: var(--sp-2); align-items: center; flex-wrap: wrap; margin-block-end: var(--sp-3); font-size: var(--fs-sm); }
.phase { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: var(--r-pill); background: var(--c-surface-2); color: var(--c-text-3); }
.phase.active { background: var(--c-accent); color: #fff; }
.phase.done { background: var(--c-ok-soft); color: var(--c-ok); }
.toolbar { display: flex; gap: var(--sp-3); align-items: center; flex-wrap: wrap; padding-block: var(--sp-2); border-block-end: 1px solid var(--c-border); margin-block-end: var(--sp-3); position: sticky; inset-block-start: 0; background: var(--c-bg); z-index: 5; }
.results-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: var(--sp-4); }
@media (max-width: 1100px) { .results-layout { grid-template-columns: minmax(0, 1fr); } .facets { display: none; } }
.facets { font-size: var(--fs-sm); }
.facet { margin-block-end: var(--sp-4); }
.facet h4 { font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: 0.6px; color: var(--c-text-3); margin-block-end: var(--sp-2); }
.facet-row { display: flex; justify-content: space-between; gap: var(--sp-2); padding: 3px 0; }

/* ---------- Result cards ---------- */
.vgrid { position: relative; overflow-y: auto; height: calc(100vh - 330px); min-height: 360px; }
.vgrid-inner { position: relative; }
.vgrid-row { position: absolute; inset-inline: 0; display: grid; gap: var(--sp-4); }
.result-card { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--r-3); overflow: hidden; position: relative; display: flex; flex-direction: column; transition: box-shadow var(--motion); }
.result-card:hover, .result-card:focus-within { box-shadow: var(--e-2); }
.result-card .thumb { border-radius: 0; }
.result-card .body { padding: var(--sp-3); display: flex; flex-direction: column; gap: 6px; min-height: 0; }
.result-card .title { font-weight: 600; font-size: var(--fs-sm); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.result-card .reasons { font-size: var(--fs-xs); color: var(--c-text-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.result-card .hover-actions { position: absolute; inset-block-start: var(--sp-2); inset-inline-end: var(--sp-2); display: flex; gap: 4px; opacity: 0; transition: opacity var(--motion); }
.result-card:hover .hover-actions, .result-card:focus-within .hover-actions { opacity: 1; }
.result-card .hover-actions .btn { background: rgba(255,255,255,0.95); }
.result-card .crop-inset { position: absolute; inset-block-end: var(--sp-2); inset-inline-end: var(--sp-2); box-shadow: 0 0 0 2px #fff, var(--e-2); }
.result-card.selected { outline: 3px solid var(--c-accent); outline-offset: -3px; }
.result-card.compact .body { padding: var(--sp-2); }
.result-card.compact .reasons { display: none; }
.pending-rank { font-size: 11px; color: var(--c-text-3); font-style: italic; }
.list-row { display: grid; grid-template-columns: 120px minmax(0, 1fr) auto; gap: var(--sp-4); align-items: center; padding: var(--sp-2); border-block-end: 1px solid var(--c-border); background: var(--c-surface); }
.list-row .thumb { width: 120px; }
.group-head { display: flex; align-items: center; gap: var(--sp-2); margin: var(--sp-4) 0 var(--sp-2); font-weight: 600; }
.plain-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: var(--sp-4); }
.plain-grid.dense { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: var(--sp-2); }

/* ---------- Inspector ---------- */
.inspector { display: grid; grid-template-columns: minmax(0, 1fr) 420px; grid-template-rows: minmax(0, 1fr) auto; height: calc(100vh - var(--topbar-h) - 38px); }
@media (max-width: 1200px) { .inspector { grid-template-columns: minmax(0, 1fr); height: auto; } }
.viewer { position: relative; background: #20252c; overflow: hidden; min-height: 420px; user-select: none; touch-action: none; flex: 1 1 auto; width: 100%; }
.viewer:fullscreen { background: #000; }
.viewer-stage { position: absolute; inset: 0; display: grid; place-items: center; }
.viewer-layer { position: relative; transform-origin: 0 0; }
.viewer-layer img { display: block; max-width: none; }
.viewer-tools { position: absolute; inset-block-start: var(--sp-3); inset-inline-start: var(--sp-3); display: flex; gap: 4px; z-index: 5; flex-wrap: wrap; }
.viewer-tools .btn { background: rgba(255,255,255,0.95); }
.viewer-overlays { position: absolute; inset-block-end: var(--sp-3); inset-inline-start: var(--sp-3); display: flex; gap: 4px; flex-wrap: wrap; z-index: 5; max-width: calc(100% - 24px); }
.viewer-overlays .btn { background: rgba(255,255,255,0.92); }
.viewer-zoom { position: absolute; inset-block-start: var(--sp-3); inset-inline-end: var(--sp-3); color: #fff; background: rgba(0,0,0,0.5); padding: 2px 8px; border-radius: var(--r-1); font-size: var(--fs-xs); z-index: 5; }
.select-layer { position: absolute; inset: 0; cursor: crosshair; }
.clickable-box { position: absolute; border: 2px solid rgba(255,255,255,0.85); border-radius: 3px; cursor: pointer; background: transparent; padding: 0; pointer-events: auto; }
.clickable-box:hover, .clickable-box:focus-visible { background: rgba(31,95,139,0.25); }
.panel { background: var(--c-surface); border-inline-start: 1px solid var(--c-border); overflow: auto; display: flex; flex-direction: column; }
.panel .tabs { position: sticky; inset-block-start: 0; background: var(--c-surface); z-index: 2; padding-inline: var(--sp-3); flex-wrap: wrap; overflow: visible; }
.panel-body { padding: var(--sp-4); }
.related { grid-column: 1 / -1; background: var(--c-surface); border-block-start: 1px solid var(--c-border); padding: var(--sp-3) var(--sp-4); overflow-x: auto; }
.related-strip { display: flex; gap: var(--sp-3); }
.related-strip a { width: 140px; flex: none; }
.assertion { border: 1px solid var(--c-border); border-radius: var(--r-2); padding: var(--sp-3); display: flex; flex-direction: column; gap: 6px; background: var(--c-surface); }
.assertion.machine { border-inline-start: 3px solid var(--c-border-strong); }
.assertion .row.between { align-items: flex-start; }
.reason-list { margin: 0; padding-inline-start: var(--sp-4); font-size: var(--fs-sm); }
.reason-list.contra li { color: var(--c-danger); }
.note { border-radius: var(--r-2); padding: var(--sp-3); background: #fffbe8; border: 1px solid #efe2a8; border-inline-start: 4px solid #c9a227; font-size: var(--fs-sm); }

/* ---------- Region selector ---------- */
.selector-wrap { position: relative; display: inline-block; max-width: 100%; }
.selector-wrap img { display: block; max-width: 100%; max-height: 60vh; }
.drag-rect { position: absolute; border: 2px dashed #fff; background: rgba(31,95,139,0.2); box-shadow: 0 0 0 1px rgba(0,0,0,0.6); pointer-events: none; }

/* ---------- Map ---------- */
.map-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: var(--sp-4); }
@media (max-width: 1100px) { .map-layout { grid-template-columns: minmax(0, 1fr); } }
.map-frame { position: relative; background: #e9eef2; border: 1px solid var(--c-border); border-radius: var(--r-3); overflow: hidden; }
.map-frame svg { display: block; width: 100%; height: auto; max-height: 72vh; }
.map-land { fill: #fbfbf9; stroke: #9aa5b1; stroke-width: 1.4; }
.marker-confirmed { fill: var(--ev-observed); stroke: #fff; stroke-width: 2; }
.marker-corroborated { fill: var(--ev-corroborated); stroke: #fff; stroke-width: 2; }
.marker-candidate { fill: #fff; stroke: var(--ev-hypothesis); stroke-width: 3; stroke-dasharray: 4 3; }
.zone { fill: rgba(122, 82, 0, 0.12); stroke: var(--ev-hypothesis); stroke-dasharray: 6 4; stroke-width: 1.5; }
.marker-label { font-size: 13px; fill: var(--c-text); paint-order: stroke; stroke: #fff; stroke-width: 3px; }
.marker-count { font-size: 11px; fill: #fff; font-weight: 700; text-anchor: middle; dominant-baseline: central; pointer-events: none; }
.marker-count.dark { fill: var(--c-text); }
.route { fill: none; stroke: var(--c-accent); stroke-width: 3; }
.route.hypothetical { stroke-dasharray: 8 6; stroke: var(--ev-hypothesis); }
.map-legend { display: flex; gap: var(--sp-4); flex-wrap: wrap; font-size: var(--fs-xs); color: var(--c-text-2); padding: var(--sp-2) var(--sp-3); }
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.map-controls { position: absolute; inset-block-start: var(--sp-3); inset-inline-end: var(--sp-3); display: flex; flex-direction: column; gap: 4px; }
.map-controls .btn { background: #fff; }
.range-row { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-3); }
.range-row input[type="range"] { flex: 1; }

/* ---------- Timeline ---------- */
.timeline { position: relative; background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--r-3); overflow: hidden; }
.timeline-axis { position: relative; height: 34px; border-block-end: 1px solid var(--c-border); background: var(--c-surface-2); }
.tick { position: absolute; inset-block: 0; border-inline-start: 1px solid var(--c-border); font-size: 11px; color: var(--c-text-3); padding-inline-start: 4px; padding-block-start: 8px; white-space: nowrap; }
.tick.major { border-inline-start-color: var(--c-border-strong); color: var(--c-text-2); font-weight: 600; }
.timeline-lanes { position: relative; }
.tl-bar { position: absolute; height: 22px; border-radius: 4px; border: 1px solid; font-size: 11px; padding-inline: 6px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; cursor: pointer; text-align: start; line-height: 20px; }
.tl-bar.observed { background: var(--ev-observed-soft); color: var(--ev-observed); }
.tl-bar.measured { background: var(--ev-measured-soft); color: var(--ev-measured); border-style: dashed; }
.tl-bar.corroborated { background: var(--ev-corroborated-soft); color: var(--ev-corroborated); border-width: 2px; }
.tl-bar.hypothesis { background: repeating-linear-gradient(45deg, var(--ev-hypothesis-soft), var(--ev-hypothesis-soft) 6px, #fff 6px, #fff 10px); color: var(--ev-hypothesis); border-style: dotted; }
.tl-bar.event { font-weight: 600; }
.tl-bar.selected { box-shadow: 0 0 0 2px var(--c-accent); }
.tl-point { position: absolute; width: 14px; height: 14px; margin-inline-start: -7px; margin-block-start: 4px; border-radius: 50%; border: 2px solid var(--ev-observed); background: #fff; cursor: pointer; padding: 0; }
.tl-point.selected { background: var(--c-accent); border-color: var(--c-accent); }
.timeline-grid-lines { position: absolute; inset: 0; pointer-events: none; }

/* ---------- Graph ---------- */
.graph-layout { display: grid; grid-template-columns: 240px minmax(0, 1fr) 320px; gap: var(--sp-4); }
@media (max-width: 1280px) { .graph-layout { grid-template-columns: minmax(0, 1fr); } }
.graph-frame { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--r-3); overflow: hidden; }
.graph-frame svg { display: block; width: 100%; height: auto; }
.g-edge { stroke: #8f99a5; stroke-width: 1.4; }
.g-edge.corroborated { stroke-width: 2.4; stroke: var(--ev-corroborated); }
.g-edge.observed { stroke: var(--ev-observed); stroke-width: 2; }
.g-edge.measured { stroke-dasharray: 5 3; }
.g-edge.hypothesis { stroke-dasharray: 2 4; stroke: var(--ev-hypothesis); }
.g-node { cursor: pointer; }
.g-node:focus-visible { outline: none; }
.g-node:focus-visible .g-shape, .g-node.selected .g-shape { stroke: var(--c-focus); stroke-width: 4; }
.g-shape { stroke: #fff; stroke-width: 2; }
.g-person .g-shape { fill: #2d5a8e; }
.g-photo .g-shape { fill: #6b7380; }
.g-place .g-shape { fill: #1d6b44; }
.g-event .g-shape { fill: #7a5200; }
.g-collection .g-shape { fill: #5d3f8c; }
.g-cluster .g-shape { fill: #fff; stroke: #6b7380; stroke-dasharray: 3 2; }
.g-label { font-size: 12px; fill: var(--c-text); paint-order: stroke; stroke: #fff; stroke-width: 3px; pointer-events: none; }
.g-glyph { font-size: 11px; fill: #fff; font-weight: 700; text-anchor: middle; dominant-baseline: central; pointer-events: none; }
.g-cluster .g-glyph { fill: var(--c-text); }

/* ---------- Compare ---------- */
.compare-grid { display: grid; gap: var(--sp-4); }
.compare-grid.n2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.compare-grid.n3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.compare-grid.n4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.compare-pane .viewer { min-height: 320px; height: 360px; border-radius: var(--r-2); }
.decisions { display: flex; gap: var(--sp-2); flex-wrap: wrap; }

/* ---------- Person / Place ---------- */
.person-card { display: flex; gap: var(--sp-3); align-items: center; }
.silhouette { width: 64px; height: 64px; border-radius: 50%; background: var(--c-surface-2); border: 1px dashed var(--c-border-strong); display: grid; place-items: center; color: var(--c-text-3); flex: none; }
.silhouette .icon { width: 30px; height: 30px; }
.entity-head { display: flex; gap: var(--sp-4); align-items: center; }

/* ---------- Admin ---------- */
.admin-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: var(--sp-5); }
@media (max-width: 900px) { .admin-layout { grid-template-columns: minmax(0, 1fr); } }
.admin-nav { display: flex; flex-direction: column; gap: 2px; }
.device-card { border: 1px solid var(--c-border); border-radius: var(--r-2); padding: var(--sp-3); background: var(--c-surface); display: flex; flex-direction: column; gap: var(--sp-2); }
.device-card.unavailable { background: #f8f8f8; border-style: dashed; }
.switch { position: relative; width: 38px; height: 22px; border-radius: 11px; background: var(--c-border-strong); border: 0; cursor: pointer; flex: none; }
.switch::after { content: ""; position: absolute; inset-block-start: 3px; inset-inline-start: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: inset-inline-start var(--motion); }
.switch[aria-checked="true"] { background: var(--c-accent); }
.switch[aria-checked="true"]::after { inset-inline-start: 19px; }
.switch:disabled { opacity: 0.5; cursor: not-allowed; }
.stat { display: flex; flex-direction: column; gap: 2px; }
.stat .value { font-size: var(--fs-xl); font-weight: 600; }
.stat .label { font-size: var(--fs-xs); color: var(--c-text-3); }

/* Tableau de bord (/stats) : KPI, periode, courbe, anneau, barres, Gantt. */
.st-open { --st: #2d6fa3; }
.st-waiting-customer { --st: #d9a404; }
.st-waiting-third { --st: #7b5ea7; }
.st-escalated { --st: #c0392b; }
.st-resolved { --st: #1d8a57; }
.st-closed { --st: #7a828e; }
.st-unknown { --st: #b8bec8; }
.s-created { --s: #1f5f8b; }
.s-resolved { --s: #1d8a57; }
.s-backlog { --s: #d98e04; }

.dash-body { display: flex; flex-direction: column; gap: var(--sp-4); }
.scope-pill { display: inline-flex; align-items: center; gap: 6px; align-self: flex-start; margin: 0; padding: 4px 12px; border-radius: var(--r-pill); background: var(--c-accent-soft); color: var(--c-accent-strong); font-size: var(--fs-sm); font-weight: 500; }

.kpi-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: var(--sp-4); }
@media (max-width: 1300px) { .kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 1100px) { .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) { .kpi-grid { grid-template-columns: minmax(0, 1fr); } }
.kpi { --kpi: var(--c-accent); display: flex; align-items: center; gap: var(--sp-4); padding: var(--sp-4) var(--sp-5); border-block-start: 3px solid var(--kpi); }
.kpi-open { --kpi: #d98e04; }
.kpi-resolved { --kpi: #1d8a57; }
.kpi-time { --kpi: #7b5ea7; }
.kpi-sla { --kpi: #c0392b; }
.kpi-icon { display: grid; place-items: center; inline-size: 44px; block-size: 44px; border-radius: var(--r-3); background: color-mix(in srgb, var(--kpi) 14%, transparent); color: var(--kpi); flex: none; }
.kpi-icon .icon { width: 22px; height: 22px; }
.kpi-body { display: flex; flex-direction: column; min-width: 0; }
.kpi-value { font-size: var(--fs-2xl); font-weight: 700; line-height: 1.1; color: var(--c-text); font-variant-numeric: tabular-nums; }
.kpi-label { font-size: var(--fs-sm); font-weight: 500; color: var(--c-text-2); }
.kpi-sub { font-size: var(--fs-xs); color: var(--c-text-3); }

.period-bar { display: flex; align-items: center; gap: var(--sp-3) var(--sp-4); flex-wrap: wrap; padding: var(--sp-3) var(--sp-4); }
.period-bar-title { display: inline-flex; align-items: center; gap: var(--sp-2); font-weight: 600; color: var(--c-text); }
.period-bar-title .icon { color: var(--c-accent); }
.period-slide, .period-custom { display: inline-flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }
.period-rolling { font-size: var(--fs-xs); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--c-text-3); }
.period-date { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-sm); color: var(--c-text-2); }
.period-range { margin-inline-start: auto; display: inline-flex; align-items: center; gap: var(--sp-2); font-family: var(--font-mono); font-size: var(--fs-sm); color: var(--c-text); direction: ltr; unicode-bidi: isolate; }
.period-days { font-family: var(--font-sans); font-size: var(--fs-xs); font-weight: 600; padding: 2px 8px; border-radius: var(--r-pill); background: var(--c-surface-2); color: var(--c-text-2); }

.dash-card { display: flex; flex-direction: column; gap: var(--sp-3); min-width: 0; padding: var(--sp-4) var(--sp-5); }
.dash-card-title { display: flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-lg); font-weight: 600; color: var(--c-text); }
.dash-card-title .icon { color: var(--c-accent); }
.dash-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-4); }
@media (max-width: 1300px) { .dash-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 800px) { .dash-grid { grid-template-columns: minmax(0, 1fr); } }

.chart { display: flex; flex-direction: column; gap: var(--sp-3); }
.chart-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); flex-wrap: wrap; }
.chart-legend, .gantt-legend { display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-4); }
.legend-item { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-sm); color: var(--c-text-2); }
.legend-swatch { inline-size: 16px; block-size: 4px; border-radius: 2px; background: var(--s, var(--c-border-strong)); }
.legend-swatch.s-ongoing { inline-size: 18px; block-size: 10px; background: repeating-linear-gradient(135deg, #9aa2ad 0 3px, #e5e8ec 3px 6px); }
.legend-dot { inline-size: 10px; block-size: 10px; border-radius: 3px; background: var(--st, var(--c-border-strong)); flex: none; }
.chart-granularity { padding: 2px 8px; border: 1px solid var(--c-border); border-radius: var(--r-pill); font-size: var(--fs-xs); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--c-text-3); }
.chart-wrap { position: relative; }
.chart-svg { display: block; inline-size: 100%; block-size: auto; overflow: visible; }
.chart-grid { stroke: var(--c-border); stroke-width: 1; stroke-dasharray: 3 4; }
.chart-axis { fill: var(--c-text-3); font-family: var(--font-sans); font-size: 11px; }
.chart-area { fill: #d98e04; fill-opacity: 0.12; }
.chart-line { fill: none; stroke: var(--s); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.chart-line.s-backlog { stroke-width: 2; stroke-dasharray: 6 4; }
.chart-dot { fill: var(--c-surface); stroke: var(--s); stroke-width: 2; }
.chart-overlay { position: absolute; inset: 0; }
.chart-col { position: absolute; border-radius: var(--r-1); }
.chart-col::after { content: ""; position: absolute; top: 0; bottom: 0; left: 50%; border-left: 1px dashed var(--c-border-strong); opacity: 0; }
.chart-col:hover { background: rgba(31, 95, 139, 0.06); }
.chart-col:hover::after { opacity: 1; }
.chart-tip { display: none; position: absolute; top: 8px; left: calc(50% + 10px); z-index: 3; flex-direction: column; gap: 4px; min-inline-size: 170px; padding: var(--sp-2) var(--sp-3); background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--r-2); box-shadow: var(--e-2); font-size: var(--fs-xs); color: var(--c-text-2); white-space: nowrap; pointer-events: none; }
.chart-tip.end { left: auto; right: calc(50% + 10px); }
.chart-col:hover .chart-tip { display: flex; }
.chart-tip strong { font-family: var(--font-mono); font-size: var(--fs-sm); color: var(--c-text); }
.tip-row { display: flex; align-items: center; gap: 6px; }
.tip-row::before { content: ""; inline-size: 8px; block-size: 8px; border-radius: 50%; background: var(--s); }
.tip-row b { margin-inline-start: auto; padding-inline-start: var(--sp-3); color: var(--c-text); font-variant-numeric: tabular-nums; }
.chart-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-3); }
@media (max-width: 700px) { .chart-summary { grid-template-columns: minmax(0, 1fr); } }
.chart-kpi { display: flex; flex-direction: column; gap: 2px; padding: var(--sp-2) var(--sp-3); border-radius: var(--r-2); background: var(--c-surface-2); border-inline-start: 3px solid var(--s); }
.chart-kpi-value { font-size: var(--fs-xl); font-weight: 700; color: var(--c-text); font-variant-numeric: tabular-nums; }
.chart-kpi-label { font-size: var(--fs-xs); color: var(--c-text-3); }

.donut { display: flex; align-items: center; gap: var(--sp-5); flex-wrap: wrap; }
.donut-chart { position: relative; inline-size: 150px; block-size: 150px; flex: none; }
.donut-svg { display: block; inline-size: 100%; block-size: 100%; }
.donut-track { stroke: var(--c-surface-2); }
.donut-seg { stroke: var(--st); }
.donut-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.donut-total { font-size: var(--fs-2xl); font-weight: 700; line-height: 1; color: var(--c-text); }
.donut-caption { font-size: var(--fs-xs); color: var(--c-text-3); }
.donut-legend { flex: 1; min-inline-size: 160px; display: flex; flex-direction: column; gap: 6px; margin: 0; padding: 0; list-style: none; }
.donut-legend-item { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto 40px; align-items: center; gap: var(--sp-2); font-size: var(--fs-sm); }
.donut-legend-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--c-text-2); }
.donut-legend-count { font-weight: 700; font-variant-numeric: tabular-nums; }
.donut-legend-pct { text-align: end; font-size: var(--fs-xs); color: var(--c-text-3); }

.hbars { display: flex; flex-direction: column; gap: var(--sp-3); }
.hbar-row { display: grid; grid-template-columns: minmax(90px, 38%) minmax(0, 1fr) 72px; align-items: center; gap: var(--sp-3); }
.hbar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--fs-sm); color: var(--c-text-2); }
.hbar-track { block-size: 10px; border-radius: var(--r-pill); background: var(--c-surface-2); overflow: hidden; }
.hbar-fill { block-size: 100%; border-radius: var(--r-pill); background: var(--c, var(--c-accent)); transition: inline-size 300ms ease; }
.hbar-value { display: inline-flex; align-items: baseline; justify-content: flex-end; gap: 6px; font-weight: 700; font-variant-numeric: tabular-nums; }
.hbar-share { font-size: var(--fs-xs); font-weight: 500; color: var(--c-text-3); }
.c-incident { --c: #c0392b; }
.c-improvement { --c: #2d6fa3; }
.c-unknown { --c: #9aa2ad; }
.c-p1 { --c: #a3261d; }
.c-p2 { --c: #d0661b; }
.c-p3 { --c: #d9a404; }
.c-p4 { --c: #7a828e; }

.gantt-block { --gantt-label-w: 240px; --gantt-meta-w: 170px; display: flex; flex-direction: column; gap: var(--sp-3); }
@media (max-width: 900px) { .gantt-block { --gantt-label-w: 150px; --gantt-meta-w: 110px; } }
.gantt-toolbar { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); flex-wrap: wrap; }
.gantt { border: 1px solid var(--c-border); border-radius: var(--r-2); overflow: hidden; }
.gantt-row { display: grid; grid-template-columns: var(--gantt-label-w) minmax(0, 1fr) var(--gantt-meta-w); align-items: stretch; min-block-size: 44px; border-block-end: 1px solid var(--c-border); }
.gantt-rows .gantt-row:last-child { border-block-end: 0; }
.gantt-rows .gantt-row:hover { background: rgba(31, 95, 139, 0.04); }
.gantt-head { min-block-size: 36px; background: var(--c-surface-2); font-size: var(--fs-xs); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--c-text-3); }
.gantt-label { display: flex; flex-direction: column; justify-content: center; gap: 2px; min-width: 0; padding: var(--sp-2) var(--sp-3); border-inline-end: 1px solid var(--c-border); }
.gantt-head .gantt-label { flex-direction: row; align-items: center; justify-content: flex-start; gap: 0; }
.gantt-id .tech { font-size: var(--fs-xs); font-weight: 700; color: var(--c-accent-strong); word-break: normal; }
.gantt-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--fs-sm); color: var(--c-text); }
.gantt-axis { position: relative; }
.gantt-tick { position: absolute; top: 50%; transform: translateY(-50%); padding-inline-start: 4px; border-inline-start: 1px solid var(--c-border-strong); font-family: var(--font-mono); font-size: 11px; font-weight: 500; letter-spacing: 0; text-transform: none; white-space: nowrap; color: var(--c-text-3); }
.gantt-scroll { max-block-size: 520px; overflow-y: auto; }
.gantt-rows { position: relative; }
.gantt-overlay { position: absolute; inset-block: 0; inset-inline-start: var(--gantt-label-w); inset-inline-end: var(--gantt-meta-w); z-index: 0; pointer-events: none; }
.gantt-gridline { position: absolute; inset-block: 0; border-inline-start: 1px dashed var(--c-border); }
.gantt-today { position: absolute; inset-block: 0; z-index: 2; border-inline-start: 2px solid var(--c-danger); }
.gantt-today-label { position: absolute; top: 2px; inset-inline-start: 4px; padding: 0 4px; border-radius: 3px; background: var(--c-surface); font-size: 10px; font-weight: 700; text-transform: uppercase; white-space: nowrap; color: var(--c-danger); }
.gantt-track { position: relative; z-index: 1; }
.gantt-bar { position: absolute; top: 50%; transform: translateY(-50%); display: flex; align-items: center; block-size: 22px; overflow: hidden; border: 1px solid color-mix(in srgb, var(--st) 55%, transparent); border-radius: 6px; background-color: color-mix(in srgb, var(--st) 20%, var(--c-surface)); text-decoration: none; transition: box-shadow var(--motion); }
.gantt-bar:hover { text-decoration: none; box-shadow: 0 0 0 2px color-mix(in srgb, var(--st) 35%, transparent), var(--e-1); }
.gantt-bar.ongoing { border-start-end-radius: 0; border-end-end-radius: 0; background-image: repeating-linear-gradient(135deg, transparent 0 6px, rgba(255, 255, 255, 0.55) 6px 10px); }
.gantt-bar.cut-start { border-start-start-radius: 0; border-end-start-radius: 0; border-inline-start-style: dashed; }
.gantt-fill { position: absolute; inset-block: 0; inset-inline-start: 0; background: var(--st); }
.gantt-bar-text { position: relative; z-index: 1; padding-inline: 6px; font-size: 11px; font-weight: 700; white-space: nowrap; color: #fff; text-shadow: 0 1px 1px rgba(0, 0, 0, 0.35); }
.gantt-meta { display: flex; flex-direction: column; justify-content: center; gap: 4px; min-width: 0; padding: var(--sp-2) var(--sp-3); border-inline-start: 1px solid var(--c-border); }
.gantt-status { display: inline-flex; align-items: center; gap: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--fs-xs); font-weight: 600; color: var(--c-text-2); }
.gantt-status::before { content: ""; inline-size: 8px; block-size: 8px; border-radius: 50%; background: var(--st); flex: none; }
.gantt-progress { display: flex; align-items: center; gap: var(--sp-2); }
.gantt-progress-track { flex: 1; block-size: 6px; overflow: hidden; border-radius: var(--r-pill); background: var(--c-surface-2); }
.gantt-progress-fill { display: block; block-size: 100%; border-radius: var(--r-pill); background: var(--st); }
.gantt-progress-value { min-inline-size: 36px; text-align: end; font-size: var(--fs-xs); font-weight: 700; font-variant-numeric: tabular-nums; }
.gantt-empty { margin: 0; padding: var(--sp-5); text-align: center; color: var(--c-text-3); }
.gantt-hint { display: flex; align-items: flex-start; gap: var(--sp-2); margin: 0; font-size: var(--fs-xs); color: var(--c-text-3); }

/* Base de connaissances (/faq). */
.page-head-text { display: flex; flex-direction: column; min-width: 0; max-inline-size: 760px; }
.kb-search { position: relative; margin-block-end: var(--sp-4); }
.kb-search > .icon { position: absolute; inset-inline-start: var(--sp-3); top: 50%; transform: translateY(-50%); color: var(--c-text-3); pointer-events: none; }
.kb-search .input { inline-size: 100%; min-height: 42px; padding-inline-start: 36px; font-size: var(--fs-md); border-radius: var(--r-3); box-shadow: var(--e-1); transition: border-color var(--motion), box-shadow var(--motion); }
.kb-search .input:focus { outline: none; border-color: var(--c-focus); box-shadow: 0 0 0 3px var(--c-accent-soft); }
.kb-editor { font-family: var(--font-mono); font-size: var(--fs-sm); }
.kb-switch-row { display: inline-flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-sm); color: var(--c-text-2); }

.kb-list { display: flex; flex-direction: column; gap: var(--sp-3); }
.kb-kind-article { --kb: #2d6fa3; }
.kb-kind-tutorial { --kb: #1d8a57; }
.kb-kind-troubleshooting { --kb: #d0661b; }
.kb-item { overflow: hidden; border-inline-start: 4px solid var(--kb); transition: box-shadow var(--motion), border-color var(--motion); }
.kb-item:hover, .kb-item.open { box-shadow: var(--e-2); }
.kb-item.archived { opacity: 0.7; }
.kb-item-head { display: flex; align-items: center; gap: var(--sp-4); padding: var(--sp-3) var(--sp-4); cursor: pointer; }
.kb-item-head:hover { background: var(--c-surface-2); }
.kb-kind-icon { display: grid; place-items: center; inline-size: 40px; block-size: 40px; flex: none; border-radius: var(--r-3); background: color-mix(in srgb, var(--kb) 14%, transparent); color: var(--kb); }
.kb-item-main { display: flex; flex-direction: column; gap: 6px; flex: 1; min-width: 0; }
.kb-item-title { font-size: var(--fs-lg); font-weight: 600; line-height: 1.3; color: var(--c-text); }
.kb-item-badges { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }
.kb-kind-tag { background: color-mix(in srgb, var(--kb) 12%, var(--c-surface)); color: var(--kb); border-color: color-mix(in srgb, var(--kb) 35%, transparent); font-weight: 600; }
.kb-views { display: inline-flex; align-items: center; gap: 6px; flex: none; padding: 4px 10px; border-radius: var(--r-pill); background: var(--c-surface-2); font-size: var(--fs-xs); color: var(--c-text-3); }
.kb-views b { font-size: var(--fs-sm); color: var(--c-text); font-variant-numeric: tabular-nums; }
@media (max-width: 700px) { .kb-views-label { display: none; } }
.kb-chevron { display: grid; place-items: center; flex: none; color: var(--c-text-3); transition: transform var(--motion); }
.kb-item.open .kb-chevron { transform: rotate(180deg); color: var(--c-accent); }
.kb-actions { display: flex; align-items: center; gap: var(--sp-2) var(--sp-4); flex-wrap: wrap; padding: var(--sp-2) var(--sp-4); background: var(--c-surface-2); border-block-start: 1px solid var(--c-border); }
.kb-delete { margin-inline-start: auto; }
.kb-body { padding: var(--sp-4) var(--sp-5) var(--sp-4) calc(var(--sp-4) + 40px + var(--sp-4)); border-block-start: 1px solid var(--c-border); }
@media (max-width: 700px) { .kb-body { padding-inline-start: var(--sp-4); } }
.kb-body .md { max-inline-size: 820px; line-height: 1.6; }
.kb-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: var(--sp-4) 0 0; padding-block-start: var(--sp-3); border-block-start: 1px dashed var(--c-border); font-size: var(--fs-xs); color: var(--c-text-3); }
.kb-meta .icon + span { margin-inline-end: var(--sp-3); }
.kb-empty { display: flex; flex-direction: column; align-items: center; gap: var(--sp-3); padding: var(--sp-7) var(--sp-4); border: 1px dashed var(--c-border-strong); border-radius: var(--r-3); background: var(--c-surface); text-align: center; color: var(--c-text-3); }
.kb-empty .icon { width: 36px; height: 36px; }
.kb-empty p { margin: 0; }

/* Administration (/administration) : navigation groupes/onglets et cartes. */
.admin-page .banner.notice { margin-block-end: var(--sp-4); }
.admin-nav { margin-block-end: var(--sp-2); overflow: hidden; }
.admin-groups { display: flex; gap: var(--sp-2); flex-wrap: wrap; padding: var(--sp-3) var(--sp-4); background: var(--c-surface-2); border-block-end: 1px solid var(--c-border); }
.admin-group { display: inline-flex; align-items: center; gap: var(--sp-2); min-height: var(--touch); padding: 0 var(--sp-4); border: 1px solid var(--c-border); border-radius: var(--r-pill); background: var(--c-surface); color: var(--c-text-2); font-weight: 500; cursor: pointer; white-space: nowrap; transition: background var(--motion), border-color var(--motion), color var(--motion); }
.admin-group:hover { border-color: var(--c-accent); color: var(--c-text); }
.admin-group[aria-selected="true"] { background: var(--c-accent); border-color: var(--c-accent); color: #fff; font-weight: 600; box-shadow: var(--e-1); }
.admin-group:focus-visible, .admin-subtabs .tab:focus-visible { outline: 2px solid var(--c-focus); outline-offset: 2px; }
.admin-subtabs { padding-inline: var(--sp-3); border-block-end: 0; }
.admin-subtabs .tab { min-height: 44px; border-block-end-width: 3px; }
.admin-subtabs .tab:hover { color: var(--c-text); }
.admin-subtabs .tab[aria-selected="true"] { font-weight: 600; }

/* Cartes : titre en bandeau, alignement des lignes, champs et tableaux homogenes. */
.admin-page .card.pad { padding: var(--sp-5); box-shadow: var(--e-1); }
.admin-page .card.pad:has(> .card-title:first-child) { padding-block-start: 0; overflow: hidden; }
.admin-page .card.pad > .card-title:first-child { margin: 0 calc(-1 * var(--sp-5)) var(--sp-2); padding: var(--sp-3) var(--sp-5); background: var(--c-accent-soft); border-block-end: 1px solid var(--c-border); font-size: var(--fs-lg); color: var(--c-accent-strong); }
.admin-page .card-title .icon { color: var(--c-accent); }
.admin-page .divider { margin-block: var(--sp-4) var(--sp-2); }
.admin-page .divider + .card-title, .admin-page .divider + .col > .card-title:first-child { font-size: var(--fs-md); padding-inline-start: var(--sp-2); border-inline-start: 3px solid var(--c-accent); }
.admin-page .row.stack-2 > * + * { margin-block-start: 0; }
.admin-page .row.stack-2 { gap: var(--sp-2); }
.admin-page label.col { gap: 4px; }
.admin-page label.col > span.small.muted:first-child, .admin-page .row.stack-2 > span.small.muted:first-child { font-size: var(--fs-xs); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--c-text-3); }
.admin-page .input, .admin-page .select, .admin-page .textarea { transition: border-color var(--motion), box-shadow var(--motion); }
.admin-page .input:focus, .admin-page .select:focus, .admin-page .textarea:focus { outline: none; border-color: var(--c-focus); box-shadow: 0 0 0 3px var(--c-accent-soft); }
.admin-page .textarea { font-family: var(--font-mono); font-size: var(--fs-sm); line-height: 1.5; }
.admin-page .btn.sm:not(.ghost):not(.danger):not(.icon-only) { background: var(--c-accent); border-color: var(--c-accent); color: #fff; }
.admin-page .btn.sm:not(.ghost):not(.danger):not(.icon-only):hover { background: var(--c-accent-strong); }
.admin-page .btn.ghost.sm { border-color: var(--c-border); background: var(--c-surface); }
.admin-page .btn.ghost.sm:hover { border-color: var(--c-accent); background: var(--c-surface-2); }
.admin-page .seg .btn.sm:not(.ghost):not(.danger):not(.icon-only) { background: var(--c-surface); color: var(--c-text-2); }
.admin-page .seg .btn.sm:not(.ghost):not(.danger):not(.icon-only):hover { background: var(--c-surface-2); }
.admin-page .seg .btn.sm[aria-pressed="true"]:not(.ghost):not(.danger):not(.icon-only) { background: var(--c-accent); color: #fff; font-weight: 600; }
.admin-page .table th { font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: 0.04em; color: var(--c-text-3); padding-block: var(--sp-3); white-space: nowrap; }
.admin-page .table td { padding-block: var(--sp-3); }
.admin-page .table tbody tr:nth-child(even) td { background: #fafbfc; }
.admin-page .table tbody tr:hover td { background: var(--c-accent-soft); }
.admin-page .table tbody tr:last-child td { border-block-end: 0; }
.admin-page .kv { padding: var(--sp-3); border: 1px solid var(--c-border); border-radius: var(--r-2); background: var(--c-surface); }
.admin-page .kv dt { font-weight: 600; }
.admin-page details > summary.card-title { cursor: pointer; }

/* Panneau d'une operation KARL Core. */
.admin-op { padding: var(--sp-4) !important; background: var(--c-surface-2); border-inline-start: 4px solid var(--c-border-strong); box-shadow: none !important; }
.admin-op:has(.verb-get) { border-inline-start-color: #2d6fa3; }
.admin-op:has(.verb-post) { border-inline-start-color: #1d8a57; }
.admin-op:has(.verb-put), .admin-op:has(.verb-patch) { border-inline-start-color: #d98e04; }
.admin-op:has(.verb-delete) { border-inline-start-color: #c0392b; }
.admin-op-id { font-family: var(--font-mono); font-size: var(--fs-sm); font-weight: 600; background: var(--c-surface); color: var(--c-text); }
.admin-verb { font-family: var(--font-mono); font-weight: 700; letter-spacing: 0.04em; color: #fff; border-color: transparent; }
.verb-get { background: #2d6fa3; }
.verb-post { background: #1d8a57; }
.verb-put, .verb-patch { background: #d98e04; }
.verb-delete { background: #c0392b; }
.admin-result { padding: var(--sp-3); border: 1px solid var(--c-border); border-radius: var(--r-2); background: var(--c-surface); }
.admin-result .kv { border: 0; padding: 0; }

/* Utilisateurs & roles : societes et comptes. */
.org-section-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); flex-wrap: wrap; margin-block-start: var(--sp-4); padding-block-end: var(--sp-2); border-block-end: 2px solid var(--c-accent-soft); }
.org-section-head h3 { margin: 0; font-size: var(--fs-lg); color: var(--c-text); }
.org-filter { display: inline-flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-sm); color: var(--c-text-2); }
.org-name { font-weight: 600; color: var(--c-text); }
.tag.org-kind.client { background: var(--c-accent-soft); color: var(--c-accent-strong); border-color: #bcd4e6; font-weight: 600; }
.tag.org-kind.reseller { background: #eee8f6; color: #5d3f8c; border-color: #d6c8ea; font-weight: 600; }
.org-inactive td { color: var(--c-text-3); }
.org-form { border: 1px solid var(--c-border-strong); border-radius: var(--r-3); overflow: hidden; box-shadow: var(--e-2); background: var(--c-surface); }
.org-form-head { display: flex; align-items: center; gap: var(--sp-2); padding: var(--sp-3) var(--sp-5); font-weight: 600; color: var(--c-accent-strong); background: var(--c-accent-soft); border-block-end: 1px solid var(--c-border); }
.org-form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-3) var(--sp-4); padding: var(--sp-4) var(--sp-5); }
@media (max-width: 1100px) { .org-form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 700px) { .org-form-grid { grid-template-columns: minmax(0, 1fr); } }
.org-form-grid .org-wide { grid-column: 1 / -1; }
.org-form-grid .field > span:first-child { font-size: var(--fs-xs); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--c-text-3); }
.org-form-grid .input, .org-form-grid .select { inline-size: 100%; }
.org-form-foot { display: flex; justify-content: flex-end; gap: var(--sp-3); padding: var(--sp-3) var(--sp-5); background: var(--c-surface-2); border-block-start: 1px solid var(--c-border); }

/* ---------- Niveaux, attribution, SLA, transfert ---------- */
.level-tag { display: inline-grid; place-items: center; min-inline-size: 30px; padding: 1px 8px; border-radius: var(--r-pill); font-size: var(--fs-xs); font-weight: 700; letter-spacing: 0.02em; border: 1px solid; }
.level-tag.level-1 { background: var(--c-accent-soft); color: var(--c-accent-strong); border-color: #bcd4e6; }
.level-tag.level-2 { background: #eee8f6; color: #5d3f8c; border-color: #d6c8ea; }
.queue-tag { display: inline-flex; align-items: center; padding: 1px 8px; border-radius: var(--r-pill); font-size: var(--fs-xs); font-weight: 600; white-space: nowrap; background: var(--c-surface-2); color: var(--c-text-2); border: 1px solid var(--c-border); }
.queue-tag.queue-reseller { background: #eee8f6; color: #5d3f8c; border-color: #d6c8ea; }
.queue-tag.queue-internal { background: var(--c-ok-soft); color: var(--c-ok); border-color: #bfe0cc; }
.queue-tag.queue-unassigned { background: var(--c-warning-soft); color: var(--c-warning); border-color: #eed9a8; }
.assignment-cell { display: inline-flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.assignee-name { font-size: var(--fs-xs); color: var(--c-text-2); }
.status-cell { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.sla-breach-tag { display: inline-flex; align-items: center; padding: 1px 6px; border-radius: var(--r-pill); font-size: 10px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; background: var(--c-danger-soft); color: var(--c-danger); border: 1px solid #efc4c0; }
.banner .sla-breach-tag { margin-inline-end: 4px; }
.unassigned-banner strong { font-size: var(--fs-md, 1rem); }

.treatment-card { border-inline-start: 3px solid var(--c-accent); }
.treatment-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-4); flex-wrap: wrap; }
.treatment-facts { display: flex; align-items: center; gap: var(--sp-5); flex-wrap: wrap; }
.treatment-fact { display: flex; flex-direction: column; gap: 4px; }
.fact-label { font-size: var(--fs-xs); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--c-text-3); }
.treatment-form { max-inline-size: 640px; }
.treatment-form .input { inline-size: 100%; }
.treatment-form textarea.input { padding-block: var(--sp-2); min-block-size: 80px; resize: vertical; }

.sla-clock { gap: var(--sp-2); }
.sla-bar { block-size: 8px; border-radius: var(--r-pill); background: var(--c-surface-2); overflow: hidden; border: 1px solid var(--c-border); }
.sla-bar-fill { block-size: 100%; background: var(--c-accent); transition: width var(--motion); }
.sla-bar-fill.warning { background: #d98e04; }
.sla-bar-fill.breached { background: var(--c-danger); }

.rules-form { display: flex; align-items: flex-end; gap: var(--sp-3); flex-wrap: wrap; }
.rules-form .field { min-inline-size: 150px; }
.rules-form .field > span:first-child { font-size: var(--fs-xs); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--c-text-3); }
.rules-form .checkbox-field { flex-direction: row; align-items: center; gap: var(--sp-2); min-inline-size: 0; min-block-size: var(--touch); }
.rules-form .checkbox-field > span:first-child { text-transform: none; }
.rules-card { margin-block-start: var(--sp-5); }
.sla-section-title { margin: 0; font-size: var(--fs-sm); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--c-text-2); }
.sla-new-rule { padding: var(--sp-4); border: 1px dashed var(--c-border-strong); border-radius: var(--r-3); background: var(--c-surface-2); }
.org-transfer { border: 1px solid var(--c-border-strong); box-shadow: var(--e-2); border-inline-start: 3px solid #5d3f8c; }
tr.rule-editing td, .admin-page .table tr.rule-editing td { background: var(--c-accent-soft); }
.initial-request { border-inline-start: 3px solid var(--c-accent); background: var(--c-accent-soft); }
.initial-request-facts { display: flex; flex-wrap: wrap; gap: var(--sp-1) var(--sp-4); margin: 0; }
.initial-request-text { white-space: pre-wrap; }
.case-overview { padding: 0; border-inline-start: 3px solid var(--c-accent); }
.case-overview-summary { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; padding: var(--sp-3) var(--sp-4); cursor: pointer; list-style: none; }
.case-overview-summary::-webkit-details-marker { display: none; }
.case-overview-title { font-size: var(--fs-lg, 1.1rem); color: var(--c-text); }
.case-overview-chevron { color: var(--c-text-3); transform: rotate(-90deg); transition: transform var(--motion); }
.case-overview[open] .case-overview-chevron { transform: none; }
.case-overview-hint { margin-inline-start: auto; }
.case-overview-body { display: flex; flex-direction: column; gap: var(--sp-3); padding: var(--sp-3) var(--sp-4) var(--sp-4); border-block-start: 1px solid var(--c-border); }
.case-overview-facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: var(--sp-3) var(--sp-4); margin: 0; }
.case-overview-facts dt { font-size: var(--fs-xs); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--c-text-3); }
.case-overview-facts dd { margin: 2px 0 0; color: var(--c-text); overflow-wrap: anywhere; }
.case-overview-description p { margin: 4px 0 0; white-space: pre-wrap; }
