/* Abi-Stand design plan
   Read: personal Abitur planner for DIA students, phone first and also on the desktop, with the calm
   document precision of a German Zeugnis. Dials: ENERGY 2 / RHYTHM 2 / MOTION 1.
   Color: neutrals tinted toward hue 264. One accent, "Koenigsblau": the royal-blue ink German pupils
   write with. It marks the active tab, selection, links, focus and the forecast, nothing else.
   Primary buttons are ink (near-black on light, near-white on dark), one per screen. Green / amber / red
   only mean pass / at risk / fail. The school logo sits on its own white plate in both themes.
   Type: Atkinson Hyperlegible Next everywhere, with tabular (fixed-width) digits: the app is mostly
   digits, and its distinct 0/8 and 1/7 keep grades from being misread. Scale 12/13/14/16/20/24/40/72.
   Space: 4px grid; 8 inside groups, 16 between related blocks, 32 between sections. Everything on one
   left edge: section titles, lists, buttons. Radius 6 cells, 10 controls, 14 panels, 18 sheets and bar.
   Shadow only on what floats: the tab bar and sheets.
   Motif: the 900-point ruler with the real grade marks, and the 11 x 4 half-year grid.
*/
:root {
  --bg: oklch(98.4% 0.004 264);
  --surface: oklch(99.8% 0.002 264);
  --surface-2: oklch(96.2% 0.007 264);
  --line: oklch(90.5% 0.009 264);
  --text: oklch(22% 0.016 264);
  --muted: oklch(48% 0.016 264);
  --faint: oklch(68% 0.012 264);
  --accent: oklch(46% 0.14 264);
  --accent-soft: oklch(94.5% 0.028 264);
  --accent-ink: oklch(37% 0.13 264);
  --ink: oklch(22% 0.016 264);
  --on-ink: oklch(99% 0.003 264);
  --good: oklch(50% 0.12 152);
  --warn: oklch(52% 0.11 65);
  --warn-soft: oklch(96% 0.04 85);
  --bad: oklch(51% 0.17 27);
  --bad-soft: oklch(95.5% 0.03 27);
  --plate: oklch(100% 0 0);
  --shadow-float: 0 1px 1px oklch(30% 0.03 264 / .06), 0 4px 10px oklch(30% 0.03 264 / .07), 0 14px 32px oklch(30% 0.03 264 / .10);
  --font: "Atkinson Hyperlegible Next", "Segoe UI", system-ui, -apple-system, sans-serif;
  --r-cell: 6px; --r-ctl: 10px; --r-panel: 14px; --r-big: 18px;
  --ease: cubic-bezier(0.23, 1, 0.32, 1);
  --bar-h: 64px;
  --gutter-l: max(16px, env(safe-area-inset-left, 0px));
  --gutter-r: max(16px, env(safe-area-inset-right, 0px));
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: oklch(17.5% 0.011 264); --surface: oklch(21% 0.013 264); --surface-2: oklch(25% 0.014 264);
    --line: oklch(100% 0 0 / 0.1); --text: oklch(94% 0.006 264); --muted: oklch(73% 0.013 264); --faint: oklch(56% 0.013 264);
    --accent: oklch(75% 0.1 264); --accent-soft: oklch(31% 0.06 264); --accent-ink: oklch(86% 0.07 264);
    --ink: oklch(94% 0.006 264); --on-ink: oklch(18% 0.012 264);
    --good: oklch(76% 0.12 152); --warn: oklch(82% 0.11 80); --warn-soft: oklch(32% 0.05 70);
    --bad: oklch(74% 0.14 25); --bad-soft: oklch(32% 0.06 25);
    --shadow-float: 0 1px 1px oklch(0% 0 0 / .3), 0 8px 24px oklch(0% 0 0 / .45);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: oklch(17.5% 0.011 264); --surface: oklch(21% 0.013 264); --surface-2: oklch(25% 0.014 264);
  --line: oklch(100% 0 0 / 0.1); --text: oklch(94% 0.006 264); --muted: oklch(73% 0.013 264); --faint: oklch(56% 0.013 264);
  --accent: oklch(75% 0.1 264); --accent-soft: oklch(31% 0.06 264); --accent-ink: oklch(86% 0.07 264);
  --ink: oklch(94% 0.006 264); --on-ink: oklch(18% 0.012 264);
  --good: oklch(76% 0.12 152); --warn: oklch(82% 0.11 80); --warn-soft: oklch(32% 0.05 70);
  --bad: oklch(74% 0.14 25); --bad-soft: oklch(32% 0.06 25);
  --shadow-float: 0 1px 1px oklch(0% 0 0 / .3), 0 8px 24px oklch(0% 0 0 / .45);
  color-scheme: dark;
}

