
:root {
  color-scheme: light dark;
  --bg: #f6f7f9; --surface: #ffffff; --surface-2: #f0f2f5; --border: #dfe3e8; --text: #16191f; --muted: #5b6573;
  --accent: #2b59c3; --accent-ink: #ffffff; --accent-soft: #e6edfb; --danger: #c0392b; --danger-soft: #fbeae8;
  --ok: #1e7d4f; --ok-soft: #e3f4ea; --warn: #9a6400; --warn-soft: #fbf1dc;
  --radius: 10px; --shadow: 0 1px 2px rgb(16 24 40 / 6%), 0 1px 3px rgb(16 24 40 / 6%);
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; font-size: 15px; line-height: 1.5;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1216; --surface: #171b21; --surface-2: #1f242c; --border: #2c333d; --text: #e7eaee; --muted: #98a2b0;
    --accent: #7aa2ff; --accent-ink: #0b1020; --accent-soft: #1d2a4a; --danger: #ff7a6b; --danger-soft: #3a1d1a;
    --ok: #5fd39b; --ok-soft: #15301f; --warn: #f2c063; --warn-soft: #362a12;
    --shadow: none;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.5rem; margin: 0 0 0.25rem; letter-spacing: -0.01em; }
h2 { font-size: 1.1rem; margin: 2rem 0 0.75rem; }
h3 { font-size: 1rem; margin: 1.25rem 0 0.5rem; }
p { margin: 0.5rem 0; }
code { font-family: var(--mono); font-size: 0.9em; background: var(--surface-2); padding: 0.1em 0.35em; border-radius: 4px; }
pre { font-family: var(--mono); font-size: 0.85rem; white-space: pre-wrap; word-break: break-word; background: var(--surface-2);
  border: 1px solid var(--border); padding: 0.75rem; border-radius: 8px; margin: 0.5rem 0; }

/* Shell */
.topbar { position: sticky; top: 0; z-index: 10; background: var(--surface); border-bottom: 1px solid var(--border); }
.topbar-inner { max-width: 64rem; margin: 0 auto; padding: 0 1rem; display: flex; align-items: center; gap: 1rem; height: 3.25rem; }
.brand { font-weight: 700; color: var(--text); display: flex; align-items: center; gap: 0.45rem; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 1.4rem; height: 1.4rem; border-radius: 6px; background: var(--accent); color: var(--accent-ink);
  display: inline-grid; place-items: center; font-size: 0.75rem; font-weight: 800; }
.nav { display: flex; gap: 0.15rem; overflow-x: auto; flex: 1; scrollbar-width: none; }
.nav a { color: var(--muted); padding: 0.4rem 0.6rem; border-radius: 6px; white-space: nowrap; font-size: 0.92rem; }
.nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav a[aria-current='page'] { color: var(--text); background: var(--surface-2); font-weight: 600; }
.nav .count { display: inline-block; min-width: 1.2rem; padding: 0 0.35rem; margin-left: 0.3rem; border-radius: 999px;
  background: var(--danger); color: #fff; font-size: 0.72rem; font-weight: 700; text-align: center; line-height: 1.2rem; }
.account { color: var(--muted); font-size: 0.88rem; white-space: nowrap; max-width: 14rem; overflow: hidden; text-overflow: ellipsis; }
main { max-width: 64rem; margin: 0 auto; padding: 1.75rem 1rem 4rem; }
main.narrow { max-width: 30rem; padding-top: 3.5rem; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.subtitle { color: var(--muted); margin: 0; }

/* Building blocks */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; box-shadow: var(--shadow); }
.card + .card { margin-top: 0.75rem; }
.card > h2:first-child, .card > div:first-child > h2:first-child, .card > h3:first-child { margin-top: 0; }
.section { margin-top: 1.75rem; }
.grid { display: grid; gap: 0.75rem; grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr)); }
.grid > .card + .card { margin-top: 0; }
.tiles { display: grid; gap: 0.75rem; grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr)); margin-bottom: 1.5rem; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 0.85rem 1rem; color: var(--text); }
.tile:hover { text-decoration: none; border-color: var(--accent); }
.tile .num { font-size: 1.6rem; font-weight: 700; line-height: 1.2; }
.tile .label { color: var(--muted); font-size: 0.85rem; }
.tile.attention { border-color: var(--danger); background: var(--danger-soft); }
.stack > * + * { margin-top: 0.75rem; }
.row { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.spread { display: flex; justify-content: space-between; align-items: flex-start; gap: 0.75rem; flex-wrap: wrap; }
.muted { color: var(--muted); font-size: 0.9rem; }
.mono { font-family: var(--mono); font-size: 0.88rem; }
.empty { text-align: center; color: var(--muted); padding: 1.5rem 1rem; border: 1px dashed var(--border); border-radius: var(--radius); }
.badge { display: inline-block; padding: 0.05rem 0.5rem; border-radius: 999px; font-size: 0.75rem; font-weight: 600;
  background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); vertical-align: middle; }
.badge.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.badge.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge.danger { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.badge.accent { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.chips { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.chip { font-family: var(--mono); font-size: 0.75rem; padding: 0.05rem 0.45rem; border-radius: 4px; background: var(--surface-2); color: var(--muted); }
.notice { border-left: 3px solid var(--warn); background: var(--warn-soft); padding: 0.6rem 0.8rem; border-radius: 6px; }
.copy-row { display: flex; gap: 0.5rem; align-items: stretch; }
.copy-row code { flex: 1; display: flex; align-items: center; padding: 0.5rem 0.7rem; border: 1px solid var(--border); overflow-x: auto; white-space: nowrap; }
details { border: 1px solid var(--border); border-radius: 8px; padding: 0.5rem 0.75rem; background: var(--surface); }
details + details { margin-top: 0.5rem; }
summary { cursor: pointer; font-weight: 600; }

/* Forms */
form.stack, .form { max-width: 34rem; }
label { display: block; font-size: 0.9rem; font-weight: 600; }
label:has(> input[type='checkbox']), label:has(> input[type='radio']) { font-weight: 400; display: flex; gap: 0.5rem; align-items: baseline; }
input:not([type='checkbox']):not([type='radio']), select, textarea { width: 100%; font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: 8px; padding: 0.55rem 0.7rem; margin-top: 0.25rem; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: 0.75rem 1rem; margin: 0; }
legend { font-weight: 600; padding: 0 0.3rem; }
button, a.button { font: inherit; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  padding: 0.5rem 0.95rem; border-radius: 8px; border: 1px solid transparent; background: var(--accent); color: var(--accent-ink); cursor: pointer; }
a.button:hover { text-decoration: none; filter: brightness(1.05); }
button:hover { filter: brightness(1.05); }
button.secondary, a.button.secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
button.danger { background: var(--surface); color: var(--danger); border-color: var(--danger); }
button.small, a.button.small { padding: 0.25rem 0.6rem; font-size: 0.85rem; }
form.inline { display: inline; }
.actions { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.75rem; }

@media (max-width: 640px) {
  .topbar-inner { gap: 0.5rem; }
  .account { display: none; }
  h1 { font-size: 1.3rem; }
  main.narrow { padding-top: 2rem; }
}
