/* ---------- Fonts (self-hosted, SIL Open Font License — see public/vendor/fonts) ---------- */
@font-face { font-family: "Nunito"; font-style: normal; font-display: swap; font-weight: 200 1000; src: url("../vendor/fonts/nunito-latin-wght-normal.woff2") format("woff2-variations"); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "Nunito"; font-style: normal; font-display: swap; font-weight: 200 1000; src: url("../vendor/fonts/nunito-latin-ext-wght-normal.woff2") format("woff2-variations"); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,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"; font-style: normal; font-display: swap; font-weight: 100 800; src: url("../vendor/fonts/jetbrains-mono-latin-wght-normal.woff2") format("woff2-variations"); }

/* ==========================================================================
   PDMP design system — "Ledger"
   Cool grey canvas, navy ink, saffron signal, flat colour (no gradients).
   Nunito (friendly, rounded, with equal-width digits) for headlines, figures and interface; JetBrains Mono for
   references.
   No build step: plain CSS custom properties.
   ========================================================================== */

:root {
  --brand: #1e3a6e;
  --brand-ink: #0f1f3d;
  --accent: #e8a33d;

  --canvas: #f7f8fb;
  --canvas-2: #eff2f7;
  --surface: #ffffff;
  --surface-2: #f9fafc;
  --surface-3: #eff2f7;
  --line: #e0e5ee;
  --line-strong: #ccd4e1;
  --ink: #141c2e;
  --ink-2: #39455c;
  --muted: #66728a;
  --faint: #97a1b3;

  --side: #ffffff;
  --side-2: #f5f7fb;
  --side-ink: #3a4558;
  --side-muted: #8a94a6;
  --side-line: #e6eaf1;
  --side-strong: #141c2e;
  --side-hover: #f1f4f9;
  --side-active: color-mix(in srgb, var(--brand) 8%, #ffffff);
  --side-active-ink: var(--brand);

  --green: #1f8a5b;   --green-bg: #e3f3ea;
  --emerald: #0f766e; --emerald-bg: #dcf1ee;
  --teal: #0e7490;    --teal-bg: #ddf0f5;
  --sky: #2563eb;     --sky-bg: #e3ebfd;
  --indigo: #4f46e5;  --indigo-bg: #e8e7fc;
  --violet: #7c3aed;  --violet-bg: #efe7fd;
  --amber: #b45309;   --amber-bg: #fdf0d9;
  --orange: #c2410c;  --orange-bg: #fde8dc;
  --red: #c0352b;     --red-bg: #fbe4e1;
  --slate: #556274;   --slate-bg: #eceff4;
  --zinc: #52525b;    --zinc-bg: #ececee;

  --radius: 14px;
  --radius-sm: 9px;
  --radius-lg: 20px;
  --shadow-sm: 0 1px 2px rgba(20, 28, 46, .05);
  --shadow: 0 1px 2px rgba(20, 28, 46, .04), 0 6px 18px -8px rgba(20, 28, 46, .12);
  --shadow-lg: 0 24px 60px -20px rgba(13, 26, 51, .35);
  --brand-text: var(--brand);
  --ring: 0 0 0 3px color-mix(in srgb, var(--brand-text) 25%, transparent);

  --font: "Nunito", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --display: var(--font);
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --side-w: 268px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --canvas: #0c111c; --canvas-2: #101624; --surface: #131b2a; --surface-2: #172031; --surface-3: #1c2639; --line: #243049; --line-strong: #31405c; --ink: #e7ecf4; --ink-2: #c2cbda; --muted: #8c98ad; --faint: #637089; --side: #0a101d; --side-2: #121b2c; --side-ink: #cfd8e6; --side-muted: #8293ad; --side-line: rgba(255, 255, 255, .07); --side-strong: #ffffff; --side-hover: rgba(255, 255, 255, .06); --side-active: rgba(255, 255, 255, .1); --side-active-ink: #ffffff; --brand-ink: #0b1630; --brand-text: color-mix(in srgb, var(--brand) 40%, #fff); --green-bg: #133024; --emerald-bg: #11302c; --teal-bg: #112b33; --sky-bg: #16233f; --indigo-bg: #1d1d40; --violet-bg: #251a3d; --amber-bg: #33240d; --orange-bg: #36200f; --red-bg: #3a1a17; --slate-bg: #1d2535; --zinc-bg: #232327; --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px -10px rgba(0,0,0,.5); color-scheme: dark; }
}
:root[data-theme="dark"] { --canvas: #0c111c; --canvas-2: #101624; --surface: #131b2a; --surface-2: #172031; --surface-3: #1c2639; --line: #243049; --line-strong: #31405c; --ink: #e7ecf4; --ink-2: #c2cbda; --muted: #8c98ad; --faint: #637089; --side: #0a101d; --side-2: #121b2c; --side-ink: #cfd8e6; --side-muted: #8293ad; --side-line: rgba(255, 255, 255, .07); --side-strong: #ffffff; --side-hover: rgba(255, 255, 255, .06); --side-active: rgba(255, 255, 255, .1); --side-active-ink: #ffffff; --brand-ink: #0b1630; --brand-text: color-mix(in srgb, var(--brand) 40%, #fff); --green-bg: #133024; --emerald-bg: #11302c; --teal-bg: #112b33; --sky-bg: #16233f; --indigo-bg: #1d1d40; --violet-bg: #251a3d; --amber-bg: #33240d; --orange-bg: #36200f; --red-bg: #3a1a17; --slate-bg: #1d2535; --zinc-bg: #232327; --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px -10px rgba(0,0,0,.5); color-scheme: dark; }
@supports (color: oklch(from red l c h)) {
  @media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --brand-text: oklch(from var(--brand) 0.78 calc(c + 0.03) h); } }
  :root[data-theme="dark"] { --brand-text: oklch(from var(--brand) 0.78 calc(c + 0.03) h); }
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 14.5px; line-height: 1.55; color: var(--ink); background: var(--canvas); -webkit-font-smoothing: antialiased; }
a { color: var(--brand-text); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
img, svg { max-width: 100%; }
h1, h2, h3, h4 { margin: 0 0 .5em; line-height: 1.2; color: var(--ink); }
h1 { font-family: var(--display); font-weight: 700; font-size: 1.9rem; letter-spacing: -.025em; }
h2 { font-family: var(--display); font-weight: 700; font-size: 1.3rem; letter-spacing: -.015em; }
h3 { font-size: 1rem; font-weight: 650; }
h4 { font-size: .8rem; font-weight: 650; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
p { margin: 0 0 1em; }
hr, .divider { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }
code, .mono { font-family: var(--mono); font-size: .86em; }
kbd { font-family: var(--mono); font-size: .75em; padding: 2px 6px; border-radius: 6px; border: 1px solid var(--line-strong); border-bottom-width: 2px; background: var(--surface); color: var(--ink-2); }
[x-cloak] { display: none !important; }
::selection { background: color-mix(in srgb, var(--accent) 35%, transparent); }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: 6px; }
svg.lucide { width: 18px; height: 18px; stroke-width: 1.9; flex: none; }

/* ---------- Utilities ---------- */
.muted { color: var(--muted); } .faint { color: var(--faint); } .strong { font-weight: 650; }
.small { font-size: .86rem; } .tiny { font-size: .76rem; } .big { font-size: 1.1rem; }
.right { text-align: right; } .center { text-align: center; } .nowrap { white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row { display: flex; align-items: center; gap: 10px; } .row-wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.stack { display: flex; flex-direction: column; gap: 12px; } .stack-lg { display: flex; flex-direction: column; gap: 24px; }
.grow { flex: 1; min-width: 0; }
.mt-0 { margin-top: 0 } .mt-1 { margin-top: 8px } .mt-2 { margin-top: 16px } .mt-3 { margin-top: 24px } .mt-4 { margin-top: 36px }
.mb-0 { margin-bottom: 0 } .mb-1 { margin-bottom: 8px } .mb-2 { margin-bottom: 16px } .mb-3 { margin-bottom: 24px } .mb-4 { margin-bottom: 36px }
.gap-sm { gap: 6px } .gap-lg { gap: 20px }
.hide { display: none !important; }
.w-full { width: 100%; }
.grid { display: grid; gap: 20px; }
.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, 1fr) 340px; } .g-main-wide { grid-template-columns: minmax(0, 1fr) 400px; }
.span-2 { grid-column: span 2; } .span-all { grid-column: 1 / -1; }
@media (max-width: 1180px) { .g-main, .g-main-wide { grid-template-columns: 1fr; } .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 760px) { .g-2, .g-3, .g-4 { grid-template-columns: 1fr; } .span-2 { grid-column: auto; } .hide-sm { display: none !important; } }
.c-green { color: var(--green) } .c-red { color: var(--red) } .c-amber { color: var(--amber) } .c-brand { color: var(--brand-text) }

/* ---------- App shell ---------- */
.shell { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--side); color: var(--side-ink); display: flex; flex-direction: column; padding: 18px 14px 14px; scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; border-right: 1px solid var(--side-line); }
.brand { display: flex; align-items: center; gap: 11px; color: var(--side-strong); padding: 2px 6px 14px; text-decoration: none !important; position: relative; z-index: 1; }
.brand-mark { width: 38px; height: 38px; flex: none; display: block; }
.brand-mark svg { width: 100%; height: 100%; display: block; border-radius: 11px; box-shadow: 0 1px 2px rgba(20, 28, 46, .12); }
.brand-name { font-family: var(--display); font-weight: 650; font-size: 1.18rem; letter-spacing: -.01em; line-height: 1.05; }
.brand-sub { display: block; font-family: var(--font); font-size: .68rem; letter-spacing: .08em; text-transform: uppercase; color: var(--side-muted); font-weight: 600; margin-top: 2px; }

