:root {
  --bg: #f6f7f9; --surface: #ffffff; --text: #1b1f24; --muted: #667085; --border: #e3e6ea;
  --accent: #3b5bdb; --accent-ink: #ffffff; --accent-soft: #e7ecfd; --danger: #c92a2a;
  --good: #2f9e44; --warn: #e8a400; --radius: 12px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111317; --surface: #1a1d23; --text: #e7e9ec; --muted: #9aa3ae; --border: #2b3038;
    --accent: #7b93f5; --accent-ink: #0d1020; --accent-soft: #232a45; --danger: #ff6b6b;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.6rem; margin: .2em 0 .5em; line-height: 1.25; }
h2 { font-size: 1.05rem; margin: 0 0 .8em; }
code { background: var(--accent-soft); padding: 0 .3em; border-radius: 4px; font-size: .9em; }

.topbar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--border); }
.brand { font-weight: 700; color: var(--text); }
.topbar nav { display: flex; gap: 16px; align-items: center; }
.topbar nav a { color: var(--text); }
.wrap { max-width: 980px; margin: 0 auto; padding: 20px 16px 60px; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; margin-bottom: 16px; min-width: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid2 > .card { margin-bottom: 0; }
.grid2 + .card, .grid2 { margin-bottom: 16px; }
@media (max-width: 720px) { .grid2 { grid-template-columns: 1fr; } }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
@media (max-width: 720px) { .stats { grid-template-columns: repeat(2, 1fr); } }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; }
.stat .label { color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }
.stat .value { font-size: 1.7rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat .unit { font-size: .85rem; font-weight: 500; color: var(--muted); }

.meter { height: 8px; background: var(--accent-soft); border-radius: 99px; overflow: hidden; margin-top: 6px; }
.meter.small { height: 5px; }
.meter span { display: block; height: 100%; background: var(--accent); border-radius: 99px; }

.cheer { font-size: 1.05rem; color: var(--muted); margin: 0 0 14px; }

.stack { display: flex; flex-direction: column; gap: 10px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.row > label { flex: 1 1 140px; }
label { display: flex; flex-direction: column; gap: 4px; font-size: .85rem; color: var(--muted); }
input, select, textarea { font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--border);
  border-radius: 8px; padding: 8px 10px; width: 100%; }
textarea { resize: vertical; font-family: ui-monospace, Consolas, monospace; font-size: .9rem; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

.btn { display: inline-block; font: inherit; font-weight: 600; cursor: pointer; padding: 8px 14px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); text-align: center; }
.btn:hover { text-decoration: none; border-color: var(--accent); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.link { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); cursor: pointer; }
.danger { color: var(--danger); }
form.inline { display: inline; margin: 0; }

.bars { display: flex; gap: 8px; align-items: flex-end; height: 140px; margin-bottom: 14px; }
.bar { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; }
.bar .col { flex: 1; width: 100%; max-width: 34px; display: flex; align-items: flex-end;
  background: var(--accent-soft); border-radius: 6px; overflow: hidden; }
.bar .col span { width: 100%; background: var(--accent); }
.bar .lbl { font-size: .75rem; color: var(--muted); margin-top: 4px; }
.bar.today .lbl { color: var(--text); font-weight: 700; }
.bar .num { font-size: .7rem; color: var(--muted); height: 1em; }
.goal { margin-top: 4px; }

.nextlist { list-style: none; padding: 0; margin: 0; }
.nextlist li { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-top: 1px solid var(--border); flex-wrap: wrap; }
.nextlist li:first-child { border-top: 0; }
.grow { flex: 1 1 200px; min-width: 0; }
.strong { font-weight: 600; }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.error { color: var(--danger); font-weight: 600; }

.table { width: 100%; border-collapse: collapse; }
.table td { padding: 8px 6px; border-top: 1px solid var(--border); vertical-align: middle; }
.table tr:first-child td { border-top: 0; }
.lessons tr.done a { color: var(--muted); text-decoration: line-through; }
.lessons tr.skipped { opacity: .5; }
.check { width: 34px; }
.tick { width: 24px; height: 24px; border-radius: 6px; border: 2px solid var(--border); background: var(--bg);
  color: var(--good); font-weight: 700; cursor: pointer; padding: 0; line-height: 1; }
.prio { padding: 4px 6px; width: auto; font-size: .82rem; }
.lessons td.grow { overflow-wrap: anywhere; }

.pill { font-size: .75rem; padding: 2px 10px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); }
.pill.done { color: var(--good); }
.pill.paused { color: var(--warn); }

.crumbs { margin: 0; font-size: .85rem; color: var(--muted); }
.titlerow { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.titlerow h2 { margin: 0 0 .8em; }
.pager { display: flex; justify-content: space-between; margin: 0 0 14px; }

.prose { overflow-wrap: anywhere; }
.prose pre { background: var(--bg); border: 1px solid var(--border); padding: 12px; border-radius: 8px; overflow-x: auto; }
.prose pre code { background: none; padding: 0; }
.prose table { border-collapse: collapse; display: block; overflow-x: auto; }
.prose th, .prose td { border: 1px solid var(--border); padding: 4px 8px; }
.prose blockquote { margin: 0; padding-left: 12px; border-left: 3px solid var(--accent); color: var(--muted); }

.login { min-height: 80vh; display: grid; place-items: center; }
.login .card { width: 100%; max-width: 360px; }
.login h1 { margin-bottom: 0; }
