/* ============================================================
   Passreif · telc B1 — styles
   Brand: Passreif Brand Spec (Oktober 2026). Palette from the German
   passport cover: bordeaux RAL 4004 (#6B1A37), gold (#C9A646), off-white
   (#FAF7F2). Surfaces are white/off-white (light) or near-black (dark);
   bordeaux and gold are reserved for buttons, links, active states,
   progress and small accents. Gold is never running text on light.
   Type: Rubik 400–600, headings 600.
   ============================================================ */
@font-face { font-family: "Rubik"; font-style: normal; font-weight: 400 600; font-display: swap; src: url("../assets/fonts/rubik-latin.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Rubik"; font-style: normal; font-weight: 400 600; font-display: swap; src: url("../assets/fonts/rubik-latin-ext.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }

:root {
  /* brand spec tokens */
  --pr-primary: #6b1a37;
  --pr-primary-dark: #4a1024;
  --pr-accent: #c9a646;
  --pr-bg: #faf7f2;
  --pr-text: #1f1b1e;
  /* roles (light) */
  --paper: var(--pr-bg);
  --surface: #ffffff;
  --surface-2: #fdfbf8;
  --sunken: #f3ede6;
  --line: #e8dfdc;
  --line-2: #ddd2cf;
  --ink: var(--pr-text);
  --ink-2: #4a4246;
  --ink-3: #5e555a;
  --ink-4: #8c8186;
  --heading: var(--pr-text);
  --primary: var(--pr-primary);
  --primary-strong: var(--pr-primary-dark);
  --primary-ink: #ffffff;
  --primary-soft: #f5e8ec;
  --on-primary-soft: #4a1024;
  --link: var(--pr-primary);
  --gold: var(--pr-accent);
  --marker: var(--pr-accent);           /* progress, active frame, today */
  --marker-soft: #fff6e5;
  --on-marker-soft: #6b4700;
  --track: #f0eae2; --field: #ffffff; --on-marker: #1a0e13; --on-ok: #ffffff;
  --ok: #0e7a4e; --ok-soft: #e2f4ea; --on-ok-soft: #0a5738;
  --warn: #8a5a00; --warn-soft: #fff6e5; --on-warn-soft: #6b4700;
  --bad: #c22a1f; --bad-soft: #fce9e6; --on-bad-soft: #8e1f16;
  --der: #1e3f8f; --die: #c22a1f; --das: #0e7a4e;
  /* nav band (white in light, canvas in dark); bordeaux only on the active item */
  --band: #ffffff;
  --band-raised: #f5e8ec;
  --on-band: var(--pr-text);
  --on-band-muted: #4a4246;
  --band-line: #e8dfdc;
  --band-accent: var(--pr-primary);
  /* legacy aliases used by inline styles in JS */
  --accent: var(--primary);
  --accent-2: var(--primary);
  --accent-3: var(--gold);
  --radius: 12px;
  --radius-s: 8px;
  --shadow: 0 1px 2px rgba(31,27,30,.06), 0 10px 30px -12px rgba(31,27,30,.12);
  --font-display: "Rubik", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-body: "Rubik", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --topbar-h: 56px;
  --tabbar-h: 60px;
  --sab: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}
/* dark roles, from the Flutter tokens (PassKlarColors.dark) */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --pr-accent: #d9b85c;
    --paper: #140c10; --surface: #1f1419; --surface-2: #261a20; --sunken: #2d2027;
    --line: #3a2b32; --line-2: #5b4651;
    --ink: #f6f1f3; --ink-2: #e4d9de; --ink-3: #bfb0b7; --ink-4: #93848b;
    --heading: #ffffff;
    --primary: #d9b85c; --primary-strong: #e8cd85; --primary-ink: #1a0e13;
    --primary-soft: #3d1a2a; --on-primary-soft: #e8cd85;
    --link: #d9b85c; --gold: #d9b85c; --marker: #d9b85c;
    --marker-soft: #2e2515; --on-marker-soft: #e8c97a; --track: #3a2b32; --field: #2a1c23; --on-marker: #1a0e13; --on-ok: #11291f;
    --ok: #4fd08d; --ok-soft: #11291f; --on-ok-soft: #7ee0ac;
    --warn: #e8c97a; --warn-soft: #2e2515; --on-warn-soft: #e8c97a;
    --bad: #ff7c6e; --bad-soft: #2e1512; --on-bad-soft: #ffb4aa;
    --der: #9db7ff; --die: #ff7c6e; --das: #4fd08d;
    --band: #140c10; --band-raised: #4a1024; --on-band: #f6f1f3; --on-band-muted: #cdbcc4; --band-line: #3a2b32; --band-accent: #d9b85c;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 12px 30px -12px rgba(0,0,0,.5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --pr-accent: #d9b85c;
  --paper: #140c10; --surface: #1f1419; --surface-2: #261a20; --sunken: #2d2027;
  --line: #3a2b32; --line-2: #5b4651;
  --ink: #f6f1f3; --ink-2: #e4d9de; --ink-3: #bfb0b7; --ink-4: #93848b;
  --heading: #ffffff;
  --primary: #d9b85c; --primary-strong: #e8cd85; --primary-ink: #1a0e13;
  --primary-soft: #3d1a2a; --on-primary-soft: #e8cd85;
  --link: #d9b85c; --gold: #d9b85c; --marker: #d9b85c;
  --marker-soft: #2e2515; --on-marker-soft: #e8c97a; --track: #3a2b32; --field: #2a1c23; --on-marker: #1a0e13; --on-ok: #11291f;
  --ok: #4fd08d; --ok-soft: #11291f; --on-ok-soft: #7ee0ac;
  --warn: #e8c97a; --warn-soft: #2e2515; --on-warn-soft: #e8c97a;
  --bad: #ff7c6e; --bad-soft: #2e1512; --on-bad-soft: #ffb4aa;
  --der: #9db7ff; --die: #ff7c6e; --das: #4fd08d;
  --band: #140c10; --band-raised: #4a1024; --on-band: #f6f1f3; --on-band-muted: #cdbcc4; --band-line: #3a2b32; --band-accent: #d9b85c;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 12px 30px -12px rgba(0,0,0,.5);
  color-scheme: dark;
}

/* ---------- base ---------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: var(--link); text-decoration-thickness: 1px; text-underline-offset: 2px; }
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 600; line-height: 1.18; margin: 0 0 .4em; letter-spacing: -.01em; text-wrap: balance; color: var(--heading); }
h1 { font-size: 2.1rem; }
h2 { font-size: 1.5rem; margin-top: 1.7em; }
h3 { font-size: 1.18rem; margin-top: 1.2em; }
h4 { font-size: 1rem; font-weight: 600; letter-spacing: 0; color: var(--ink); }
p { margin: 0 0 .9em; }
small, .muted { color: var(--ink-3); }
small { font-size: .84rem; }
b, strong { font-weight: 600; }
code, .mono { font-family: var(--font-mono); font-size: .92em; }
hr { border: 0; border-top: 1px solid var(--line); margin: 1.4rem 0; }
ul, ol { padding-left: 1.3em; margin: 0 0 .9em; }
li { margin: .25em 0; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 4px; }
::selection { background: color-mix(in srgb, var(--marker) 45%, transparent); }

/* ---------- shell ---------- */
.app { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; min-height: 100dvh; }
.side {
  background: var(--band);
  color: var(--on-band);
  border-right: 1px solid var(--band-line);
  padding: 14px 12px 12px;
  position: sticky; top: 0; height: 100vh; height: 100dvh; overflow: hidden;
  display: flex; flex-direction: column;
}
.brand { display: flex; flex-direction: column; gap: 5px; padding: 4px 10px 12px; margin-bottom: 2px; border-bottom: 1px solid color-mix(in srgb, var(--on-band) 16%, transparent); text-decoration: none; color: var(--on-band); }
.wordmark { display: block; height: 22px; width: auto; flex: 0 0 auto; --wm-pass: var(--on-band); --wm-rest: var(--band-accent); }
.brand span { display: block; font-size: .8rem; color: var(--on-band-muted); }
.nav { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; margin: 0 -4px; padding: 0 4px; }
.nav a { display: flex; align-items: center; gap: 8px; min-height: 34px; padding: 5px 10px 5px 12px; border-radius: 9px; color: var(--on-band-muted); text-decoration: none; font-size: .95rem; position: relative; }
.nav a:hover { background: color-mix(in srgb, var(--on-band) 10%, transparent); color: var(--on-band); }
.nav a.active { background: var(--band-raised); color: var(--primary); font-weight: 600; }
.nav a.active::before { content: ""; position: absolute; left: 0; top: 7px; bottom: 7px; width: 4px; border-radius: 4px; background: var(--band-accent); }
.nav .grp { font-size: .74rem; color: var(--band-accent); padding: 12px 12px 3px; font-weight: 600; }
.nav .num { margin-left: auto; font-size: .76rem; color: var(--on-band-muted); font-weight: 400; }
.side-foot { margin-top: 10px; padding: 14px 12px 10px; border-radius: 12px; background: color-mix(in srgb, var(--band-raised) 50%, var(--band)); border: 1px solid color-mix(in srgb, var(--gold) 45%, transparent); font-size: .82rem; color: var(--on-band-muted); }
.side-foot small, .side-foot .muted { color: var(--on-band-muted); font-size: .8rem; }
.side-foot .sf-days { display: grid; grid-template-columns: auto 1fr; column-gap: 10px; align-items: center; color: var(--on-band); line-height: 1.15; }
.side-foot .sf-days b { font-size: 2.1rem; font-weight: 600; letter-spacing: -.02em; color: var(--band-accent); font-variant-numeric: tabular-nums; line-height: 1; }
.side-foot .sf-days span { font-size: .84rem; font-weight: 500; color: var(--on-band); display: block; }
.side-foot .sf-days .sf-date { display: block; font-weight: 400; color: var(--on-band-muted); font-size: .78rem; margin-top: 1px; }
.side-foot .progress { margin: 10px 0 6px; height: 6px; background: color-mix(in srgb, var(--on-band) 12%, transparent); }
.side-foot .progress > i { background: var(--marker); }
.side-foot .sf-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.side-foot .iconbtn { color: var(--on-band); width: 34px; height: 34px; border-color: color-mix(in srgb, var(--on-band) 20%, transparent); }
.side-foot .iconbtn:hover { background: color-mix(in srgb, var(--on-band) 12%, transparent); color: var(--on-band); }
.iconbtn { color: var(--on-band-muted); }
.side-foot .iconbtn:hover { background: color-mix(in srgb, var(--on-band) 12%, transparent); color: var(--on-band); }
.side-foot .sf-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; }
.iconbtn { display: inline-grid; place-items: center; width: 40px; height: 40px; padding: 0; border-radius: 10px; border: 1px solid transparent; background: transparent; color: var(--ink-2); cursor: pointer; }
.iconbtn:hover { background: var(--sunken); color: var(--ink); border-color: transparent; }
.iconbtn svg { width: 20px; height: 20px; }
.main { padding: 32px 44px 96px; width: 100%; max-width: 1120px; margin: 0 auto; min-width: 0; }
@media (min-width: 1500px) { .main { max-width: 1240px; padding-inline: 56px; } .app { grid-template-columns: 264px minmax(0, 1fr); } }
.main > .kicker { margin-bottom: 6px; }
.main > h1 { margin-bottom: .35em; }
.topbar, .tabbar, .backdrop { display: none; }

/* ---------- phone / small laptop ---------- */
@media (max-width: 860px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; z-index: 40; left: 0; top: 0; bottom: 0; width: min(300px, 86vw); height: 100vh; height: 100dvh; transform: translateX(-102%); transition: transform .24s cubic-bezier(.2,.8,.2,1); box-shadow: none; padding-bottom: calc(16px + var(--sab)); }
  .side.open { transform: none; box-shadow: 0 0 60px rgba(0,0,0,.35); }
  .backdrop { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(10,12,20,.45); opacity: 0; pointer-events: none; transition: opacity .2s; }
  body.drawer-open .backdrop { opacity: 1; pointer-events: auto; }
  body.drawer-open { overflow: hidden; }
  .topbar { display: flex; align-items: center; gap: 8px; height: var(--topbar-h); padding: 0 10px 0 8px; background: var(--band); color: var(--on-band); border-bottom: 1px solid var(--band-line); position: sticky; top: 0; z-index: 30; }
  .topbar .iconbtn { color: var(--on-band); }
  .topbar .iconbtn:hover { background: color-mix(in srgb, var(--on-band) 12%, transparent); color: var(--on-band); }
  .topbar .tb-title { flex: 1; min-width: 0; font-weight: 600; font-size: 1.1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .topbar .tb-count { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 999px; background: var(--marker); color: var(--on-marker); font-size: .8rem; font-weight: 600; text-decoration: none; }
  .topbar .tb-count:empty { display: none; }
  .main { padding: 16px 16px calc(var(--tabbar-h) + var(--sab) + 28px); max-width: none; }
  h1 { font-size: 1.7rem; }
  h2 { font-size: 1.3rem; }
  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; height: calc(var(--tabbar-h) + var(--sab)); padding: 0 4px var(--sab); background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px); border-top: 1px solid var(--line); }
  .tabbar a, .tabbar button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; padding: 6px 2px 4px; border: 0; background: transparent; color: var(--ink-3); text-decoration: none; font: inherit; font-size: .68rem; font-weight: 500; border-radius: 10px; min-height: 44px; -webkit-tap-highlight-color: transparent; }
  .tabbar svg { width: 24px; height: 24px; }
  .tabbar .active { color: var(--primary); }
  .tabbar .active svg { filter: drop-shadow(0 0 0 transparent); }
  .tabbar .active span { position: relative; }
  .tabbar .active { color: var(--primary); font-weight: 600; }
  .tabbar .active span::after { content: ""; position: absolute; left: -2px; right: -2px; bottom: -1px; height: 5px; z-index: -1; background: color-mix(in srgb, var(--marker) 55%, transparent); border-radius: 2px; }
  .main .side-note { display: none; }
}
@media (hover: none) and (pointer: coarse) {
  button, .btn { min-height: 44px; }
  button.small { min-height: 36px; }
  button.say { min-height: 28px; }
  .kbd-hint { display: none !important; }
  input, select, textarea { font-size: 16px; }
}