.prog-switch { position: relative; z-index: 2; margin: 0 0 14px; }
.prog-btn { width: 100%; display: flex; align-items: center; gap: 10px; text-align: left; padding: 10px 12px; border-radius: 12px; background: var(--side-2); border: 1px solid var(--side-line); color: var(--side-strong); cursor: pointer; transition: background .15s; font: inherit; }
.prog-btn:hover { background: var(--side-hover); border-color: var(--line-strong); }
.prog-dot { width: 10px; height: 10px; border-radius: 3px; flex: none; box-shadow: 0 0 0 1.5px var(--side-line); }
.prog-code { font-family: var(--mono); font-size: .7rem; color: var(--brand-text); letter-spacing: .04em; }
.prog-name { font-size: .84rem; font-weight: 600; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.prog-menu { position: absolute; left: 0; right: 0; top: calc(100% + 6px); background: var(--surface); color: var(--ink); border-radius: 12px; box-shadow: var(--shadow-lg); border: 1px solid var(--line); padding: 6px; z-index: 50; max-height: 360px; overflow: auto; }
.prog-menu a { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 8px; color: var(--ink); font-size: .88rem; }
.prog-menu a:hover { background: var(--surface-3); text-decoration: none; }

.nav-group { position: relative; z-index: 1; margin: 14px 8px 6px; font-size: .66rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--side-muted); display: flex; align-items: center; gap: 8px; }
.nav-group::after { content: ""; flex: 1; height: 1px; background: var(--side-line); }
.nav-link { position: relative; z-index: 1; display: flex; align-items: center; gap: 11px; padding: 7.5px 10px; border-radius: 10px; color: var(--side-ink); font-size: .9rem; font-weight: 500; text-decoration: none !important; transition: background .12s, color .12s; }
.nav-link svg { width: 17px; height: 17px; opacity: .75; }
.nav-link:hover { background: var(--side-hover); color: var(--side-strong); }
.nav-link.active { background: var(--side-active); color: var(--side-active-ink); font-weight: 600; }
.nav-link.active::before { content: ""; position: absolute; left: -14px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--brand-text); }
.nav-link.active svg { opacity: 1; color: var(--brand-text); }
.nav-count { margin-left: auto; font-size: .7rem; font-weight: 700; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; display: grid; place-items: center; background: var(--accent); color: #1b2540; }
.side-foot { margin-top: auto; padding-top: 14px; position: relative; z-index: 1; }
.side-card { border: 1px solid var(--side-line); background: var(--side-2); border-radius: 12px; padding: 12px; font-size: .8rem; color: var(--side-muted); margin-bottom: 10px; }
.side-card strong { color: var(--side-strong); display: block; font-size: .82rem; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 14px; height: 64px; padding: 0 32px; background: color-mix(in srgb, var(--canvas) 82%, transparent); backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px); border-bottom: 1px solid transparent; transition: border-color .2s; }
.topbar.scrolled { border-bottom-color: var(--line); }
.crumbs { display: flex; align-items: center; gap: 8px; font-size: .85rem; color: var(--muted); min-width: 0; }
.crumbs a { color: var(--muted); } .crumbs .sep { opacity: .45; } .crumbs .here { color: var(--ink); font-weight: 600; }
.search-trigger { margin-left: auto; display: flex; align-items: center; gap: 10px; width: min(380px, 34vw); height: 40px; padding: 0 12px; border-radius: 11px; border: 1px solid var(--line); background: var(--surface); color: var(--faint); font: inherit; font-size: .88rem; cursor: pointer; box-shadow: var(--shadow-sm); transition: border-color .15s; }
.search-trigger:hover { border-color: var(--line-strong); }
.search-trigger kbd { margin-left: auto; }
.icon-btn { position: relative; width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; border: 1px solid transparent; background: transparent; color: var(--ink-2); cursor: pointer; transition: background .15s; }
.icon-btn:hover { background: var(--surface-3); }
.icon-btn .dot { position: absolute; top: 9px; right: 9px; width: 8px; height: 8px; border-radius: 50%; background: var(--red); box-shadow: 0 0 0 2px var(--canvas); }
.ai-btn { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 14px 0 12px; border-radius: 11px; border: 0; cursor: pointer; font: inherit; font-weight: 600; font-size: .86rem; color: #fff; background: var(--brand); }
.ai-btn svg { color: #ffe3b3; }
.ai-btn:hover { filter: brightness(1.07); }
.avatar { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-weight: 700; font-size: .78rem; color: #fff; background: #2a4a80; flex: none; letter-spacing: .02em; }
.avatar.sm { width: 26px; height: 26px; border-radius: 8px; font-size: .66rem; }
.avatar.lg { width: 48px; height: 48px; border-radius: 14px; font-size: 1rem; }
.menu-btn { display: none; }
.content { padding: 28px 32px 64px; width: 100%; max-width: 1480px; margin: 0 auto; }
.content.narrow { max-width: 980px; }
@media (max-width: 1024px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: 290px; z-index: 60; transform: translateX(-102%); transition: transform .22s ease; box-shadow: var(--shadow-lg); }
  .side.open { transform: none; }
  .scrim { position: fixed; inset: 0; background: rgba(8, 20, 17, .45); z-index: 55; }
  .menu-btn { display: grid; }
  .topbar { padding: 0 16px; }
  .content { padding: 20px 16px 56px; }
  .search-trigger { width: auto; } .search-trigger span, .search-trigger kbd { display: none; }
  .ai-btn span { display: none; } .ai-btn { padding: 0 11px; }
}

/* ---------- Page head ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 26px; flex-wrap: wrap; }
.eyebrow { display: inline-flex; align-items: center; gap: 7px; font-size: .72rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--brand-text); margin-bottom: 8px; }
.eyebrow .code { font-family: var(--mono); letter-spacing: 0; padding: 2px 7px; border-radius: 6px; background: color-mix(in srgb, var(--brand) 10%, transparent); }
.page-head h1 { margin: 0; }
.page-head .sub { color: var(--muted); margin: 6px 0 0; max-width: 760px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-pad, .card > .body { padding: 22px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 22px; border-bottom: 1px solid var(--line); }
.card-head h3 { margin: 0; display: flex; align-items: center; gap: 9px; }
.card-head h3 svg { color: var(--brand-text); }
.card-head .meta { color: var(--muted); font-size: .82rem; }
.card-foot { padding: 12px 22px; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }
.card.soft { background: var(--surface-2); box-shadow: none; }
.card.tinted { background: color-mix(in srgb, var(--brand) 4%, var(--surface)); }
.card.hover { transition: transform .15s, box-shadow .15s, border-color .15s; }
.card.hover:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--line-strong); }
a.card { color: inherit; text-decoration: none !important; display: block; }
.section-title { display: flex; align-items: center; justify-content: space-between; margin: 30px 0 14px; }
.section-title h2 { margin: 0; }

/* ---------- KPI tiles ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; }
.kpi { position: relative; display: block; padding: 18px 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); color: inherit; text-decoration: none !important; box-shadow: var(--shadow-sm); transition: border-color .15s, transform .15s, box-shadow .15s; overflow: hidden; }
a.kpi:hover { border-color: var(--line-strong); transform: translateY(-2px); box-shadow: var(--shadow); }
.kpi-label { display: flex; align-items: center; gap: 8px; font-size: .78rem; font-weight: 600; color: var(--muted); }
.kpi-label svg { width: 15px; height: 15px; }
.kpi-value { font-family: var(--display); font-size: 2rem; font-weight: 700; letter-spacing: -.03em; line-height: 1.1; margin-top: 10px; font-variant-numeric: tabular-nums; }
.kpi-sub { font-size: .8rem; color: var(--muted); margin-top: 4px; }
.kpi .bar { margin-top: 12px; }
/* (decorative corner circle removed for a cleaner white theme) */
.kpi.tone-green { --tone: var(--green) } .kpi.tone-amber { --tone: var(--amber) } .kpi.tone-red { --tone: var(--red) } .kpi.tone-accent { --tone: var(--accent) }
a.kpi .go { position: absolute; right: 14px; bottom: 14px; opacity: 0; transition: opacity .15s, transform .15s; color: var(--muted); }
a.kpi:hover .go { opacity: 1; transform: translateX(2px); }

/* ---------- Hero band (dashboard) ---------- */
.hero { position: relative; overflow: hidden; border-radius: var(--radius-lg); padding: 28px 30px; color: var(--ink-2); background: var(--surface); border: 1px solid var(--line); border-top: 4px solid var(--brand-text); box-shadow: var(--shadow); }
.hero h1 { color: var(--ink); font-size: 2.1rem; }
.hero .eyebrow { color: var(--brand-text); }
.hero .eyebrow .code { background: var(--surface-3); color: var(--ink-2); }
.hero .sub { color: var(--muted); }
.hero-rag { background: var(--surface-2); border: 1px solid var(--line); border-radius: 16px; padding: 14px 18px; }
.hero-rag-l { color: var(--muted); text-transform: uppercase; letter-spacing: .1em; font-weight: 700; }
.hero-stats { display: flex; flex-wrap: wrap; gap: 30px; margin-top: 22px; position: relative; z-index: 1; }
.hero-stat .v { font-family: var(--display); font-size: 1.65rem; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.hero-stat .l { font-size: .74rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; }
.hero-stat a { color: inherit; text-decoration: none; }

/* ---------- Buttons ---------- */
.btn { --b: var(--surface); display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 38px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--b); color: var(--ink); font: inherit; font-size: .88rem; font-weight: 600; cursor: pointer; white-space: nowrap; text-decoration: none !important; transition: background .15s, border-color .15s, box-shadow .15s, transform .05s; box-shadow: var(--shadow-sm); }
.btn:hover { background: var(--surface-3); }
.btn:active { transform: translateY(1px); }
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: 0 6px 14px -8px color-mix(in srgb, var(--brand) 90%, transparent); }
.btn-primary:hover { background: color-mix(in srgb, var(--brand) 88%, #000); }
.btn-accent { background: var(--accent); border-color: var(--accent); color: #2b1a02; }
.btn-accent:hover { background: color-mix(in srgb, var(--accent) 90%, #000); }
.btn-danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn-danger:hover { background: color-mix(in srgb, var(--red) 88%, #000); }
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--ink-2); }
.btn-ghost:hover { background: var(--surface-3); }
.btn-soft { background: color-mix(in srgb, var(--brand) 9%, var(--surface)); border-color: color-mix(in srgb, var(--brand) 20%, transparent); color: var(--brand-text); box-shadow: none; }
.btn-soft:hover { background: color-mix(in srgb, var(--brand) 15%, var(--surface)); }
.btn-ai { background: color-mix(in srgb, #7c3aed 8%, var(--surface)); border-color: color-mix(in srgb, #7c3aed 25%, transparent); color: color-mix(in srgb, #7c3aed 70%, var(--ink)); }
.btn-sm { height: 32px; padding: 0 11px; font-size: .82rem; border-radius: 8px; }
.btn-lg { height: 46px; padding: 0 20px; font-size: .95rem; border-radius: 12px; }
.btn-icon { width: 38px; padding: 0; }
.btn-sm.btn-icon { width: 32px; }
.btn[disabled], .btn.is-loading { opacity: .6; pointer-events: none; }
.btn.is-loading::after { content: ""; width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; }
.btn-group { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 10px; overflow: hidden; background: var(--surface); box-shadow: var(--shadow-sm); }
.btn-group a, .btn-group button { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 13px; font-size: .84rem; font-weight: 600; color: var(--ink-2); border: 0; background: transparent; border-right: 1px solid var(--line); cursor: pointer; text-decoration: none; font-family: inherit; }
.btn-group > :last-child { border-right: 0; }
.btn-group .on { background: var(--surface-3); color: var(--ink); box-shadow: inset 0 -2px 0 var(--brand); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Badges & chips ---------- */
.badge { --c: var(--slate); --bg: var(--slate-bg); display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: 999px; font-size: .74rem; font-weight: 650; color: var(--c); background: var(--bg); white-space: nowrap; line-height: 1; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .9; }
.badge.plain::before { display: none; }
.badge svg { width: 13px; height: 13px; }
.badge-green { --c: var(--green); --bg: var(--green-bg); } .badge-emerald { --c: var(--emerald); --bg: var(--emerald-bg); } .badge-teal { --c: var(--teal); --bg: var(--teal-bg); }
.badge-sky { --c: var(--sky); --bg: var(--sky-bg); } .badge-indigo { --c: var(--indigo); --bg: var(--indigo-bg); } .badge-violet { --c: var(--violet); --bg: var(--violet-bg); }
.badge-amber { --c: var(--amber); --bg: var(--amber-bg); } .badge-orange { --c: var(--orange); --bg: var(--orange-bg); } .badge-red { --c: var(--red); --bg: var(--red-bg); }
.badge-slate { --c: var(--slate); --bg: var(--slate-bg); } .badge-zinc { --c: var(--zinc); --bg: var(--zinc-bg); }
.ref { font-family: var(--mono); font-size: .78rem; font-weight: 600; color: var(--ink-2); background: var(--surface-3); border: 1px solid var(--line); padding: 1px 7px; border-radius: 6px; white-space: nowrap; }
.rag { display: inline-flex; align-items: center; gap: 7px; font-size: .74rem; font-weight: 800; letter-spacing: .08em; }
.rag i { width: 12px; height: 12px; border-radius: 50%; display: inline-block; box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 18%, transparent); background: currentColor; }
.rag-green { color: var(--green); } .rag-amber { color: #d48a13; } .rag-red { color: var(--red); }
.flag { display: inline-flex; align-items: center; gap: 5px; font-size: .74rem; font-weight: 700; color: var(--orange); background: var(--orange-bg); padding: 2px 8px; border-radius: 6px; }
.flag svg { width: 13px; height: 13px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); font-size: .8rem; color: var(--ink-2); }

/* ---------- Progress ---------- */
.bar { height: 7px; border-radius: 99px; background: var(--surface-3); overflow: hidden; position: relative; }
.bar > span { display: block; height: 100%; border-radius: inherit; background: var(--brand-text); }
.bar .plan { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--ink); opacity: .45; border-radius: 2px; }
.bar.amber > span { background: var(--amber); } .bar.red > span { background: var(--red); } .bar.green > span { background: var(--green); }
.stacked { display: flex; height: 12px; border-radius: 99px; overflow: hidden; background: var(--surface-3); }
.stacked > span { display: block; height: 100%; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: .78rem; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; border-radius: var(--radius); }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .875rem; }
.table th { text-align: left; font-size: .72rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); padding: 11px 14px; background: var(--surface-2); border-bottom: 1px solid var(--line); white-space: nowrap; position: sticky; top: 0; z-index: 1; }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .1s; }
.table tbody tr:hover { background: var(--surface-2); }
.table tr.click { cursor: pointer; }
.table .title-cell a { color: var(--ink); font-weight: 600; }
.table .title-cell .sub { font-size: .78rem; color: var(--muted); }
.table tfoot td { font-weight: 700; background: var(--surface-2); border-top: 1px solid var(--line-strong); }
.table.compact td { padding: 8px 12px; } .table.compact th { padding: 8px 12px; }
.table tr.group td { background: color-mix(in srgb, var(--brand) 6%, var(--surface)); font-weight: 700; color: color-mix(in srgb, var(--brand-text) 70%, var(--ink)); border-bottom-color: var(--line-strong); }
:root[data-theme="dark"] .table tr.group td { color: var(--ink); }
.table tr.is-changed td { background: color-mix(in srgb, var(--amber) 9%, transparent); }
.table tr.is-added td { background: color-mix(in srgb, var(--green) 9%, transparent); }
.table tr.is-removed td { background: color-mix(in srgb, var(--red) 8%, transparent); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--red) 50%, transparent); }
.table tr.target td { animation: flash 2s ease; }
@keyframes flash { 0%, 40% { background: color-mix(in srgb, var(--accent) 30%, transparent); } }
.override { background: color-mix(in srgb, var(--amber) 16%, transparent); border-radius: 4px; padding: 0 4px; }

/* ---------- Lists ---------- */
.list { display: flex; flex-direction: column; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 12px 22px; border-bottom: 1px solid var(--line); color: inherit; text-decoration: none !important; transition: background .1s; }
.list-item:last-child { border-bottom: 0; }
a.list-item:hover { background: var(--surface-2); }
.list-item .t { font-weight: 600; } .list-item .s { font-size: .8rem; color: var(--muted); }
.list-ico { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-3); color: var(--brand-text); flex: none; }
.list-ico.amber { color: var(--amber); background: var(--amber-bg); } .list-ico.red { color: var(--red); background: var(--red-bg); } .list-ico.green { color: var(--green); background: var(--green-bg); } .list-ico.violet { color: var(--violet); background: var(--violet-bg); }
.dl { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 0; }
.dl > dt { color: var(--muted); font-size: .84rem; padding: 9px 0; border-bottom: 1px dashed var(--line); }
.dl > dd { margin: 0; padding: 9px 0; border-bottom: 1px dashed var(--line); font-weight: 500; white-space: pre-line; }
.dl > :nth-last-child(-n+2) { border-bottom: 0; }
@media (max-width: 640px) { .dl { grid-template-columns: 1fr; } .dl > dt { border-bottom: 0; padding-bottom: 0; } }

/* ---------- Forms ---------- */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 20px; }
.form-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 760px) { .form-grid, .form-grid.three { grid-template-columns: 1fr; } }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .label { font-size: .8rem; font-weight: 650; color: var(--ink-2); }
.field .req { color: var(--red); }
.hint { font-size: .76rem; color: var(--muted); }
.error-text { font-size: .78rem; color: var(--red); font-weight: 600; }
.input, .select, .textarea { width: 100%; height: 40px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); font: inherit; font-size: .9rem; transition: border-color .15s, box-shadow .15s; }
.textarea { height: auto; min-height: 96px; padding: 10px 12px; line-height: 1.5; resize: vertical; }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7873' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 34px; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--brand); box-shadow: var(--ring); }
.input.is-invalid, .select.is-invalid, .textarea.is-invalid { border-color: var(--red); }
.input-sm { height: 32px; font-size: .84rem; border-radius: 8px; padding: 0 9px; }
.select.input-sm { padding-right: 28px; background-position: right 6px center; }
.input-group { display: flex; align-items: stretch; }
.input-group .prefix { display: grid; place-items: center; padding: 0 11px; border: 1px solid var(--line-strong); border-right: 0; border-radius: 10px 0 0 10px; background: var(--surface-3); color: var(--muted); font-weight: 600; font-size: .86rem; }
.input-group .input { border-radius: 0 10px 10px 0; }
.check { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; font-size: .9rem; }
.check input { width: 17px; height: 17px; accent-color: var(--brand); }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; align-items: center; margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px 20px; margin: 0 0 18px; }
legend { padding: 0 8px; font-weight: 700; font-size: .85rem; color: var(--ink-2); }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 16px; }
.filters .input, .filters .select { height: 36px; width: auto; min-width: 150px; font-size: .86rem; }
.filters .search { min-width: 240px; flex: 1; max-width: 360px; }
.seg { display: inline-flex; gap: 4px; padding: 4px; border-radius: 12px; background: var(--surface-3); }
.seg label { cursor: pointer; } .seg input { display: none; }
.seg span { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 9px; font-size: .84rem; font-weight: 600; color: var(--muted); }
.seg input:checked + span { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }
.radio-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; }
.radio-card input { display: none; }
.radio-card .card { padding: 14px; cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.radio-card input:checked + .card { border-color: var(--brand); box-shadow: var(--ring); }
.radio-card input:disabled + .card { opacity: .5; cursor: not-allowed; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 22px; overflow-x: auto; scrollbar-width: none; }
.tabs a, .tabs button { display: inline-flex; align-items: center; gap: 7px; padding: 10px 14px; font-weight: 600; font-size: .88rem; color: var(--muted); border: 0; background: none; border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer; white-space: nowrap; text-decoration: none !important; font-family: inherit; }
.tabs a:hover, .tabs button:hover { color: var(--ink); }
.tabs .on { color: var(--ink); border-bottom-color: var(--brand); }
.tabs svg { width: 16px; height: 16px; }
.tabs .count { font-size: .7rem; background: var(--surface-3); border-radius: 99px; padding: 1px 7px; color: var(--muted); }

/* ---------- Alerts & toasts ---------- */
.alert { display: flex; gap: 11px; align-items: flex-start; padding: 13px 16px; border-radius: 12px; border: 1px solid; font-size: .9rem; }
.alert svg { margin-top: 1px; }
.alert-success { background: var(--green-bg); border-color: color-mix(in srgb, var(--green) 25%, transparent); color: color-mix(in srgb, var(--green) 80%, var(--ink)); }
.alert-error { background: var(--red-bg); border-color: color-mix(in srgb, var(--red) 25%, transparent); color: color-mix(in srgb, var(--red) 85%, var(--ink)); }
.alert-warn { background: var(--amber-bg); border-color: color-mix(in srgb, var(--amber) 30%, transparent); color: color-mix(in srgb, var(--amber) 85%, var(--ink)); }
.alert-info { background: var(--sky-bg); border-color: color-mix(in srgb, var(--sky) 22%, transparent); color: color-mix(in srgb, var(--sky) 80%, var(--ink)); }
.alert .title { font-weight: 700; display: block; }
.alert-action { align-items: center; }
.alert-action > form { flex-shrink: 0; }
@media (max-width: 760px) { .alert-action { flex-wrap: wrap; } .alert-action > form { width: 100%; } .alert-action > form .btn { width: 100%; justify-content: center; } }
.toasts { position: fixed; right: 22px; bottom: 22px; z-index: 100; display: flex; flex-direction: column; gap: 10px; max-width: min(440px, calc(100vw - 32px)); }
.toasts .alert { box-shadow: var(--shadow-lg); background-clip: padding-box; animation: rise .3s ease; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }

/* ---------- Empty ---------- */
.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty .ico { width: 56px; height: 56px; margin: 0 auto 14px; border-radius: 16px; display: grid; place-items: center; background: color-mix(in srgb, var(--brand) 8%, var(--surface-3)); color: var(--brand); }
.empty .ico svg { width: 26px; height: 26px; }
.empty h3 { color: var(--ink); margin-bottom: 6px; }

/* ---------- Dropdown ---------- */
.dropdown { position: relative; }
.dropdown-menu { position: absolute; right: 0; top: calc(100% + 8px); min-width: 230px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 6px; z-index: 70; }
.dropdown-menu a, .dropdown-menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: 8px; border: 0; background: none; color: var(--ink); font: inherit; font-size: .88rem; cursor: pointer; text-align: left; text-decoration: none !important; }
.dropdown-menu a:hover, .dropdown-menu button:hover { background: var(--surface-3); }
.dropdown-menu svg { width: 16px; height: 16px; color: var(--muted); }

