/* Design tokens: see docs/UI.md. No external fonts, no inline styles anywhere. */
:root {
  color-scheme: light dark;
  --bg: #f4f6f4; --surface: #ffffff; --surface-2: #eaefec; --line: #d5ddd8;
  --text: #19201d; --muted: #55605b; --accent: #0f766e; --accent-ink: #ffffff; --accent-soft: #d9efeb;
  --pos: #0b6b3a; --neg: #a32121; --warn: #7a4f00; --warn-soft: #fbefd2;
  --bar-var: #0f766e; --bar-fix: #3b4a73; --focus: #0b4f9c;
  --shadow: 0 1px 2px rgb(0 0 0 / .06), 0 2px 8px rgb(0 0 0 / .05);
  --r: 14px; --r-s: 9px; --gap: 16px; --nav-h: 64px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101413; --surface: #1a201e; --surface-2: #242c29; --line: #33403b;
    --text: #e9eeeb; --muted: #a4b0aa; --accent: #4fd1c0; --accent-ink: #06201c; --accent-soft: #1d3a36;
    --pos: #6fdc9b; --neg: #ff9b95; --warn: #f2c25e; --warn-soft: #3a2f12;
    --bar-var: #4fd1c0; --bar-fix: #9db2f2; --focus: #8cc1ff;
    --shadow: 0 1px 2px rgb(0 0 0 / .5);
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.45 var(--font); }
h1 { font-size: 1.4rem; margin: 0 0 .25rem; line-height: 1.2; }
h2 { font-size: 1.05rem; margin: 0 0 .5rem; }
p { margin: 0 0 .75rem; }
a { color: var(--accent); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.skip { position: absolute; left: -999px; top: 0; background: var(--surface); padding: .5rem 1rem; z-index: 50; }
.skip:focus { left: 0; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.muted { color: var(--muted); }
.pos { color: var(--pos); } .neg { color: var(--neg); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Shell: mobile = bottom nav, desktop = left rail */
.app { min-height: 100dvh; padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom)); }
.topbar { display: flex; align-items: center; gap: 10px; padding: 12px var(--gap); position: sticky; top: 0; background: var(--bg); z-index: 5; border-bottom: 1px solid var(--line); min-height: 56px; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; flex: 1; }
.brand-mark { width: 22px; height: 22px; fill: var(--accent); }
.nav { position: fixed; inset: auto 0 0 0; height: calc(var(--nav-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); display: grid; grid-template-columns: repeat(5, 1fr); background: var(--surface); border-top: 1px solid var(--line); z-index: 10; }
.nav a { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 48px; text-decoration: none; color: var(--muted); font-size: .72rem; }
.nav svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.nav a[aria-current="page"] { color: var(--accent); font-weight: 700; }
.nav a[aria-current="page"]::before { content: ""; position: absolute; top: 0; width: 28px; height: 3px; border-radius: 0 0 3px 3px; background: var(--accent); }
.badge { position: absolute; top: 4px; left: calc(50% + 6px); min-width: 18px; padding: 0 5px; height: 18px; border-radius: 9px; background: var(--neg); color: #fff; font-size: .7rem; line-height: 18px; text-align: center; font-weight: 700; }
@media (prefers-color-scheme: dark) { .badge { background: #ff7a72; color: #2a0a08; } }
.view { padding: var(--gap); max-width: 920px; margin: 0 auto; outline: none; }
@media (min-width: 900px) {
  .app { padding-bottom: 0; padding-left: 220px; }
  .nav { inset: 56px auto 0 0; width: 220px; height: auto; display: flex; flex-direction: column; padding: 12px; gap: 4px; border-top: 0; border-right: 1px solid var(--line); }
  .nav a { flex-direction: row; justify-content: flex-start; gap: 12px; padding: 10px 12px; border-radius: var(--r-s); font-size: .95rem; }
  .nav a[aria-current="page"] { background: var(--accent-soft); }
  .nav a[aria-current="page"]::before { display: none; }
  .badge { position: static; margin-left: auto; }
  .topbar { padding-left: 24px; margin-left: -220px; padding-left: 244px; }
  .view { padding: 24px; }
  .toasts { bottom: 24px; }
}

/* Components */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: var(--gap); margin-bottom: var(--gap); box-shadow: var(--shadow); }
.card > h2:first-child { margin-top: 0; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: var(--gap); }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 10px 12px; min-width: 0; }
.kpi .l { font-size: .75rem; color: var(--muted); }
.kpi .v { font-size: 1rem; font-weight: 700; }
@media (min-width: 600px) { .kpi .v { font-size: 1.3rem; } }
.btn { font: inherit; min-height: 44px; padding: 0 16px; border-radius: var(--r-s); border: 1px solid var(--muted); background: var(--surface); color: var(--text); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none; }
.btn:hover { background: var(--surface-2); }
.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
.btn-primary:hover { background: var(--accent); filter: brightness(1.08); }
.btn-quiet { border-color: transparent; background: transparent; color: var(--muted); }
.btn-danger { color: var(--neg); }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.chip { display: inline-block; padding: 2px 10px; border-radius: 99px; background: var(--surface-2); font-size: .8rem; }
.chip-warn { background: var(--warn-soft); color: var(--warn); }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row .grow { flex: 1; }
.between { justify-content: space-between; }
.empty { text-align: center; padding: 32px 16px; color: var(--muted); }
.empty h2 { color: var(--text); }
.error-box { border: 1px solid var(--neg); color: var(--neg); border-radius: var(--r-s); padding: 10px 12px; margin-bottom: 12px; }
.note { background: var(--warn-soft); color: var(--warn); border-radius: var(--r-s); padding: 8px 12px; font-size: .9rem; margin-bottom: var(--gap); }
.skeleton { height: 90px; border-radius: var(--r); background: var(--surface-2); margin-bottom: var(--gap); }

/* Forms */
label { display: block; font-weight: 600; margin-bottom: 4px; }
input[type=text], input[type=password], input[type=search], select { width: 100%; min-height: 44px; padding: 0 12px; font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--muted); border-radius: var(--r-s); }
.field { margin-bottom: 14px; }
.hint { font-size: .85rem; color: var(--muted); margin-top: 4px; }
.login { min-height: 100dvh; display: grid; place-items: center; padding: var(--gap); }
.login .card { width: min(100%, 400px); }
.secret { font-family: ui-monospace, Menlo, Consolas, monospace; word-break: break-all; background: var(--surface-2); padding: 8px; border-radius: var(--r-s); user-select: all; }

.monthbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: var(--gap); }
.monthbar h1 { margin: 0; text-align: center; flex: 1; }
.rangebar { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: var(--gap); }
.rangebar label { margin: 0; font-size: .85rem; }
.rangebar select { margin-top: 4px; }
@media (max-width: 380px) { .rangebar { grid-template-columns: 1fr; } }
.iconbtn { width: 44px; padding: 0; font-size: 1.3rem; }

.catlist { list-style: none; margin: 0; padding: 0; }
.catlist li { padding: 8px 0; border-top: 1px solid var(--line); }
.catlist li:first-child { border-top: 0; }
.catlist svg { display: block; width: 100%; height: 10px; margin-top: 6px; }
.track { fill: var(--surface-2); } .fill { fill: var(--accent); }
.delta { font-size: .8rem; color: var(--muted); }

.chart { width: 100%; height: auto; display: block; }
.chart text { fill: var(--muted); font: 11px var(--font); }
.chart .val { fill: var(--text); font-weight: 700; }
.chart .bar { fill: var(--bar-var); }
.chart .bar-last { fill: var(--accent); stroke: var(--text); stroke-width: 1.5; }
.chart .axis { stroke: var(--line); }
.chart .fixed { stroke: var(--bar-fix); stroke-width: 1; }
.chart .variable { fill: var(--bar-var); }
.hatch-bg { fill: var(--surface); }
.hatch-line { stroke: var(--bar-fix); stroke-width: 2; }
.legend { display: flex; gap: 16px; font-size: .85rem; margin-top: 8px; flex-wrap: wrap; }
.legend i { display: inline-block; width: 14px; height: 14px; border-radius: 3px; vertical-align: -2px; margin-right: 6px; }
.legend .l-fix { background: repeating-linear-gradient(45deg, var(--bar-fix) 0 2px, transparent 2px 5px); border: 1px solid var(--bar-fix); }
.legend .l-var { background: var(--bar-var); }
details.data { margin-top: 10px; font-size: .9rem; }
details.data summary { cursor: pointer; color: var(--accent); min-height: 32px; }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: 6px 8px; border-top: 1px solid var(--line); }
td.r, th.r { text-align: right; }

