:root {
  color-scheme: light;
  --background: #eef3fb; --surface: #fff; --ink: #152b49; --muted: #536986;
  --line: #d5e1f1; --accent: #2057aa; --accent-ink: #fff; --quiet: #eaf2ff;
  --header: #103674; --header-end: #1d59a9; --warning: #813900; --radius: 17px;
  --editor-size: 16px; --space: 16px; --shadow: 0 5px 18px #143d7910;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--background); color: var(--ink);
}
:root[data-dark="true"] {
  color-scheme: dark; --background: #101a2b; --surface: #18253b; --ink: #edf4ff;
  --muted: #b0c0d8; --line: #334861; --quiet: #20364f; --warning: #ffca86;
  --header: #102b56; --header-end: #173c71; --shadow: none;
}
:root[data-style="modern"] { --radius: 12px; --space: 19px; --header: #114d56; --header-end: #146a76; }
:root[data-style="retro"] { --radius: 3px; --header: #1d462b; --header-end: #316545; font-family: ui-monospace, Menlo, monospace; }
:root[data-style="paper"] { --radius: 9px; --header: #634c2e; --header-end: #80653b; }
:root[data-style="paper"] h1, :root[data-style="paper"] h2 { font-family: Georgia, serif; }
:root[data-style="compact"] { --space: 11px; --radius: 10px; --header: #303d6a; --header-end: #4b558b; }
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }
button, select, input, textarea { font: inherit; }
button, select, input[type=date] { min-height: 44px; }
button { color: var(--accent); background: var(--quiet); border: 1px solid var(--line); border-radius: 10px; padding: 8px 13px; font-weight: 650; cursor: pointer; }
button:disabled { opacity: .55; cursor: default; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible { outline: 3px solid #568fe1; outline-offset: 2px; }
.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.full { width: 100%; margin-top: 10px; }
.sr { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.header { position: sticky; top: 0; z-index: 3; color: #fff; background: linear-gradient(120deg, var(--header), var(--header-end)); padding: max(13px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) 13px max(14px, env(safe-area-inset-left)); box-shadow: 0 3px 14px #102a5244; }
.brand, .context { max-width: 760px; margin: auto; display: flex; align-items: center; gap: 10px; }
.brand img { border-radius: 11px; box-shadow: 0 0 0 1px #ffffff60; }
.brand strong { display: block; font-size: clamp(18px, 5vw, 25px); letter-spacing: -.035em; }
.eyebrow { margin: 0 0 4px; font-weight: 750; font-size: .68rem; letter-spacing: .12em; }
.brand .eyebrow { color: #d3e7ff; }
.badge { margin-left: auto; max-width: 45%; text-align: center; font-size: .72rem; font-weight: 650; padding: 6px 8px; border-radius: 20px; background: #ffffff24; }
.context { justify-content: space-between; margin-top: 11px; flex-wrap: wrap; }
.day-label { display: block; }
.day-label input { padding: 6px 9px; background: #fff; color: #172d4e; font-size: 16px; border-radius: 10px; border: 0; }
.segments { display: flex; gap: 3px; background: #071c4550; border-radius: 12px; padding: 3px; }
.segments button { background: transparent; color: #fff; border-color: transparent; min-width: 55px; padding-inline: 9px; }
.segments button[aria-pressed="true"] { color: #12366e; background: #fff; }
main { max-width: 790px; margin: auto; padding: 16px 14px calc(90px + env(safe-area-inset-bottom)); }
section { display: grid; gap: var(--space); }
.page-title { display: flex; justify-content: space-between; align-items: flex-end; gap: 10px; }
.page-title .eyebrow { color: var(--muted); }
h1, h2, p { margin: 0; }
h1 { font-size: 1.7rem; line-height: 1.16; letter-spacing: -.035em; }
h2 { font-size: 1.05rem; line-height: 1.3; }
p, small { line-height: 1.45; }
.pill, .index { background: var(--quiet); color: var(--accent); border-radius: 9px; padding: 6px 8px; font-size: .75rem; font-weight: 700; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--space); box-shadow: var(--shadow); }
.card p, .hint { color: var(--muted); font-size: .86rem; margin-top: 5px; }
.card > label:not(.sr) { display: block; margin: 9px 0 5px; font-weight: 620; }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.card > button { margin-top: 9px; }
.card summary { min-height: 44px; display: flex; align-items: center; justify-content: space-between; font-weight: 700; cursor: pointer; }
.card summary::marker { content: ''; }
.card summary::before { content: '›'; margin-right: 9px; color: var(--accent); }
.card[open] summary::before { transform: rotate(90deg); }
.card summary span:first-child { margin-right: auto; }
.editor, .search, .field, select { width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 10px 11px; background: var(--background); color: var(--ink); font-size: 16px; }
.editor { margin-top: 10px; display: block; resize: vertical; font-family: ui-monospace, Menlo, monospace; font-size: var(--editor-size); }
.search { min-height: 44px; }
.actions { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; margin-top: 9px; }
.actions button { font-size: .86rem; }
.editor + .actions button { padding-inline: 9px; }
.route { min-height: 58px; display: flex; justify-content: space-between; text-align: left; gap: 10px; align-items: center; border-radius: var(--radius); background: var(--surface); color: var(--ink); }
.route small { display: block; color: var(--muted); font-weight: 450; }
.route > span:last-child { font-size: 1.45rem; color: var(--accent); }
.history { margin-top: 0; }
.notice { padding: 11px 12px; border: 1px solid var(--line); background: var(--surface); border-radius: 11px; margin-bottom: 14px; overflow-wrap: anywhere; }
.notice.error { color: var(--warning); }
.check { display: flex !important; align-items: center; gap: 8px; min-height: 44px; }
input[type=checkbox] { accent-color: var(--accent); width: 20px; height: 20px; flex: 0 0 auto; }
.list { display: grid; gap: 7px; }
.record { display: flex; align-items: center; width: 100%; text-align: left; gap: 9px; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; min-height: 50px; padding: 10px 12px; overflow-wrap: anywhere; }
.record strong, .record small { display: block; }
.record small { font-size: .78rem; color: var(--muted); }
.record strong { font-size: .92rem; }
.record .record-value { margin-left: auto; text-align: right; color: var(--accent); min-width: 65px; }
.record .record-issue { color: var(--warning); }
.token-total { display: grid; gap: 2px; color: #fff; background: linear-gradient(125deg, var(--header), var(--header-end)); border-radius: var(--radius); padding: var(--space); }
.token-total strong { font-size: clamp(1.45rem, 6vw, 2rem); font-variant-numeric: tabular-nums; }
.token-total small { color: #d3e7ff; }
.navigation { position: fixed; z-index: 4; bottom: 0; width: 100%; display: flex; justify-content: center; background: var(--surface); border-top: 1px solid var(--line); padding: 5px max(6px, env(safe-area-inset-right)) max(5px, env(safe-area-inset-bottom)) max(6px, env(safe-area-inset-left)); }
.navigation button { flex: 1 1 0; max-width: 152px; min-width: 0; padding: 5px 2px; background: transparent; color: var(--muted); border-color: transparent; font-size: .73rem; }
.navigation button span { display: block; font-size: 1.23rem; line-height: 1.15; }
.navigation [aria-current="page"] { background: var(--quiet); color: var(--accent); }
dialog { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--ink); width: min(94vw, 680px); max-height: min(88dvh, 850px); padding: 0; }
dialog[open] { display: flex; flex-direction: column; }
dialog::backdrop { background: #08182c99; }
dialog header, dialog footer { padding: 11px 13px; }
dialog header { display: flex; justify-content: space-between; align-items: center; gap: 9px; border-bottom: 1px solid var(--line); }
dialog footer { margin: 0 !important; border-top: 1px solid var(--line); }
.dialog-body { overflow: auto; overscroll-behavior: contain; padding: 13px; }
.dialog-body > * + * { margin-top: 9px; }
.dialog-body label:not(.check) { display: block; }
pre { white-space: pre-wrap; overflow-wrap: anywhere; margin: 0; padding: 10px; background: var(--background); border-radius: 8px; font: var(--editor-size)/1.43 ui-monospace, Menlo, monospace; }
.preview { white-space: pre; overflow: auto; }
mark { background: #ffeaa4; color: #24210f; }
mark.current { background: #f8b64e; }
.comparison { padding-left: 20px; overflow-wrap: anywhere; }
@media (min-width: 680px) { main { padding-top: 23px; } }
