/* Reader shell and reading view. Reference: mockups/reader-gliederung.html
   (state k=4, bar 1, card 1, ans=5, nav=3, ctx=4), handover UEBERGABE_FRONTEND.md.
   Tokens first; no px font sizes — every size is a step on the type scale. */
:root {
  color-scheme: light;
  --bg: #F4F5F2; --surface: #FFFFFF; --ink: #1C1C1E; --muted: #6A6A6A; --body: #2C2C2E; --quiet: #3A3A3C;
  --sage-light: #E6E9E1; --sage: #5F7A50; --sage-mid: #B7C5AA; --warn: #FFF3D9;
  --serif: "New York", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  /* Type scale: base 17px × 1.25ⁿ. */
  --fs--2: 10.9px; --fs--1: 13.6px; --fs-0: 17px; --fs-1: 21.25px; --fs-2: 26.6px; --fs-3: 33.2px; --fs-4: 41.5px; --fs-5: 51.9px;
  --radius: 28px; --motion: cubic-bezier(.2, 1, .3, 1);
  --hairline: #1C1C1E14; --shadow-pop: 0 1px 2px #1c1c1e0f, 0 12px 32px #1c1c1e14;
  --card-shadow: 0 1px 1px #1c1c1e0a, 0 8px 24px #1c1c1e06;
  --header-h: 64px; --side-w: 232px; --measure: 68ch; --outline-w: 300px; --card-w: 760px;
  /* Z scale: one ladder for the whole page. */
  --z-base: 0; --z-raised: 1; --z-sticky: 100; --z-header: 200; --z-sidebar: 300; --z-dropdown: 400;
  --z-overlay: 500; --z-drawer: 600; --z-modal: 700; --z-toast: 800; --z-skip: 900;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: var(--fs-0)/1.5 var(--sans); -webkit-font-smoothing: antialiased; }
button, select, input, textarea { font: inherit; color: inherit; }
/* iPhone (2026-10-03): two quick taps on "Weiter" zoomed the page and it was hard
   to get back. manipulation turns off double-tap zoom only; pinch zoom stays. */
html { touch-action: manipulation; }
/* iOS zooms in when a field under 16px gets focus. On touch screens every field
   uses the base size — one rule, so a new field cannot reintroduce it. */
