:root {
  --green: #12614b;
  --green-ink: #ffffff;
  --orange: #c8651f;
  --paper: #f6f4ee;
  --surface: #ffffff;
  --ink: #14231f;
  --ink-soft: #596861;
  --line: #e2ddd2;
  --wash: #eef1ea;
  --good: #1d7a52;
  --warn: #9a6410;
  --bad: #b3362e;
  --focus: #c8651f;
  --shadow: 0 1px 2px rgba(20, 35, 31, 0.06), 0 4px 14px rgba(20, 35, 31, 0.05);
  --radius: 10px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --green: #3fb58c;
    --green-ink: #07130e;
    --orange: #f29a55;
    --paper: #0f1815;
    --surface: #16231e;
    --ink: #e8efea;
    --ink-soft: #9db0a7;
    --line: #2a3a33;
    --wash: #1b2b25;
    --good: #5bd19c;
    --warn: #e4b45a;
    --bad: #f07f76;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  }
}
:root[data-theme="dark"] {
  --green: #3fb58c;
  --green-ink: #07130e;
  --orange: #f29a55;
  --paper: #0f1815;
  --surface: #16231e;
  --ink: #e8efea;
  --ink-soft: #9db0a7;
  --line: #2a3a33;
  --wash: #1b2b25;
  --good: #5bd19c;
  --warn: #e4b45a;
  --bad: #f07f76;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

* { box-sizing: border-box; }
html { color-scheme: light dark; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 15px/1.5 var(--font); -webkit-text-size-adjust: 100%; }
h1, h2, h3 { line-height: 1.2; margin: 0; text-wrap: balance; }
h1 { font-size: 24px; letter-spacing: -0.01em; }
h2 { font-size: 17px; }
h3 { font-size: 14px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-soft); font-weight: 600; }
p { margin: 0; }
a { color: var(--green); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.mono, td.num, .num { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); font-size: 13px; word-break: break-all; }
.soft { color: var(--ink-soft); }
.small { font-size: 13px; }
.right { text-align: right; }

/* Shell */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.rail { background: var(--surface); border-right: 1px solid var(--line); padding: 20px 14px; display: flex; flex-direction: column; gap: 22px; position: sticky; top: 0; height: 100vh; }
.brand img { height: 30px; display: block; }
.brand-dark { display: none !important; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .brand-light { display: none !important; } :root:not([data-theme="light"]) .brand-dark { display: block !important; } }
:root[data-theme="dark"] .brand-light { display: none !important; }
:root[data-theme="dark"] .brand-dark { display: block !important; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { padding: 9px 12px; border-radius: 8px; color: var(--ink); text-decoration: none; font-weight: 500; }
.nav a:hover { background: var(--wash); }
.nav a[aria-current="page"] { background: var(--green); color: var(--green-ink); }
.who { margin-top: auto; display: grid; gap: 6px; padding-top: 14px; border-top: 1px solid var(--line); }
.who strong { display: block; overflow-wrap: anywhere; }
.main { padding: 28px clamp(16px, 4vw, 44px) 64px; max-width: 1180px; width: 100%; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head .sub { color: var(--ink-soft); margin-top: 4px; }
.stack { display: grid; gap: 18px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1 1 auto; }

@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .rail { position: static; height: auto; flex-direction: row; align-items: center; flex-wrap: wrap; gap: 10px 16px; padding: 12px 16px; border-right: 0; border-bottom: 1px solid var(--line); }
  .nav { flex-direction: row; overflow-x: auto; max-width: 100%; order: 3; flex: 1 0 100%; }
  .nav a { white-space: nowrap; padding: 8px 12px; }
  .who { margin: 0 0 0 auto; border: 0; padding: 0; grid-auto-flow: column; align-items: center; }
  .who .soft { display: none; }
  .main { padding-top: 20px; }
}

/* Surfaces */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; display: grid; gap: 14px; }
.card.flush { padding: 0; gap: 0; overflow: hidden; }
.card > header, .card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.card.flush > .card-head { padding: 14px 18px; border-bottom: 1px solid var(--line); }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.tile .label { color: var(--ink-soft); font-size: 13px; }
.tile .value { font-size: 22px; overflow-wrap: anywhere; font-weight: 650; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }

/* Tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; margin-bottom: 18px; }
.tabs a { padding: 10px 14px; text-decoration: none; color: var(--ink-soft); font-weight: 550; border-bottom: 3px solid transparent; white-space: nowrap; }
.tabs a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--orange); }

/* Tables */
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th { text-align: left; font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-soft); padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; }
tr.sub td { background: var(--wash); font-size: 13px; }
tr.sub td:first-child { padding-left: 32px; }
.empty { padding: 28px 18px; color: var(--ink-soft); text-align: center; }

/* Forms */
form { display: grid; gap: 12px; }
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; align-items: end; }
label { display: grid; gap: 5px; font-size: 13px; font-weight: 600; color: var(--ink-soft); }
label.check { display: flex; align-items: center; gap: 8px; font-weight: 500; color: var(--ink); }
input, select, textarea { background: var(--paper); border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; width: 100%; min-height: 40px; }
input[type="checkbox"] { width: 18px; min-height: 18px; accent-color: var(--green); }
input[type="file"] { padding: 7px; }
textarea { min-height: 84px; resize: vertical; }
input[readonly] { background: var(--wash); }
.hint { font-size: 12.5px; color: var(--ink-soft); font-weight: 400; }
button, .btn { background: var(--green); color: var(--green-ink); border: 0; border-radius: 8px; padding: 9px 16px; font-weight: 600; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; min-height: 40px; }
button:hover, .btn:hover { filter: brightness(1.08); }
button[disabled] { opacity: 0.55; cursor: progress; }
button.ghost, .btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
button.danger { background: var(--bad); color: #fff; }
button.small, .btn.small { padding: 5px 11px; min-height: 32px; font-size: 13px; }
.form-error { color: var(--bad); font-weight: 550; }
.notice { border: 1px solid var(--line); border-left: 4px solid var(--orange); background: var(--wash); border-radius: 8px; padding: 12px 14px; display: grid; gap: 8px; }
.notice.good { border-left-color: var(--good); }
.notice.bad { border-left-color: var(--bad); }
.secret { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.secret code { background: var(--paper); border: 1px solid var(--line); border-radius: 6px; padding: 6px 9px; word-break: break-all; font-family: var(--mono); font-size: 13px; }

/* Pills */
.pill { display: inline-block; width: fit-content; justify-self: start; padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 650; border: 1px solid currentColor; white-space: nowrap; }
.pill.good { color: var(--good); }
.pill.warn { color: var(--warn); }
.pill.bad { color: var(--bad); }
.pill.mute { color: var(--ink-soft); }

/* Toast */
#toasts { position: fixed; right: 16px; bottom: 16px; display: grid; gap: 8px; z-index: 50; max-width: min(380px, calc(100vw - 32px)); }
.toast { background: var(--ink); color: var(--paper); border-radius: 8px; padding: 11px 14px; box-shadow: var(--shadow); font-weight: 550; }
.toast.bad { background: var(--bad); color: #fff; }

/* Sign-in */
.center { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.sign { width: min(440px, 100%); display: grid; gap: 22px; }
.sign .brand img { height: 44px; }
.sign h1 { font-size: 22px; }

/* Discrepancy */
.disc { display: grid; gap: 8px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.disc:last-child { border-bottom: 0; }
.disc .kind { font-size: 12px; font-weight: 700; letter-spacing: 0.05em; color: var(--bad); }
.disc.resolved .kind { color: var(--ink-soft); }

@media (prefers-reduced-motion: no-preference) {
  .toast { animation: rise 0.18s ease-out; }
  @keyframes rise { from { transform: translateY(8px); opacity: 0; } }
}

.sign .fields { grid-template-columns: 1fr; }
