/* =====================================================================================================
   BeeTwin 3.0 design system — "evidence-aware instrument"
   Tokens → base → layout → components → data/evidence → pages. No framework. Light/dark themes via
   [data-theme] on <html>; "auto" follows prefers-color-scheme. All text colours meet WCAG 2.2 AA (≥ 4.5:1)
   on their surfaces; large display text ≥ 3:1. Motion respects prefers-reduced-motion.
   ===================================================================================================== */

@font-face { font-family: "Inter"; src: url("../lib/fonts/inter-latin-wght.woff2") format("woff2"); font-weight: 100 900; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Inter"; src: url("../lib/fonts/inter-latin-ext-wght.woff2") format("woff2"); font-weight: 100 900; font-display: swap;
  unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "JetBrains Mono"; src: url("../lib/fonts/jetbrains-mono-latin-wght.woff2") format("woff2"); font-weight: 100 800; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+2000-206F, U+2212; }
@font-face { font-family: "JetBrains Mono"; src: url("../lib/fonts/jetbrains-mono-latin-ext-wght.woff2") format("woff2"); font-weight: 100 800; font-display: swap;
  unicode-range: U+0100-02AF, U+1E00-1E9F; }

:root {
  --font: "Inter", "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "Cascadia Code", Consolas, monospace;
  --radius-s: 8px; --radius: 14px; --radius-l: 22px;
  --nav-w: 268px; --nav-w-collapsed: 76px; --top-h: 64px;
  --ease: cubic-bezier(.2,.7,.2,1); --dur: 180ms;
  --shadow-1: 0 1px 2px rgb(16 24 40 / .06), 0 1px 3px rgb(16 24 40 / .08);
  --shadow-2: 0 8px 24px -8px rgb(16 24 40 / .18), 0 2px 6px rgb(16 24 40 / .06);
  --shadow-3: 0 24px 64px -24px rgb(16 24 40 / .35);
  color-scheme: light;

  /* Light theme (default) */
  --bg: #f5f3ee; --bg-grad: radial-gradient(1200px 600px at 100% -10%, #fff6dd 0%, transparent 60%), radial-gradient(900px 500px at -10% 110%, #e7f4f1 0%, transparent 55%);
  --surface: #ffffff; --surface-2: #faf8f4; --surface-3: #f1ede4; --overlay: rgb(255 255 255 / .82);
  --ink: #131920; --ink-2: #374151; --muted: #56606d; --faint: #8a93a0;
  --line: #e3ded2; --line-strong: #cfc8b8; --focus: #0b63ce;
  --brand: #b87800; --brand-ink: #7a4f00; --brand-soft: #fff1cf; --brand-contrast: #1d1400;
  --nav-bg: #12171d; --nav-ink: #c9d1db; --nav-ink-strong: #ffffff; --nav-muted: #8d99a8; --nav-active: rgb(242 179 61 / .14); --nav-line: #232b35;
  /* epistemic classes */
  --c-obs: #0f6f68;   --c-obs-soft: #e2f4f1;
  --c-der: #3f3aa8;   --c-der-soft: #ebeafb;
  --c-mod: #7a2fd0;   --c-mod-soft: #f3eafd;
  --c-fct: #9a4a00;   --c-fct-soft: #fdf0e1;
  --c-sim: #b3175a;   --c-sim-soft: #fde8f1;
  --c-evi: #146c34;   --c-evi-soft: #e4f5e9;
  --c-ai:  #075a8f;   --c-ai-soft:  #e1f1fb;
  --c-sch: #5f6672;   --c-sch-soft: #eef0f3;
  /* status */
  --ok: #157a3b; --ok-soft: #e3f5e8; --warn: #946100; --warn-soft: #fff3d6; --att: #b4430d; --att-soft: #fdebe1;
  --crit: #b4232a; --crit-soft: #fde7e8; --none: #5b6573; --none-soft: #eef0f3;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0a0e13; --bg-grad: radial-gradient(1200px 600px at 100% -10%, rgb(242 179 61 / .07) 0%, transparent 60%), radial-gradient(900px 500px at -10% 110%, rgb(45 212 191 / .06) 0%, transparent 55%);
  --surface: #111821; --surface-2: #151d27; --surface-3: #1b2531; --overlay: rgb(17 24 33 / .84);
  --ink: #edf1f5; --ink-2: #cdd5de; --muted: #9eaab7; --faint: #6f7b89;
  --line: #222d3a; --line-strong: #2f3c4c; --focus: #6cb2ff;
  --brand: #f2b33d; --brand-ink: #f6c766; --brand-soft: rgb(242 179 61 / .14); --brand-contrast: #1d1400;
  --nav-bg: #080b0f; --nav-line: #1a222c;
  --c-obs: #3fd2bf; --c-obs-soft: rgb(63 210 191 / .13);
  --c-der: #a9b3ff; --c-der-soft: rgb(169 179 255 / .13);
  --c-mod: #cfb4ff; --c-mod-soft: rgb(207 180 255 / .13);
  --c-fct: #fbbf5a; --c-fct-soft: rgb(251 191 90 / .13);
  --c-sim: #f7a6cc; --c-sim-soft: rgb(247 166 204 / .13);
  --c-evi: #8fe6a8; --c-evi-soft: rgb(143 230 168 / .12);
  --c-ai:  #84d2fb; --c-ai-soft:  rgb(132 210 251 / .12);
  --c-sch: #aab3bf; --c-sch-soft: rgb(170 179 191 / .12);
  --ok: #6fdc95; --ok-soft: rgb(111 220 149 / .12); --warn: #f2c454; --warn-soft: rgb(242 196 84 / .13); --att: #ff9e6b; --att-soft: rgb(255 158 107 / .13);
  --crit: #ff8a8f; --crit-soft: rgb(255 138 143 / .13); --none: #a3adba; --none-soft: rgb(163 173 186 / .12);
  --shadow-1: 0 1px 2px rgb(0 0 0 / .4); --shadow-2: 0 12px 28px -10px rgb(0 0 0 / .6); --shadow-3: 0 30px 80px -30px rgb(0 0 0 / .8);
}