/* ---------- Modal / drawer ---------- */
.modal-wrap { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 20px; background: rgba(8, 20, 17, .5); backdrop-filter: blur(3px); }
.modal { width: min(620px, 100%); max-height: calc(100vh - 40px); overflow: auto; background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); border: 1px solid var(--line); animation: rise .2s ease; }
.modal-head { padding: 18px 22px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; }
.modal-head h3 { margin: 0; }
.modal-body { padding: 22px; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(480px, 100vw); z-index: 95; background: var(--surface); border-left: 1px solid var(--line); box-shadow: var(--shadow-lg); display: flex; flex-direction: column; animation: slidein .22s ease; }
@keyframes slidein { from { transform: translateX(30px); opacity: 0; } }

/* ---------- Command palette ---------- */
.palette { width: min(640px, 100%); background: var(--surface); border-radius: 18px; box-shadow: var(--shadow-lg); border: 1px solid var(--line); overflow: hidden; align-self: start; margin-top: 10vh; }
.palette input { width: 100%; border: 0; padding: 18px 20px 18px 52px; font: inherit; font-size: 1.02rem; background: transparent; color: var(--ink); outline: none; }
.palette .in { position: relative; border-bottom: 1px solid var(--line); }
.palette .in svg { position: absolute; left: 20px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.palette .results { max-height: 420px; overflow: auto; padding: 8px; }
.palette .grp { font-size: .68rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--faint); padding: 10px 12px 6px; }
.palette .opt { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 10px; color: var(--ink); cursor: pointer; text-decoration: none !important; font-size: .92rem; }
.palette .opt svg { color: var(--muted); width: 17px; height: 17px; }
.palette .opt.on { background: color-mix(in srgb, var(--brand) 10%, var(--surface)); }
.palette .opt.on svg { color: var(--brand-text); }
.palette .foot { display: flex; gap: 16px; padding: 10px 16px; border-top: 1px solid var(--line); font-size: .75rem; color: var(--faint); background: var(--surface-2); }

