@font-face {
  font-family: "Instrument Sans";
  src: url("/static/fonts/instrument-sans-latin-wght-normal.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
}

:root {
  --bg: #ffffff;
  --bg-soft: #f6f8fb;
  --ink: #0a1a33;
  --ink-2: #3d4b63;
  --ink-3: #6b7891;
  --line: #e3e8ef;
  --line-2: #eef1f5;
  --brand: #2b59e8;
  --brand-600: #1f47cc;
  --brand-50: #eef3ff;
  --brand-100: #dce6ff;
  --red: #d93a40;
  --red-50: #fdeeee;
  --amber-ink: #985a00;
  --amber-50: #fff3dc;
  --green: #178a4c;
  --green-50: #e6f5ec;
  --shadow: 0 0 0 1px rgba(10, 26, 51, 0.06), 0 1px 2px rgba(10, 26, 51, 0.05), 0 8px 24px -12px rgba(10, 26, 51, 0.12);
  --font: "Instrument Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, "SFMono-Regular", "Cascadia Code", Menlo, Consolas, monospace;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg-soft);
  color: var(--ink);
  font: 0.9375rem/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand-600); text-underline-offset: 0.18em; }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.015em; }
p { margin: 0 0 0.75rem; }
p:last-child { margin-bottom: 0; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 6px; }
.muted { color: var(--ink-3); }
.small { font-size: 0.8125rem; }
.mono, code { font-family: var(--mono); font-size: 0.8125rem; }
.break { word-break: break-all; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.top-gap { margin-top: 16px; }
.grow { flex: 1 1 220px; }

/* shell */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 6px;
  padding: 18px 14px; background: var(--bg); border-right: 1px solid var(--line-2);
}
.brand { display: inline-flex; align-items: center; gap: 9px; color: var(--ink); text-decoration: none; font-weight: 600; font-size: 1rem; padding: 4px 8px; }
.brand b { font-weight: 500; color: var(--ink-3); }
.brand-lg { font-size: 1.125rem; margin-bottom: 20px; }
.mark { width: 26px; height: 26px; }
.mark rect { fill: var(--brand); }
.mark path { fill: none; stroke: #fff; stroke-width: 2.6; }
.beta {
  align-self: flex-start; margin: 0 8px 14px; padding: 1px 8px; border-radius: 999px;
  background: var(--brand-50); color: var(--brand-600); font-size: 0.6875rem; font-weight: 600;
}
.side-nav { display: grid; gap: 2px; }
.side-nav a { padding: 8px 10px; border-radius: 8px; color: var(--ink-2); text-decoration: none; font-weight: 500; }
.side-nav a:hover { background: var(--bg-soft); color: var(--ink); }
.side-nav a.active { background: var(--brand-50); color: var(--brand-600); }
.side-foot { margin-top: auto; padding: 12px 10px 0; border-top: 1px solid var(--line-2); font-size: 0.8125rem; }
.side-foot .org { font-weight: 600; }
.side-foot .who { color: var(--ink-3); word-break: break-all; }
.link-button { padding: 0; margin-top: 6px; border: 0; background: none; color: var(--brand-600); font: inherit; cursor: pointer; }
.main { padding: 28px 36px 64px; max-width: 1240px; width: 100%; }

/* page head */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { font-size: 1.625rem; letter-spacing: -0.025em; }
.page-head .sub { margin: 4px 0 0; color: var(--ink-2); }
.crumb { margin-bottom: 4px; color: var(--ink-3); font-size: 0.8125rem; }
.crumb a { color: var(--ink-3); }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* cards and layout */
.card { background: var(--bg); border-radius: 14px; box-shadow: var(--shadow); padding: 20px 22px; margin-bottom: 18px; min-width: 0; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.card-head h2 { font-size: 1.0625rem; }
.card-alert { box-shadow: 0 0 0 1px #f5c9cb, 0 8px 24px -12px rgba(217, 58, 64, 0.25); }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: start; }
.grid-2 > .card { margin-bottom: 0; }
.grid-2 + .card, .card + .grid-2 { margin-top: 18px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-bottom: 18px; }
.stat { display: flex; flex-direction: column; gap: 2px; padding: 18px 20px; border-radius: 14px; background: var(--bg); box-shadow: var(--shadow); color: var(--ink-2); text-decoration: none; }
.stat:hover { box-shadow: 0 0 0 1px var(--brand-100), var(--shadow); }
.stat-n { font-size: 1.75rem; font-weight: 600; color: var(--ink); letter-spacing: -0.03em; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 38px; padding: 0 14px; border: 0; border-radius: 9px;
  background: var(--bg); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line), 0 1px 2px rgba(10, 26, 51, 0.04);
  font: 550 0.875rem/1 var(--font); text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--bg-soft); }
.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 1px 2px rgba(10, 26, 51, 0.14); }
.btn-primary:hover { background: var(--brand-600); }
.btn-danger { background: var(--red); color: #fff; box-shadow: none; }
.btn-danger:hover { background: #bf2f35; }
.btn-sm { height: 30px; padding: 0 10px; font-size: 0.8125rem; border-radius: 8px; }

/* forms */
.stack { display: grid; gap: 14px; }
.row-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.field { display: grid; gap: 5px; margin: 0; border: 0; padding: 0; min-width: 0; }
.field > span, .field > legend { color: var(--ink-2); font-size: 0.8125rem; font-weight: 550; padding: 0; }
input, select, textarea {
  width: 100%; padding: 8px 10px; border: 0; border-radius: 8px;
  background: var(--bg); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line);
  font: 0.9375rem/1.4 var(--font);
}
input[type="checkbox"], input[type="radio"] { width: auto; box-shadow: none; accent-color: var(--brand); }
input[type="file"] { padding: 7px; }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: 0; }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px 14px; }
.check { display: flex; align-items: flex-start; gap: 8px; font-size: 0.875rem; color: var(--ink); font-weight: 400; }
.check input { margin-top: 3px; }
details > summary { cursor: pointer; color: var(--brand-600); font-weight: 550; }
details[open] > summary { margin-bottom: 10px; }