/* ---------------------------------------------------------------------------------------------- base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.55; color: var(--ink); background: var(--bg); background-image: var(--bg-grad);
  background-attachment: fixed; font-feature-settings: "cv11", "ss01", "ss03"; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
h1, h2, h3, h4 { margin: 0 0 .4em; line-height: 1.2; letter-spacing: -.015em; color: var(--ink); }
h1 { font-size: clamp(1.55rem, 1.1rem + 1.2vw, 2.05rem); font-weight: 700; }
h2 { font-size: 1.22rem; font-weight: 650; }
h3 { font-size: 1.02rem; font-weight: 650; }
p { margin: 0 0 .8em; }
a { color: var(--focus); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
small, .small { font-size: .84rem; }
code, .mono, kbd { font-family: var(--mono); font-size: .88em; }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
hr { border: 0; border-top: 1px solid var(--line); margin: 1.2rem 0; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
::selection { background: var(--brand-soft); color: var(--ink); }
.sr-only { position: absolute !important; 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; left: 12px; top: -60px; z-index: 1000; background: var(--surface); color: var(--ink); padding: .6rem 1rem; border-radius: var(--radius-s); box-shadow: var(--shadow-2); }
.skip-link:focus { top: 12px; }
.ico { width: 18px; height: 18px; flex: none; vertical-align: -3px; }
.ico-l { width: 22px; height: 22px; }
.muted { color: var(--muted); } .ink2 { color: var(--ink-2); } .faint { color: var(--faint); }
.hidden, [hidden] { display: none !important; }
.nowrap { white-space: nowrap; }
.right { text-align: right; } .center { text-align: center; }
.stack > * + * { margin-top: var(--gap, 1rem); }
.row { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }
.row-between { display: flex; gap: 1rem; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.grid { display: grid; gap: 1.1rem; }
/* Grid items may shrink below their content width; wide tables then scroll inside .table-wrap instead of widening the page. */
.grid > * { min-width: 0; }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); }
.span-2 { grid-column: span 2; } .span-all { grid-column: 1 / -1; }
@media (max-width: 1180px) { .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g-main { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 760px) { .g-2, .g-3, .g-4 { grid-template-columns: minmax(0, 1fr); } .span-2 { grid-column: auto; } }

/* --------------------------------------------------------------------------------------------- shell */
.shell { display: grid; grid-template-columns: var(--nav-w) minmax(0, 1fr); min-height: 100vh; }
.shell.collapsed { grid-template-columns: var(--nav-w-collapsed) minmax(0, 1fr); }
.nav { position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--nav-bg); color: var(--nav-ink); display: flex; flex-direction: column;
  border-right: 1px solid var(--nav-line); scrollbar-width: thin; }