.drop { display: block; position: relative; border: 2px dashed var(--muted); border-radius: var(--r); padding: 28px 16px; text-align: center; background: var(--surface); cursor: pointer; font-weight: 400; }
.drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.drop:focus-within { outline: 3px solid var(--focus); outline-offset: 2px; }
.drop strong { display: block; font-size: 1.1rem; }
progress { width: 100%; height: 10px; accent-color: var(--accent); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px 0; }
.stat { background: var(--surface-2); border-radius: var(--r-s); padding: 10px; text-align: center; }
.stat b { display: block; font-size: 1.4rem; }
.stat span { font-size: .8rem; color: var(--muted); }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0; }
.tabs button { min-height: 36px; border-radius: 99px; border: 1px solid var(--muted); background: var(--surface); color: var(--text); padding: 0 12px; font: inherit; cursor: pointer; }
.tabs button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.loglist { list-style: none; padding: 0; margin: 0; font-size: .9rem; }
.loglist li { display: flex; gap: 8px; padding: 6px 0; border-top: 1px solid var(--line); }
.loglist .ref { color: var(--muted); min-width: 64px; }
.status-ok::before { content: "\2713 "; } .status-bad::before { content: "\2717 "; }

.qcard header { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.qcard h2 { margin: 0; overflow-wrap: anywhere; }
.qmeta { font-size: .85rem; color: var(--muted); margin: 2px 0 10px; }
.examples { list-style: none; margin: 0 0 12px; padding: 0; font-size: .88rem; color: var(--muted); }
.examples li { display: flex; justify-content: space-between; gap: 8px; padding: 2px 0; }
.suggest { display: grid; gap: 8px; margin-bottom: 10px; }
.suggest .btn { justify-content: space-between; text-align: left; }
.suggest .btn:first-child { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
.seg { display: inline-flex; border: 1px solid var(--muted); border-radius: var(--r-s); overflow: hidden; margin-bottom: 10px; }
.seg label { margin: 0; font-weight: 400; }
.seg input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.seg span { display: block; padding: 10px 14px; min-height: 44px; cursor: pointer; }
.seg input:checked + span { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.seg input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: -3px; }
.toasts { position: fixed; left: 0; right: 0; bottom: calc(var(--nav-h) + 12px + env(safe-area-inset-bottom)); display: grid; justify-items: center; gap: 8px; z-index: 30; pointer-events: none; }
.toast { background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 99px; box-shadow: var(--shadow); max-width: 90vw; }
.more-list { list-style: none; padding: 0; margin: 0; }
.more-list li { border-top: 1px solid var(--line); padding: 14px 0; }
.noscript { padding: 16px; }
@media (prefers-reduced-motion: no-preference) { .toast { animation: pop .2s ease-out; } @keyframes pop { from { transform: translateY(8px); opacity: 0; } } }
.seg-set { border: 0; padding: 0; margin: 0; min-width: 0; }

/* U22: Buchungen, Nachfragen details, Abos/Ausreisser */
h3 { font-size: .95rem; margin: 12px 0 4px; }
.center { text-align: center; }
.stat-line { background: var(--surface-2); border-radius: var(--r-s); padding: 8px 12px; font-size: .9rem; }
.card.flush { padding: 0; overflow: hidden; }
.txrows { list-style: none; margin: 0; padding: 0; }
.txrow { padding: 12px var(--gap); border-top: 1px solid var(--line); }
.txrow:first-child { border-top: 0; }
.txrow .row { align-items: flex-start; flex-wrap: nowrap; }
.txrow .row + .row { align-items: center; margin-top: 8px; }
.txmain { min-width: 0; overflow-wrap: anywhere; }
.txamt { display: grid; justify-items: end; gap: 4px; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 400; min-height: 44px; margin: 0; }
.check input { width: 22px; height: 22px; flex: none; accent-color: var(--accent); }
.check.small { font-size: .85rem; white-space: nowrap; }
.txlist { list-style: none; margin: 0; padding: 0; max-height: 320px; overflow: auto; }
.txlist .check { justify-content: space-between; gap: 8px; border-top: 1px solid var(--line); }
.txlist .check input { order: -1; }
.txlist .txt { flex: 1; font-size: .88rem; overflow-wrap: anywhere; }
input[type=search] { width: 100%; }

/* Coach / Kaufberater */
h3 { font-size: .95rem; margin: 14px 0 6px; }
.plain { list-style: none; margin: 0; padding: 0; }
.plain > li { padding: 6px 0; }
.big { font-size: 1.25rem; font-weight: 700; }
.summary { font-size: 1.02rem; }
.tip { border-top: 1px solid var(--line); padding: 12px 0 4px; }
.tip h3 { margin: 0; flex: 1; min-width: 0; }
.tipchf { text-align: right; white-space: nowrap; }
.budrow { border-top: 1px solid var(--line); padding: 12px 0; }
.budrow label { margin: 0; flex: 1; }
.report-text p { margin: 0 0 .4rem; }
progress { width: 100%; height: 14px; accent-color: var(--accent); }
.verdict { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--r-s); border: 2px solid var(--text); }
.verdict h2 { margin: 0; font-size: 1.3rem; }
.vicon { font-size: 1.6rem; line-height: 1; }
.v-buy { border-color: var(--pos); color: var(--pos); }
.v-wait { border-color: var(--warn); color: var(--warn); }
.v-no { border-color: var(--neg); color: var(--neg); }
.options li { padding: 6px 0; }
.catconfirm { background: var(--surface-2); border-radius: var(--r-s); padding: 10px 12px; margin: 12px 0; }
.payload { background: var(--surface-2); border-radius: var(--r-s); padding: 10px; overflow: auto; font-size: .8rem; max-height: 280px; white-space: pre-wrap; overflow-wrap: anywhere; }
.refused { border: 2px solid var(--warn); }
.decide { margin-top: 12px; }
.histrow { border-top: 1px solid var(--line); padding: 10px 0; }
.seg { max-width: 100%; flex-wrap: wrap; }

/* Anlagen (U49) */
.disclaimer { background: var(--surface-2); border-radius: var(--r-s); padding: 8px 12px; font-size: .9rem; color: var(--muted); margin: 0 0 var(--gap); }
label.inline { margin: 0; }
label.inline select { width: auto; min-width: 11rem; }
.tablewrap { overflow-x: auto; }
table.positions th[scope=row] { font-weight: 400; }
table.positions .pname { display: block; font-weight: 600; overflow-wrap: anywhere; }
table.positions .psub { display: block; font-size: .8rem; color: var(--muted); overflow-wrap: anywhere; }
table.positions td { vertical-align: top; }
.facts { display: grid; grid-template-columns: 1fr auto; gap: 0 12px; margin: 8px 0; }
.facts dt, .facts dd { margin: 0; padding: 8px 0; border-top: 1px solid var(--line); }
.facts dt:first-of-type, .facts dt:first-of-type + dd { border-top: 0; }
.facts dd { text-align: right; font-weight: 600; }
.factlist { margin: 10px 0 0; padding-left: 1.2rem; font-size: .9rem; color: var(--muted); }
.legend .l-total { background: var(--accent); border-radius: 50%; }
.legend .l-inv { background: transparent; border: 2px dashed var(--bar-fix); }
.chart .line-total { stroke: var(--accent); stroke-width: 2.5; }
.chart .line-inv { stroke: var(--bar-fix); stroke-width: 2; stroke-dasharray: 6 4; }
.chart .pt-total { fill: var(--accent); }
.chart .pt-inv { fill: var(--bar-fix); }
@media (max-width: 380px) { .facts { grid-template-columns: 1fr; } .facts dd { text-align: left; border-top: 0; padding-top: 0; } }