/* ---------- boot ---------- */
.loading { display: grid; gap: 12px; max-width: 720px; padding-top: 6px; }
.skel { height: 14px; border-radius: 7px; background: linear-gradient(90deg, var(--sunken) 0%, color-mix(in srgb, var(--sunken) 60%, var(--surface)) 50%, var(--sunken) 100%); background-size: 200% 100%; animation: skel 1.2s linear infinite; }
.skel.skel-h { height: 30px; width: 40%; border-radius: 9px; }
.skel.short { width: 60%; }
@keyframes skel { from { background-position: 200% 0; } to { background-position: -200% 0; } }
body.ready .loading { display: none; }

/* ---------- surfaces ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 16px; }
.card.tight { padding: 12px 14px; }
.card:has(> table), .card:has(> div > table) { overflow-x: auto; }
.card.setup { border-color: var(--marker); border-width: 1.5px; }
.card.hero { background: linear-gradient(180deg, var(--marker-soft) 0, var(--surface) 120px); }
.grid { display: grid; gap: 14px; }
.grid.c2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid.c3 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }
.kicker { font-size: .84rem; color: var(--ink-3); font-weight: 400; margin-bottom: 4px; }
.big { font-size: 2.2rem; line-height: 1; font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; color: var(--heading); }
.big small { color: var(--ink-3); font-weight: 500; }
.stat { display: flex; flex-direction: column; gap: 4px; }
.stat .lbl { font-size: .8rem; color: var(--ink-3); }
.card.stat { background: var(--sunken); border-color: transparent; }
.card.stat .progress { background: var(--track); margin-top: 6px; }
@media (max-width: 640px) {
  .grid.c3:has(> .stat), .grid.c2:has(> .stat) { grid-template-columns: 1fr 1fr; gap: 10px; }
  .grid:has(> .stat) > .stat:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .card.stat { padding: 12px 12px; }
  .big { font-size: 1.9rem; }
}
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: .76rem; font-weight: 600; line-height: 1.5; background: var(--sunken); color: var(--ink-2); border: 1px solid transparent; white-space: nowrap; }
.pill.ok { background: var(--ok-soft); color: var(--on-ok-soft); }
.pill.bad { background: var(--bad-soft); color: var(--on-bad-soft); }
.pill.warn { background: var(--warn-soft); color: var(--on-warn-soft); }
.pill.accent { background: var(--primary); color: var(--primary-ink); }
.pill.teal { background: var(--primary-soft); color: var(--on-primary-soft); }
label.pill { cursor: pointer; }

/* ---------- controls ---------- */
button, .btn { font: inherit; font-size: .92rem; font-weight: 500; min-height: 40px; padding: 8px 16px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--field); color: var(--ink); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; line-height: 1.25; text-decoration: none; transition: background .15s, border-color .15s, transform .08s; -webkit-tap-highlight-color: transparent; }
button:hover, .btn:hover { background: var(--sunken); }
button:active, .btn:active { transform: translateY(1px); }
button.primary { background: var(--primary); color: var(--primary-ink); border-color: transparent; }
button.primary { font-weight: 600; }
button.primary:hover { background: var(--primary-strong); }
button.ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
button.ghost:hover { background: var(--sunken); color: var(--ink); }
button.small { min-height: 32px; padding: 4px 11px; font-size: .82rem; border-radius: 8px; }
button:disabled { opacity: .45; cursor: default; transform: none; }
button.say { min-height: 24px; padding: 1px 7px; font-size: .74rem; line-height: 1.4; border-radius: 6px; color: var(--primary); border-color: color-mix(in srgb, var(--primary) 45%, transparent); background: transparent; vertical-align: middle; font-weight: 600; }
button.say:hover { background: var(--primary-soft); }
input, select, textarea { font: inherit; color: var(--ink); background: var(--field); border: 1px solid var(--line-2); border-radius: 10px; padding: 8px 12px; min-height: 40px; max-width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary); outline-offset: 0; border-color: transparent; }
input[type="number"] { width: 90px; }
input[type="range"] { min-height: 0; padding: 0; border: 0; background: transparent; accent-color: var(--primary); }
input[type="checkbox"], input[type="radio"] { min-height: 0; accent-color: var(--primary); }
textarea { width: 100%; min-height: 260px; line-height: 1.65; resize: vertical; font-size: 1.02rem; }
label { font-size: .86rem; color: var(--ink-2); }
.field { display: flex; flex-direction: column; gap: 5px; }
.field input, .field select { width: 100%; }
.status-sel { font-size: .82rem; padding: 4px 8px; min-height: 32px; }
.status-ok { color: var(--ok); } .status-learn { color: var(--warn); } .status-open { color: var(--ink-3); }