/* ---- base ---- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 400 15px/1.5 var(--font); font-variant-numeric: tabular-nums; -webkit-font-smoothing: antialiased; }
::selection { background: var(--accent-soft); color: var(--accent-ink); }
h1, h2, h3, p, dl, dd { margin: 0; }
h1 { font-size: 20px; line-height: 1.2; font-weight: 600; letter-spacing: -0.01em; text-wrap: balance; }
h2 { font-size: 16px; line-height: 1.3; font-weight: 600; text-wrap: balance; }
a { color: var(--accent); text-underline-offset: 3px; }
button, input, select, textarea { font: inherit; color: inherit; }
button, a[href], select, summary, label[for], input[type="checkbox"], input[type="range"] { cursor: pointer; }
button:disabled { cursor: not-allowed; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
img { max-width: 100%; height: auto; display: block; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.link { color: var(--accent); font-weight: 500; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 12px; top: -48px; background: var(--ink); color: var(--on-ink); padding: 8px 12px; border-radius: var(--r-ctl); z-index: 50; }
.skip:focus { top: calc(12px + env(safe-area-inset-top, 0px)); }
.pad { padding: 24px; }

/* ---- brand: school logo on a white plate, app name under it ---- */
.brand { display: flex; align-items: center; gap: 12px; }
.logo-plate { background: var(--plate); border-radius: 10px; padding: 6px 8px; display: block; flex: none; box-shadow: 0 0 0 1px var(--line); }
.logo-plate img { width: 64px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.brand-text b { font-size: 16px; font-weight: 600; }
.brand-text span { font-size: 12px; color: var(--muted); }
.brand.big { flex-direction: column; align-items: flex-start; gap: 16px; }
.brand.big .logo-plate { padding: 12px 16px; border-radius: 14px; }
.brand.big .logo-plate img { width: 168px; }
.brand.big .brand-text b { font-size: 24px; letter-spacing: -0.02em; }
.brand.big .brand-text span { font-size: 14px; }
.brand.small { margin-top: 8px; opacity: .9; }

/* ---- shell ---- */
.app { min-height: 100dvh; }
.shell { display: grid; grid-template-columns: minmax(0, 1fr); min-height: 100dvh; }
.col { min-width: 0; }
.top {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 12px; min-height: 60px;
  padding: calc(8px + env(safe-area-inset-top, 0px)) var(--gutter-r) 8px var(--gutter-l);
  background: var(--bg); border-bottom: 1px solid transparent;
}
.top.scrolled { border-bottom-color: var(--line); }
.top h1 { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sync { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); white-space: nowrap; }
.sync .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--good); }
.sync.old .dot { background: var(--warn); }
.sync.err .dot { background: var(--bad); }
.sync.busy .dot { background: var(--accent); }
main { padding: 8px var(--gutter-r) 48px var(--gutter-l); min-width: 0; }
main:focus { outline: none; }
.view { display: flex; flex-direction: column; gap: 32px; max-width: 1040px; margin: 0 auto; }
.foot-note { max-width: 1040px; margin: 0 auto; padding: 0 var(--gutter-r) calc(var(--bar-h) + 40px + env(safe-area-inset-bottom, 0px)) var(--gutter-l); font-size: 12px; color: var(--muted); }

