/* LC Desk — styles. Tokens first; every colour pair is checked for WCAG AA in both themes. */
:root {
  color-scheme: light;
  --bg: #f3f5f9; --surface: #ffffff; --surface-2: #f6f8fb; --line: #e1e7ef; --line-2: #cbd5e1;
  --ink: #0f1b2d; --ink-2: #334155; --muted: #556275;
  --brand: #1f4fd1; --brand-hover: #1a43b3; --on-brand: #ffffff; --brand-soft: #ebf1ff; --brand-ink: #1c46b9;
  --red: #b42318; --red-soft: #fdeeec; --amber: #8a4f07; --amber-soft: #fff3df; --green: #0b6e4c; --green-soft: #e3f5ec; --blue: #1c46b9; --blue-soft: #e8efff; --neutral: #4a5768; --neutral-soft: #eef1f5;
  --nav: #0f1e33; --nav-ink: #c7d3e3; --nav-label: #8fa1ba; --nav-active: #213a60; --nav-line: #22344f;
  --focus: #2b62f0;
  --radius: 14px; --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(15, 27, 45, .05), 0 6px 24px rgba(15, 27, 45, .05);
  --shadow-lg: 0 24px 60px rgba(10, 20, 40, .22);
  --tabbar-h: 0px;
  font-synthesis: none;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0a111d; --surface: #111a2a; --surface-2: #0e1624; --line: #1f2b3f; --line-2: #2c3b55;
    --ink: #e8eef7; --ink-2: #c3cedd; --muted: #9aa9bd;
    --brand: #4d7cff; --brand-hover: #6890ff; --on-brand: #06122b; --brand-soft: #172447; --brand-ink: #a9c1ff;
    --red: #ff9a91; --red-soft: #3a1719; --amber: #f5c06a; --amber-soft: #33250e; --green: #6dd8ae; --green-soft: #0f2f24; --blue: #a9c1ff; --blue-soft: #18264a; --neutral: #b6c2d2; --neutral-soft: #1c2638;
    --nav: #070d17; --nav-ink: #c0cbdb; --nav-label: #8a9ab0; --nav-active: #1a2b47; --nav-line: #17233a;
    --focus: #7ea0ff;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3); --shadow-lg: 0 24px 60px rgba(0, 0, 0, .55);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; }
body.no-scroll { overflow: hidden; }
h1, h2, h3 { margin: 0; letter-spacing: -0.015em; line-height: 1.2; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--brand-ink); }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.sr-only, .visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 12px; top: -60px; background: var(--brand); color: var(--on-brand); padding: 10px 14px; border-radius: 8px; z-index: 100; }
.skip:focus { top: 12px; }
.ic { width: 18px; height: 18px; flex: none; }
.ic.big { width: 28px; height: 28px; color: var(--brand-ink); }
code { font: 12.5px/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: var(--surface-2); border: 1px solid var(--line); border-radius: 5px; padding: 1px 5px; white-space: nowrap; }
hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }
.muted, .t-muted { color: var(--muted); }
.t-red { color: var(--red); } .t-amber { color: var(--amber); } .t-green { color: var(--green); } .t-blue { color: var(--blue); }
.print-only { display: none; }
.nowrap { white-space: nowrap; }