table { border-collapse: collapse; width: 100%; font-size: .93rem; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .8rem; color: var(--ink-3); font-weight: 600; }
tr.total td { font-weight: 700; border-top: 2px solid var(--ink); }
tr:last-child td { border-bottom: 0; }

.progress { height: 8px; background: var(--track); border-radius: 999px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--marker); border-radius: 999px; transition: width .5s cubic-bezier(.2,.8,.2,1); }
.progress.accent > i { background: var(--marker); }

.check { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-bottom: 1px dashed var(--line); cursor: pointer; }
.check:last-child { border-bottom: 0; }
.check input { margin-top: 4px; flex: 0 0 auto; width: 18px; height: 18px; }
.check.done span { text-decoration: line-through; color: var(--ink-3); }

.callout { border-left: 3px solid var(--marker); background: var(--marker-soft); padding: 10px 14px; border-radius: 0 10px 10px 0; margin: 12px 0; }
.callout.red { border-left-color: var(--bad); background: var(--bad-soft); }
.callout.teal { border-left-color: var(--primary); background: var(--primary-soft); }

details { border: 1px solid var(--line); border-radius: 10px; background: var(--surface); margin: 8px 0; }
details > summary { padding: 10px 14px; cursor: pointer; font-weight: 600; list-style: none; display: flex; align-items: center; gap: 8px; min-height: 44px; }
details > summary::-webkit-details-marker { display: none; }
details > summary::before { content: ""; flex: 0 0 auto; width: 8px; height: 8px; border-right: 2px solid var(--ink-3); border-bottom: 2px solid var(--ink-3); transform: rotate(-45deg); transition: transform .15s; margin-right: 2px; }
details[open] > summary::before { transform: rotate(45deg); }
details > .body { padding: 2px 14px 14px; }
details > .body p { margin-bottom: .7em; }
details > .body h4 { margin-bottom: .3em; }
details.help { background: transparent; border-style: dashed; }
details.help > summary { color: var(--ink-2); font-weight: 500; font-size: .92rem; }
details.help.strategy { margin: 0 0 18px; }
details.help.strategy > .body > .callout { margin-top: 6px; }
details.help.strategy > .body > .card:last-child { margin-bottom: 4px; }