/* ---------- AI ---------- */
.ai-drawer .head { padding: 18px 20px; display: flex; align-items: center; gap: 12px; border-bottom: 1px solid var(--line); background: color-mix(in srgb, #7c3aed 5%, var(--surface)); }
.ai-orb { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; color: #fff; background: #7c3aed; }
.ai-msgs { flex: 1; overflow: auto; padding: 18px 20px; display: flex; flex-direction: column; gap: 12px; }
.msg { max-width: 92%; padding: 11px 14px; border-radius: 14px; font-size: .9rem; white-space: pre-wrap; line-height: 1.55; }
.msg.user { align-self: flex-end; background: var(--brand); color: #fff; border-bottom-right-radius: 4px; }
.msg.ai { align-self: flex-start; background: var(--surface-3); border-bottom-left-radius: 4px; }
.ai-input { padding: 14px 16px; border-top: 1px solid var(--line); display: flex; gap: 8px; }
.ai-suggest { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 20px 12px; }
.ai-suggest button { font: inherit; font-size: .78rem; padding: 5px 10px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); cursor: pointer; }
.ai-suggest button:hover { border-color: var(--brand-text); color: var(--brand-text); }
.typing { display: inline-flex; gap: 4px; } .typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite; } .typing i:nth-child(2) { animation-delay: .2s } .typing i:nth-child(3) { animation-delay: .4s }
@keyframes blink { 0%, 80%, 100% { opacity: .25 } 40% { opacity: 1 } }
.ai-card { border: 1px dashed color-mix(in srgb, #7c3aed 35%, var(--line)); background: color-mix(in srgb, #7c3aed 4%, var(--surface)); border-radius: var(--radius); padding: 16px 18px; }
.ai-card .tag { display: inline-flex; align-items: center; gap: 6px; font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: #7c3aed; }
.brief-item { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px dashed var(--line); }
.brief-item:last-child { border-bottom: 0; }
.sev { width: 8px; border-radius: 4px; flex: none; }
.sev.high { background: var(--red); } .sev.medium { background: var(--amber); } .sev.low { background: var(--green); }

/* ---------- Status board (sites) ---------- */
.board { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; }
.site-card { display: flex; flex-direction: column; gap: 12px; padding: 18px; }
.site-card .code { font-family: var(--mono); font-size: .74rem; color: var(--muted); }
.site-card h3 { font-size: 1.02rem; margin: 2px 0 0; }
.stages { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; }
.stage { height: 6px; border-radius: 99px; background: var(--surface-3); }
.stage.done { background: var(--green); } .stage.now { background: var(--accent); } .stage.block { background: var(--red); }
.ws-row { display: flex; align-items: center; justify-content: space-between; font-size: .82rem; color: var(--muted); }
.pipeline { display: grid; grid-template-columns: repeat(8, minmax(120px, 1fr)); gap: 12px; overflow-x: auto; }
.pipeline .col h4 { display: flex; justify-content: space-between; }
.pipeline .chipcard { padding: 10px 12px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); margin-bottom: 8px; font-size: .84rem; display: block; color: var(--ink); }

/* ---------- Map ---------- */
.map { height: 560px; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); z-index: 0; }
.map-pin { width: 18px; height: 18px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 2px 8px rgba(0,0,0,.35); }

/* ---------- Gantt ---------- */
.gantt { display: grid; grid-template-columns: 380px minmax(0, 1fr); border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.gantt-left { border-right: 1px solid var(--line); }
.gantt-right { overflow-x: auto; position: relative; }
.g-head { height: 52px; border-bottom: 1px solid var(--line); background: var(--surface-2); font-size: .7rem; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.g-left-head { display: flex; align-items: flex-end; padding: 0 14px 10px; }
.g-row { height: 40px; border-bottom: 1px solid var(--line); display: flex; align-items: center; }
.g-row:last-child { border-bottom: 0; }
.g-task { padding: 0 14px; gap: 8px; font-size: .85rem; min-width: 0; }
.g-task a { color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.g-task.package a { font-weight: 700; }
.g-task .when { margin-left: auto; font-size: .74rem; color: var(--muted); white-space: nowrap; }
.g-canvas { position: relative; }
.g-weeks { display: flex; height: 52px; border-bottom: 1px solid var(--line); background: var(--surface-2); position: sticky; top: 0; }
.g-week { flex: none; border-right: 1px solid var(--line); font-size: .68rem; color: var(--muted); padding: 6px 6px 0; font-weight: 600; }
.g-week .m { display: block; font-size: .7rem; color: var(--ink-2); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; min-height: 16px; }
.g-grid { position: absolute; inset: 52px 0 0 0; display: flex; pointer-events: none; }
.g-grid span { flex: none; border-right: 1px dashed var(--line); }
.g-bars .g-row { position: relative; }
.g-bar { position: absolute; height: 18px; top: 11px; border-radius: 6px; background: color-mix(in srgb, var(--ws, var(--brand-text)) 80%, transparent); box-shadow: inset 0 0 0 1px rgba(0,0,0,.06); overflow: hidden; display: block; }
.g-bar > i { position: absolute; inset: 0 auto 0 0; background: rgba(0, 0, 0, .22); }
.g-bar.critical { outline: 2px solid var(--red); outline-offset: 1px; }
.g-bar.package { height: 8px; top: 16px; border-radius: 2px; background: var(--ink-2); }
.g-bar.package::before, .g-bar.package::after { content: ""; position: absolute; bottom: -5px; border: 5px solid transparent; border-top-color: var(--ink-2); }
.g-bar.package::before { left: -1px; } .g-bar.package::after { right: -1px; }
.g-base { position: absolute; height: 4px; top: 32px; border-radius: 2px; background: var(--faint); opacity: .55; }
.g-ms { position: absolute; top: 12px; width: 16px; height: 16px; transform: rotate(45deg); background: var(--accent); border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--amber); margin-left: -8px; }
.g-ms.done { background: var(--green); box-shadow: 0 0 0 1px var(--green); }
.g-ms.late { background: var(--red); box-shadow: 0 0 0 1px var(--red); }
.g-today { position: absolute; top: 52px; bottom: 0; width: 2px; background: var(--red); z-index: 2; }
.g-today::before { content: "Today"; position: absolute; top: 0; left: 4px; font-size: .64rem; font-weight: 800; color: var(--red); text-transform: uppercase; letter-spacing: .06em; background: var(--surface); padding: 0 4px; border-radius: 3px; }
@media (max-width: 900px) { .gantt { grid-template-columns: 220px minmax(0, 1fr); } .g-task .when { display: none; } }

/* ---------- Kanban ---------- */
.kanban { display: grid; grid-template-columns: repeat(4, minmax(250px, 1fr)); gap: 16px; overflow-x: auto; padding-bottom: 6px; }
.kan-col { background: var(--canvas-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; min-height: 300px; transition: background .15s, border-color .15s; }
.kan-col.over { background: color-mix(in srgb, var(--brand) 8%, var(--canvas-2)); border-color: var(--brand); }
.kan-col h4 { display: flex; justify-content: space-between; align-items: center; margin: 2px 4px 12px; }
.kan-card { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: 11px; padding: 12px; margin-bottom: 10px; cursor: grab; box-shadow: var(--shadow-sm); color: var(--ink); text-decoration: none !important; }
.kan-card:active { cursor: grabbing; }
.kan-card.dragging { opacity: .5; }
.kan-card .t { font-weight: 600; font-size: .88rem; margin-bottom: 8px; }

/* ---------- Heat map ---------- */
.heat { display: grid; grid-template-columns: 34px repeat(5, 1fr); gap: 5px; }
.heat .ax { font-size: .7rem; color: var(--muted); font-weight: 700; display: grid; place-items: center; }
.heat a, .heat span.cell { aspect-ratio: 1.6; border-radius: 9px; display: grid; place-items: center; font-weight: 800; font-family: var(--display); font-size: 1.15rem; color: rgba(0,0,0,.6); text-decoration: none !important; transition: transform .12s; }
.heat a:hover { transform: scale(1.05); }
.heat .z0 { background: var(--surface-3); color: var(--faint); font-weight: 500; font-size: .85rem; }
.heat .lo { background: #cdebd7; } .heat .md { background: #fbe1a6; } .heat .hi { background: #f6b6a8; } .heat .xx { background: #e8806e; color: #fff; }

/* ---------- Checklist (field) ---------- */
.checklist { display: flex; flex-direction: column; gap: 10px; }
.cl-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.cl-item.ok { border-color: color-mix(in srgb, var(--green) 35%, var(--line)); background: color-mix(in srgb, var(--green) 4%, var(--surface)); }
.cl-item.bad { border-color: color-mix(in srgb, var(--red) 40%, var(--line)); }
.cl-item .lbl { font-weight: 600; } .cl-item .meta { font-size: .76rem; color: var(--muted); margin-top: 2px; }
.cl-item .ctrl { display: flex; gap: 6px; align-items: center; }
.tri { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 10px; overflow: hidden; }
.tri label { cursor: pointer; } .tri input { display: none; }
.tri span { display: inline-flex; align-items: center; gap: 4px; padding: 8px 12px; font-size: .82rem; font-weight: 700; color: var(--muted); border-right: 1px solid var(--line); }
.tri label:last-child span { border-right: 0; }
.tri input:checked + span.yes { background: var(--green); color: #fff; } .tri input:checked + span.no { background: var(--red); color: #fff; } .tri input:checked + span.na { background: var(--slate); color: #fff; }
@media (max-width: 640px) { .cl-item { grid-template-columns: 1fr; } }
.offline-bar { position: sticky; top: 64px; z-index: 20; display: flex; align-items: center; gap: 10px; padding: 8px 14px; border-radius: 10px; background: var(--amber-bg); color: var(--amber); font-weight: 600; font-size: .84rem; margin-bottom: 12px; }

/* ---------- Gallery ---------- */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.gallery a { position: relative; display: block; aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: var(--surface-3); border: 1px solid var(--line); }
.gallery img { width: 100%; height: 100%; object-fit: cover; }
.gallery .cap { position: absolute; inset: auto 0 0 0; padding: 4px 7px; font-size: .68rem; color: #fff; background: rgba(0,0,0,.6); }
.gallery .warn { position: absolute; top: 6px; left: 6px; }

/* ---------- Timeline ---------- */
.timeline { position: relative; padding-left: 22px; }
.timeline::before { content: ""; position: absolute; left: 6px; top: 6px; bottom: 6px; width: 2px; background: var(--line); }
.tl-item { position: relative; padding: 0 0 16px; font-size: .86rem; }
.tl-item::before { content: ""; position: absolute; left: -21px; top: 5px; width: 12px; height: 12px; border-radius: 50%; background: var(--surface); border: 2px solid var(--brand); }
.tl-item.approved::before { border-color: var(--green); background: var(--green); } .tl-item.rejected::before { border-color: var(--red); background: var(--red); } .tl-item.returned::before { border-color: var(--amber); background: var(--amber); } .tl-item.waiting::before { border-style: dashed; border-color: var(--faint); }
.tl-item .when { font-size: .74rem; color: var(--faint); }

/* ---------- Steps ---------- */
.steps { display: flex; gap: 0; counter-reset: s; }
.steps .s { flex: 1; position: relative; text-align: center; font-size: .76rem; color: var(--muted); font-weight: 600; padding-top: 30px; }
.steps .s::before { counter-increment: s; content: counter(s); position: absolute; top: 0; left: 50%; transform: translateX(-50%); width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-3); color: var(--muted); font-weight: 800; z-index: 1; border: 2px solid var(--surface); }
.steps .s::after { content: ""; position: absolute; top: 11px; left: -50%; right: 50%; height: 2px; background: var(--line); }
.steps .s:first-child::after { display: none; }
.steps .s.done::before { background: var(--green); color: #fff; content: "✓"; } .steps .s.done::after, .steps .s.now::after { background: var(--green); }
.steps .s.now::before { background: var(--accent); color: #2b1a02; } .steps .s.now { color: var(--ink); }
.steps .s.block::before { background: var(--red); color: #fff; }

/* ---------- Auth (log in, password reset, two-factor): one calm centred column ---------- */
.auth { min-height: 100vh; display: flex; flex-direction: column; background: var(--surface); }
.auth-main { flex: 1; display: grid; place-items: center; padding: 56px 20px 32px; }
.auth-box { width: min(380px, 100%); }
.auth-logo { display: grid; place-items: center; width: 52px; height: 52px; margin: 0 auto 28px; text-decoration: none !important; }
.auth-logo .brand-mark { width: 56px; height: 56px; }
.auth-title, .auth-box h2 { font-family: var(--font); font-size: 1.75rem; font-weight: 700; letter-spacing: -.03em; line-height: 1.2; text-align: center; margin: 0 0 6px; color: var(--ink); }
.auth-lead { text-align: center; color: var(--muted); font-size: .95rem; margin: 0 0 32px; }
.auth-box .input { height: 48px; border-radius: 12px; font-size: .97rem; padding: 0 14px; }
.auth-box .field label { font-size: .86rem; font-weight: 600; color: var(--ink-2); }
.auth-fields { display: flex; flex-direction: column; gap: 18px; }
.auth-box .btn-lg { height: 48px; border-radius: 12px; font-size: .97rem; }
.pw { position: relative; }
.pw .input { padding-right: 48px; }
.pw .reveal { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 36px; height: 36px; border: 0; border-radius: 9px; background: none; color: var(--muted); display: grid; place-items: center; cursor: pointer; }
.pw .reveal:hover { background: var(--surface-3); color: var(--ink); }
.pw .reveal svg { width: 18px; height: 18px; }
.auth-or { display: flex; align-items: center; gap: 12px; margin: 22px 0; color: var(--faint); font-size: .8rem; }
.auth-or::before, .auth-or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.auth-link { text-align: center; margin: 22px 0 0; font-size: .9rem; }
.auth-link a, .auth-box a.center { font-weight: 600; }
.auth-below { margin-top: 40px; padding-top: 20px; border-top: 1px solid var(--line); text-align: center; font-size: .8rem; line-height: 1.6; color: var(--muted); }
.auth-footer { padding: 20px; text-align: center; font-size: .78rem; color: var(--faint); }
@media (max-width: 480px) { .auth-main { place-items: start center; padding-top: 40px; } .auth-title, .auth-box h2 { font-size: 1.5rem; } }

/* ---------- Install ---------- */
.install-shell { min-height: 100vh; display: grid; place-items: center; padding: 32px 16px; background: var(--canvas); }
.install-shell .card { width: min(720px, 100%); padding: 32px; }
.steps-bar { display: flex; gap: 6px; margin: 4px 0 22px; } .steps-bar span { flex: 1; height: 5px; border-radius: 99px; background: var(--surface-3); } .steps-bar span.on { background: var(--brand-text); }

/* ---------- Prose (help) ---------- */
.prose { font-size: .98rem; line-height: 1.7; max-width: 760px; }
.prose h2 { margin-top: 1.6em; } .prose h3 { margin-top: 1.4em; }
.prose ul, .prose ol { padding-left: 1.3em; } .prose li { margin: .3em 0; }
.prose code { background: var(--surface-3); padding: 1px 6px; border-radius: 5px; }
.prose table { border-collapse: collapse; width: 100%; } .prose td, .prose th { border: 1px solid var(--line); padding: 6px 10px; }

/* ---------- Report preview ---------- */
.paper { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; box-shadow: var(--shadow); padding: 48px 56px; max-width: 980px; margin: 0 auto; }
.paper .org { font-size: .74rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.paper h1 { color: var(--rc, var(--brand)); margin-top: 8px; }
.paper h2 { color: var(--rc, var(--brand)); margin-top: 28px; font-size: 1.2rem; }
.paper .kvs { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; margin: 18px 0; }
.paper .kvs div { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.paper .kvs small { display: block; color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; font-weight: 700; }
.paper .kvs b { font-family: var(--display); font-size: 1.1rem; }
.paper .note { border-left: 4px solid var(--accent); background: var(--amber-bg); padding: 10px 14px; border-radius: 0 8px 8px 0; font-style: italic; }
@media (max-width: 760px) { .paper { padding: 24px 18px; } }

/* ---------- Misc ---------- */
.pill-nav { display: flex; gap: 8px; flex-wrap: wrap; }
.pill-nav a { padding: 7px 14px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); font-weight: 600; font-size: .84rem; text-decoration: none !important; display: inline-flex; align-items: center; gap: 7px; }
.pill-nav a.on { background: var(--brand-ink); color: #fff; border-color: var(--brand-ink); }
:root[data-theme="dark"] .pill-nav a.on { background: var(--brand-text); border-color: var(--brand-text); color: var(--canvas); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .pill-nav a.on { background: var(--brand-text); border-color: var(--brand-text); color: var(--canvas); } }
.pill-nav a svg { width: 15px; height: 15px; }
.stat-inline { display: flex; gap: 26px; flex-wrap: wrap; }
.stat-inline div small { display: block; font-size: .72rem; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.stat-inline div b { font-family: var(--display); font-size: 1.35rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.comment { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px dashed var(--line); }
.comment:last-child { border-bottom: 0; }
.comment .b { white-space: pre-wrap; font-size: .9rem; }
.mention { color: var(--brand-text); font-weight: 600; background: color-mix(in srgb, var(--brand) 8%, transparent); border-radius: 4px; padding: 0 3px; }
.dropzone { border: 2px dashed var(--line-strong); border-radius: 12px; padding: 18px; text-align: center; color: var(--muted); cursor: pointer; transition: border-color .15s, background .15s; display: block; }
.dropzone:hover, .dropzone.over { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 5%, transparent); }
.scanner video { width: 100%; border-radius: 12px; background: #000; max-height: 280px; object-fit: cover; }
.pagination { display: flex; gap: 6px; justify-content: center; margin-top: 20px; flex-wrap: wrap; }
.pagination a, .pagination span { min-width: 36px; height: 36px; display: grid; place-items: center; border-radius: 9px; border: 1px solid var(--line); background: var(--surface); padding: 0 10px; font-weight: 600; font-size: .85rem; color: var(--ink-2); text-decoration: none !important; }
.pagination .on { background: var(--brand); border-color: var(--brand); color: #fff; }
.pagination .off { opacity: .45; }
.matrix td, .matrix th { text-align: center; }
.matrix td:first-child, .matrix th:first-child { text-align: left; }
.matrix select { height: 30px; font-size: .78rem; padding: 0 22px 0 6px; border-radius: 7px; background-position: right 4px center; min-width: 64px; }
.print-only { display: none; }
@media print {
  .side, .topbar, .page-actions, .toasts, .no-print, .ai-btn { display: none !important; }
  .shell { display: block; } .content { padding: 0; max-width: none; }
  body { background: #fff; } .card { box-shadow: none; } .print-only { display: block; }
}

/* ---- Charts (histograms, S-curves) ---------------------------------------
   Series colours are the validated reference pair (blue / orange), stepped
   separately for the dark surface. Text never wears a series colour. */
.viz { --series-1: #2a78d6; --series-2: #eb6834; --series-ref: var(--ink-2); margin: 0; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .viz { --series-1: #3987e5; --series-2: #d95926; } }
:root[data-theme="dark"] .viz { --series-1: #3987e5; --series-2: #d95926; }
.viz-scroll { overflow-x: auto; }
.viz svg { display: block; width: 100%; height: auto; }
.viz-grid { stroke: var(--line); stroke-width: 1; }
.viz-base { stroke: var(--line-strong); stroke-width: 1; }
.viz-ax { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.viz-bar { stroke: var(--surface); stroke-width: 0; }
.viz-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.viz-ref { stroke-dasharray: 5 4; stroke-width: 1.5; }
.viz-dot { stroke: var(--surface); stroke-width: 2; }
.viz-today { stroke: var(--ink-2); stroke-width: 1; stroke-dasharray: 2 3; }
.viz-today-label { fill: var(--ink-2); font-weight: 600; }
.viz-hit { fill: transparent; cursor: crosshair; }
.viz-hit:hover { fill: color-mix(in srgb, var(--ink) 6%, transparent); }
.viz-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: .78rem; color: var(--ink-2); margin-bottom: 8px; }
.viz-legend span { display: inline-flex; align-items: center; gap: 6px; }
.viz-legend .sw { width: 12px; height: 12px; border-radius: 3px; background: var(--c); display: inline-block; }
.viz-legend .sw-line { height: 3px; border-radius: 2px; }
.viz-legend .sw-ref { height: 0; border-top: 2px dashed var(--c); background: none; }
.viz-table { margin-top: 6px; }
.viz-table summary { cursor: pointer; }
.viz-tip { position: fixed; z-index: 90; pointer-events: none; background: var(--surface); color: var(--ink); border: 1px solid var(--line-strong); border-radius: 10px; padding: 8px 10px; font-size: .78rem; line-height: 1.5; box-shadow: var(--shadow); max-width: 280px; }

/* ---- WBS chart (organisation-chart layout) ------------------------------ */
.wbs-chart { overflow-x: auto; padding: 8px 4px 16px; }
.wbs-chart ul { display: flex; justify-content: center; padding-top: 18px; position: relative; margin: 0; padding-left: 0; list-style: none; }
.wbs-chart li { display: flex; flex-direction: column; align-items: center; position: relative; padding: 18px 6px 0; }
.wbs-chart li::before, .wbs-chart li::after { content: ""; position: absolute; top: 0; right: 50%; width: 50%; height: 18px; border-top: 1px solid var(--line-strong); }
.wbs-chart li::after { right: auto; left: 50%; border-left: 1px solid var(--line-strong); }
.wbs-chart li:only-child::before, .wbs-chart li:only-child::after { display: none; }
.wbs-chart li:only-child { padding-top: 0; }
.wbs-chart li:first-child::before, .wbs-chart li:last-child::after { border: 0; }
.wbs-chart li:last-child::before { border-right: 1px solid var(--line-strong); border-radius: 0 6px 0 0; }
.wbs-chart li:first-child::after { border-radius: 6px 0 0 0; }
.wbs-chart ul ul::before { content: ""; position: absolute; top: 0; left: 50%; height: 18px; border-left: 1px solid var(--line-strong); }
.wbs-chart > ul { padding-top: 0; }
.wbs-node { display: block; min-width: 130px; max-width: 180px; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow); text-align: left; font-size: .78rem; color: var(--ink); text-decoration: none; }
.wbs-node .code { font-family: var(--mono); font-size: .68rem; color: var(--muted); }
.wbs-node.root { background: var(--brand); color: #fff; border-color: var(--brand); }
.wbs-node.root .code { color: color-mix(in srgb, #fff 70%, transparent); }
.wbs-node.pkg { border-left: 3px solid var(--accent); }
.wbs-node.ms { border-style: dashed; }

/* ---- Life cycle track ------------------------------------------------------ */
.lc-track { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(150px, 1fr); gap: 0; overflow-x: auto; padding-bottom: 4px; }
.lc-stage { position: relative; padding: 14px 16px 14px 22px; background: var(--surface-2); border: 1px solid var(--line); margin-right: 14px; border-radius: 12px; }
.lc-stage::after { content: ""; position: absolute; right: -11px; top: 50%; width: 18px; height: 18px; transform: translateY(-50%) rotate(45deg); background: var(--surface); border: 1px solid var(--line-strong); border-radius: 3px; z-index: 1; }
.lc-stage:last-child::after { display: none; }
.lc-stage.complete { background: var(--green-bg); border-color: color-mix(in srgb, var(--green) 30%, transparent); }
.lc-stage.active { background: color-mix(in srgb, var(--accent) 16%, var(--surface)); border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent); }
.lc-stage.stopped { background: var(--red-bg); border-color: color-mix(in srgb, var(--red) 35%, transparent); }
.lc-stage .n { font-family: var(--mono); font-size: .7rem; color: var(--muted); }
.lc-stage h4 { margin: 2px 0 4px; font-size: .95rem; }

/* ---- Stakeholder power / interest grid ------------------------------------ */
.pi-grid { display: grid; grid-template-columns: 22px 1fr 1fr; grid-template-rows: 1fr 1fr 22px; gap: 6px; min-height: 280px; }
.pi-cell { border: 1px solid var(--line); border-radius: 12px; padding: 10px; background: var(--surface-2); display: flex; flex-direction: column; gap: 6px; }
.pi-cell h5 { margin: 0; font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.pi-cell .chips { display: flex; flex-wrap: wrap; gap: 4px; }
.pi-cell .chip { font-size: .75rem; padding: 2px 8px; border-radius: 99px; background: var(--surface); border: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.pi-ax { font-size: .7rem; color: var(--muted); display: grid; place-items: center; }
.pi-ax.y { writing-mode: vertical-rl; transform: rotate(180deg); }
.pi-cell.hot { background: color-mix(in srgb, var(--accent) 12%, var(--surface)); }

/* ---- Results framework ------------------------------------------------------ */
.rf-row { display: grid; grid-template-columns: 1fr auto; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.rf-level { font-size: .68rem; text-transform: uppercase; letter-spacing: .06em; font-weight: 700; color: var(--muted); }
.rf-ind { display: grid; grid-template-columns: minmax(160px, 1.6fr) 1fr auto; gap: 10px; align-items: center; padding: 6px 0; font-size: .85rem; }
.flow-preview { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px; overflow: auto; min-height: 240px; }
.flow-preview svg { max-width: 100%; height: auto; }
.tabs .tab-sep { width: 1px; align-self: stretch; margin: 6px 4px; background: var(--line-strong); }
.wbs-chart > ul { width: max-content; min-width: 100%; }

/* ---------- Responsive hardening ------------------------------------------
   Grid and flex children default to min-width:auto, so one wide table or long
   word used to push the whole page sideways on phones. Let them shrink, and let
   wide tables scroll inside their card instead. */
.grid > *, .stack > *, .stack-lg > *, .form-grid > *, .kpis > *, .row > .grow, .page-head > .grow { min-width: 0; }
.card, .kpi, .list-item > .grow { min-width: 0; }
.card-head { flex-wrap: wrap; row-gap: 8px; }
.dl > dd, .dl > dt { min-width: 0; overflow-wrap: anywhere; }
.page-head h1, .card-head h3 { overflow-wrap: anywhere; }
.list-item .small, .list-item .tiny { overflow-wrap: anywhere; }
@media (max-width: 760px) {
  table.table { display: block; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .table th { position: static; }
  .page-head { align-items: flex-start; margin-bottom: 20px; }
  .page-actions { width: 100%; }
  h1 { font-size: 1.6rem; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { padding: 14px; }
  .kpi-value { font-size: 1.45rem; }
  .card-head { padding: 13px 16px; }
  .card > .body, .card-pad { padding: 16px; }
  .list-item { padding: 12px 16px; }
  .rf-ind { grid-template-columns: 1fr; gap: 6px; }
  .rf-row { grid-template-columns: minmax(0, 1fr); } .rf-row > .row { justify-content: flex-end; }
  .radio-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lc-track { grid-auto-columns: minmax(140px, 70%); }
  .hero { padding: 22px 18px; }
  .hero-stats { gap: 14px 22px; flex-wrap: wrap; }
  .filters { flex-wrap: wrap; }
  .filters > * { flex: 1 1 140px; }
}
.kpis.kpis-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
@media (max-width: 1280px) { .kpis.kpis-5 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 760px) { .kpis.kpis-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.kpis.kpis-5 .kpi-value { font-size: clamp(1.25rem, 1.6vw, 1.7rem); }

/* ---------- Filter bars: one consistent rhythm on every list ---------- */
.filters .select, .filters .input:not(.search) { flex: 1 1 170px; max-width: 240px; min-width: 150px; }
.filters .search { flex: 2 1 240px; max-width: 380px; }
.filters .check { white-space: nowrap; }

/* ---------- Forms: styled file pickers, sticky save bar, keyboard focus ---------- */
input[type="file"] { font: inherit; font-size: .86rem; color: var(--muted); max-width: 100%; }
input[type="file"]::file-selector-button { font: inherit; font-weight: 600; font-size: .84rem; margin-right: 12px; padding: 8px 14px; border-radius: 9px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); cursor: pointer; transition: background .15s; }
input[type="file"]::file-selector-button:hover { background: var(--surface-3); }
.form-actions.sticky { position: sticky; bottom: 0; z-index: 20; margin: 0 -4px; padding: 14px 4px; background: var(--canvas); border-top: 1px solid var(--line); }
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible { outline: 2px solid color-mix(in srgb, var(--brand-text) 70%, var(--accent)); outline-offset: 2px; border-radius: 6px; }
.btn:focus-visible { outline-offset: 3px; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; } }

/* ---------- Phone refinements ---------- */
.ws-line { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 2fr) 80px; gap: 18px; }
.topbar-title { display: none; font-family: var(--mono); font-size: .8rem; font-weight: 600; color: var(--ink); text-decoration: none; }
@media (max-width: 760px) {
  .topbar-title { display: inline; }
  .topbar { gap: 8px; }
  .hero > .row-between, .hero .hero-top { flex-wrap: wrap; gap: 12px; }
  .hero-rag { order: -1; padding: 8px 12px !important; display: flex; align-items: center; gap: 10px; }
  .hero-rag .mt-1 { margin-top: 0; }
  .hero h1 { font-size: 1.55rem; }
  .ws-line { grid-template-columns: minmax(0, 1fr) auto; gap: 8px 12px; }
  .ws-line > :nth-child(2) { grid-column: 1 / -1; grid-row: 2; }
}
/* Links the viewer's role cannot follow are rendered as plain text. */
a[aria-disabled="true"] { cursor: default; text-decoration: none !important; }
a[aria-disabled="true"] .go, a.kpi[aria-disabled="true"] svg.lucide-arrow-up-right { display: none; }
tr[aria-disabled="true"] { cursor: default; }

/* ---------- Execution plan ---------- */
.step-card { padding: 0; overflow: hidden; scroll-margin-top: 90px; }
.step-card:target { box-shadow: var(--ring), var(--shadow); }
.step-head { display: flex; gap: 14px; align-items: flex-start; padding: 18px 20px 12px; }
.step-num { flex: none; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-weight: 700; color: var(--brand-text); background: color-mix(in srgb, var(--brand) 9%, var(--surface)); border: 1px solid color-mix(in srgb, var(--brand) 18%, transparent); }
.step-head h3 { font-size: 1.02rem; }
.step-meta { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 6px; }
.step-meta span { display: inline-flex; align-items: center; gap: 5px; }
.step-meta svg { width: 14px; height: 14px; }
.step-actions { flex: none; }
.step-desc { padding: 0 20px 4px 68px; color: var(--ink-2); }
.step-body { padding: 14px 20px 18px; border-top: 1px solid var(--line); margin-top: 10px; background: var(--surface-2); }
.checklist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.checklist li { display: flex; align-items: flex-start; gap: 8px; padding: 6px 4px; border-radius: 8px; }
.checklist li:hover { background: var(--surface); }
.checklist li.done .small { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--faint); }
.checklist .tick { flex: none; width: 22px; height: 22px; padding: 0; border-radius: 6px; border: 1.5px solid var(--line-strong); background: var(--surface); display: grid; place-items: center; cursor: pointer; color: transparent; }
.checklist .tick svg { width: 15px; height: 15px; }
.checklist li.done .tick { background: var(--green); border-color: var(--green); color: #fff; }
.checklist span.tick { cursor: default; }
.deliv { padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
@media (max-width: 760px) {
  .step-head { flex-wrap: wrap; padding: 14px 16px 10px; }
  .step-actions { width: 100%; justify-content: flex-end; }
  .step-desc { padding: 0 16px 4px; }
  .step-body { padding: 12px 16px 16px; }
}
.col-title { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
@media (hover: hover) { .checklist li > form:last-child .btn { opacity: 0; transition: opacity .15s; } .checklist li:hover > form:last-child .btn, .checklist li > form:last-child .btn:focus-visible { opacity: 1; } }
.seg button { border: 0; background: none; padding: 6px 12px; border-radius: 9px; font: inherit; font-size: .84rem; font-weight: 600; color: var(--muted); cursor: pointer; }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }
.seg button:disabled { opacity: .45; cursor: not-allowed; }
.clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.party-card .stat-inline { gap: 10px 18px; }
.party-card .stat-inline b { font-size: 1.15rem; }
.opt-desc { display: block; font-size: .76rem; color: var(--muted); font-weight: 400; }
.help-link { display: inline-flex; align-items: center; gap: 4px; margin-left: 6px; font-weight: 600; white-space: nowrap; } .help-link svg { width: 15px; height: 15px; }
/* Light / dark switch: show the moon in light mode, the sun in dark mode. */
.theme-switch .ts-dark, .theme-switch svg.ts-dark { display: none; }
:root[data-theme="dark"] .theme-switch .ts-light { display: none; }
:root[data-theme="dark"] .theme-switch .ts-dark { display: inline-block; }
.auth-top { display: flex; justify-content: flex-end; padding: 16px 20px 0; }

/* ---------- Dashboard (modern, simple) ---------- */
.dash-head { display: flex; gap: 16px; align-items: flex-end; margin: 6px 0 20px; }
.dash-hello { margin: 0 0 4px; color: var(--muted); font-weight: 600; }
.dash-head h1 { font-size: clamp(1.6rem, 2.4vw, 2.1rem); letter-spacing: -.03em; margin: 0 0 8px; }
.dash-meta { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 0; color: var(--muted); font-size: .9rem; align-items: center; }
.dash-status { display: inline-flex; align-items: center; gap: 7px; font-weight: 700; padding: 4px 10px; border-radius: 99px; background: var(--slate-bg); color: var(--slate); }
.dash-status i { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.dash-status.green { background: var(--green-bg); color: var(--green); } .dash-status.amber { background: var(--amber-bg); color: var(--amber); } .dash-status.red { background: var(--red-bg); color: var(--red); }
.dash-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 22px; }
.dash-stat { display: flex; flex-direction: column; gap: 6px; padding: 18px 20px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-sm); color: inherit; text-decoration: none !important; transition: border-color .15s, box-shadow .15s; }
a.dash-stat:hover { border-color: var(--line-strong); box-shadow: var(--shadow); }
.dash-stat .l { font-size: .8rem; font-weight: 600; color: var(--muted); }
.dash-stat .v { font-size: 1.75rem; font-weight: 700; letter-spacing: -.03em; color: var(--ink); font-variant-numeric: tabular-nums; line-height: 1.15; }
.dash-stat .s { font-size: .8rem; color: var(--muted); }
.dash-stat .bar { height: 6px; }
.dash-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 22px; align-items: start; }
.dash-card { padding: 18px 20px; border-radius: 18px; }
.dash-h { display: flex; align-items: center; gap: 8px; font-family: var(--font); font-size: 1rem; font-weight: 700; letter-spacing: -.01em; margin: 0 0 10px; }
.dash-h > svg { width: 18px; height: 18px; color: var(--brand-text); }
.dash-more { margin-left: auto; font-size: .82rem; font-weight: 600; }
.dash-legend { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; font-size: .74rem; font-weight: 500; color: var(--muted); }
.dash-legend i { display: inline-block; width: 10px; height: 6px; border-radius: 3px; background: var(--brand-text); margin-left: 6px; } .dash-legend i.p { width: 2px; height: 10px; background: var(--ink); }
.dash-row { display: flex; align-items: center; gap: 12px; padding: 10px 8px; margin: 0 -8px; border-radius: 12px; color: inherit; text-decoration: none !important; }
a.dash-row:hover { background: var(--surface-2); }
.dash-row .go { width: 16px; height: 16px; color: var(--faint); }
.dash-count { flex: none; min-width: 36px; height: 30px; padding: 0 8px; border-radius: 9px; display: grid; place-items: center; font-weight: 700; font-variant-numeric: tabular-nums; background: var(--slate-bg); color: var(--slate); }
.dash-count.red { background: var(--red-bg); color: var(--red); } .dash-count.amber { background: var(--amber-bg); color: var(--amber); } .dash-count.green { background: var(--green-bg); color: var(--green); }
.dash-clear { display: flex; align-items: center; gap: 8px; padding: 10px 0 4px; font-size: .9rem; color: var(--green); }
.dash-clear svg { width: 18px; height: 18px; }
.dash-ws { display: flex; flex-direction: column; gap: 6px; padding: 12px 8px; margin: 0 -8px; border-radius: 12px; color: inherit; text-decoration: none !important; }
.dash-ws:hover { background: var(--surface-2); }
.dash-ws-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.dash-step { flex: none; width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; font-size: .8rem; font-weight: 700; color: var(--brand-text); background: color-mix(in srgb, var(--brand) 9%, var(--surface)); }
.dash-date { flex: none; width: 44px; height: 46px; border-radius: 11px; display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: .66rem; font-weight: 700; text-transform: uppercase; color: var(--muted); background: var(--surface-2); border: 1px solid var(--line); line-height: 1.1; }
.dash-date b { font-size: 1.05rem; color: var(--ink); }
.d-block { display: block; }
@media (max-width: 1100px) { .dash-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } .dash-grid { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 520px) { .dash-stats { gap: 10px; } .dash-stat { padding: 14px; } .dash-stat .v { font-size: 1.35rem; } .dash-head { flex-wrap: wrap; align-items: flex-start; } }
.dash-date.late { border-color: color-mix(in srgb, var(--red) 35%, transparent); background: var(--red-bg); } .dash-date.late b { color: var(--red); }
.invite-note { margin: -14px 0 22px; padding: 10px 14px; border-left: 3px solid var(--accent); background: var(--surface-2); border-radius: 0 10px 10px 0; font-size: .92rem; color: var(--ink-2); }
/* Plan import */
.import-drop { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 34px 20px; text-align: center; cursor: pointer; border: 2px dashed var(--line-strong); border-radius: 16px; }
.import-drop svg { width: 30px; height: 30px; color: var(--brand-text); }
.import-step { padding: 14px 18px; }
.import-step.off { opacity: .55; }
.import-step-head { display: flex; align-items: center; gap: 12px; }
.import-step-head .input { font-weight: 700; }
.import-step-body { margin-top: 12px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }

/* ---------- Public website ---------- */
.site { min-height: 100vh; display: flex; flex-direction: column; background: var(--surface); }
.site main { flex: 1; }
.site-wrap { width: min(1080px, 100%); margin: 0 auto; padding: 0 24px; }
.site-head { position: sticky; top: 0; z-index: 30; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.site-bar { display: flex; align-items: center; gap: 20px; height: 70px; }
.site-bar .brand { padding: 0; }
.site-nav { display: flex; gap: 4px; margin-left: auto; }
.site-nav a { padding: 8px 12px; border-radius: 10px; color: var(--ink-2); font-weight: 600; font-size: .95rem; text-decoration: none !important; }
.site-nav a:hover { background: var(--surface-3); color: var(--ink); }
.site-nav a.on { color: var(--brand-text); background: color-mix(in srgb, var(--brand) 8%, var(--surface)); }
.site-actions { display: flex; align-items: center; gap: 10px; }
.site-menu-btn { display: none; }
.site-hero { padding: 64px 0 28px; }
.site-hero.home { padding: 96px 0 40px; background: color-mix(in srgb, var(--brand) 5%, var(--surface)); border-bottom: 1px solid var(--line); margin-bottom: 36px; }
.site-hero h1 { font-size: clamp(2rem, 4.4vw, 3.3rem); letter-spacing: -.03em; line-height: 1.1; max-width: 820px; margin: 0; }
.site-lead { font-size: 1.2rem; color: var(--muted); max-width: 680px; margin: 14px 0 0; }
.site-body { padding-bottom: 64px; font-size: 1.05rem; max-width: min(1080px, 100%); }
.site-body > * { max-width: 760px; }
.site-body img { max-width: 100%; height: auto; border-radius: 14px; }
.site-foot { border-top: 1px solid var(--line); padding: 26px 0; color: var(--muted); font-size: .88rem; }
.site-foot nav { display: flex; gap: 16px; flex-wrap: wrap; }
.site-foot a { color: var(--muted); }
@media (max-width: 760px) {
  .site-wrap { padding: 0 16px; }
  .site-menu-btn { display: grid; }
  .site-nav { display: none; position: absolute; top: 70px; left: 0; right: 0; flex-direction: column; padding: 10px 16px 16px; background: var(--surface); border-bottom: 1px solid var(--line); box-shadow: var(--shadow); }
  .site-nav.open { display: flex; }
  .site-actions .btn-primary { display: none; }
  .site-bar .brand-sub { display: none; }
  .site-hero.home { padding: 56px 0 28px; }
  .site-foot .row-between { flex-direction: column; align-items: flex-start; gap: 10px; }
}
/* Page editor and media */
.tab-count { margin-left: 4px; font-size: .72rem; font-weight: 700; padding: 1px 7px; border-radius: 99px; background: var(--surface-3); color: var(--muted); }
.editor-wrap { display: grid; gap: 12px; }
.editor-wrap.mode-both { grid-template-columns: 1fr 1fr; }
.editor-preview { border: 1px solid var(--line); border-radius: 12px; min-height: 300px; overflow: auto; max-height: 640px; background: var(--surface); }
.mono-ish { font-family: var(--mono); font-size: .86rem; line-height: 1.6; }
.media-pick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; padding: 12px; }
.media-pick button { aspect-ratio: 1; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); padding: 0; overflow: hidden; cursor: pointer; font-size: .66rem; color: var(--muted); }
.media-pick button:hover { border-color: var(--brand-text); }
.media-pick img { width: 100%; height: 100%; object-fit: cover; display: block; }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.media-item { padding: 0; overflow: hidden; }
.media-thumb { display: grid; place-items: center; aspect-ratio: 4 / 3; background: var(--surface-3); color: var(--muted); }
.media-thumb img { width: 100%; height: 100%; object-fit: cover; }
.media-thumb svg { width: 36px; height: 36px; }
.media-meta { padding: 10px 12px 12px; }
@media (max-width: 760px) { .editor-wrap.mode-both { grid-template-columns: 1fr; } }