/* notices, pills */
.notice { margin-bottom: 16px; padding: 11px 14px; border-radius: 10px; font-size: 0.875rem; }
.notice-ok { background: var(--green-50); color: #0f5a32; }
.notice-warn { background: var(--amber-50); color: #6b4300; }
.notice-error { background: var(--red-50); color: #8f1d22; }
.pill { display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 999px; font-size: 0.75rem; font-weight: 600; white-space: nowrap; vertical-align: middle; }
.pill-red { background: var(--red-50); color: #b1262c; }
.pill-amber { background: var(--amber-50); color: var(--amber-ink); }
.pill-green { background: var(--green-50); color: #12683a; }
.pill-blue { background: var(--brand-50); color: var(--brand-600); }
.pill-grey { background: #eef1f5; color: var(--ink-2); }

/* tables */
.table-wrap { overflow-x: auto; background: var(--bg); border-radius: 14px; box-shadow: var(--shadow); margin-bottom: 18px; }
.card .table-wrap { box-shadow: inset 0 0 0 1px var(--line-2); border-radius: 10px; margin-bottom: 0; }
.table { width: 100%; border-collapse: collapse; }
.table th { padding: 10px 14px; background: #fafbfd; color: var(--ink-3); font-size: 0.75rem; font-weight: 550; text-align: left; white-space: nowrap; }
.table td { padding: 11px 14px; border-top: 1px solid var(--line-2); vertical-align: top; }
.table td a { text-decoration: none; }
.table td a:hover { text-decoration: underline; }
.vuln-link { display: inline-flex; align-items: center; gap: 6px; margin: 0 10px 4px 0; font-family: var(--mono); font-size: 0.8125rem; }
.tabs-line { display: flex; gap: 4px; margin-bottom: 14px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.tabs-line a { padding: 8px 12px; color: var(--ink-3); text-decoration: none; font-weight: 550; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs-line a.on { color: var(--ink); border-bottom-color: var(--brand); }

/* clocks */
.clocks { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.clock { display: grid; gap: 4px; padding: 14px; border-radius: 12px; box-shadow: inset 0 0 0 1px var(--line); align-content: start; }
.clock .btn { justify-self: start; margin-top: 6px; }
.clock-link { color: inherit; text-decoration: none; }
.clock-link:hover { box-shadow: inset 0 0 0 1px var(--brand-100); }
.clock-label { color: var(--ink-2); font-size: 0.8125rem; font-weight: 550; }
.clock-time { font-size: 1.5rem; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.clock-time.idle { color: var(--ink-3); font-size: 1.0625rem; padding: 4px 0; }
.clock-sub { color: var(--ink-3); font-size: 0.75rem; }
.clock-urgent { background: #fff8f8; box-shadow: inset 0 0 0 1px #f5c9cb; }
.clock-urgent .clock-time { color: var(--red); }
.clock-overdue { background: var(--red); box-shadow: none; }
.clock-overdue .clock-time, .clock-overdue .clock-label, .clock-overdue .clock-sub, .clock-overdue .muted { color: #fff; }
.clock-done { background: var(--green-50); box-shadow: none; }
.clock-done .clock-time { color: var(--green); }

/* decisions */
.decision { padding: 14px 0; border-top: 1px solid var(--line-2); }
.decision:first-of-type { border-top: 0; padding-top: 0; }
.decision-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; margin-bottom: 6px; }
.decide { margin-top: 6px; }
.segmented-input { display: inline-flex; flex-wrap: wrap; padding: 3px; border-radius: 10px; background: #f1f4f8; gap: 2px; }
.segmented-input label { position: relative; }
.segmented-input input { position: absolute; opacity: 0; inset: 0; }
.segmented-input span { display: block; padding: 6px 12px; border-radius: 8px; color: var(--ink-2); font-size: 0.8125rem; cursor: pointer; }
.segmented-input input:checked + span { background: var(--bg); color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(10, 26, 51, 0.12); }
.segmented-input input:focus-visible + span { outline: 2px solid var(--brand); }

/* drafts */
.draft-summary { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 10px; }
.draft-summary .ok { color: var(--green); }
.draft-summary .warn { color: var(--amber-ink); }
.draft { background: var(--bg); border-radius: 14px; box-shadow: var(--shadow); margin-bottom: 18px; }
.draft-row { display: grid; grid-template-columns: minmax(180px, 280px) 1fr auto; gap: 14px; align-items: start; padding: 12px 16px; border-top: 1px solid var(--line-2); }
.draft-row:first-child { border-top: 0; }
.draft-label { display: grid; gap: 2px; }
.draft-name { font-weight: 550; font-size: 0.875rem; }
.draft-status { color: var(--ink-3); font-size: 0.75rem; }
.draft-status.req { color: var(--brand-600); }
.draft-row.missing .draft-status, .draft-row.too-long .draft-status { color: var(--red); font-weight: 600; }
.draft-row.missing { background: #fffafa; }
.draft-value { white-space: pre-wrap; word-break: break-word; }
.copy.copied { background: var(--green-50); color: var(--green); }

/* misc */
.code { margin: 8px 0; padding: 12px 14px; border-radius: 10px; background: #f7f9fc; box-shadow: inset 0 0 0 1px var(--line-2); overflow-x: auto; font: 0.78rem/1.6 var(--mono); }
.plain { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.token-item { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.token-row { display: flex; gap: 10px; align-items: center; margin-top: 8px; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; margin: 12px 0; }
.facts dt { color: var(--ink-3); font-size: 0.8125rem; }
.facts dd { margin: 0; }
.prose { white-space: pre-wrap; font-size: 0.875rem; color: var(--ink-2); max-height: 360px; overflow: auto; }
.empty { padding: 36px 24px; margin-bottom: 18px; border-radius: 14px; background: var(--bg); box-shadow: var(--shadow); text-align: center; }
.empty h2 { font-size: 1.125rem; margin-bottom: 6px; }
.empty p { color: var(--ink-2); }
.checklist { margin: 0; padding-left: 20px; display: grid; gap: 6px; }
.checklist li.ok { color: var(--ink-3); text-decoration: line-through; }

/* sign-in */
.bare { background: radial-gradient(900px 500px at 80% -10%, #e7edff, transparent 60%), var(--bg-soft); }
.bare-main { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.auth { width: 100%; max-width: 400px; display: grid; justify-items: center; }
.auth-card { width: 100%; padding: 28px; border-radius: 16px; background: var(--bg); box-shadow: var(--shadow); }
.auth-card h1 { font-size: 1.375rem; margin-bottom: 8px; }
.auth-card p { color: var(--ink-2); }
.auth-card .btn { width: 100%; height: 42px; }
.auth-foot { margin-top: 18px; color: var(--ink-3); font-size: 0.8125rem; }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 10px 12px; border-right: 0; border-bottom: 1px solid var(--line-2); }
  .beta { margin: 0; }
  .side-nav { display: flex; flex-wrap: wrap; width: 100%; }
  .side-foot { display: none; }
  .main { padding: 20px 16px 48px; }
  .grid-2, .stats { grid-template-columns: 1fr; }
  .draft-row { grid-template-columns: 1fr; }
}