@media (pointer: coarse) { input, select, textarea { font-size: var(--fs-0) !important; } }
button { border: 0; background: none; padding: 0; }
a[href], button:not(:disabled), summary, select, label[for], .import-label { cursor: pointer; }
button:disabled { cursor: default; }
button, a, select, input { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, p { margin: 0; }
h1, h2 { font-family: var(--serif); font-weight: 400; letter-spacing: -.025em; line-height: 1.12; }
:focus-visible { outline: 3px solid var(--sage); outline-offset: 3px; border-radius: 6px; }
/* Entry title and content area take focus only so screen readers follow; they are
   not controls, so no ring — not even for keyboard users. */
[tabindex="-1"]:focus-visible { outline: none; }
svg.i { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.muted { color: var(--muted); }
.small { font-size: var(--fs--1); }
.eyebrow { font-size: var(--fs--2); font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.num { font-variant-numeric: tabular-nums; }
kbd { font: 600 var(--fs--2) var(--sans); padding: 2px 6px; border-radius: 6px; box-shadow: inset 0 0 0 1px var(--hairline); background: var(--surface); color: var(--muted); }
.skip-link { position: absolute; top: -100px; left: 16px; z-index: var(--z-skip); padding: 12px; background: var(--surface); border-radius: 10px; }
.skip-link:focus { top: 12px; }

/* ================= Shell: header, sidebar, main ================= */
.shell { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); grid-template-rows: var(--header-h) 1fr; min-height: 100vh; }
.header { grid-column: 1 / -1; position: sticky; top: 0; z-index: var(--z-header); display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr) var(--side-w); align-items: center; background: var(--surface); border-bottom: 1px solid var(--hairline); }
.hdr-left { display: flex; align-items: center; min-width: 0; padding-left: 12px; }
.menu-btn { display: none; }
.cmd { justify-self: center; display: flex; align-items: center; gap: 10px; width: min(560px, 100%); min-height: 40px; padding: 0 12px; border-radius: 12px; background: var(--bg); box-shadow: inset 0 0 0 1px var(--hairline); color: var(--muted); font-size: var(--fs--1); text-align: left; }
.cmd .lbl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmd kbd { margin-left: auto; }
.header .right { display: flex; align-items: center; justify-content: flex-end; gap: 12px; padding: 0 20px; min-width: 0; }
.status { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs--1); color: var(--muted); white-space: nowrap; }
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--sage); }
.status.error::before { background: #B4462C; }
.sidebar { position: sticky; top: var(--header-h); z-index: var(--z-sidebar); height: calc(100vh - var(--header-h)); padding: 16px 12px 12px; border-right: 1px solid var(--hairline); display: flex; flex-direction: column; gap: 2px; background: var(--bg); }
.side-nav { display: grid; gap: 2px; }
.navlink { display: flex; align-items: center; gap: 10px; min-height: 36px; padding: 6px 10px; border-radius: 10px; font-size: var(--fs--1); font-weight: 500; }
.navlink svg { color: var(--muted); }
.navlink[aria-current="page"] { background: var(--surface); box-shadow: 0 1px 2px #1c1c1e12, inset 0 0 0 1px var(--hairline); font-weight: 600; }
.navlink[aria-current="page"] svg { color: var(--sage); }
.badge { margin-left: auto; min-width: 22px; padding: 1px 7px; border-radius: 11px; background: var(--sage-light); font-size: var(--fs--1); font-weight: 600; text-align: center; font-variant-numeric: tabular-nums; }
.nav-label { padding: 14px 10px 6px; font-size: var(--fs--2); font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.main { min-width: 0; display: flex; flex-direction: column; }
main { flex: 1; min-width: 0; outline: none; }
.notice { margin: 16px 32px 0; background: var(--warn); color: var(--ink); padding: 12px 18px; border-radius: 14px; font-size: var(--fs--1); }

/* Account at the foot of the sidebar; its menu opens upwards. */
.side-acct { margin-top: auto; padding-top: 10px; border-top: 1px solid var(--hairline); }
.side-acct:empty { display: none; }
.acct-btn { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px; border-radius: 12px; text-align: left; }
.avatar { display: grid; place-items: center; flex-shrink: 0; width: 32px; height: 32px; border-radius: 50%; background: var(--sage-mid); font-size: var(--fs--2); font-weight: 700; }
.avatar.plain { background: var(--sage-light); color: var(--sage); }
.acct-n { display: grid; min-width: 0; line-height: 1.25; }
.acct-n b { font-size: var(--fs--1); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-n small { font-size: var(--fs--2); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-btn > svg { margin-left: auto; color: var(--muted); transform: rotate(180deg); }
.side-acct .menu { top: auto; bottom: calc(100% + 6px); left: 0; right: auto; width: 100%; min-width: 0; max-height: 70vh; }
.acct-who { display: grid; padding: 8px 10px 6px; font-size: var(--fs--1); }
.acct-who span { color: var(--muted); font-size: var(--fs--2); }
.acct-h { padding: 6px 10px 2px; font-size: var(--fs--2); font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.menu hr { border: 0; border-top: 1px solid var(--hairline); margin: 4px 0; }
.acct-feedback { padding: 4px 10px; font-size: var(--fs--2); color: var(--muted); }
.acct-feedback:empty { display: none; }

/* Popover menus (edition archive, prio, account). Open only on click. */
.pop { position: relative; }
.menu { position: absolute; top: calc(100% + 6px); right: 0; z-index: var(--z-dropdown); min-width: 240px; max-height: 60vh; overflow-y: auto; padding: 6px; border-radius: 14px; background: var(--surface); box-shadow: var(--shadow-pop), inset 0 0 0 1px var(--hairline); display: none; text-transform: none; letter-spacing: 0; font-weight: 400; }
.pop.open > .menu { display: grid; gap: 2px; animation: pop .16s var(--motion); }
@keyframes pop { from { opacity: 0; transform: translateY(-4px); } }
.menu .opt { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: 9px; font-size: var(--fs--1); text-align: left; color: var(--ink); }
.menu .opt:focus-visible { background: var(--bg); }
.menu .opt[aria-checked="true"] { font-weight: 600; }
.menu .opt[aria-checked="true"]::after { content: "✓"; margin-left: auto; color: var(--sage); }
.menu .opt small { display: block; color: var(--muted); font-size: var(--fs--2); font-weight: 400; }

/* ================= Buttons ================= */
.btn, .button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 16px; border-radius: 12px; font-size: var(--fs--1); font-weight: 600; background: var(--surface); box-shadow: inset 0 0 0 1px var(--hairline); white-space: nowrap; color: var(--ink); text-decoration: none; }
.btn.primary, .button:not(.secondary):not(.text-button) { background: var(--ink); color: #fff; box-shadow: none; }
.button.secondary { background: var(--sage-light); box-shadow: none; }
.button.text-button { background: transparent; box-shadow: none; color: var(--muted); }
.btn:disabled, .button:disabled { opacity: .4; }
.full { width: 100%; }
.icon-btn { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; color: var(--muted); }
.icon-btn.sm { width: 32px; height: 32px; }
.icon-btn[aria-pressed="true"] { color: var(--sage); }
.icon-btn[aria-pressed="true"] svg { fill: currentColor; }

/* ================= Reader ================= */
.reader { padding: 20px 32px 40px; }
/* Progress bar: closed exactly as wide as the card; open in the card + outline columns. */
.rbar { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px; align-items: center; min-height: 36px; max-width: var(--card-w); margin: 0 auto 18px; font-size: var(--fs--1); color: var(--muted); }
.rbar-main { display: flex; align-items: center; gap: 12px; min-width: 0; }
.track { flex: 1; min-width: 40px; height: 4px; border-radius: 4px; background: var(--sage-light); overflow: hidden; }
.track i { display: block; height: 100%; background: var(--sage); transition: width .3s var(--motion); }
.rbar .num { white-space: nowrap; }
.rbar .num b { color: var(--ink); font-weight: 600; }
.ed-label, .ed-pop > button { display: inline-flex; align-items: center; gap: 6px; min-height: 30px; padding: 0 8px; margin-left: -8px; border-radius: 10px; font-size: var(--fs--1); color: var(--ink); white-space: nowrap; }
.ed-kw { font-weight: 600; }
.ed-txt { display: inline-flex; align-items: baseline; gap: 6px; }
.ed-range { color: var(--muted); }
.ed-pop .menu { left: 0; right: auto; }
.gl-icon { display: grid; place-items: center; justify-self: end; width: 36px; height: 36px; border-radius: 10px; color: var(--muted); }
.gl-icon[aria-pressed="true"] { color: var(--ink); }
.rgrid { display: grid; grid-template-columns: minmax(0, 1fr) 0; gap: 0; }
.stage { min-width: 0; max-width: var(--card-w); width: 100%; margin: 0 auto; }
/* Hover only where a pointer can hover (operator 2026-10-03): on iPhones a :hover
   style sticks after a tap until the next one — it looked like a left-over focus. */
@media (hover: hover) {
  .cmd:hover { box-shadow: inset 0 0 0 1px var(--sage-mid); }
  .navlink:not([aria-current="page"]):hover { background: var(--sage-light); }  /* the current page keeps its look */
  .acct-btn:hover { background: var(--sage-light); }
  .menu .opt:hover { background: var(--bg); }
  .btn:hover, .button:hover { box-shadow: inset 0 0 0 1px var(--sage-mid); }
  .btn.primary:hover { background: #000; }
  .button.text-button:hover { background: var(--sage-light); color: var(--ink); }
  .icon-btn:hover { background: var(--sage-light); color: var(--ink); }
  .ed-pop > button:hover { background: var(--sage-light); }
  .gl-icon:hover { background: var(--sage-light); color: var(--ink); }
  .prio-btn:hover { background: var(--sage-light); color: var(--ink); }
  a.ft:hover { text-decoration: underline; text-underline-offset: 3px; }
  .a5-tile:hover { background: var(--sage-light); }
  .note-show:hover { background: var(--sage-light); }
  .nv-ico:hover:not(:disabled) { background: #ffffff18; color: #fff; }
  .sub .link:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
  .ti:hover { background: var(--sage-light); }
  .pal-res button:hover, .pal-res a:hover { background: var(--bg); }
  .pg-link:hover { text-decoration: underline; text-underline-offset: 3px; }
}
@media (min-width: 1280px) {
  .reader.outline-open .rbar { max-width: none; grid-template-columns: minmax(0, 1fr) var(--outline-w); gap: 40px; }
  .reader.outline-open .rgrid { grid-template-columns: minmax(0, 1fr) var(--outline-w); gap: 40px; }
  .reader.outline-open .stage { max-width: none; }
}

/* Card — fixed order: name · facts line · what happened · approach · also for · note · context · affected · known */
.card { background: var(--surface); border-radius: var(--radius); padding: 36px 40px 44px; box-shadow: var(--card-shadow); display: grid; gap: 28px; overflow-wrap: anywhere; touch-action: pan-y pinch-zoom; }
.card > * { min-width: 0; }
/* Fade only (operator 2026-10-03): the earlier 6px rise read as a bounce on the iPhone. */
.card.anim { animation: fade-in .15s ease-out; }
@keyframes fade-in { from { opacity: .4; } }
.c-head h1 { font-size: var(--fs-4); outline: none; }
.c-sub { margin-top: 6px; font-size: var(--fs--1); color: var(--muted); }
.c-sub .sep { margin: 0 6px; }
.prio-pop { display: inline-block; }
.prio-btn { display: inline-flex; align-items: center; gap: 4px; padding: 2px 6px; margin: -2px -6px; border-radius: 7px; font-size: inherit; color: var(--muted); }
.prio-btn b { color: var(--ink); font-weight: 600; }
.prio-btn svg { width: 13px; height: 13px; }
.prio-pop .menu { left: 0; right: auto; min-width: 220px; }
.lbl2 { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; font: 600 var(--fs--2)/1.2 var(--sans); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.lbl2.ink { color: var(--ink); }
.lbl2 svg { width: 15px; height: 15px; color: var(--sage); }
.c-sec { max-width: var(--measure); }
.lead-facts { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.lead-facts li { padding-left: 14px; border-left: 2px solid var(--sage); }
.ft { font-size: var(--fs--1); font-weight: 500; color: var(--ink); }
.lead-facts .ft { font-size: var(--fs-0); line-height: 1.4; }
.fmeta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 3px; font-size: var(--fs--1); color: var(--muted); }
.cf { display: inline-flex; align-items: center; gap: 5px; }
.cf i { width: 8px; height: 8px; border-radius: 50%; box-shadow: inset 0 0 0 1.5px var(--muted); }
.cf.verifiziert { color: var(--ink); }
.cf.verifiziert i { background: var(--sage); box-shadow: none; }
.cf.plausibel i { box-shadow: inset 0 0 0 1.5px var(--sage); background: linear-gradient(90deg, var(--sage) 50%, transparent 50%); }
.facts { list-style: none; margin: 0; padding: 0; display: grid; }
.fact { padding: 10px 0; border-top: 1px solid var(--hairline); }
.fact:first-child { border-top: 0; padding-top: 2px; }
.snip { margin-top: 6px; font-size: var(--fs--1); color: var(--quiet); }
/* Approach for the reader's practice: green surface, base size, bookmark top right. */
.ans { position: relative; max-width: var(--measure); background: var(--sage-light); border-radius: 18px; padding: 18px 48px 18px 20px; }
.ans-t { font: var(--fs-0)/1.55 var(--sans); }
.ans.none { background: var(--bg); box-shadow: inset 0 0 0 1px var(--hairline); padding-right: 20px; }
.ans.none p { font-size: var(--fs--1); color: var(--muted); }
.rec-save { position: absolute; top: 8px; right: 8px; }
.rec-save[aria-pressed="true"] svg { fill: var(--sage); color: var(--sage); }
.a5 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; max-width: var(--measure); }
.a5-tile { position: relative; display: grid; border-radius: 14px; background: var(--bg); color: var(--quiet); transition: background .15s; }
.a5-open { display: grid; gap: 4px; align-content: start; padding: 14px 44px 14px 16px; text-align: left; font-size: var(--fs--1); color: inherit; }
.a5-open b { font-size: var(--fs--1); font-weight: 600; color: var(--ink); }
.a5-tile.open { grid-column: 1 / -1; background: var(--sage-light); color: var(--ink); }
.a5-tile.open .a5-open { font-size: var(--fs-0); }
.clamp2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.note { width: 100%; padding: 10px 12px; border: 0; border-radius: 12px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--sage-mid); font: var(--fs--1)/1.45 var(--sans); resize: vertical; }
.note-dialog { border: 0; padding: 0; margin: auto; width: min(560px, calc(100% - 32px)); max-width: none; background: var(--surface); color: var(--ink); border-radius: 22px; box-shadow: 0 24px 80px #1c1c1e30; }
.note-dialog::backdrop { background: #1c1c1e40; backdrop-filter: blur(3px); }
.nd-in { display: grid; gap: 12px; padding: 22px 22px 18px; }
.nd-title { margin: 0; font-size: var(--fs-1); }
.nd-hint { margin: -6px 0 0; color: var(--muted); font-size: var(--fs--1); }
.note-dialog .note { min-height: 9em; font-size: var(--fs-0); }
.nd-actions { display: flex; gap: 8px; align-items: center; }
.nd-actions .grow { flex: 1; }
.note-show { display: block; width: 100%; padding: 10px 12px; border-radius: 12px; background: var(--bg); text-align: left; font-size: var(--fs--1); white-space: pre-line; }
.body { max-width: var(--measure); color: var(--body); }
.body b { font-weight: 600; color: var(--ink); }
.clamp3 { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.more-btn { margin-top: 6px; font-size: var(--fs--1); font-weight: 600; color: var(--ink); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--sage-mid); }
.caveat { margin-top: 10px; font-size: var(--fs--1); color: var(--muted); }
.aff { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.aff li { display: grid; gap: 2px; padding: 12px 14px; border-radius: 14px; background: var(--bg); }
.aff b { font-size: var(--fs--1); }
.aff span { font-size: var(--fs--1); color: var(--quiet); }

/* Navigation pill, bottom centre. "Weiter" has a fixed width; its target is in the tooltip. */
.pill-wrap { position: sticky; bottom: 20px; z-index: var(--z-sticky); display: flex; justify-content: center; margin-top: 20px; pointer-events: none; }
.pill { pointer-events: auto; display: flex; align-items: center; gap: 2px; padding: 4px; border-radius: 16px; background: var(--ink); box-shadow: 0 8px 30px #1c1c1e30; }
.nv-ico { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; color: #ffffffa8; }
.nv-ico:disabled { opacity: .3; }
.nv-ico[aria-pressed="true"] { color: var(--sage-mid); }
.nv-ico[aria-pressed="true"]:not([data-act="note"]) svg { fill: currentColor; }
.nv-div { width: 1px; height: 20px; margin: 0 4px; background: #ffffff26; }
.nv-next { display: inline-flex; align-items: center; justify-content: space-between; gap: 10px; width: 112px; height: 44px; padding: 0 12px 0 16px; border-radius: 12px; background: #fff; color: var(--ink); font-size: var(--fs--1); font-weight: 600; }

/* Outline (Gliederung): column from 1280 px, drawer from the right below. */
.outline { position: sticky; top: calc(var(--header-h) + 16px); max-height: calc(100vh - var(--header-h) - 32px); overflow: hidden auto; min-width: 0; opacity: 0; visibility: hidden; }
.reader.outline-open .outline { opacity: 1; visibility: visible; }
.ol-head { position: sticky; top: 0; z-index: var(--z-raised); display: grid; gap: 10px; padding: 0 4px 12px; background: var(--bg); }
.ol-title { display: none; align-items: center; font-size: var(--fs--1); font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.ol-title .icon-btn { margin-left: auto; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 2px; padding: 3px; border-radius: 12px; background: var(--sage-light); }
.seg button { min-height: 32px; padding: 0 4px; border-radius: 9px; font-size: var(--fs--1); font-weight: 500; color: var(--muted); white-space: nowrap; }
.seg button .n { margin-left: 4px; font-size: var(--fs--2); opacity: .75; font-variant-numeric: tabular-nums; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px #1c1c1e18; }
.sub { display: flex; align-items: center; gap: 4px; font-size: var(--fs--1); color: var(--muted); white-space: nowrap; }
.sub select { field-sizing: content; width: auto; appearance: none; -webkit-appearance: none; border: 0; background: transparent; font-size: var(--fs--1); font-weight: 600; color: var(--ink); padding: 4px 16px 4px 2px; min-height: 28px; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 7px) 55%, calc(100% - 3px) 55%; background-size: 4px 4px; background-repeat: no-repeat; }
.sub .link { margin-left: auto; font-size: var(--fs--1); color: var(--muted); }
.ol-list { display: grid; gap: 1px; }
.grp-h { display: flex; align-items: center; gap: 8px; width: 100%; padding: 16px 8px 6px; margin-top: 8px; border-top: 1px solid var(--hairline); font-size: var(--fs-0); font-weight: 600; color: var(--ink); text-align: left; }
.ol-list > .grp-h:first-child { border-top: 0; margin-top: 0; }
.grp-h .n { margin-left: auto; font-size: var(--fs--1); font-weight: 400; color: var(--muted); font-variant-numeric: tabular-nums; }
.grp-h svg { width: 14px; height: 14px; color: var(--muted); transition: transform .2s var(--motion); }
.grp-h[aria-expanded="false"] svg { transform: rotate(-90deg); }
.ti { display: grid; grid-template-columns: minmax(0, 1fr) auto 7px; gap: 10px; align-items: center; width: 100%; min-height: 32px; padding: 5px 10px 5px 12px; border-radius: 9px; text-align: left; font-size: var(--fs--1); color: var(--ink); }
.ti[aria-current="true"] { background: var(--surface); box-shadow: inset 2px 0 0 var(--ink), 0 1px 2px #1c1c1e10; }
.ti[aria-current="true"] .nm { font-weight: 600; }
.nm-wrap { display: grid; min-width: 0; }
.nm, .nm2 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nm2 { font-size: var(--fs--1); color: var(--muted); }
.ti .mk { width: 13px; height: 13px; color: var(--sage); fill: currentColor; }
.udot { width: 7px; height: 7px; border-radius: 50%; background: var(--sage); }
.ti.read .udot { background: transparent; }
.ol-empty { padding: 8px; font-size: var(--fs--1); color: var(--muted); }

/* Overlay, search palette, toast */
.overlay { position: fixed; inset: 0; z-index: var(--z-overlay); background: #1c1c1e40; backdrop-filter: blur(3px); opacity: 0; pointer-events: none; transition: opacity .2s; }
.overlay.on { opacity: 1; pointer-events: auto; }
.palette { position: fixed; left: 50%; top: 14vh; z-index: var(--z-modal); width: min(620px, calc(100% - 32px)); transform: translateX(-50%); background: var(--surface); border-radius: 18px; box-shadow: 0 24px 80px #1c1c1e30; overflow: hidden; animation: pop .18s var(--motion); }
.pal-in { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--hairline); }
.pal-in input { flex: 1; min-width: 0; border: 0; outline: 0; font-size: var(--fs-0); background: none; }
.pal-in input::-webkit-search-cancel-button { -webkit-appearance: none; }
.pal-res { max-height: 50vh; overflow-y: auto; padding: 8px; }
.pal-res button, .pal-res a { display: flex; gap: 12px; align-items: center; width: 100%; padding: 10px 12px; border-radius: 10px; text-align: left; font-size: var(--fs--1); }
.pal-res .sel { background: var(--bg); }
.pal-res .pal-type { margin-left: auto; color: var(--muted); white-space: nowrap; }
.pal-res .grp { padding: 10px 12px 4px; font-size: var(--fs--2); font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.pal-res .none { padding: 10px 12px; font-size: var(--fs--1); color: var(--muted); }
.toast { position: fixed; left: 50%; bottom: 92px; z-index: var(--z-toast); transform: translate(-50%, 12px); opacity: 0; pointer-events: none; max-width: calc(100% - 32px); padding: 10px 18px; border-radius: 22px; background: var(--ink); color: #fff; font-size: var(--fs--1); text-align: center; transition: .25s var(--motion); }
.toast.on { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast-undo { margin-left: 10px; color: var(--sage-mid); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }

/* ================= Pages: Merkliste (here), Watchlist and Admin (account.css) ================= */
.page { padding: 28px 32px 64px; max-width: 920px; width: 100%; margin: 0 auto; }
.pg-head h1 { font-size: var(--fs-4); margin-bottom: 16px; }
.pg-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; font-size: var(--fs--1); }
.pg-bar .grow { flex: 1; }
.pg-list { display: grid; gap: 14px; }
.pg-card { background: var(--surface); border-radius: 20px; padding: 22px 24px; box-shadow: var(--card-shadow); display: grid; gap: 12px; overflow-wrap: anywhere; }
.pg-card-h { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.pg-card-h h2 { font-size: var(--fs-2); }
.pg-card-h .muted { font-size: var(--fs--1); }
.pg-tag { margin-left: auto; font-size: var(--fs--2); font-weight: 600; padding: 2px 8px; border-radius: 8px; background: var(--bg); }
.pg-rec { position: relative; padding: 14px 48px 14px 16px; border-radius: 14px; background: var(--sage-light); }
.pg-rec b { font-size: var(--fs--1); }
.pg-rec p { margin-top: 2px; }
.pg-note { padding: 10px 12px; border-radius: 12px; background: var(--bg); font-size: var(--fs--1); white-space: pre-line; }
.pg-src { font-size: var(--fs--1); color: var(--muted); }
.pg-src a { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--sage-mid); }
.pg-link { justify-self: start; font-size: var(--fs--1); font-weight: 600; }
.empty-state { padding: 56px 24px; text-align: center; background: var(--surface); border-radius: var(--radius); max-width: var(--card-w); margin: 32px auto; }
.empty-state h1, .empty-state h2 { margin-bottom: 16px; font-size: var(--fs-3); }
.empty-state p { color: var(--muted); max-width: 44ch; margin: 0 auto 20px; }
.empty-state .btn { margin-top: 4px; }

/* ================= Responsive ================= */
/* Landscape iPad / small laptops: outline is a drawer from the right. */
@media (max-width: 1279px) {
  .outline { position: fixed; top: 0; bottom: 0; right: 0; z-index: var(--z-drawer); width: min(360px, 88vw); max-height: none; padding: 20px 14px; background: var(--bg); box-shadow: 0 0 60px #1c1c1e30; transform: translateX(102%); opacity: 1; visibility: hidden; transition: transform .3s var(--motion), visibility 0s .3s; }
  .reader.outline-open .outline { transform: none; visibility: visible; transition: transform .3s var(--motion); }
  .ol-head { top: -20px; margin-top: -20px; padding-top: 20px; }
  .ol-title { display: flex; }
  .rgrid { display: block; }
}
/* Phone and portrait iPad: sidebar as drawer behind ☰, header 60 px, search stays a field. */
@media (max-width: 900px) {
  :root { --header-h: 60px; }
  .shell { display: block; }
  .header { grid-template-columns: auto minmax(0, 1fr); gap: 8px; padding-right: 12px; }
  .hdr-left { padding-left: 4px; }
  .menu-btn { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; color: var(--ink); }
  .header .right { display: none; }
  .cmd { width: 100%; max-width: none; min-height: 42px; justify-self: stretch; }
  .cmd kbd { display: none; }
  .sidebar { position: fixed; top: 0; left: 0; bottom: 0; height: auto; width: min(300px, 86vw); padding-top: 20px; z-index: var(--z-drawer); transform: translateX(-102%); visibility: hidden; transition: transform .3s var(--motion), visibility 0s .3s; box-shadow: 0 0 60px #1c1c1e30; }
  body.nav-open .sidebar { transform: none; visibility: visible; transition: transform .3s var(--motion); }
  .reader { padding: 16px 16px 24px; }
  .notice { margin: 12px 16px 0; }
  .card { padding: 24px 20px 32px; border-radius: 22px; }
  .c-head h1 { font-size: var(--fs-3); }
  .page { padding: 16px 16px 48px; }
  .pill-wrap { bottom: 12px; }
  .toast { bottom: 80px; }
}
@media (min-width: 601px) and (max-width: 900px) {
  .cmd { width: min(420px, 100%); justify-self: center; }
}
@media (max-width: 600px) {
  /* Phone: the note opens at the top, where the keyboard cannot cover it (a sheet
     from the bottom made iOS push the page up, operator 2026-10-03). */
  .note-dialog { margin: calc(12px + env(safe-area-inset-top)) auto auto; width: calc(100% - 24px); }
  /* "Bericht 8" with the date range underneath, without the dot (operator 2026-10-03). */
  .ed-txt { display: grid; gap: 0; line-height: 1.2; text-align: left; }
  .ed-sep { display: none; }
  .ed-range { font-size: var(--fs--2); }
  .a5 { grid-template-columns: minmax(0, 1fr); }
  /* Phone: card without frame — one surface, more text width. */
  .card { margin: 0 -16px; border-radius: 0; padding: 22px 16px 40px; box-shadow: none; }
  .ans { padding: 14px 44px 14px 14px; border-radius: 14px; }
  .pg-card { padding: 18px 16px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }
/* Print the Merkliste ("Als PDF"): only the list, no shell. */
@media print {
  .header, .sidebar, .pg-bar, .toast, .overlay, .pg-link, .rec-save, .notice { display: none !important; }
  .shell { display: block; }
  body { background: #fff; }
  .pg-card { box-shadow: none; border: 1px solid #ddd; break-inside: avoid; }
}