.nav-brand { display: flex; align-items: center; gap: .7rem; padding: 1.1rem 1.15rem 1rem; color: var(--nav-ink-strong); text-decoration: none; }
.brand-mark { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 11px; flex: none;
  background: conic-gradient(from 210deg, #f6c766, #e09a12, #b87800, #f6c766); color: #1d1400; box-shadow: inset 0 0 0 1px rgb(255 255 255 / .25), 0 6px 18px -6px rgb(242 179 61 / .6); }
.brand-mark svg { width: 22px; height: 22px; }
.brand-name { font-weight: 750; letter-spacing: -.02em; font-size: 1.08rem; line-height: 1.1; }
.brand-sub { font-size: .7rem; color: var(--nav-muted); letter-spacing: .08em; text-transform: uppercase; }
.nav-section { padding: .9rem .75rem .2rem; }
.nav-label { font-size: .68rem; letter-spacing: .12em; text-transform: uppercase; color: var(--nav-muted); padding: 0 .55rem .35rem; }
.nav a.nav-item { display: flex; align-items: center; gap: .75rem; padding: .56rem .6rem; margin: 1px 0; border-radius: 10px; color: var(--nav-ink);
  text-decoration: none; font-weight: 520; font-size: .93rem; transition: background var(--dur) var(--ease), color var(--dur); position: relative; }
.nav a.nav-item:hover { background: rgb(255 255 255 / .05); color: var(--nav-ink-strong); }
.nav a.nav-item[aria-current="page"] { background: var(--nav-active); color: #fff; }
.nav a.nav-item[aria-current="page"]::before { content: ""; position: absolute; left: -.75rem; top: 8px; bottom: 8px; width: 3px; border-radius: 3px; background: #f2b33d; }
.nav a.nav-item .ico { color: var(--nav-muted); }
.nav a.nav-item[aria-current="page"] .ico, .nav a.nav-item:hover .ico { color: #f2b33d; }
.nav .pill { margin-left: auto; font-size: .7rem; font-weight: 700; background: #f2b33d; color: #1d1400; border-radius: 999px; padding: .05rem .45rem; }
.nav-foot { margin-top: auto; padding: 1rem 1.15rem; font-size: .74rem; color: var(--nav-muted); border-top: 1px solid var(--nav-line); }
.shell.collapsed .nav .brand-text, .shell.collapsed .nav .nav-label, .shell.collapsed .nav-item span, .shell.collapsed .nav .pill, .shell.collapsed .nav-foot { display: none; }
.shell.collapsed .nav a.nav-item { justify-content: center; }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 30; height: var(--top-h); display: flex; align-items: center; gap: .75rem; padding: 0 1.5rem;
  background: var(--overlay); backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px); border-bottom: 1px solid var(--line); }
.topbar .crumbs { display: flex; align-items: center; gap: .4rem; color: var(--muted); font-size: .9rem; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.topbar .crumbs a { color: var(--muted); text-decoration: none; } .topbar .crumbs a:hover { color: var(--ink); }
.topbar .crumbs strong { color: var(--ink); font-weight: 600; }
.topbar .spacer { flex: 1; }
.content { padding: 1.6rem 1.6rem 3rem; max-width: 1560px; width: 100%; }
@media (max-width: 960px) {
  .shell, .shell.collapsed { grid-template-columns: minmax(0, 1fr); }
  .nav { position: fixed; inset: 0 auto 0 0; width: min(86vw, 300px); z-index: 60; transform: translateX(-102%); transition: transform 240ms var(--ease); }
  .shell.nav-open .nav { transform: none; box-shadow: var(--shadow-3); }
  .shell.collapsed .nav .brand-text, .shell.collapsed .nav .nav-label, .shell.collapsed .nav-item span, .shell.collapsed .nav-foot { display: initial; }
  .content { padding: 1.1rem 1rem 2.5rem; } .topbar { padding: 0 1rem; }
}
.scrim { display: none; } @media (max-width: 960px) { .shell.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgb(0 0 0 / .45); z-index: 50; } }
.demo-banner { display: flex; gap: .6rem; align-items: center; padding: .5rem 1.6rem; font-size: .86rem; background: repeating-linear-gradient(-45deg, var(--c-sim-soft), var(--c-sim-soft) 12px, transparent 12px, transparent 24px);
  color: var(--c-sim); border-bottom: 1px solid var(--line); font-weight: 560; }

/* ---------------------------------------------------------------------------------------- controls */
.btn { --b: var(--surface); --f: var(--ink); --bd: var(--line-strong); display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: 40px; padding: .5rem 1rem; border-radius: 11px; border: 1px solid var(--bd); background: var(--b); color: var(--f); font: inherit; font-weight: 600;
  font-size: .92rem; cursor: pointer; text-decoration: none; transition: transform 80ms, background var(--dur), border-color var(--dur), box-shadow var(--dur); white-space: nowrap; }
.btn:hover { border-color: var(--ink-2); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn.disabled { opacity: .55; pointer-events: none; }
.btn-primary { --b: var(--brand); --f: var(--brand-contrast); --bd: transparent; box-shadow: 0 6px 18px -8px rgb(184 120 0 / .7); }
:root[data-theme="dark"] .btn-primary { box-shadow: 0 6px 22px -8px rgb(242 179 61 / .55); }
.btn-primary:hover { filter: brightness(1.06); border-color: transparent; }
.btn-ghost { --b: transparent; --bd: transparent; --f: var(--ink-2); }
.btn-ghost:hover { --b: var(--surface-3); border-color: transparent; }
.btn-danger { --b: var(--crit-soft); --f: var(--crit); --bd: transparent; }
.btn-sm { min-height: 32px; padding: .3rem .7rem; font-size: .84rem; border-radius: 9px; }
.btn-icon { width: 40px; padding: 0; } .btn-sm.btn-icon { width: 32px; }
.btn-block { width: 100%; }
.seg { display: inline-flex; padding: 3px; border-radius: 11px; background: var(--surface-3); border: 1px solid var(--line); }
.seg button, .seg a { border: 0; background: transparent; color: var(--muted); font: inherit; font-weight: 600; font-size: .83rem; padding: .3rem .7rem; border-radius: 8px; cursor: pointer; text-decoration: none; }
.seg [aria-pressed="true"], .seg [aria-current="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); }
label, .label { display: block; font-weight: 600; font-size: .86rem; color: var(--ink-2); margin-bottom: .35rem; }
.field { margin-bottom: 1rem; }
.hint { font-size: .8rem; color: var(--muted); margin-top: .3rem; }
.input, select.input, textarea.input { width: 100%; min-height: 42px; padding: .55rem .8rem; border-radius: 11px; border: 1px solid var(--line-strong); background: var(--surface);
  color: var(--ink); font: inherit; transition: border-color var(--dur), box-shadow var(--dur); }
textarea.input { min-height: 110px; resize: vertical; line-height: 1.5; }
.input:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 4px color-mix(in srgb, var(--focus) 22%, transparent); }
.input::placeholder { color: var(--faint); }
.input-validation-error, .input.invalid { border-color: var(--crit) !important; }
.field-error, .field-validation-error { color: var(--crit); font-size: .82rem; margin-top: .3rem; display: block; }
.validation-summary-errors ul { margin: 0; padding-left: 1.1rem; }
.check { display: flex; gap: .6rem; align-items: flex-start; font-weight: 500; color: var(--ink); }
.check input { width: 18px; height: 18px; margin-top: .15rem; accent-color: var(--brand); }
input[type="range"] { accent-color: var(--brand); width: 100%; }

/* ----------------------------------------------------------------------------------------- surfaces */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-1); padding: 1.25rem 1.3rem; position: relative; min-width: 0; }
.card.flush { padding: 0; overflow: hidden; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: .9rem; flex-wrap: wrap; }
.card-head h2, .card-head h3 { margin: 0; display: flex; align-items: center; gap: .5rem; }
.card-head .ico { color: var(--muted); }
.card.glow { background: linear-gradient(180deg, var(--surface) 0%, var(--surface-2) 100%); }
.card.accent { border-color: color-mix(in srgb, var(--brand) 40%, var(--line)); }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; margin-bottom: 1.4rem; flex-wrap: wrap; }
.page-head .eyebrow { font-size: .74rem; letter-spacing: .12em; text-transform: uppercase; color: var(--brand-ink); font-weight: 700; margin-bottom: .3rem; display: flex; align-items: center; gap: .4rem; }
.page-head p { color: var(--muted); margin: .2rem 0 0; max-width: 72ch; }
.kpi { display: flex; flex-direction: column; gap: .25rem; }
.kpi .k-label { font-size: .8rem; color: var(--muted); font-weight: 600; display: flex; align-items: center; gap: .4rem; }
.kpi .k-value { font-size: 1.9rem; font-weight: 720; letter-spacing: -.03em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi .k-sub { font-size: .8rem; color: var(--muted); }
.tabs { display: flex; gap: .2rem; border-bottom: 1px solid var(--line); margin-bottom: 1.2rem; overflow-x: auto; scrollbar-width: none; }
.tabs a { padding: .65rem .9rem; color: var(--muted); text-decoration: none; font-weight: 600; font-size: .92rem; border-bottom: 2px solid transparent; white-space: nowrap; display: flex; gap: .45rem; align-items: center; }
.tabs a:hover { color: var(--ink); }
.tabs a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--brand); }
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { text-align: left; font-size: .74rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 700; padding: .65rem .8rem; border-bottom: 1px solid var(--line); background: var(--surface-2); white-space: nowrap; }
.table td { padding: .7rem .8rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--surface-2); }
.table a { font-weight: 600; text-decoration: none; } .table a:hover { text-decoration: underline; }
.list { list-style: none; margin: 0; padding: 0; }
.list > li { padding: .7rem 0; border-bottom: 1px solid var(--line); } .list > li:last-child { border-bottom: 0; }
.empty { text-align: center; padding: 2.4rem 1rem; color: var(--muted); }
.empty .ico { width: 34px; height: 34px; color: var(--faint); margin-bottom: .6rem; }
.empty h3 { color: var(--ink); }
.alert { display: flex; gap: .7rem; align-items: flex-start; padding: .85rem 1rem; border-radius: 12px; border: 1px solid transparent; font-size: .92rem; margin-bottom: 1rem; }
.alert .ico { margin-top: 2px; }
.alert-info { background: var(--c-ai-soft); color: var(--ink); border-color: color-mix(in srgb, var(--c-ai) 25%, transparent); } .alert-info .ico { color: var(--c-ai); }
.alert-ok { background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 25%, transparent); } .alert-ok .ico { color: var(--ok); }
.alert-warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 30%, transparent); } .alert-warn .ico { color: var(--warn); }
.alert-crit { background: var(--crit-soft); border-color: color-mix(in srgb, var(--crit) 25%, transparent); } .alert-crit .ico { color: var(--crit); }
.toasts { position: fixed; right: 18px; bottom: 18px; z-index: 90; display: flex; flex-direction: column; gap: .5rem; max-width: min(420px, calc(100vw - 36px)); }
.toast { background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-2); border-radius: 12px; padding: .8rem 1rem; display: flex; gap: .6rem; align-items: flex-start; animation: toast-in 260ms var(--ease); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
details.disclosure > summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: .5rem; font-weight: 600; }
details.disclosure > summary::-webkit-details-marker { display: none; }
details.disclosure > summary .chev { transition: transform var(--dur); }
details.disclosure[open] > summary .chev { transform: rotate(90deg); }
.menu { position: relative; }
.menu-panel { position: absolute; right: 0; top: calc(100% + 8px); min-width: 230px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-3); padding: .4rem; z-index: 40; }
.menu-panel a, .menu-panel button { display: flex; width: 100%; gap: .6rem; align-items: center; padding: .55rem .7rem; border-radius: 9px; color: var(--ink); text-decoration: none; background: none; border: 0; font: inherit; cursor: pointer; text-align: left; }
.menu-panel a:hover, .menu-panel button:hover { background: var(--surface-3); }
.menu-panel .meta { padding: .5rem .7rem .6rem; border-bottom: 1px solid var(--line); margin-bottom: .3rem; }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: .82rem; background: var(--brand-soft); color: var(--brand-ink); border: 1px solid color-mix(in srgb, var(--brand) 35%, transparent); }
.skeleton { background: linear-gradient(90deg, var(--surface-3), var(--surface-2), var(--surface-3)); background-size: 200% 100%; animation: sk 1.2s linear infinite; border-radius: 8px; min-height: 1em; }
@keyframes sk { to { background-position: -200% 0; } }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line-strong); border-top-color: var(--brand); animation: spin .8s linear infinite; display: inline-block; vertical-align: -4px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ------------------------------------------------------------------------------- data & evidence */
.chip { display: inline-flex; align-items: center; gap: .32rem; padding: .14rem .55rem; border-radius: 999px; font-size: .74rem; font-weight: 650; line-height: 1.5; white-space: nowrap;
  border: 1px solid transparent; background: var(--surface-3); color: var(--ink-2); }