/* ---------- logo ---------- */
.logo { width: 36px; height: 36px; border-radius: 10px; background: #102237 url("./assets/favicon.svg") center/cover; flex: none; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .08); }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; min-height: 100dvh; }
.sidebar { position: sticky; top: 0; height: 100vh; height: 100dvh; background: var(--nav); color: var(--nav-ink); display: flex; flex-direction: column; padding: 20px 12px 16px; overflow-y: auto; z-index: 40; }
.brand { display: flex; align-items: center; gap: 11px; padding: 0 8px 22px; }
.brand strong { display: block; color: #fff; font-size: 16px; letter-spacing: -0.01em; }
.brand small { display: block; color: var(--nav-label); font-size: 12px; }
.brand .close-menu { margin-left: auto; color: var(--nav-ink); }
.nav { display: grid; gap: 2px; }
.nav button { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border: 0; border-radius: 9px; background: transparent; color: var(--nav-ink); font-size: 14px; font-weight: 600; text-align: left; }
.nav button:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav button.active { background: var(--nav-active); color: #fff; }
.nav-label { margin: 18px 12px 6px; font-size: 11.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--nav-label); }
.badge { margin-left: auto; min-width: 22px; padding: 1px 7px; border-radius: 99px; background: rgba(255, 255, 255, .1); color: #e6edf7; font-size: 12px; font-weight: 700; text-align: center; }
.badge.red { background: #c2322a; color: #fff; }
.sidebar-foot { margin-top: auto; padding: 16px 6px 0; display: grid; gap: 12px; }
.org { display: flex; align-items: center; gap: 10px; padding-top: 14px; border-top: 1px solid var(--nav-line); }
.org strong { display: block; color: #fff; font-size: 13.5px; }
.org small { display: block; color: var(--nav-label); font-size: 12px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: #2b4f88; color: #fff; font-size: 12px; font-weight: 800; flex: none; }
.tiny-note { font-size: 12px; color: var(--nav-label); line-height: 1.45; }
.scrim { position: fixed; inset: 0; background: rgba(5, 12, 24, .5); z-index: 35; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; min-height: 60px; padding: 10px 32px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line); }
.topbar-title { display: none; font-weight: 700; font-size: 16px; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.scope { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.scope-label { font-size: 13px; color: var(--muted); font-weight: 600; }
.scope select, .filters select { appearance: none; -webkit-appearance: none; background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23778599' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 12px center; border: 1px solid var(--line-2); border-radius: var(--radius-sm); padding: 8px 34px 8px 12px; font-weight: 600; font-size: 14px; max-width: 280px; min-height: 40px; }
.demo-banner { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 16px 32px 0; padding: 10px 14px; border-radius: var(--radius-sm); background: var(--amber-soft); color: var(--amber); font-size: 14px; border: 1px solid color-mix(in srgb, var(--amber) 25%, transparent); }
.page { width: 100%; max-width: 1280px; margin: 0 auto; padding: 28px 32px 56px; outline: none; }

/* ---------- headings ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head h1 { font-size: 28px; font-weight: 800; }
.eyebrow { font-size: 12.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.lede { margin-top: 6px; color: var(--ink-2); max-width: 70ch; }
.head-actions, .btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.section { margin-top: 28px; }
.section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.section-head h2 { font-size: 18px; }
.footnote { margin-top: 14px; color: var(--muted); font-size: 13px; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 40px; padding: 8px 15px; border-radius: var(--radius-sm); border: 1px solid transparent; font-size: 14px; font-weight: 650; text-decoration: none; white-space: nowrap; transition: background .12s, border-color .12s; }
.btn .ic { width: 17px; height: 17px; }
.btn.primary { background: var(--brand); color: var(--on-brand); }
.btn.primary:hover { background: var(--brand-hover); }
.btn.secondary { background: var(--surface); border-color: var(--line-2); color: var(--ink); }
.btn.secondary:hover { background: var(--surface-2); border-color: var(--muted); }
.btn.danger { background: var(--red); color: #fff; }
@media (prefers-color-scheme: dark) { .btn.danger { color: #2a0b0b; } }
.btn.danger-ghost { background: transparent; color: var(--red); border-color: color-mix(in srgb, var(--red) 35%, transparent); }
.btn.danger-ghost:hover { background: var(--red-soft); }
.btn.ghost-light { background: rgba(255, 255, 255, .06); color: #fff; border-color: rgba(255, 255, 255, .12); }
.btn.light { background: var(--surface); color: var(--ink); border-color: var(--line-2); }
.btn.tiny { min-height: 32px; padding: 4px 10px; font-size: 13px; border-radius: 8px; }
.btn.tiny .ic { width: 15px; height: 15px; }
.btn.on { background: var(--blue-soft); color: var(--blue); border-color: color-mix(in srgb, var(--blue) 30%, transparent); }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.as-btn { pointer-events: none; margin-top: auto; }
.icon-btn { display: inline-grid; place-items: center; width: 40px; height: 40px; border: 0; border-radius: 10px; background: transparent; color: var(--ink-2); }
.icon-btn:hover { background: var(--surface-2); }
.icon-btn .ic { width: 22px; height: 22px; }
.link { border: 0; background: none; padding: 4px 2px; color: var(--brand-ink); font-weight: 650; font-size: 14px; }
.link:hover { text-decoration: underline; }

/* ---------- cards & KPIs ---------- */
.card, .panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 18px; text-align: left; min-height: 124px; }
button.kpi:hover { border-color: var(--line-2); }
.kpi-label { font-size: 13.5px; font-weight: 650; color: var(--ink-2); }
.kpi strong { font-size: 34px; line-height: 1.1; letter-spacing: -0.03em; margin-top: 10px; font-variant-numeric: tabular-nums; }
.kpi small { font-size: 13px; color: var(--muted); }
.kpi.red strong { color: var(--red); } .kpi.amber strong { color: var(--amber); }
.kpi.red { border-color: color-mix(in srgb, var(--red) 28%, var(--line)); }

.nudges { display: grid; gap: 10px; margin-bottom: 18px; }
.nudge { display: flex; align-items: center; gap: 14px; padding: 14px 16px; background: var(--surface); border: 1px dashed var(--line-2); border-radius: var(--radius); }
.nudge > .ic { width: 24px; height: 24px; color: var(--brand-ink); }
.nudge div { flex: 1; min-width: 0; }
.nudge p { color: var(--muted); font-size: 14px; }

.two-col { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.panel { overflow: hidden; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.panel-head h2 { font-size: 16px; }
.panel-head p { color: var(--muted); font-size: 13.5px; margin-top: 2px; }
.panel-body { padding: 18px; }
.panel-body > * + * { margin-top: 14px; }
.panel-foot { padding: 12px 18px; border-top: 1px solid var(--line); }
.empty { padding: 36px 20px; text-align: center; color: var(--muted); display: grid; justify-items: center; gap: 12px; }
.empty .ic { width: 28px; height: 28px; color: var(--green); }

.rows { list-style: none; margin: 0; padding: 0; }
.rows li + li { border-top: 1px solid var(--line); }
.row-btn { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr) auto; align-items: center; gap: 12px; width: 100%; padding: 12px 18px; border: 0; background: transparent; text-align: left; }
.row-btn:hover { background: var(--surface-2); }
.lc-row { grid-template-columns: minmax(0, .9fr) minmax(0, 1.2fr) auto; }
.who strong, .what strong { display: block; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; }
.who small, .what small, td small { display: block; color: var(--muted); font-size: 13px; margin-top: 1px; }
.when { display: grid; justify-items: end; gap: 3px; text-align: right; }
.when small { font-size: 13px; color: var(--muted); }

.pills { display: inline-flex; gap: 5px; flex-wrap: wrap; }
.pill { display: inline-flex; align-items: center; padding: 3px 9px; border-radius: 99px; font-size: 12.5px; font-weight: 700; white-space: nowrap; line-height: 1.35; }
.pill.red { color: var(--red); background: var(--red-soft); }
.pill.amber { color: var(--amber); background: var(--amber-soft); }
.pill.green { color: var(--green); background: var(--green-soft); }
.pill.blue { color: var(--blue); background: var(--blue-soft); }
.pill.neutral { color: var(--neutral); background: var(--neutral-soft); }

.usage { display: grid; gap: 5px; min-width: 120px; }
.usage small { font-size: 13px; color: var(--muted); }
.bar { display: block; height: 8px; border-radius: 99px; background: var(--neutral-soft); overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--brand); border-radius: 99px; }
.bar.full > span { background: var(--amber); }
.bar.over > span { background: var(--red); }
.warn-ic { color: var(--red); vertical-align: -3px; }
.warn-ic .ic { width: 16px; height: 16px; }

.company-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.company { padding: 16px; display: grid; gap: 14px; }
.company-main { display: flex; align-items: center; gap: 12px; border: 0; background: none; padding: 0; text-align: left; }
.company-main strong { display: block; font-size: 15px; }
.company-main small { display: block; color: var(--muted); font-size: 13px; }
.mark { width: 40px; height: 40px; border-radius: 10px; background: var(--brand-soft); color: var(--brand-ink); display: grid; place-items: center; font-weight: 800; font-size: 14px; flex: none; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 0; }
.stats dt { font-size: 12px; color: var(--muted); }
.stats dd { margin: 0; font-size: 20px; font-weight: 750; font-variant-numeric: tabular-nums; }
.card-actions { display: flex; gap: 14px; border-top: 1px solid var(--line); padding-top: 10px; }

.steps { list-style: none; margin: 0; padding: 6px 0; counter-reset: s; }
.steps li { display: flex; align-items: center; gap: 14px; padding: 14px 18px; flex-wrap: wrap; }
.steps li + li { border-top: 1px solid var(--line); }
.steps li > div { flex: 1; min-width: 200px; }
.steps p { color: var(--muted); font-size: 14px; }
.steps li .btn + .btn { margin-left: 6px; }
.tick { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--line-2); display: grid; place-items: center; flex: none; counter-increment: s; }
.tick:empty::before { content: counter(s); font-size: 13px; font-weight: 750; color: var(--muted); }
.steps li.done .tick { background: var(--green); border-color: var(--green); color: var(--surface); }
.steps li.done strong { text-decoration: line-through; color: var(--muted); }
.tick .ic { width: 15px; height: 15px; }

/* ---------- filters ---------- */
.filters { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.filter-tools { display: flex; gap: 8px; flex-wrap: wrap; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip, .seg { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 6px 12px; border: 1px solid var(--line-2); border-radius: 99px; background: var(--surface); color: var(--ink-2); font-size: 13.5px; font-weight: 650; }
.chip .count { font-size: 12px; padding: 0 6px; border-radius: 99px; background: var(--neutral-soft); color: var(--neutral); }
.chip.active, .seg.active { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.chip.active .count { background: color-mix(in srgb, var(--surface) 20%, transparent); color: var(--surface); }
.segmented { display: inline-flex; gap: 0; }
.seg { border-radius: 0; }
.seg:first-child { border-radius: 99px 0 0 99px; } .seg:last-child { border-radius: 0 99px 99px 0; }
.seg + .seg { margin-left: -1px; }
.search { position: relative; display: flex; align-items: center; }
.search .ic { position: absolute; left: 11px; color: var(--muted); width: 16px; height: 16px; pointer-events: none; }
.search input { min-height: 40px; width: 270px; max-width: 100%; padding: 8px 12px 8px 34px; border: 1px solid var(--line-2); border-radius: var(--radius-sm); background: var(--surface); font-size: 14px; }
.search.grow { flex: 1 1 260px; max-width: 380px; margin-left: auto; }
.search.grow input { width: 100%; }

/* ---------- tables ---------- */
.rtable { width: 100%; border-collapse: collapse; }
.rtable th { padding: 11px 16px; font-size: 12.5px; font-weight: 700; letter-spacing: .02em; color: var(--muted); text-align: left; background: var(--surface-2); border-bottom: 1px solid var(--line); white-space: nowrap; }
.rtable td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; font-size: 14px; }
.rtable tr:last-child td { border-bottom: 0; }
.rtable td strong { display: block; font-weight: 650; }
.rtable tr.clickable { cursor: pointer; }
.rtable tr.clickable:hover td { background: var(--surface-2); }
.rtable tr.left td { color: var(--muted); }
.rtable tr.err td { background: var(--red-soft); }
.rtable .actions { text-align: right; white-space: nowrap; }
.rtable .actions .btn + .btn { margin-left: 6px; }
.rtable.compact td { padding: 9px 14px; }
.rtable tr.b-overdue td:first-child { box-shadow: inset 3px 0 0 var(--red); }
.rtable tr.b-soon td:first-child { box-shadow: inset 3px 0 0 color-mix(in srgb, var(--red) 55%, transparent); }

/* ---------- forms ---------- */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; border: 0; padding: 0; margin: 0; }
.field.wide { grid-column: 1 / -1; }
.field label, .field legend { font-size: 13.5px; font-weight: 650; color: var(--ink-2); padding: 0; }
.field input, .field select, .field textarea { width: 100%; min-height: 42px; padding: 9px 12px; border: 1px solid var(--line-2); border-radius: var(--radius-sm); background: var(--surface); font-size: 15px; }
.field textarea { resize: vertical; min-height: 72px; }
.field input[aria-invalid="true"], .field select[aria-invalid="true"] { border-color: var(--red); box-shadow: 0 0 0 3px var(--red-soft); }
.field-error { color: var(--red); font-size: 13px; font-weight: 600; }
.field-note { display: grid; gap: 4px; font-size: 13px; }
.field-note .ic { width: 15px; height: 15px; vertical-align: -3px; }
.hint { color: var(--muted); font-size: 12.5px; font-weight: 400; line-height: 1.45; }
.group { border: 0; padding: 0; margin: 20px 0 0; }
.group > legend, .group > summary, .group > h3 { font-size: 14px; font-weight: 750; margin-bottom: 12px; padding: 0; }
.group > summary { cursor: pointer; color: var(--brand-ink); }
.check { display: flex; gap: 10px; align-items: flex-start; margin-top: 12px; font-size: 14px; }
.check input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--brand); }
.check .hint { display: block; }
.radio-row { display: flex; gap: 16px; min-height: 42px; align-items: center; }
.radio-row label { display: flex; align-items: center; gap: 6px; font-weight: 500; font-size: 14px; }
.radio-row input { accent-color: var(--brand); width: 17px; height: 17px; }
.mini-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; }
.mini-list li { display: flex; gap: 8px; align-items: baseline; }
.mini-list small { color: var(--muted); }
.banner { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius-sm); font-size: 14px; }
.banner .ic { margin-top: 2px; }
.banner.info { background: var(--blue-soft); color: var(--ink); }
.banner.info .ic { color: var(--blue); }
.banner.warn { background: var(--amber-soft); color: var(--ink); }
.banner.warn .ic { color: var(--amber); }
.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.danger-zone { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.danger-zone p { font-size: 13.5px; }
.mapping summary { cursor: pointer; font-weight: 650; color: var(--brand-ink); padding: 4px 0; }
.mapping[open] summary { margin-bottom: 12px; }
.summary-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.sticky-actions { position: sticky; bottom: 0; display: flex; justify-content: flex-end; gap: 8px; background: var(--surface); }
.action-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.action { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 20px; text-align: left; cursor: pointer; min-height: 190px; border: 1px solid var(--line); font-size: 14px; }
.action:hover { border-color: var(--brand); }
.action:focus-within { outline: 2px solid var(--focus); }
.action strong { font-size: 16px; }
.action span:not(.btn) { color: var(--muted); }
.preview-img { display: block; max-width: 100%; max-height: 300px; margin: 12px auto 0; border-radius: var(--radius-sm); border: 1px solid var(--line); object-fit: contain; }
.digest { width: 100%; padding: 12px; border: 1px solid var(--line-2); border-radius: var(--radius-sm); background: var(--surface-2); font: 13px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; margin: 12px 0; resize: vertical; }

/* ---------- drawer & dialog ---------- */
.backdrop { position: fixed; inset: 0; background: rgba(5, 12, 24, .45); z-index: 60; animation: fade .15s ease; }
.drawer:focus { outline: none; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100%); background: var(--surface); z-index: 61; display: flex; flex-direction: column; box-shadow: var(--shadow-lg); animation: slide .18s ease; }
.drawer.wide { width: min(760px, 100%); }
.drawer-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.drawer-head h2 { font-size: 18px; }
.drawer-body { padding: 20px; overflow-y: auto; flex: 1; }
.drawer-body > .banner { margin-bottom: 14px; }
.drawer-actions { position: sticky; bottom: -20px; margin: 24px -20px -20px; padding: 14px 20px calc(14px + env(safe-area-inset-bottom)); display: flex; align-items: center; gap: 8px; background: var(--surface); border-top: 1px solid var(--line); }
.spacer { flex: 1; }
.dialog { position: fixed; z-index: 71; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(440px, calc(100% - 32px)); background: var(--surface); border-radius: 16px; padding: 22px; box-shadow: var(--shadow-lg); display: grid; gap: 14px; animation: pop .15s ease; }
.dialog-backdrop { z-index: 70; }
.dialog h2 { font-size: 18px; }
.dialog-body { color: var(--ink-2); display: grid; gap: 8px; font-size: 14.5px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
@keyframes fade { from { opacity: 0; } }
@keyframes slide { from { transform: translateX(30px); opacity: 0; } }
@keyframes pop { from { transform: translate(-50%, -48%); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

.toast { position: fixed; left: 50%; bottom: calc(22px + var(--tabbar-h) + env(safe-area-inset-bottom)); transform: translate(-50%, 12px); z-index: 90; display: flex; align-items: center; gap: 14px; max-width: min(560px, calc(100% - 24px)); padding: 12px 16px; border-radius: 12px; background: #13233b; color: #fff; font-size: 14px; box-shadow: var(--shadow-lg); opacity: 0; pointer-events: none; transition: opacity .18s, transform .18s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast-action { flex: none; border: 0; background: none; color: #a9c4ff; font-weight: 750; padding: 4px 2px; }

/* ---------- gate (setup / lock) ---------- */
.gate { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; background: radial-gradient(1200px 600px at 20% -10%, color-mix(in srgb, var(--brand) 14%, transparent), transparent), var(--bg); }
.gate-card { width: min(420px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 28px; box-shadow: var(--shadow-lg); display: grid; gap: 16px; }
.gate-card.wide { width: min(500px, 100%); }
.gate-card h1 { font-size: 24px; }
.brand.big { padding: 0; }
.brand.big strong { color: var(--ink); font-size: 18px; }
.brand.big small { color: var(--muted); font-size: 13px; }
.brand.big .logo { width: 44px; height: 44px; border-radius: 12px; }
.setup { display: grid; gap: 14px; }
.gate-alt { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding-top: 16px; border-top: 1px solid var(--line); }
.forgot summary { cursor: pointer; color: var(--brand-ink); font-weight: 650; font-size: 14px; }
.forgot p { margin: 10px 0; font-size: 14px; }
#unlock-error:empty { display: none; }

/* ---------- intro + sign-in ---------- */
.intro { width: min(480px, 100%); display: grid; gap: 18px; }
.intro-top { display: flex; align-items: center; justify-content: space-between; }
.intro-card { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 24px; box-shadow: var(--shadow-lg); display: grid; gap: 12px; touch-action: pan-y; animation: fadeup .22s ease; }
.intro-card h1 { font-size: 24px; outline: none; }
.intro-text { color: var(--ink-2); font-size: 16px; line-height: 1.55; }
.intro-foot { display: grid; gap: 16px; }
.intro-dots { display: flex; gap: 7px; justify-content: center; }
.intro-dots span { width: 8px; height: 8px; border-radius: 99px; background: var(--line-2); transition: width .2s, background .2s; }
.intro-dots span.on { width: 26px; background: var(--brand); }
.signin .intro-dots { justify-content: flex-start; }
.intro-nav { display: flex; justify-content: space-between; gap: 10px; }
.intro-nav .btn { min-width: 128px; }
@keyframes fadeup { from { opacity: 0; transform: translateY(8px); } }
.art { position: relative; height: 196px; border-radius: 16px; overflow: hidden; background: linear-gradient(135deg, color-mix(in srgb, var(--brand) 16%, var(--surface-2)), var(--surface-2) 70%); margin-bottom: 6px; }
.art-docs .doc { position: absolute; width: 64%; display: grid; gap: 0; padding: 8px 14px; line-height: 1.3; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); font-size: 13px; }
.art-docs .doc b { font-size: 14px; }
.art-docs .doc i { font-style: normal; color: var(--muted); }
.art-docs .dot { position: absolute; right: 12px; top: 14px; width: 9px; height: 9px; border-radius: 50%; }
.art-docs .d1 { left: 7%; top: 6%; transform: rotate(-3deg); } .art-docs .d1 .dot { background: var(--green); }
.art-docs .d2 { left: 20%; top: 36%; transform: rotate(2deg); } .art-docs .d2 .dot { background: var(--red); }
.art-docs .d3 { left: 31%; top: 66%; transform: rotate(-1.5deg); } .art-docs .d3 .dot { background: var(--amber); }
.art-list { display: grid; align-content: center; gap: 7px; padding: 16px 18px; }
.art-list .row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 12px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); font-size: 13.5px; font-weight: 600; }
.art-list .pill { font-style: normal; }
.art-lock { display: grid; place-items: center; align-content: center; gap: 14px; }
.art-lock .shield { width: 78px; height: 78px; border-radius: 22px; display: grid; place-items: center; background: var(--brand); color: var(--on-brand); box-shadow: 0 14px 30px color-mix(in srgb, var(--brand) 35%, transparent); }
.art-lock .shield .ic { width: 42px; height: 42px; }
.art-lock .chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.art-lock .chips span { display: inline-flex; align-items: center; gap: 5px; padding: 5px 10px; border-radius: 99px; background: var(--surface); border: 1px solid var(--line); font-size: 12.5px; font-weight: 650; }
.art-lock .chips .ic { width: 14px; height: 14px; }
.code-input { font: 650 26px/1.2 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace !important; letter-spacing: .4em; text-align: center; }
.form-error { color: var(--red); font-size: 14px; font-weight: 600; }
.form-error:empty { display: none; }
.signin-links { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 6px 12px; }
.link:disabled { color: var(--muted); cursor: default; text-decoration: none; }
.gate-card > .banner { margin: 0; }
.account-line { display: block; max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--nav-label); font-size: 12px; }
@media (max-width: 520px) {
  .intro-gate { align-items: start; }
  .intro-card { padding: 18px; }
  .intro-card h1 { font-size: 22px; }
  .art { height: 184px; }
  .art-list { gap: 5px; padding: 10px 12px; }
  .art-list .row { padding: 6px 10px; font-size: 13px; }
  .gate-card { padding: 22px; }
}

/* ---------- tabbar ---------- */
.tabbar { display: none; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .two-col, .settings-grid { grid-template-columns: 1fr; }
  .form-grid.three { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  :root { --tabbar-h: 64px; }
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: min(300px, 86vw); transform: translateX(-102%); transition: transform .2s ease; }
  .sidebar.open { transform: none; box-shadow: var(--shadow-lg); }
  .only-mobile { display: inline-grid; }
  .topbar { padding: 8px 12px; padding-top: max(8px, env(safe-area-inset-top)); }
  .topbar-title { display: block; }
  .scope-label { display: none; }
  .scope select { max-width: 52vw; }
  .page { padding: 18px 16px calc(32px + var(--tabbar-h) + env(safe-area-inset-bottom)); }
  .demo-banner { margin: 12px 16px 0; }
  .page-head h1 { font-size: 24px; }
  .action-grid { grid-template-columns: 1fr; }
  .action { min-height: 0; }
  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; height: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); background: var(--surface); border-top: 1px solid var(--line); }
  .tabbar button { position: relative; display: grid; justify-items: center; align-content: center; gap: 3px; border: 0; background: none; color: var(--muted); font-size: 11.5px; font-weight: 650; }
  .tabbar button .ic { width: 22px; height: 22px; }
  .tabbar button.active { color: var(--brand-ink); }
  .tabbar .badge { position: absolute; top: 6px; left: calc(50% + 6px); margin: 0; font-size: 11px; min-width: 18px; padding: 0 5px; }
}
@media (min-width: 861px) { .only-mobile { display: none; } }
@media (max-width: 720px) {
  .head-actions { width: 100%; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 6px; }
  .head-actions .btn { padding: 8px 6px; font-size: 13.5px; gap: 5px; }
  .demo-banner { padding: 8px 12px; font-size: 13px; flex-wrap: nowrap; }
  .demo-banner .extra { display: none; }
  .filters { flex-direction: column; align-items: stretch; flex-wrap: nowrap; }
  .chips { min-width: 0; }
  .filter-tools { display: grid; grid-template-columns: 1fr; }
  .search input, .filters select { width: 100%; max-width: none; }
  .search.grow { max-width: none; margin-left: 0; }
  .chips { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 2px; scrollbar-width: none; }
  .chip { flex: none; }
  .segmented { width: 100%; } .seg { flex: 1; justify-content: center; }
  .form-grid, .form-grid.three { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .row-btn, .lc-row { grid-template-columns: minmax(0, 1fr) auto; }
  .row-btn .what, .lc-row .usage { grid-column: 1; grid-row: 2; }
  .row-btn .when { grid-row: 1 / span 2; grid-column: 2; }
  .kpi { min-height: 108px; padding: 14px; }
  .kpi strong { font-size: 28px; }
  /* tables become cards */
  .rtable thead { display: none; }
  .rtable, .rtable tbody, .rtable tr, .rtable td { display: block; width: 100%; }
  .rtable tr { position: relative; padding: 12px 14px; border-bottom: 1px solid var(--line); }
  .rtable tr:last-child { border-bottom: 0; }
  .rtable td { padding: 2px 0; border: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; }
  .rtable td::before { content: attr(data-label); flex: 0 0 84px; font-size: 12.5px; font-weight: 650; color: var(--muted); }
  .rtable td.who { display: block; padding-bottom: 6px; padding-right: 0; }
  .rtable td.who::before { content: none; }
  .rtable td.who strong { font-size: 15.5px; }
  .rtable td.actions { display: flex; justify-content: flex-start; gap: 6px; padding-top: 10px; }
  .rtable td.actions::before { content: none; }
  .rtable td.actions .btn { flex: 1; }
  .rtable td.actions .btn + .btn { margin-left: 0; }
  .rtable td:not(.who):not(.actions) > strong, .rtable td > small { display: inline; }
  .rtable tr.b-overdue td:first-child, .rtable tr.b-soon td:first-child { box-shadow: none; }
  .rtable tr.b-overdue { box-shadow: inset 3px 0 0 var(--red); }
  .rtable tr.b-soon { box-shadow: inset 3px 0 0 color-mix(in srgb, var(--red) 55%, transparent); }
  .drawer { top: auto; height: calc(100% - 24px); width: 100%; border-radius: 18px 18px 0 0; animation-name: rise; }
  .gate-alt { grid-template-columns: 1fr; }
  .nudge { flex-wrap: wrap; }
  .nudge .btn { width: 100%; }
  .toast { flex-wrap: wrap; }
}
@keyframes rise { from { transform: translateY(40px); opacity: 0; } }

/* ---------- print (PRO hand-off list) ---------- */
@media print {
  :root { color-scheme: light; --bg: #fff; --surface: #fff; --surface-2: #f4f4f4; --ink: #000; --ink-2: #222; --muted: #444; --line: #bbb; --line-2: #999; --red: #a00; --red-soft: #fff; --amber: #7a4500; --amber-soft: #fff; --green: #075; --green-soft: #fff; --blue: #124; --blue-soft: #fff; --neutral-soft: #fff; }
  body { font-size: 11pt; background: #fff; }
  .sidebar, .topbar, .tabbar, .demo-banner, .head-actions, .filters, .footnote + *, .rtable .actions, .panel-foot, #toast, #drawer-host, #dialog-host, .skip { display: none !important; }
  .shell { display: block; }
  .page { padding: 0; max-width: none; }
  .page-head { margin-bottom: 8px; }
  .page-head .lede { display: none; }
  .print-only { display: block; margin-bottom: 10px; font-weight: 600; }
  .panel, .card { box-shadow: none; border: 0; }
  .rtable th, .rtable td { padding: 5px 8px; border-bottom: 1px solid #ccc; }
  .rtable tr { break-inside: avoid; }
  .rtable tr.b-overdue td:first-child, .rtable tr.b-soon td:first-child { box-shadow: none; }
  .pill { padding: 0; border: 0; font-weight: 700; }
  .pill + .pill::before { content: "· "; }
}
