/* RouteSheet — calm engineering UI. 4/8 pt rhythm, one accent, borders before shadows. */
:root {
  --bg: #f5f7fa;
  --surface: #ffffff;
  --ink: #142033;
  --muted: #5b6b80;
  --line: #d9e0e8;
  --line-strong: #c3ccd7;
  --accent: #1f5fbf;
  --accent-ink: #ffffff;
  --accent-soft: #e8f0fb;
  --head: #0b1a2e;
  --head-ink: #e6edf6;
  --ok: #17663d;
  --ok-soft: #e6f4ec;
  --warn: #8a5a00;
  --warn-soft: #fdf3dc;
  --bad: #b42318;
  --bad-soft: #fdecea;
  --focus: #1f5fbf;
  --radius: 6px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c1522; --surface: #121e2e; --ink: #e4ebf4; --muted: #9aa9bc; --line: #24344a; --line-strong: #31455f;
    --accent: #5b9bff; --accent-ink: #08111d; --accent-soft: #16294a; --head: #070e18; --head-ink: #e4ebf4;
    --ok: #5fd08f; --ok-soft: #10301f; --warn: #f0c062; --warn-soft: #2f240c; --bad: #ff8a80; --bad-soft: #3a1512;
    --focus: #8ab8ff; color-scheme: dark;
  }
}
* { 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; }
a { color: var(--accent); }
h1 { font-size: 24px; line-height: 32px; margin: 0; font-weight: 650; letter-spacing: -0.01em; }
h2 { font-size: 17px; line-height: 24px; margin: 0 0 12px; font-weight: 650; }
code { font-family: var(--mono); font-size: 13px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* top bar */
.top { display: flex; align-items: center; gap: 24px; padding: 0 24px; height: 56px; background: var(--head); color: var(--head-ink); }
.brand { display: flex; align-items: center; gap: 8px; color: inherit; text-decoration: none; font-weight: 700; letter-spacing: 0.01em; }
.brand .mark { width: 22px; height: 22px; color: #5fb4ff; }
.top nav { display: flex; gap: 4px; flex: 1; }
.top nav a { color: var(--head-ink); opacity: 0.78; text-decoration: none; padding: 8px 12px; border-radius: var(--radius); }
.top nav a:hover { opacity: 1; background: rgba(255,255,255,0.06); }
.top nav a[aria-current="page"] { opacity: 1; background: rgba(255,255,255,0.1); }
.top .signout .btn.ghost { color: #c5d0de; border-color: #3a4a60; background: transparent; }
.top .signout .btn.ghost:hover { background: rgba(255,255,255,0.06); }

main { max-width: 1120px; margin: 0 auto; padding: 24px 24px 64px; }
.head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 8px 0 16px; flex-wrap: wrap; }
.crumbs { font-size: 13px; color: var(--muted); }
.crumbs a { color: var(--muted); }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 24px; margin: 16px 0; }
.card.cta { display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap; border-color: var(--accent); }
.card.cta h2 { margin-bottom: 4px; }
.narrow, .narrow-card { max-width: 520px; }
.empty { background: var(--surface); border: 1px dashed var(--line-strong); border-radius: var(--radius); padding: 32px; margin: 16px 0; }
.empty p { color: var(--muted); max-width: 60ch; }

/* facts */
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin: 16px 0; }
.facts > div { padding: 12px 16px; box-shadow: 1px 0 0 var(--line), 0 1px 0 var(--line); }
.facts dt { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.facts dd { margin: 2px 0 0; font-weight: 600; font-variant-numeric: tabular-nums; }

/* tables */
table.list { width: 100%; border-collapse: collapse; background: var(--surface); }
.card table.list { margin: 0 0 16px; }
table.list th, table.list td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.list th { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
table.list td.num, table.list th.num { text-align: right; font-variant-numeric: tabular-nums; }
body > main > table.list { border: 1px solid var(--line); border-radius: var(--radius); }
.actions-cell { display: flex; gap: 8px; justify-content: flex-end; }

/* forms */
label { display: block; font-weight: 600; font-size: 14px; margin: 0 0 4px; }
label .unit { color: var(--muted); font-weight: 400; }
input, select, textarea { font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: var(--radius); padding: 8px 10px; width: 100%; min-height: 40px; }
textarea { font-family: var(--mono); font-size: 13px; }
input[type="checkbox"] { width: 18px; height: 18px; min-height: 0; vertical-align: -3px; margin-right: 6px; }
input[type="file"] { padding: 6px; }
.check { font-weight: 500; }
.stack { display: grid; gap: 4px; }
.stack .btn { margin-top: 12px; justify-self: start; }
.stack label { margin-top: 8px; }
.inline { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: end; }
.inline label { grid-column: 1 / -1; margin: 0; }
.mt { margin-top: 16px; }
.hint { color: var(--muted); font-size: 13px; margin: 4px 0 0; }
.err { color: var(--bad); font-size: 13px; margin: 4px 0 0; }
.has-error input, .has-error textarea { border-color: var(--bad); }
.upload { display: grid; gap: 8px; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); max-width: 640px; }
.upload .btn { justify-self: start; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: 16px 24px 24px; margin: 0 0 16px; }
legend { font-weight: 650; padding: 0 8px; font-size: 16px; }
.params .grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px 24px; margin-top: 8px; }
.params .field.wide { grid-column: 1 / -1; }
.actions { display: flex; gap: 8px; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 8px 16px;
  font: inherit; font-weight: 600; border-radius: var(--radius); border: 1px solid var(--line-strong); background: var(--surface);
  color: var(--ink); text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.ghost { background: transparent; color: var(--muted); }
.btn.danger { color: var(--bad); border-color: var(--bad); background: transparent; }
.btn.small { min-height: 32px; padding: 4px 10px; font-size: 13px; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }

/* status */
.pill { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); }
.pill.done, .pill.ready { background: var(--ok-soft); color: var(--ok); }
.pill.failed, .pill.error { background: var(--bad-soft); color: var(--bad); }
.pill.cancelled, .pill.purged { background: var(--bg); color: var(--muted); border: 1px solid var(--line); }
.alert { background: var(--bad-soft); color: var(--bad); border: 1px solid var(--bad); border-radius: var(--radius); padding: 12px 16px; }
.ok { background: var(--ok-soft); color: var(--ok); border: 1px solid var(--ok); border-radius: var(--radius); padding: 12px 16px; }
.ok p { margin: 4px 0; }
.warn { background: var(--warn-soft); color: var(--warn); border: 1px solid var(--warn); border-radius: var(--radius); padding: 12px 16px; }
.bad { color: var(--bad); }
.secret { font-size: 16px; padding: 4px 8px; background: var(--surface); border: 1px solid var(--ok); border-radius: 4px; user-select: all; }
.busy { display: flex; align-items: center; gap: 12px; }
.spinner { width: 16px; height: 16px; border: 2px solid var(--line-strong); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } }
.stage { font-weight: 650; margin: 0 0 12px; }
progress { width: 100%; height: 10px; appearance: none; border: 0; border-radius: 999px; background: var(--bg); overflow: hidden; }
progress::-webkit-progress-bar { background: var(--line); border-radius: 999px; }
progress::-webkit-progress-value { background: var(--accent); border-radius: 999px; }
progress::-moz-progress-bar { background: var(--accent); border-radius: 999px; }

