

:root {
  --bg: #f3f6f5; --surface: #ffffff; --surface-2: #eef3f2; --line: #d9e2e0; --line-strong: #c3cfcc;
  --fg: #16233b; --muted: #5b6b78; --faint: #8a98a3;
  --ink: #1b2a4a; --ink-fg: #e7edf6; --ink-muted: #9fb0c8; --ink-hover: #26385f;
  --accent: #127a73; --accent-fg: #ffffff; --accent-soft: #dff0ee; --accent-strong: #0d5f59;
  --hikari: #c9861c; --hikari-soft: #fbf0dc;
  --ok: #1f8a4c; --ok-soft: #e1f3e8; --warn: #b7791f; --warn-soft: #fbf1de; --bad: #c0392b; --bad-soft: #fbe5e2; --info: #2f5fa7; --info-soft: #e3ecf9;
  --shadow: 0 1px 2px rgba(22, 35, 59, .06), 0 2px 8px rgba(22, 35, 59, .05);
  --font-ui: "Plus Jakarta Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --r: 10px; --r-sm: 6px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1726; --surface: #16203a; --surface-2: #1b2744; --line: #2a3756; --line-strong: #3a4a6d;
    --fg: #e6ecf5; --muted: #a2b0c4; --faint: #77869d;
    --ink: #0b1220; --ink-fg: #e7edf6; --ink-muted: #8c9bb5; --ink-hover: #18233b;
    --accent: #3cb3a8; --accent-fg: #06201d; --accent-soft: #163a3a; --accent-strong: #6fd0c6;
    --hikari: #e8a945; --hikari-soft: #3a2d14;
    --ok: #4cc27f; --ok-soft: #173426; --warn: #e3a948; --warn-soft: #3a2e15; --bad: #ef7a6c; --bad-soft: #40211e; --info: #7fa7e8; --info-soft: #1c2b48;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1726; --surface: #16203a; --surface-2: #1b2744; --line: #2a3756; --line-strong: #3a4a6d;
  --fg: #e6ecf5; --muted: #a2b0c4; --faint: #77869d;
  --ink: #0b1220; --ink-fg: #e7edf6; --ink-muted: #8c9bb5; --ink-hover: #18233b;
  --accent: #3cb3a8; --accent-fg: #06201d; --accent-soft: #163a3a; --accent-strong: #6fd0c6;
  --hikari: #e8a945; --hikari-soft: #3a2d14;
  --ok: #4cc27f; --ok-soft: #173426; --warn: #e3a948; --warn-soft: #3a2e15; --bad: #ef7a6c; --bad-soft: #40211e; --info: #7fa7e8; --info-soft: #1c2b48;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3); color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; min-height: 100%; }
body { margin: 0; padding: 0; background: var(--bg); color: var(--fg); font-family: var(--font-ui); font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; overflow-x: hidden; }
h1, h2, h3, h4 { margin: 0; text-wrap: balance; line-height: 1.25; }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
.num, td.num, .tab { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--font-mono); font-size: .92em; letter-spacing: .01em; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }


.shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100%; }
.rail { background: var(--ink); color: var(--ink-fg); display: flex; flex-direction: column; gap: 4px; padding-block: 20px; padding-inline: 14px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 18px; border-bottom: 1px solid rgba(255,255,255,.08); margin-bottom: 10px; }
.brand-mark { width: 34px; height: 34px; border-radius: 8px; background: linear-gradient(135deg, var(--accent) 0%, var(--accent) 55%, var(--hikari) 55%); display: grid; place-items: center; font-weight: 800; color: #fff; font-size: 13px; letter-spacing: .02em; flex: none; overflow: hidden; }
.brand-mark-img { padding: 2px; background: var(--surface); }
.brand-mark-img img { width: 100%; height: 100%; object-fit: cover; border-radius: 6px; display: block; }
.brand-name { font-weight: 800; font-size: 15px; letter-spacing: .01em; }
.brand-sub { font-size: 11.5px; color: var(--ink-muted); }
.nav-group { font-size: 10.5px; text-transform: uppercase; letter-spacing: .09em; color: var(--ink-muted); padding: 14px 10px 4px; }
.nav a { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--ink-fg); text-decoration: none; padding: 8px 10px; border-radius: 7px; font-weight: 500; font-size: 13.5px; }
.nav a:hover { background: var(--ink-hover); }
.nav a.active { background: rgba(255,255,255,.1); box-shadow: inset 3px 0 0 var(--hikari); }
.nav .count { background: var(--hikari); color: #1b1300; border-radius: 99px; font-size: 11px; font-weight: 700; padding: 0 7px; min-width: 20px; text-align: center; }
.rail-foot { margin-top: auto; padding: 14px 10px 0; border-top: 1px solid rgba(255,255,255,.08); font-size: 12px; color: var(--ink-muted); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding-block: 12px; padding-left: max(24px, env(safe-area-inset-left, 0px)); padding-right: max(24px, env(safe-area-inset-right, 0px)); border-bottom: 1px solid var(--line); background: var(--surface); }
.topbar .who { margin-left: auto; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.btn.menu-btn { display: none; }
.content { padding-block: 24px 64px; padding-left: max(24px, env(safe-area-inset-left, 0px)); padding-right: max(24px, env(safe-area-inset-right, 0px)); max-width: 1240px; width: 100%; }

.demo-bar { background: var(--hikari-soft); border-bottom: 1px solid color-mix(in srgb, var(--hikari) 35%, transparent); padding-block: 8px; padding-left: max(24px, env(safe-area-inset-left, 0px)); padding-right: max(24px, env(safe-area-inset-right, 0px)); display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; font-size: 13px; }
.demo-bar .tag { font-weight: 700; color: var(--hikari); text-transform: uppercase; letter-spacing: .08em; font-size: 11px; }
.demo-bar .clock { display: flex; align-items: center; gap: 6px; }
.demo-bar .date { font-family: var(--font-mono); font-weight: 600; }


.page-head { display: flex; gap: 16px; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; margin-bottom: 20px; }
.eyebrow { font-size: 11.5px; text-transform: uppercase; letter-spacing: .09em; color: var(--muted); font-weight: 600; }
.page-head h1 { font-size: 24px; font-weight: 800; letter-spacing: -.01em; }
.page-head p { margin: 4px 0 0; color: var(--muted); max-width: 70ch; }
.section-title { font-size: 15px; font-weight: 700; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; justify-content: space-between; flex-wrap: wrap; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.lead { font-size: 15px; color: var(--muted); max-width: 68ch; }


.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.split { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; box-shadow: var(--shadow); min-width: 0; }
.card.flat { box-shadow: none; }
.card.tint { background: var(--surface-2); box-shadow: none; }
.card.attention { border-color: color-mix(in srgb, var(--hikari) 50%, var(--line)); background: color-mix(in srgb, var(--hikari-soft) 60%, var(--surface)); }

.stat { display: flex; flex-direction: column; gap: 4px; min-width: 0; overflow: hidden; }
.stat .label { font-size: 12px; color: var(--muted); font-weight: 600; }
.stat .value { font-size: clamp(15px, 1.35vw, 22px); font-weight: 800; letter-spacing: -.01em; font-variant-numeric: tabular-nums; word-break: break-word; overflow-wrap: anywhere; line-height: 1.25; }
.stat .hint { font-size: 12px; color: var(--muted); }

.kv { display: grid; grid-template-columns: minmax(130px, auto) minmax(0, 1fr); gap: 6px 16px; margin: 0; }
.kv dt { color: var(--muted); font-size: 13px; }
.kv dd { margin: 0; font-weight: 600; min-width: 0; overflow-wrap: anywhere; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; font-weight: 600; color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--surface-2); white-space: nowrap; }
td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
tr.total td { font-weight: 700; background: var(--surface-2); }
tr.link-row { cursor: pointer; }
tr.link-row:hover td { background: var(--accent-soft); }

.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.pill.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.pill.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.pill.info { background: var(--info-soft); color: var(--info); border-color: transparent; }
.pill.accent { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.grade { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 6px; font-weight: 800; font-size: 13px; background: var(--ink); color: var(--ink-fg); }
.grade.A { background: var(--ok); color: #fff; } .grade.B { background: var(--accent); color: var(--accent-fg); } .grade.C { background: var(--warn); color: #1b1300; } .grade.D { background: var(--bad); color: #fff; }

.progress { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; border: 1px solid var(--line); }
.progress > span { display: block; height: 100%; background: var(--accent); border-radius: 99px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--fg); padding: 8px 14px; border-radius: 8px; font-weight: 600; font-size: 13.5px; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.btn.primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); color: var(--accent-fg); }
.btn.danger { border-color: color-mix(in srgb, var(--bad) 45%, var(--line)); color: var(--bad); }
.btn.danger:hover { background: var(--bad-soft); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.sm { padding: 5px 10px; font-size: 12.5px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn.on-ink { background: transparent; color: var(--ink-fg); border-color: rgba(255,255,255,.2); }

form.form { display: grid; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field label { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.field .help { font-size: 12px; color: var(--faint); }
input:not([type]), input[type=text], input[type=number], input[type=email], input[type=password], input[type=date], input[type=tel], input[type=url], input[type=search], select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); min-width: 0;
}
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--accent) 40%, transparent); border-color: var(--accent); }
.checks { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.checks label { display: inline-flex; gap: 6px; align-items: center; font-weight: 500; color: var(--fg); font-size: 13px; }
.inline-form { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.inline-form .field { flex: 1 1 160px; }

.va-box { display: inline-flex; align-items: center; gap: 10px; flex-wrap: wrap; background: var(--surface-2); border: 1px dashed var(--line-strong); padding: 12px 14px; border-radius: var(--r); max-width: 100%; }
.va-box .va-text { min-width: 0; }
.va-box .va { font-family: var(--font-mono); font-size: 19px; font-weight: 700; letter-spacing: .06em; }

.notice { padding: 12px 14px; border-radius: var(--r); font-size: 13px; border: 1px solid var(--line); background: var(--surface-2); }
.notice.warn { background: var(--warn-soft); border-color: transparent; }
.notice.bad { background: var(--bad-soft); border-color: transparent; }
.notice.ok { background: var(--ok-soft); border-color: transparent; }
.notice.info { background: var(--info-soft); border-color: transparent; }

.tabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.tabs button { border: 0; background: transparent; padding: 8px 12px; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; cursor: pointer; font-size: 13px; }
.tabs button.active { color: var(--fg); border-bottom-color: var(--accent); }
.tabs .count { color: var(--faint); font-weight: 500; margin-left: 4px; }

.listing { display: flex; flex-direction: column; gap: 12px; }
.listing-top { display: flex; gap: 10px; align-items: flex-start; justify-content: space-between; }
.listing h3 { font-size: 15.5px; font-weight: 700; }
.listing .facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.listing .facts div { display: flex; flex-direction: column; }
.listing .facts span:first-child { font-size: 11.5px; color: var(--muted); }
.listing .facts span:last-child { font-weight: 700; font-variant-numeric: tabular-nums; }

.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0; }
.timeline li { flex: 1 1 0; min-width: 84px; position: relative; padding-top: 18px; font-size: 11.5px; color: var(--faint); text-align: center; }
.timeline li::before { content: ""; position: absolute; top: 5px; left: 0; right: 0; height: 2px; background: var(--line); }
.timeline li::after { content: ""; position: absolute; top: 0; left: calc(50% - 6px); width: 12px; height: 12px; border-radius: 50%; background: var(--surface); border: 2px solid var(--line-strong); }
.timeline li.done { color: var(--muted); }
.timeline li.done::before, .timeline li.done::after { background: var(--accent); border-color: var(--accent); }
.timeline li.now { color: var(--fg); font-weight: 700; }
.timeline li.now::after { background: var(--hikari); border-color: var(--hikari); box-shadow: 0 0 0 4px var(--hikari-soft); }

.bars { display: flex; flex-direction: column; gap: 8px; }
.bar-row { display: grid; grid-template-columns: 130px minmax(0, 1fr) 120px; gap: 10px; align-items: center; font-size: 13px; }
.bar-track { height: 10px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.bar-track span { display: block; height: 100%; border-radius: 99px; }

.contract { white-space: pre-wrap; font-size: 13px; line-height: 1.65; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; max-height: 420px; overflow-y: auto; }

.toast-wrap { position: fixed; right: max(16px, env(safe-area-inset-right, 0px)); bottom: calc(16px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; gap: 8px; z-index: 50; max-width: min(420px, calc(100vw - 32px)); }
.toast { background: var(--ink); color: var(--ink-fg); padding: 11px 14px; border-radius: 8px; box-shadow: 0 6px 24px rgba(0,0,0,.2); font-size: 13.5px; }
.toast.error { background: var(--bad); color: #fff; }
.modal-back { position: fixed; inset: 0; background: rgba(10, 16, 30, .45); display: grid; place-items: center; z-index: 40; padding: 16px; }
.modal { background: var(--surface); border-radius: 12px; padding: 20px; width: min(560px, 100%); max-height: 90vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,.25); display: flex; flex-direction: column; gap: 14px; }
.modal.wide { width: min(820px, 100%); }

.auth { min-height: 100vh; min-height: 100dvh; width: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; margin: 0; padding-block: 32px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); box-sizing: border-box; background: var(--ink); }
.auth .card { width: min(440px, 100%); }
.auth .brand { margin-bottom: 4px; }
.empty { text-align: center; padding: 36px 16px; color: var(--muted); }
.empty strong { display: block; color: var(--fg); font-size: 15px; margin-bottom: 4px; }
hr.sep { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }
.chip { display: inline-block; padding: 1px 8px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--line); font-size: 12px; color: var(--muted); }

@media (max-width: 980px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 820px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .rail { position: fixed; inset: 0 auto 0 0; width: min(280px, 85vw); z-index: 30; transform: translateX(-102%); transition: transform .2s ease; height: 100%; padding-top: calc(20px + env(safe-area-inset-top, 0px)); padding-left: max(14px, env(safe-area-inset-left, 0px)); }
  .rail.open { transform: none; box-shadow: 0 0 0 100vmax rgba(10,16,30,.4); }
  .btn.menu-btn { display: inline-flex; }
  .g3, .g2 { grid-template-columns: minmax(0, 1fr); }
  .listing .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bar-row { grid-template-columns: 96px minmax(0, 1fr) 96px; }
  .topbar, .content, .demo-bar { padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
}
@media (max-width: 480px) { .g4, .g5 { grid-template-columns: minmax(0, 1fr); } .kv { grid-template-columns: minmax(0, 1fr); gap: 0 0; } .kv dd { margin-bottom: 8px; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