.tabs { display: flex; gap: 6px; margin-bottom: 14px; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; padding-bottom: 2px; scroll-snap-type: x proximity; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { flex: 0 0 auto; min-height: 34px; padding: 5px 13px; border-radius: 999px; font-size: .86rem; scroll-snap-align: start; background: transparent; }
.tabs button.active { background: var(--primary); color: var(--primary-ink); border-color: transparent; }
.topic-nav { display: flex; gap: 8px; align-items: center; margin-bottom: 14px; }
.topic-nav select { flex: 1; min-width: 0; }
.topic-nav button { flex: 0 0 auto; width: 40px; padding: 0; font-size: 1.2rem; }

.toast { position: fixed; left: 50%; bottom: calc(24px + var(--sab)); transform: translate(-50%, 12px); background: var(--pr-primary-dark); color: #fff; padding: 10px 16px; border-radius: 10px; box-shadow: var(--shadow); font-size: .9rem; opacity: 0; transition: opacity .2s, transform .25s cubic-bezier(.2,.8,.2,1); pointer-events: none; z-index: 60; max-width: min(92vw, 520px); text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (max-width: 860px) { .toast { bottom: calc(var(--tabbar-h) + var(--sab) + 14px); } }

/* ---------- stacked tables on phones (vocabulary lists) ---------- */
@media (max-width: 640px) {
  table.stack, table.stack tbody, table.stack tr, table.stack td { display: block; width: 100%; }
  table.stack thead { display: none; }
  table.stack tr { padding: 10px 0; border-bottom: 1px solid var(--line); }
  table.stack tr:last-child { border-bottom: 0; }
  table.stack td { border: 0; padding: 1px 0; white-space: normal !important; }
  table.stack td:first-child { font-size: 1.02rem; }
  table.stack td + td { color: var(--ink-2); font-size: .92rem; }
}

/* ---------- reading ---------- */
.pre { white-space: pre-wrap; font-size: 1.02rem; line-height: 1.7; max-width: 72ch; }
.fehlerbrief .pre { line-height: 1.95; }
.two { columns: 2; column-gap: 28px; }
@media (max-width: 700px) { .two { columns: 1; } }
.info p { margin-bottom: .8em; }
.mock-sec { border-left: 3px solid var(--line-2); padding-left: 12px; margin: 10px 0; }
.partner { border-color: var(--primary); }
.art { font-weight: 600; }
.art-der { color: var(--der); } .art-die { color: var(--die); } .art-das { color: var(--das); }
.gapno { color: var(--primary); font-weight: 600; }
.sbl .quiz .q { padding: 6px 0; }
.tok { cursor: pointer; border-radius: 4px; padding: 0 1px; }
.tok:hover { background: color-mix(in srgb, var(--marker) 35%, transparent); }
.tok.picked { background: var(--primary-soft); }
.tok.hit { background: color-mix(in srgb, var(--ok) 30%, transparent); }
.tok.miss { background: color-mix(in srgb, var(--bad) 30%, transparent); text-decoration: underline wavy var(--bad); }
.tok.fa { text-decoration: line-through; }

/* ---------- timer / recorder ---------- */
.timer { font-family: var(--font-mono); font-size: 2.2rem; font-weight: 700; letter-spacing: .02em; font-variant-numeric: tabular-nums; }
.timer.over { color: var(--bad); }
.timerbox .timer { font-size: 1.5rem; }

/* ---------- quiz ---------- */
.quiz .q { padding: 12px 0; border-bottom: 1px solid var(--line); }
.quiz .q:last-child { border-bottom: 0; }
.quiz .opts { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.quiz .opts.col { flex-direction: column; align-items: stretch; }
.quiz .opts label { display: inline-flex; align-items: center; gap: 8px; min-height: 38px; padding: 6px 14px; border: 1px solid var(--line-2); border-radius: 999px; cursor: pointer; font-size: .94rem; color: var(--ink); background: var(--field); transition: background .12s, border-color .12s; -webkit-tap-highlight-color: transparent; }
.quiz .opts label:hover { background: var(--sunken); }
.quiz .opts input { display: none; }
.quiz .opts input:checked + span { font-weight: 600; }
.quiz .opts label.sel { border-color: var(--primary); background: var(--primary-soft); color: var(--ink); box-shadow: inset 0 0 0 1px var(--primary); }
.quiz .opts label.right { border-color: var(--ok); background: var(--ok-soft); color: var(--on-ok-soft); }
.quiz .opts label.right::after { content: "✓"; color: var(--ok); font-weight: 600; margin-left: auto; }
.quiz .opts label.wrong { border-color: var(--bad); background: var(--bad-soft); color: var(--on-bad-soft); }
.quiz .opts label.wrong::after { content: "✗"; color: var(--bad); font-weight: 600; margin-left: auto; }
.quiz .expl { font-size: .88rem; color: var(--ink-2); margin-top: 6px; display: none; }
.quiz.graded .expl { display: block; }
.quiz .opts input[type=text], .quiz input[data-gin] { font-size: 1rem; }
@media (max-width: 640px) {
  .quiz .opts:not(.inline) { flex-direction: column; align-items: stretch; gap: 6px; }
  .quiz .opts:not(.inline) label { width: 100%; border-radius: 10px; min-height: 44px; }
  .quiz .opts.inline label { min-height: 40px; padding-inline: 14px; }
}
.gap { display: inline-block; min-width: 110px; margin: 0 2px; }
.gap select { padding: 2px 6px; font-size: .95rem; min-height: 30px; }
.gap.right select { border-color: var(--ok); background: var(--ok-soft); color: var(--on-ok-soft); }
.gap.wrong select { border-color: var(--bad); background: var(--bad-soft); color: var(--on-bad-soft); }
.wordbank { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.wordbank span { padding: 3px 10px; border: 1px solid var(--line); border-radius: 999px; font-size: .9rem; background: var(--sunken); }
.mat-item { display: grid; grid-template-columns: 24px 1fr; gap: 10px; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.mat-item:last-child { border-bottom: 0; }
.mat-item input { margin-top: 5px; }
.mat-item .n { font-weight: 600; }
.mat-item .w { font-size: .9rem; color: var(--ink-2); }
.mat-item .t { font-size: .78rem; color: var(--ink-3); }
.rubric select { width: 100%; }
.score-big { font-size: 1.6rem; font-weight: 600; color: var(--heading); }

/* ---------- flashcards (SRS + Redemittel) ---------- */
.flash { perspective: 1200px; }
.flash .face { min-height: 230px; display: flex; align-items: center; justify-content: center; text-align: center; padding: 28px 24px; font-size: 1.5rem; line-height: 1.3; font-weight: 500; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); cursor: pointer; box-shadow: var(--shadow); text-wrap: balance; color: var(--heading); }
.flash .face.back { background: var(--surface); color: var(--ink); border: 2px solid var(--gold); flex-direction: column; align-items: stretch; cursor: default; animation: flip .28s cubic-bezier(.2,.8,.2,1); }
.flash .face.back .cb-main { color: var(--primary); }
@keyframes flip { from { transform: rotateX(-18deg); opacity: .6; } to { transform: none; opacity: 1; } }
.flash .cb-main { text-align: center; padding: 6px 0 4px; }
.flash .cb-more { font-size: .95rem; font-weight: 400; text-align: left; border-top: 1px solid var(--line); margin-top: 14px; padding-top: 12px; display: grid; gap: 8px; }
.cb-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.cb-refl { font-size: .85rem; color: var(--ink-2); }
.cb-ex { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.cb-ex li { display: flex; gap: 8px; align-items: flex-start; }
.cb-ex li > span { display: flex; flex-direction: column; min-width: 0; }
.cb-ex .de { color: var(--ink); }
.cb-ex .en { color: var(--ink-3); font-size: .85rem; }
.cb-note { font-size: .88rem; padding: 8px 10px; border-radius: 8px; background: var(--marker-soft); color: var(--on-marker-soft); }
.cb-det { margin-top: 4px; font-size: .9rem; border: 0; background: transparent; margin: 4px 0 0; }
.cb-det summary { cursor: pointer; color: var(--link); font-size: .82rem; padding: 2px 0; min-height: 0; }
.cb-det summary::before { display: none; }
.cb-det .cb-ex, .cb-det .cb-note { margin-top: 6px; }
.srs-meta { display: flex; justify-content: space-between; gap: 10px; font-size: .8rem; color: var(--ink-3); margin-bottom: 8px; }
.srs-actions { display: flex; gap: 10px; align-items: center; margin-top: 12px; }
.srs-actions .srs-audio { flex: 0 0 auto; }
.srs-actions .srs-show { flex: 1; min-height: 48px; }
.srs-grades { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.srs-grades button { flex-direction: column; gap: 1px; min-height: 54px; padding: 6px 8px; line-height: 1.2; }
.srs-grades button small { font-weight: 500; font-size: .74rem; color: inherit; opacity: .75; }
.srs-grades button { font-weight: 600; }
.srs-grades button[data-g="again"] { border-color: var(--bad); color: var(--bad); }
.srs-grades button[data-g="again"]:hover { background: var(--bad-soft); }
.srs-grades button[data-g="good"] { background: var(--primary); color: var(--primary-ink); border-color: transparent; }
.srs-grades button[data-g="good"]:hover { background: var(--primary-strong); }
.srs-grades button[data-g="easy"] { border-color: var(--ok); color: var(--ok); }
.srs-grades button[data-g="easy"]:hover { background: var(--ok-soft); }
.kbd-hint { font-size: .78rem; color: var(--ink-3); }
.kbd-hint kbd { font-family: var(--font-body); font-size: .74rem; padding: 0 5px; border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 5px; background: var(--field); }
@media (max-width: 640px) { .flash .face { min-height: 200px; font-size: 1.35rem; padding: 22px 18px; } }

/* ---------- chart ---------- */
.chart { width: 100%; height: auto; }
.chart text { font-family: var(--font-body); font-size: 11px; fill: var(--ink-3); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: .8rem; color: var(--ink-2); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 4px; vertical-align: middle; }

/* ---------- lesson: head, track, steps ---------- */
.lesson-head { border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 22px 16px; margin-bottom: 14px; background: linear-gradient(180deg, var(--marker-soft) 0, var(--surface) 120px); }
.lesson-head h1 { font-size: 1.85rem; }
.lesson-head .lh-meta { color: var(--ink-3); font-size: .9rem; margin: 2px 0 10px; }
.lesson-head .lh-cta { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 12px; }
.lesson-head .lh-cta .primary { min-height: 44px; padding-inline: 18px; }
.lesson-head .lh-cta .lh-next { color: var(--ink-3); font-size: .86rem; }
.ltrack { display: flex; gap: 4px; padding: 10px 0 12px; }
.ltrack i { flex: 1; height: 6px; border-radius: 3px; background: var(--track); border: 1px solid transparent; }
.ltrack i.done { background: var(--ok); }
.ltrack i.skipped { background: var(--line-2); }
.ltrack i.current { background: var(--marker); box-shadow: 0 0 0 2px color-mix(in srgb, var(--marker) 40%, transparent); }
@media (max-width: 860px) {
  .lesson-head { padding: 14px 16px 14px; }
  .lesson-head h1 { font-size: 1.45rem; }
  .lesson-head .lh-links { display: none; }
  .lesson-head .lh-cta { flex-direction: column; align-items: stretch; }
  .lesson-head .lh-cta .primary { width: 100%; }
  .ltrack { position: sticky; top: var(--topbar-h); z-index: 20; background: var(--paper); margin: 0 -16px 2px; padding: 10px 16px 10px; }
}
.steps { display: flex; flex-direction: column; gap: 12px; }
.step { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: visible; transition: border-color .15s; }
.step + .step::before { content: ""; position: absolute; left: 31px; top: -13px; width: 2px; height: 13px; background: var(--line-2); }
.step > header { display: flex; align-items: center; gap: 12px; padding: 12px 16px; cursor: pointer; border-radius: var(--radius); -webkit-tap-highlight-color: transparent; min-height: 56px; }
.step > header:hover { background: color-mix(in srgb, var(--sunken) 55%, transparent); }
.step.open > header { border-radius: var(--radius) var(--radius) 0 0; }
.step > header h3 { margin: 0; font-size: 1.04rem; font-weight: 600; color: var(--ink); }
.step > header small { color: var(--ink-3); font-size: .8rem; }
.step .st-title { flex: 1; min-width: 0; }
.step .st-toggle { color: var(--ink-3); width: 10px; height: 10px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg); margin-right: 4px; transition: transform .15s; font-size: 0; }
.step.open .st-toggle { transform: rotate(45deg); }
.step .num { flex: 0 0 auto; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-weight: 600; font-size: .9rem; background: var(--sunken); color: var(--ink-2); border: 1px solid var(--line-2); font-variant-numeric: tabular-nums; }
.step.current { border-color: var(--marker); box-shadow: 0 0 0 3px color-mix(in srgb, var(--marker) 30%, transparent); }
.step.current .num { background: var(--marker); color: var(--on-marker); border-color: transparent; }
.step.done .num { background: var(--ok); color: var(--on-ok); border-color: transparent; }
.step.done > header h3, .step.skipped > header h3 { color: var(--ink-3); font-weight: 600; }
.step.skipped .num { background: var(--sunken); color: var(--ink-3); }
.step.optional:not(.done) > header h3::after { content: " · optional"; font-size: .78rem; font-weight: 500; color: var(--warn); }
.step > .body { padding: 6px 18px 14px; border-top: 1px solid var(--line); }
.step > .body > footer { margin-top: 14px; padding: 12px 0 0; border-top: 1px dashed var(--line); }
.step > .body > footer .primary { min-height: 44px; }
@media (max-width: 860px) {
  .step > .body { padding: 4px 12px 12px; }
  .step > .body > footer { position: sticky; bottom: calc(var(--tabbar-h) + var(--sab)); background: var(--surface); margin: 14px -12px -12px; padding: 10px 12px calc(10px); border-radius: 0 0 var(--radius) var(--radius); z-index: 5; }
  .step > .body > footer .row:last-child { margin-left: auto; }
  .step > .body > footer .row:last-child .primary { flex: 1; }
}
.lesson-summary { border-color: var(--ok); background: linear-gradient(180deg, var(--ok-soft) 0, var(--surface) 120px); }

/* ---------- plan rows ---------- */
.plan-sum { margin: 2px 0 14px; }
.plan-tools { margin-bottom: 14px; row-gap: 8px; }
.plan-list.hide-short .lrow.short { display: none; }
.lrow .ld-short { display: none; }
.weeklabel { font-size: .78rem; color: var(--ink-3); margin: 16px 0 6px; font-weight: 600; }
.weeks + h2 { margin-top: 2em; }
.lrow { display: grid; grid-template-columns: 36px 118px minmax(0, 1fr) 64px 92px; gap: 10px; align-items: center; padding: 10px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; margin-bottom: 6px; color: var(--ink); text-decoration: none; position: relative; min-height: 52px; transition: border-color .12s, background .12s; }
.lrow:hover { border-color: var(--line-2); background: color-mix(in srgb, var(--sunken) 45%, var(--surface)); }
.lrow .ln { font-weight: 600; color: var(--ink-3); font-family: var(--font-mono); font-size: .86rem; }
.lrow small { display: block; font-size: .76rem; color: var(--ink-3); }
.lrow .lt { min-width: 0; } .lrow .lt b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lrow .ls { text-align: right; }
.lrow.today { border-color: var(--marker); background: var(--marker-soft); }
.lrow.today::before { content: ""; position: absolute; left: -1px; top: 8px; bottom: 8px; width: 4px; border-radius: 0 4px 4px 0; background: var(--marker); }
.lrow.erledigt { opacity: .72; }
.lrow.erledigt .ln { color: var(--ok); }
.lrow.short { background: transparent; padding-top: 7px; padding-bottom: 7px; min-height: 44px; border-style: dashed; }
.lrow.short .lt b { font-weight: 500; color: var(--ink-2); }
@media (max-width: 640px) {
  .lrow { grid-template-columns: 26px 74px minmax(0, 1fr); gap: 8px; padding: 10px 10px 10px 12px; }
  .lrow .lm, .lrow .ls { display: none; }
  .lrow .ld-long { display: none; } .lrow .ld-short { display: block; font-variant-numeric: tabular-nums; white-space: nowrap; font-size: .88rem; }
  .lrow .lt b { white-space: normal; }
  .lrow.erledigt .ln::before { content: "✓ "; }
  table.milestones td:first-child { white-space: normal !important; font-size: .82rem; }
}

.app-about { font-size: .8rem; margin-top: 18px; }

/* ---------- settings days ---------- */
.days { display: flex; flex-direction: column; gap: 6px; }
.dayrow { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; opacity: .55; padding: 4px 0; }
.dayrow.on { opacity: 1; }
.dayrow input[type="time"] { min-height: 38px; padding: 4px 8px; }
.gramgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.gcell { display: block; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; text-decoration: none; color: var(--ink); background: var(--sunken); font-size: .88rem; }
.gcell small { display: block; color: var(--ink-3); font-size: .75rem; }
.gcell.ok { border-color: var(--ok); background: var(--ok-soft); color: var(--on-ok-soft); }
.gcell.part { border-color: var(--warn); }
.pill.status-ok { color: var(--ok); } .pill.status-learn { color: var(--warn); }

/* ---------- week view (legacy) ---------- */
.week { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); margin-bottom: 12px; overflow: hidden; }
.week > header { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 16px; background: var(--sunken); cursor: pointer; }
.week > header h3 { margin: 0; font-size: 1.05rem; }
.week.current > header { background: var(--marker-soft); }
.week .sessions { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 0; }
.session { padding: 12px 16px; border-top: 1px solid var(--line); border-right: 1px solid var(--line); }
.session:last-child { border-right: 0; }
.session h4 { margin: 0 0 2px; font-size: 1rem; }
.session .when { font-size: .78rem; color: var(--ink-3); margin-bottom: 6px; }
.session.today { background: var(--marker-soft); }
.session.past-missed h4::after { content: " · übersprungen"; color: var(--bad); font-size: .75rem; font-weight: 500; }

/* ---------- print ---------- */
.printonly { display: none; }
@media print {
  .side, .topbar, .tabbar, .backdrop, button, .noprint { display: none !important; }
  .app { display: block; }
  .main { padding: 0; max-width: none; }
  .card { box-shadow: none; break-inside: avoid; }
  .printonly { display: block; }
}

/* ---------- motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