.chip .ico { width: 13px; height: 13px; vertical-align: -2px; }
.chip.obs { background: var(--c-obs-soft); color: var(--c-obs); } .chip.der { background: var(--c-der-soft); color: var(--c-der); }
.chip.mod { background: var(--c-mod-soft); color: var(--c-mod); } .chip.fct { background: var(--c-fct-soft); color: var(--c-fct); }
.chip.sim { background: var(--c-sim-soft); color: var(--c-sim); } .chip.evi { background: var(--c-evi-soft); color: var(--c-evi); }
.chip.ai { background: var(--c-ai-soft); color: var(--c-ai); } .chip.sch { background: var(--c-sch-soft); color: var(--c-sch); border-style: dashed; border-color: var(--c-sch); }
.chip.ok { background: var(--ok-soft); color: var(--ok); } .chip.warn { background: var(--warn-soft); color: var(--warn); } .chip.att { background: var(--att-soft); color: var(--att); }
.chip.crit { background: var(--crit-soft); color: var(--crit); } .chip.none { background: var(--none-soft); color: var(--none); }
.chip.outline { background: transparent; border-color: var(--line-strong); color: var(--muted); }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; background: currentColor; flex: none; }
.dot.live { box-shadow: 0 0 0 0 currentColor; animation: pulse 2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, currentColor 55%, transparent); } 70% { box-shadow: 0 0 0 9px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
.band { --bc: var(--none); --bs: var(--none-soft); display: inline-flex; align-items: baseline; gap: .5rem; }
.band.good { --bc: var(--ok); --bs: var(--ok-soft); } .band.moderate { --bc: var(--warn); --bs: var(--warn-soft); } .band.attention { --bc: var(--att); --bs: var(--att-soft); } .band.critical { --bc: var(--crit); --bs: var(--crit-soft); }
.score-ring { --pct: 0; width: 132px; height: 132px; border-radius: 50%; display: grid; place-items: center; position: relative;
  background: conic-gradient(var(--bc) calc(var(--pct) * 1%), var(--surface-3) 0); }
.score-ring::after { content: ""; position: absolute; inset: 11px; border-radius: 50%; background: var(--surface); }
.score-ring > div { position: relative; z-index: 1; text-align: center; }
.score-ring .v { font-size: 2.1rem; font-weight: 750; letter-spacing: -.04em; font-variant-numeric: tabular-nums; color: var(--ink); }
.score-ring .u { font-size: .72rem; color: var(--muted); display: block; margin-top: -4px; }
.score-ring.na { background: repeating-conic-gradient(var(--surface-3) 0 6deg, transparent 6deg 12deg); }
.meter { --pct: 0; height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.meter > span { display: block; height: 100%; width: calc(var(--pct) * 1%); background: var(--mc, var(--brand)); border-radius: inherit; transition: width 600ms var(--ease); }
.factor { display: grid; grid-template-columns: 120px minmax(0, 1fr) 72px; gap: .7rem; align-items: center; padding: .5rem 0; }
.factor .f-name { font-weight: 600; font-size: .88rem; } .factor .f-val { text-align: right; font-family: var(--mono); font-size: .84rem; }
.factor.excluded { opacity: .7; } .factor.excluded .meter { background: repeating-linear-gradient(45deg, var(--surface-3), var(--surface-3) 4px, transparent 4px, transparent 8px); }
.evidence { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2); }
.evidence > summary { padding: .85rem 1rem; }
.evidence .ev-body { padding: 0 1rem 1rem; display: grid; gap: .9rem; }
.ev-status { display: inline-flex; gap: .45rem; align-items: center; font-weight: 700; font-size: .86rem; }
.ev-status.supported { color: var(--ok); } .ev-status.limited { color: var(--warn); } .ev-status.insufficient { color: var(--crit); }
.ev-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .6rem; }
.ev-cell { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: .55rem .7rem; }
.ev-cell .l { font-size: .72rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 700; }
.ev-cell .v { font-weight: 600; font-size: .9rem; }
.ev-list { margin: 0; padding-left: 1.15rem; font-size: .9rem; } .ev-list li { margin: .2rem 0; }
.caution { display: flex; gap: .5rem; align-items: flex-start; font-size: .88rem; padding: .45rem .6rem; border-radius: 9px; background: var(--warn-soft); }
.caution .ico { color: var(--warn); margin-top: 2px; }
.caution.crit { background: var(--crit-soft); } .caution.crit .ico { color: var(--crit); }
.trust-note { font-size: .82rem; color: var(--muted); border-left: 3px solid var(--line-strong); padding-left: .7rem; }
.reading { display: flex; justify-content: space-between; gap: .8rem; align-items: center; padding: .7rem .2rem; border-bottom: 1px dashed var(--line); }
.reading:last-child { border-bottom: 0; }
.reading .r-name { font-weight: 600; font-size: .9rem; } .reading .r-meta { font-size: .78rem; color: var(--muted); }
.reading .r-val { font-family: var(--mono); font-weight: 650; font-size: 1.05rem; text-align: right; white-space: nowrap; }
.reading.stale .r-val { color: var(--muted); text-decoration: line-through dotted; }
.reading.flagged .r-val { color: var(--crit); }
.advisory { display: grid; grid-template-columns: 4px minmax(0, 1fr); gap: .9rem; padding: .9rem 0; border-bottom: 1px solid var(--line); }
.advisory:last-child { border-bottom: 0; }
.advisory .sev { border-radius: 4px; background: var(--none); } .advisory.critical .sev { background: var(--crit); } .advisory.warning .sev { background: var(--warn); } .advisory.info .sev { background: var(--c-ai); }
.advisory h4 { margin: 0 0 .2rem; font-size: .98rem; }
.timeline { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--line); }
.timeline li { position: relative; padding: 0 0 .9rem 1rem; } .timeline li::before { content: ""; position: absolute; left: -7px; top: 5px; width: 12px; height: 12px; border-radius: 50%; background: var(--surface); border: 2px solid var(--line-strong); }
.legend { display: flex; flex-wrap: wrap; gap: .5rem .9rem; font-size: .8rem; color: var(--muted); align-items: center; }
.legend span { display: inline-flex; align-items: center; gap: .35rem; }
.legend i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.chart-box { position: relative; height: 300px; } .chart-box.tall { height: 380px; } .chart-box.short { height: 200px; }
.map-box { height: 460px; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); background: var(--surface-3); }
.leaflet-container { font-family: var(--font); background: var(--surface-3); }
:root[data-theme="dark"] .leaflet-tile-pane .basemap { filter: brightness(.72) contrast(1.1) saturate(.75); }

