:root {
  --bg: #f6f7f9;
  --card: #ffffff;
  --text: #1c2430;
  --muted: #5b6676;
  --line: #d9dee6;
  --accent: #26547c;
  --accent-text: #ffffff;
  --good: #1f6f43;
  --good-bg: #e4f3ea;
  --warn: #8a4b08;
  --warn-bg: #fbefd9;
  --bad: #a12a2a;
  --bad-bg: #fae3e3;
  --radius: 12px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12161c; --card: #1b212a; --text: #e8ecf1; --muted: #a3adba; --line: #2e3742;
    --accent: #7fb2de; --accent-text: #0f1720;
    --good: #7fd3a3; --good-bg: #173326; --warn: #f0b572; --warn-bg: #3a2a12; --bad: #f09a9a; --bad-bg: #3d1c1c;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); }
h1 { font-size: 1.5rem; line-height: 1.25; margin: 0 0 6px; text-wrap: balance; }
h2 { font-size: 1.15rem; margin: 0 0 10px; }
h3 { font-size: 1rem; margin: 18px 0 6px; }
p { margin: 0 0 12px; }
.muted { color: var(--muted); font-size: 0.93rem; }
.small { font-size: 0.88rem; }

#top { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px; padding: 12px 16px; background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.brand { font-weight: 700; text-decoration: none; color: var(--text); }
#nav { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-left: auto; }
#nav a { text-decoration: none; padding: 4px 2px; }
#nav a[aria-current="page"] { text-decoration: underline; text-underline-offset: 5px; }
.count { display: inline-block; min-width: 1.4em; padding: 0 6px; margin-left: 4px; border-radius: 999px; background: var(--accent); color: var(--accent-text); font-size: 0.8rem; text-align: center; }

main { max-width: 860px; margin: 0 auto; padding: 20px 16px 64px; outline: none; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin: 0 0 16px; }
.card > :last-child { margin-bottom: 0; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.between { justify-content: space-between; }
.stack > * + * { margin-top: 12px; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }

button, .button { font: inherit; padding: 9px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--text); cursor: pointer; text-decoration: none; display: inline-block; }
button.primary, .button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
button.danger { color: var(--bad); border-color: var(--bad); }
button.link { border: 0; background: none; padding: 0; color: var(--accent); text-decoration: underline; }
button:disabled { opacity: 0.55; cursor: default; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

label { display: block; font-weight: 600; margin: 12px 0 4px; }
label.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; margin: 8px 0; }
label.check input { margin-top: 5px; flex: none; }
input[type="text"], input[type="email"], input[type="password"], input[type="time"], input[type="number"], select, textarea {
  font: inherit; width: 100%; padding: 9px 11px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--text);
}
textarea { min-height: 96px; resize: vertical; }
.inline-form { display: flex; gap: 8px; }
.inline-form input { flex: 1; min-width: 0; }
fieldset { border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; margin: 12px 0; }
legend { font-weight: 600; padding: 0 6px; }

.tabs { display: flex; flex-wrap: wrap; gap: 4px; margin: 14px 0 16px; border-bottom: 1px solid var(--line); }
.tabs a { padding: 8px 12px; text-decoration: none; border-bottom: 3px solid transparent; color: var(--muted); }
.tabs a[aria-current="page"] { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }

.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 0.85rem; background: var(--line); }
.pill.good { background: var(--good-bg); color: var(--good); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.bad { background: var(--bad-bg); color: var(--bad); }
.notice { border-left: 4px solid var(--warn); background: var(--warn-bg); color: var(--text); padding: 10px 14px; border-radius: 8px; margin: 0 0 14px; }
.notice.bad { border-left-color: var(--bad); background: var(--bad-bg); }
.notice.good { border-left-color: var(--good); background: var(--good-bg); }

ul.plain { list-style: none; margin: 0; padding: 0; }
ul.plain > li { padding: 10px 0; border-top: 1px solid var(--line); }
ul.plain > li:first-child { border-top: 0; padding-top: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 0; padding: 0; list-style: none; }
.chips li { display: inline-flex; align-items: center; gap: 6px; padding: 3px 4px 3px 10px; border: 1px solid var(--line); border-radius: 999px; font-size: 0.92rem; overflow-wrap: anywhere; }
.chips li.auto { border-style: dashed; }
.chips button { border: 0; background: none; padding: 0 6px; color: var(--muted); font-size: 1.05rem; line-height: 1; }
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 0.93rem; }
th, td { text-align: left; padding: 7px 10px 7px 0; border-top: 1px solid var(--line); vertical-align: top; }
th { border-top: 0; color: var(--muted); font-weight: 600; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.wrap { overflow-wrap: anywhere; }
code, .code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.95em; }
.bigcode { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 1.7rem; letter-spacing: 0.18em; font-weight: 700; }
dl.fields { display: grid; grid-template-columns: minmax(120px, max-content) 1fr; gap: 6px 16px; margin: 0; }
dl.fields dt { color: var(--muted); }
dl.fields dd { margin: 0; overflow-wrap: anywhere; }
#toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px; max-width: calc(100% - 32px); opacity: 0; pointer-events: none; transition: opacity 0.2s; }
#toast.show { opacity: 1; }
@media (prefers-reduced-motion: reduce) { #toast { transition: none; } }
[hidden] { display: none !important; }

/* Inputs inside a row size to their content instead of each taking a full line. */
.row > input[type="text"], .row > select { width: auto; flex: 1 1 180px; }
.row > input[type="time"] { width: auto; flex: 0 1 150px; }
td select { width: auto; min-width: 7em; }
td input[type="number"] { width: 5.5em; }