/* bottom tab bar on phones */
.tabbar {
  position: fixed; z-index: 20; left: max(12px, env(safe-area-inset-left, 0px)); right: max(12px, env(safe-area-inset-right, 0px));
  bottom: calc(12px + env(safe-area-inset-bottom, 0px)); height: var(--bar-h); max-width: 520px; margin: 0 auto;
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); padding: 6px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-big); box-shadow: var(--shadow-float);
}
.tab {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 44px;
  border: 0; background: none; border-radius: 12px; color: var(--muted); font-size: 11px; font-weight: 500; text-decoration: none;
}
.tab svg { width: 22px; height: 22px; }
.tab[aria-current="page"] { color: var(--accent-ink); background: var(--accent-soft); }
.side { display: none; }

@media (min-width: 960px) {
  .shell { grid-template-columns: 248px minmax(0, 1fr); }
  .side {
    display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100dvh;
    padding: calc(20px + env(safe-area-inset-top, 0px)) 12px 20px var(--gutter-l);
    border-right: 1px solid var(--line); background: var(--bg);
  }
  .side .brand { padding: 0 8px 24px; }
  .side .tab { flex-direction: row; justify-content: flex-start; gap: 12px; padding: 0 12px; font-size: 14px; width: 100%; }
  .side .tab svg { width: 20px; height: 20px; }
  .side .foot { margin-top: auto; }
  .tabbar, .only-phone { display: none; }
  main, .top { padding-left: 32px; padding-right: max(32px, env(safe-area-inset-right, 0px)); }
  .foot-note { padding: 0 32px 40px; }
}