/* --------------------------------------------------------------------------------------- twin */
.twin-stage { position: relative; height: min(72vh, 720px); min-height: 460px; border-radius: var(--radius-l); overflow: hidden; border: 1px solid var(--line);
  background: radial-gradient(120% 90% at 50% 10%, var(--surface) 0%, var(--surface-3) 100%); }
:root[data-theme="dark"] .twin-stage { background: radial-gradient(120% 90% at 50% 0%, #16212d 0%, #070a0e 100%); }
.twin-stage canvas { display: block; width: 100%; height: 100%; outline: none; }
.twin-toolbar { position: absolute; left: 14px; top: 14px; display: flex; flex-direction: column; gap: 6px; z-index: 3; }
.twin-toolbar .btn { background: var(--overlay); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.twin-toolbar .btn[aria-pressed="true"] { border-color: var(--brand); color: var(--brand-ink); }
.twin-legend { position: absolute; left: 14px; bottom: 14px; right: 14px; z-index: 3; display: flex; justify-content: space-between; align-items: flex-end; gap: .8rem; pointer-events: none; flex-wrap: wrap; }
.twin-legend > * { pointer-events: auto; background: var(--overlay); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border: 1px solid var(--line); border-radius: 12px; padding: .5rem .75rem; }
.twin-label { position: absolute; transform: translate(-50%, -130%); pointer-events: none; z-index: 2; font-size: .76rem; font-weight: 650; padding: .2rem .5rem; border-radius: 8px;
  background: var(--overlay); border: 1px solid var(--line); color: var(--ink); white-space: nowrap; box-shadow: var(--shadow-1); font-family: var(--mono); }
.twin-label.stale { color: var(--muted); border-style: dashed; } .twin-label.flagged { color: var(--crit); border-color: var(--crit); } .twin-label.anom { border-color: var(--att); color: var(--att); }
.twin-fallback { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 2rem; color: var(--muted); }
.playback { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: .8rem; align-items: center; }

/* ---------------------------------------------------------------------------------------- auth */
.auth { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(380px, 1fr); min-height: 100vh; }
.auth-scene { position: relative; overflow: hidden; isolation: isolate; background: linear-gradient(160deg, #fdf6e6 0%, #f3e7cc 45%, #e6ecd9 100%); }
:root[data-theme="dark"] .auth-scene { background: radial-gradient(120% 90% at 30% 20%, #1a2633 0%, #0b1118 55%, #05080b 100%); }
.auth-scene canvas { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; }
.auth-scene .scene-fallback { position: absolute; inset: 0; z-index: 0; display: grid; place-items: center; }
.auth-scene .scene-fallback svg { width: min(70%, 520px); height: auto; opacity: .9; }
.auth-copy { position: absolute; z-index: 2; left: clamp(1.25rem, 4vw, 3.5rem); bottom: clamp(1.25rem, 5vh, 3.5rem); max-width: 560px;
  background: rgb(255 252 245 / .88); color: #141a21; border: 1px solid rgb(120 90 20 / .16); border-radius: 22px; padding: 1.5rem 1.6rem; box-shadow: 0 30px 60px -30px rgb(80 55 0 / .35);
  backdrop-filter: blur(14px) saturate(1.2); -webkit-backdrop-filter: blur(14px) saturate(1.2); }
:root[data-theme="dark"] .auth-copy { background: rgb(9 13 18 / .78); color: #eef2f6; border-color: rgb(255 255 255 / .10); box-shadow: 0 30px 70px -30px rgb(0 0 0 / .9); }
.auth-copy .eyebrow { font-size: .72rem; letter-spacing: .16em; text-transform: uppercase; font-weight: 750; color: #7a4f00; display: flex; align-items: center; gap: .45rem; }
:root[data-theme="dark"] .auth-copy .eyebrow { color: #f6c766; }
.auth-copy h1 { font-size: clamp(1.6rem, 1.1rem + 1.6vw, 2.5rem); line-height: 1.08; letter-spacing: -.03em; margin: .5rem 0 .7rem; color: inherit; }
.auth-copy p { color: #3a4350; font-size: 1rem; margin-bottom: 1rem; }
:root[data-theme="dark"] .auth-copy p { color: #c9d2dc; }
.auth-copy .pillars { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .45rem .9rem; font-size: .88rem; color: #2c3440; }
:root[data-theme="dark"] .auth-copy .pillars { color: #d8dfe7; }
.auth-copy .pillars span { display: flex; gap: .45rem; align-items: center; } .auth-copy .pillars .ico { color: #b87800; } :root[data-theme="dark"] .auth-copy .pillars .ico { color: #f2b33d; }
.auth-brand { position: absolute; z-index: 2; left: clamp(1.25rem, 4vw, 3.5rem); top: clamp(1.1rem, 4vh, 2.4rem); display: flex; align-items: center; gap: .7rem; color: #141a21; font-weight: 750; letter-spacing: -.02em; font-size: 1.15rem; text-decoration: none; }
:root[data-theme="dark"] .auth-brand { color: #fff; }
.auth-brand small { display: block; font-size: .68rem; letter-spacing: .14em; text-transform: uppercase; font-weight: 650; opacity: .75; }
.auth-panel { display: flex; flex-direction: column; justify-content: center; padding: clamp(1.5rem, 4vw, 3.5rem); background: var(--surface); border-left: 1px solid var(--line); }
.auth-panel .auth-tools { display: flex; justify-content: flex-end; gap: .5rem; position: absolute; top: 1.1rem; right: 1.2rem; }
.auth-form { width: 100%; max-width: 410px; margin: 0 auto; }
.auth-form h2 { font-size: 1.65rem; letter-spacing: -.025em; margin-bottom: .3rem; }
.auth-form .lede { color: var(--muted); margin-bottom: 1.6rem; }
.auth-panel { position: relative; }
.auth-foot { margin-top: 2rem; font-size: .8rem; color: var(--muted); display: flex; gap: .4rem; align-items: center; }
@media (max-width: 980px) {
  .auth { grid-template-columns: 1fr; grid-template-rows: minmax(340px, 46vh) auto; }
  .auth-copy { left: 1rem; right: 1rem; bottom: 1rem; padding: 1.1rem 1.2rem; } .auth-copy .pillars { display: none; } .auth-copy p { font-size: .92rem; margin: 0; }
  .auth-panel { border-left: 0; border-top: 1px solid var(--line); }
}

/* ------------------------------------------------------------------------------------- study */
.study { max-width: 860px; margin: 0 auto; padding: 2rem 1rem 4rem; }
.study-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l); padding: clamp(1.2rem, 3vw, 2rem); box-shadow: var(--shadow-2); }
.stimulus { border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem; background: var(--surface-2); }
.options { display: grid; gap: .6rem; margin: 1rem 0; }
.option { display: flex; gap: .7rem; align-items: flex-start; border: 1px solid var(--line-strong); border-radius: 12px; padding: .8rem 1rem; cursor: pointer; background: var(--surface); }
.option:hover { border-color: var(--ink-2); } .option input { margin-top: .25rem; accent-color: var(--brand); width: 18px; height: 18px; }
.option:has(input:checked) { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.likert { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: .35rem; }
.likert label { margin: 0; text-align: center; border: 1px solid var(--line-strong); border-radius: 10px; padding: .45rem 0; cursor: pointer; font-family: var(--mono); font-weight: 600; color: var(--ink); }
.likert input { position: absolute; opacity: 0; } .likert label:has(input:checked) { background: var(--brand); color: var(--brand-contrast); border-color: transparent; }
.likert label:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }
.progress-steps { display: flex; gap: 4px; } .progress-steps span { flex: 1; height: 5px; border-radius: 4px; background: var(--surface-3); } .progress-steps span.done { background: var(--brand); }

/* ----------------------------------------------------------------------------------- utilities */
.mt-0 { margin-top: 0; } .mt-1 { margin-top: .5rem; } .mt-2 { margin-top: 1rem; } .mt-3 { margin-top: 1.6rem; }
.mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: .5rem; } .mb-2 { margin-bottom: 1rem; } .mb-3 { margin-bottom: 1.6rem; }
.w-100 { width: 100%; } .maxw-sm { max-width: 520px; } .maxw-md { max-width: 760px; }
.prose { max-width: 75ch; } .prose p { color: var(--ink-2); } .prose li { margin: .25rem 0; }
.answer { line-height: 1.65; overflow-wrap: anywhere; } .answer p { margin: 0 0 .6rem; } .answer ul, .answer ol { margin: 0 0 .6rem; padding-left: 1.3rem; } .answer li { margin: .15rem 0; } .answer .answer-head { margin-top: .4rem; }
.answer .cite { font-family: var(--mono); font-size: .8em; color: var(--c-evi); font-weight: 700; }
.kbd-hint kbd { border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 5px; padding: 0 .3rem; background: var(--surface); font-size: .78rem; }
.hex-bg { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='98' viewBox='0 0 56 98'%3E%3Cpath d='M28 66L0 50L0 16L28 0L56 16L56 50L28 66L28 100' fill='none' stroke='%23b87800' stroke-opacity='0.08' stroke-width='1.2'/%3E%3C/svg%3E"); }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; } }
@media print {
  .nav, .topbar, .demo-banner, .no-print, .toasts, .twin-toolbar { display: none !important; }
  .shell { display: block; } body { background: #fff; color: #000; font-size: 11pt; } .card { box-shadow: none; break-inside: avoid; border-color: #ccc; }
  .content { padding: 0; max-width: none; } a { color: #000; text-decoration: none; }
}

/* theme toggle + collapsed navigation (state set before first paint by the head script) */
[data-theme-icon] { display: none; }
html[data-theme-mode="light"] [data-theme-icon="light"], html[data-theme-mode="dark"] [data-theme-icon="dark"], html[data-theme-mode="auto"] [data-theme-icon="auto"], html:not([data-theme-mode]) [data-theme-icon="auto"] { display: inline-flex; }
@media (min-width: 961px) { html.nav-collapsed .shell { grid-template-columns: var(--nav-w-collapsed) minmax(0, 1fr); }
  html.nav-collapsed .nav .brand-text, html.nav-collapsed .nav .nav-label, html.nav-collapsed .nav-item span, html.nav-collapsed .nav .pill, html.nav-collapsed .nav-foot { display: none; }
  html.nav-collapsed .nav a.nav-item { justify-content: center; } }
.legend i.lg-obs { background: var(--c-obs); } .legend i.lg-flag { background: var(--crit); border-radius: 50%; } .legend i.lg-anom { background: var(--att); transform: rotate(45deg); }
.legend i.lg-fct { background: var(--c-fct-soft); border: 1px dashed var(--c-fct); } .legend i.lg-der { background: var(--c-der); } .legend i.lg-mod { background: var(--c-mod); } .legend i.lg-sch { background: transparent; border: 1px dashed var(--c-sch); }
.legend i.lg-stale { background: transparent; border: 2px solid var(--muted); border-radius: 50%; }
a.hive-card { display: block; color: inherit; text-decoration: none; transition: transform 140ms var(--ease), box-shadow 140ms var(--ease), border-color 140ms; }
a.hive-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); border-color: var(--line-strong); text-decoration: none; }
.hive-score { font-size: 1.75rem; font-weight: 760; letter-spacing: -.03em; color: var(--bc); }
#twinLabels { position: absolute; inset: 0; pointer-events: none; z-index: 2; overflow: hidden; }

.hive-card-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .75rem; align-items: start; }
.hive-card-title { min-width: 0; } .hive-card-title strong { margin-right: .2rem; }

/* Names entered by users keep their own casing (text-transform with lang=tr would turn "i" into "İ" in English names). */
.eyebrow.eyebrow-data { text-transform: none; letter-spacing: .02em; }

fieldset { border: 1px solid var(--line); border-radius: var(--radius, 14px); padding: .9rem 1rem 1rem; margin: 0 0 1rem; min-width: 0; }
fieldset > legend { padding: 0 .4rem; }
.evidence-summary { border: 1px solid var(--line); border-radius: var(--radius, 14px); padding: .9rem 1rem; background: var(--surface-2, transparent); }
.eyebrow .eyebrow-name { text-transform: none; letter-spacing: .02em; }

.quantity-info { margin-top: .75rem; padding: .7rem .9rem; border: 1px dashed var(--line-strong); border-radius: var(--radius-s); display: grid; gap: .35rem; }
.table tr.channel-edit td { padding-top: 0; border-top: 0; }