/* downloads + sheets */
.downloads { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.sheets { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.sheets li { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.sheets .thumb { display: block; background: #fff; border-bottom: 1px solid var(--line); }
.sheets img { display: block; width: 100%; height: auto; aspect-ratio: 841 / 594; }
.sheets .cap { display: flex; flex-direction: column; gap: 0; padding: 8px 12px 0; font-size: 13px; font-variant-numeric: tabular-nums; }
.sheets .cap span { color: var(--muted); }
.sheets .links { display: flex; gap: 12px; padding: 4px 12px 10px; font-size: 13px; }

details.danger-zone summary { cursor: pointer; color: var(--muted); font-weight: 600; }
details.danger-zone[open] summary { margin-bottom: 16px; }

.auth { max-width: 400px; margin: 48px auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 32px; }
.auth h1 { margin-bottom: 4px; }

@media (max-width: 720px) {
  .top { padding: 0 16px; gap: 12px; }
  .top nav a { padding: 8px; }
  main { padding: 16px 16px 48px; }
  .card { padding: 16px; }
  .inline { grid-template-columns: 1fr; }
  table.list th:nth-child(n+4), table.list td:nth-child(n+4) { display: none; }
  .brand span { display: none; }
}
@media (max-width: 480px) {
  .top { padding: 0 12px; gap: 8px; }
  .top nav { gap: 0; }
  .top nav a { padding: 8px 6px; }
  .brand { font-size: 0; gap: 0; }
  .brand .mark { width: 24px; height: 24px; }
  .top .signout .btn { min-height: 36px; padding: 4px 10px; }
}