/* ---- controls ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px;
  border-radius: var(--r-ctl); border: 1px solid var(--line); background: var(--surface); color: var(--text);
  font-weight: 600; font-size: 14px; text-decoration: none; white-space: nowrap;
}
.btn svg { width: 18px; height: 18px; }
.btn.primary { background: var(--ink); color: var(--on-ink); border-color: transparent; }
.btn.ghost { background: none; border-color: transparent; color: var(--accent); padding: 0 10px; }
.btn.danger { background: var(--bad); color: oklch(99% 0 0); border-color: transparent; }
.btn.danger-text { color: var(--bad); }
.btn.small { min-height: 38px; padding: 0 14px; font-size: 13px; }
.btn.ghost.small { padding: 0 8px; }
.btn.wide { width: 100%; }
.btn .spin { width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.iconbtn { width: 44px; height: 44px; display: grid; place-items: center; border-radius: var(--r-ctl); border: 1px solid var(--line); background: var(--surface); color: var(--text); flex: none; }
.iconbtn svg { width: 20px; height: 20px; }
@media (hover: hover) and (pointer: fine) {
  .btn:hover { border-color: var(--faint); }
  .btn.primary:hover { background: color-mix(in oklch, var(--ink) 86%, var(--accent)); }
  .btn.ghost:hover { background: var(--accent-soft); }
  .tab:hover { color: var(--text); }
  .iconbtn:hover { border-color: var(--faint); }
  .row-link:hover { background: var(--surface-2); }
  button.trow:hover { border-color: var(--faint); background: var(--surface-2); }
}
@media (prefers-reduced-motion: no-preference) {
  .btn, .iconbtn, .tab, .cell { transition: transform .15s var(--ease), background-color .15s var(--ease), border-color .15s var(--ease); }
  .btn:active, .iconbtn:active, button.cell:active { transform: scale(0.97); }
}
.seg { display: inline-flex; padding: 3px; gap: 3px; background: var(--surface-2); border-radius: 12px; max-width: 100%; }
.seg.wide { display: flex; }
.seg.wide button { flex: 1 1 0; }
.seg button { min-height: 40px; padding: 0 12px; border: 0; border-radius: 9px; background: none; color: var(--muted); font-weight: 500; font-size: 13px; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px oklch(30% 0.03 264 / .14); }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .field > .label { font-size: 13px; font-weight: 600; }
.hint { font-size: 12px; color: var(--muted); }
input[type="text"], input[type="password"], input[type="search"], select, textarea {
  width: 100%; min-height: 46px; padding: 0 12px; font-size: 16px; border-radius: var(--r-ctl);
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
}
input:focus-visible, select:focus-visible { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
.suffix { display: flex; align-items: stretch; }
.suffix input { border-radius: var(--r-ctl) 0 0 var(--r-ctl); }
.suffix span { display: flex; align-items: center; padding: 0 12px; border: 1px solid var(--line); border-left: 0; border-radius: 0 var(--r-ctl) var(--r-ctl) 0; background: var(--surface-2); color: var(--muted); font-size: 14px; }
.check-line { display: flex; gap: 10px; align-items: center; font-size: 14px; min-height: 44px; }
.check-line input { width: 20px; height: 20px; accent-color: var(--accent); }
input.pts-input { width: 72px; min-height: 46px; text-align: center; font-size: 18px; font-weight: 600; padding: 0; flex: none; }
.two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }

/* ---- blocks ---- */
.section { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.section > header { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 38px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panel); padding: 16px; display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.panel.flat { background: var(--surface-2); border-color: transparent; }
.panel.notice { background: var(--warn-soft); border-color: transparent; }
.panel.install { flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: space-between; }
.panel.install .grow { flex: 1 1 220px; display: flex; flex-direction: column; gap: 4px; }
.split { display: grid; gap: 32px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 960px) { .split { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); align-items: start; gap: 48px; } }
.list { display: flex; flex-direction: column; }
.list > * + * { border-top: 1px solid var(--line); }
.row { display: flex; align-items: center; gap: 12px; padding: 10px 0; min-width: 0; }
.row .grow { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.t { font-weight: 600; font-size: 14px; }
.s { font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.row-link { text-align: left; border: 0; background: none; border-radius: 10px; padding: 10px 8px; margin: 0 -8px; width: calc(100% + 16px); color: inherit; }
.tag { font-size: 11px; font-weight: 500; color: var(--muted); background: var(--surface-2); padding: 1px 6px; border-radius: 5px; margin-left: 4px; }

/* folded summaries (rule 3) */
details.summary > summary { list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 40px; }
details.summary > summary::-webkit-details-marker { display: none; }
details.summary > summary > svg { width: 18px; height: 18px; color: var(--muted); flex: none; }
@media (prefers-reduced-motion: no-preference) { details.summary > summary > svg, details.rule summary svg { transition: transform .2s var(--ease); } }
details.summary[open] > summary > svg { transform: rotate(180deg); }
details.summary > .checks, details.summary > ul, details.summary > .btn-row { margin-top: 8px; }

/* points badges: what a value IS shows in its fill, how GOOD it is in its color */
.pt { display: inline-flex; align-items: center; justify-content: center; min-width: 36px; height: 32px; padding: 0 6px; border-radius: var(--r-cell); font-weight: 600; font-size: 15px; background: var(--surface-2); color: var(--text); }
.pt.mine { background: var(--accent-soft); color: var(--accent-ink); }
.pt.none { background: none; color: var(--faint); font-weight: 400; }
.pt.risk { background: var(--warn-soft); color: var(--warn); }
.pt.fail { background: var(--bad-soft); color: var(--bad); }
.pt.check { box-shadow: inset 0 0 0 1.5px var(--warn); }
.pt.sm { min-width: 32px; height: 28px; font-size: 14px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 14px; height: 12px; border-radius: 3px; display: inline-block; }

/* ---- overview hero ---- */
.hero { display: flex; flex-direction: column; gap: 16px; }
.hero .label { font-size: 13px; color: var(--muted); font-weight: 500; }
.grade-line { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 12px; }
.grade { font-size: 72px; line-height: 1; font-weight: 600; letter-spacing: -0.03em; }
.of { font-size: 15px; color: var(--muted); }
.ruler { position: relative; height: 44px; margin: 4px 8px 0; }
.ruler .track { position: absolute; left: 0; right: 0; top: 10px; height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.ruler .fill { position: absolute; left: 0; top: 0; bottom: 0; background: var(--accent); border-radius: 3px; opacity: .28; }
.ruler .tick { position: absolute; top: 6px; width: 1px; height: 14px; background: var(--line); }
.ruler .tick.major { background: var(--faint); }
.ruler .tl { position: absolute; top: 26px; transform: translateX(-50%); font-size: 11px; color: var(--muted); white-space: nowrap; }
.ruler .marker { position: absolute; top: 0; width: 3px; height: 26px; margin-left: -1.5px; background: var(--accent); border-radius: 2px; }
.facts { display: flex; flex-wrap: wrap; gap: 8px 32px; }
.facts dt { font-size: 12px; color: var(--muted); }
.facts dd { font-size: 20px; font-weight: 600; }
.facts dd span { font-size: 13px; color: var(--muted); font-weight: 400; }
.next { font-size: 14px; font-weight: 500; }
.act { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding-top: 4px; }
.act p { max-width: 56ch; }
.checks { display: flex; flex-direction: column; gap: 10px; }
.chk { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; }
.chk svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.chk.ok svg { color: var(--good); } .chk.no svg { color: var(--bad); } .chk.wait svg { color: var(--faint); }
.chk .v { color: var(--muted); font-size: 13px; }

/* ---- subjects table and the 11 x 4 grid ----
   Every subject is its own box (owner 03.12.2026: "which is a subject, which is a button?").
   A whole box is one button where it opens the subject; in Einbringung only the cells can be tapped. */
.tbl { display: flex; flex-direction: column; gap: 6px; --cols: minmax(0, 1fr) repeat(4, 38px) 40px 14px; }
.tbl.ein { --cols: minmax(0, 1fr) repeat(4, 40px); }
@media (min-width: 720px) { .tbl { --cols: minmax(0, 1fr) repeat(4, 56px) 64px 16px; } .tbl.ein { --cols: minmax(0, 1fr) repeat(4, 56px); } }
.tbl .thead, .tbl .trow { display: grid; grid-template-columns: var(--cols); gap: 4px; align-items: center; }
.tbl .thead { padding: 0 11px; font-size: 12px; color: var(--muted); text-align: center; }
.tbl .thead .l { text-align: left; }
.trow { padding: 7px 10px; min-height: 52px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: inherit; text-align: left; width: 100%; }
button.trow { font: inherit; }
.trow > svg { width: 14px; height: 14px; color: var(--faint); justify-self: end; }
.trow .name { display: flex; flex-direction: column; justify-content: center; min-width: 0; gap: 2px; }
.trow .name b { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trow .name > span { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trow .c { display: flex; justify-content: center; }
.trow .avg { font-size: 14px; text-align: center; color: var(--muted); }
/* why a subject counts: required by rule (outlined), exam subject (solid blue), free (plain text) */
.why { font-style: normal; font-weight: 600; font-size: 11px; padding: 1px 6px; border-radius: 5px; margin-right: 2px; }
.why.must { color: var(--text); box-shadow: inset 0 0 0 1px var(--faint); }
.why.exam { background: var(--accent); color: var(--on-ink); }
.why.free { font-weight: 500; padding-left: 0; color: var(--muted); }
.narrow { max-width: 640px; }
.rules-t { --cols: minmax(0, 1fr) auto 14px; }
@media (min-width: 720px) { .rules-t { --cols: minmax(0, 1fr) auto 16px; } }
.rrow .cnt { font-size: 12px; color: var(--muted); white-space: nowrap; }
.cell { width: 40px; height: 34px; border-radius: var(--r-cell); border: 1px solid transparent; display: grid; place-items: center; font-weight: 600; font-size: 14px; padding: 0; }
.cell.in { background: var(--ink); color: var(--on-ink); }
.cell.ex { background: var(--accent); color: var(--on-ink); }
.cell.pick { background: var(--accent-soft); color: var(--accent-ink); }
.cell.out { background: none; border: 1px dashed var(--faint); color: var(--muted); font-weight: 400; }
.cell.empty { background: none; color: var(--faint); font-weight: 400; }
.cell.assumed { opacity: .7; }
.cell.fx-in { box-shadow: 0 0 0 2px var(--accent); }
.cell.fx-out { box-shadow: 0 0 0 2px var(--bad); }
.counter { display: flex; flex-wrap: wrap; gap: 8px 32px; }
.counter .n { font-size: 28px; font-weight: 600; line-height: 1.1; }
.counter .k { font-size: 12px; color: var(--muted); }
.edit-bar { display: flex; flex-direction: column; gap: 10px; padding: 12px 14px; border-radius: var(--r-panel); background: var(--accent-soft); color: var(--text); }

/* ---- subject page ---- */
.back { align-self: flex-start; margin-left: -10px; }
.term-tabs { display: flex; gap: 6px; overflow-x: auto; margin-top: -16px; }
.term-tabs button { min-height: 40px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); font-weight: 500; font-size: 14px; }
.term-tabs button[aria-pressed="true"] { background: var(--ink); color: var(--on-ink); border-color: transparent; }
.subject-head { display: flex; gap: 20px; align-items: center; }
.subject-head > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.big-pt { font-size: 56px; font-weight: 600; line-height: 1; min-width: 64px; }
.rulebox { background: var(--surface-2); border-radius: var(--r-panel); padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.eyebrow-plain { font-size: 13px; font-weight: 600; color: var(--muted); }
.rulebox .answer { font-size: 16px; font-weight: 600; }
.rulebox ul { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
.opts { display: flex; gap: 6px; flex-wrap: wrap; }
.opts span { min-width: 32px; height: 28px; display: inline-grid; place-items: center; border-radius: 8px; border: 1px solid var(--line); font-size: 13px; background: var(--surface); }
.opts span.off { opacity: .35; text-decoration: line-through; }
.opts span.on { background: var(--ink); color: var(--on-ink); border-color: transparent; }
.cat { display: flex; flex-direction: column; }
.cat + .cat { margin-top: 12px; }
.cat-h { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; font-weight: 600; padding-bottom: 2px; }
.field-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.panel button[type="submit"] { align-self: flex-start; }

/* ---- exams ---- */
.slots { display: flex; flex-direction: column; }
.slot { display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 12px; padding: 14px 0; }
.slot + .slot { border-top: 1px solid var(--line); }
.slot .no { font-weight: 600; font-size: 15px; width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; background: var(--surface-2); margin-top: 7px; }
.slot.zero .no { background: none; border: 1px dashed var(--faint); color: var(--muted); }
.slot .body { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.slot .pick { display: flex; align-items: center; gap: 10px; min-height: 46px; }
.slot .pick select { flex: 1 1 auto; width: auto; min-width: 0; }
.fixed-subject { flex: 1 1 auto; font-weight: 600; }
.slot .meta { font-size: 12px; color: var(--muted); }
.slot .kind { font-size: 12px; color: var(--muted); font-weight: 500; }
.slot .body { gap: 4px; }
.slot .no { margin-top: 20px; }
.slot .res { display: flex; align-items: center; gap: 10px; }
.slot .res:empty { display: none; }
.calc { font-size: 13px; color: var(--muted); white-space: nowrap; }
.slider { display: flex; align-items: center; gap: 10px; }
.slider input { flex: 1; accent-color: var(--accent); }
.eii h2 { font-weight: 500; }
.num-big { font-size: 40px; font-weight: 600; line-height: 1.1; }
.num-big span { font-size: 16px; color: var(--muted); font-weight: 400; }
.assumption { display: flex; flex-direction: column; gap: 8px; }
.err-list { display: flex; flex-direction: column; gap: 6px; }
.err { display: flex; gap: 8px; font-size: 14px; color: var(--bad); }
.err svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }

/* ---- rules ---- */
details.rule { border-top: 1px solid var(--line); }
details.rule:last-child { border-bottom: 1px solid var(--line); }
details.rule summary { list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 52px; font-weight: 600; font-size: 15px; }
details.rule summary::-webkit-details-marker { display: none; }
details.rule summary svg { width: 18px; height: 18px; color: var(--muted); flex: none; }
details.rule[open] summary svg { transform: rotate(180deg); }
details.rule .body { padding: 0 0 16px; display: flex; flex-direction: column; gap: 8px; max-width: 70ch; font-size: 14px; }
details.rule .src { font-size: 12px; color: var(--muted); }
.eq { display: flex; flex-wrap: wrap; align-items: stretch; gap: 8px; }
.eq .part { flex: 1 1 150px; display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); min-width: 0; }
.eq .part.total { background: var(--ink); color: var(--on-ink); }
.eq .part.total .k, .eq .part.total .s { color: inherit; opacity: .78; }
.eq .k { font-size: 12px; color: var(--muted); font-weight: 500; }
.eq .n { font-size: 28px; font-weight: 600; line-height: 1.15; }
.eq .s { font-size: 12px; color: var(--muted); }
.eq .op { align-self: center; font-size: 20px; color: var(--muted); }
@media (max-width: 559px) { .eq .op { display: none; } .eq .part { flex-basis: 100%; flex-direction: row; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; } .eq .n { font-size: 22px; order: -1; min-width: 48px; } }
.scale { display: flex; gap: 6px; }
.scale > div { flex: 1 1 0; display: flex; flex-direction: column; align-items: center; padding: 6px 2px; border: 1px solid var(--line); border-radius: 10px; min-width: 0; max-width: 96px; }
.scale b { font-size: 16px; }
.scale span { font-size: 12px; color: var(--muted); }
.h3 { font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.plain-list { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
.stack { display: flex; flex-direction: column; gap: 32px; min-width: 0; }
.xlist { display: flex; flex-direction: column; gap: 6px; }
.xrow { display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 12px; align-items: center; padding: 8px 10px; border: 1px solid var(--line); border-radius: 12px; }
.xrow .no { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; background: var(--surface-2); font-weight: 600; }

/* ---- login ---- */
.login { min-height: 100dvh; display: grid; place-items: center; padding: calc(24px + env(safe-area-inset-top, 0px)) var(--gutter-r) calc(24px + env(safe-area-inset-bottom, 0px)) var(--gutter-l); }
.login form { width: 100%; max-width: 400px; display: flex; flex-direction: column; gap: 18px; }
.login .lead { color: var(--muted); font-size: 15px; }
.login .seg { align-self: flex-start; }
.form-err { color: var(--bad); font-size: 14px; display: flex; gap: 8px; }
.form-err svg { width: 18px; height: 18px; flex: none; margin-top: 2px; }
details.plain summary { list-style: none; color: var(--accent); font-size: 14px; font-weight: 500; min-height: 44px; display: flex; align-items: center; }
details.plain summary::-webkit-details-marker { display: none; }
details.plain p { font-size: 13px; color: var(--muted); max-width: 60ch; }

/* ---- sheets ---- */
.sheet-bg { position: fixed; inset: 0; z-index: 40; background: oklch(15% 0.02 264 / .45); display: flex; align-items: flex-end; justify-content: center; }
.sheet { width: 100%; max-width: 560px; max-height: 90dvh; overflow: auto; background: var(--surface); border-radius: var(--r-big) var(--r-big) 0 0; box-shadow: var(--shadow-float);
  padding: 20px max(20px, env(safe-area-inset-right, 0px)) calc(20px + env(safe-area-inset-bottom, 0px)) max(20px, env(safe-area-inset-left, 0px)); display: flex; flex-direction: column; gap: 20px; }
.sheet form { display: flex; flex-direction: column; gap: 18px; }
.sheet .head { display: flex; align-items: center; gap: 12px; }
.sheet .head h2 { flex: 1; font-size: 18px; }
.sheet .actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.sheet .actions .spacer { flex: 1; }
.profile { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 14px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.profile > div { display: flex; flex-direction: column; gap: 2px; }
@media (min-width: 640px) { .sheet-bg { align-items: center; } .sheet { border-radius: var(--r-big); } }
@media (prefers-reduced-motion: no-preference) {
  .sheet-bg { animation: fade .18s var(--ease); }
  .sheet { animation: rise .22s var(--ease); }
}
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(12px) scale(0.98); } }
.toast { position: fixed; z-index: 60; left: 50%; transform: translateX(-50%); bottom: calc(var(--bar-h) + 28px + env(safe-area-inset-bottom, 0px)); background: var(--ink); color: var(--on-ink); padding: 10px 16px; border-radius: 12px; font-size: 14px; font-weight: 500; box-shadow: var(--shadow-float); max-width: calc(100vw - 32px); }
@media (min-width: 960px) { .toast { bottom: 28px; } }

/* ---- states ---- */
.state { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; padding: 20px 0; }
.state p { color: var(--muted); max-width: 52ch; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; } }

@media (min-width: 960px) { .iconbtn.only-phone { display: none; } }

/* LunchBell suggestion in settings (owner 03.12.2026): a plain card, the button stays secondary */
.panel.lunch { gap: 10px; padding: 14px; }
.lunch-dl { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
