/* PUFU Portal: ein Design-System fuer alle Seiten.
   Tokens oben, dann Grundgeruest, dann genau ein Satz Komponenten. Seiten-CSS (css/pages/*.css)
   ordnet nur an und nutzt diese Tokens; es definiert keine eigenen Knoepfe, Felder oder Karten. */

@font-face { font-family: "Familjen Grotesk"; src: url(/static/fonts/familjen-grotesk-400.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Familjen Grotesk"; src: url(/static/fonts/familjen-grotesk-500.woff2) format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Familjen Grotesk"; src: url(/static/fonts/familjen-grotesk-600.woff2) format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Familjen Grotesk"; src: url(/static/fonts/familjen-grotesk-700.woff2) format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "DM Serif Display"; src: url(/static/fonts/dm-serif-display-400.woff2) format("woff2"); font-weight: 400; font-display: swap; }

/* ═══ Tokens ═══════════════════════════════════════════════════════ */
:root {
  /* Farben */
  --bg: #F4F1EA;          /* Seitengrund (cream) */
  --surface: #FBF9F5;     /* Karten, Dialoge */
  --surface-2: #EFE9DF;   /* Seitenleiste, Fussleisten, ruhige Flaechen */
  --surface-3: #E7E1D5;   /* Spur, Platzhalter (sand) */
  --ink: #2E2C29;
  --text-2: #5A544B;
  --text-3: #736B5F;
  --line: #E2DACB;
  --line-2: #D3C8B7;
  --accent: #FBC49D;      /* die eine Akzentfarbe: Hauptaktion, Auswahl */
  --accent-hover: #F6B482;
  --accent-soft: #FDE8D7;
  --accent-ink: #2E2C29;
  --accent-deep: #A9763F; /* caramel: Symbole aktiver Eintraege */
  --ok: #5F7F40;          /* matcha, nur Statuspunkte */
  --warn: #A9763F;
  --bad: #A8432F;
  --bad-soft: #F8E9E4;
  --ok-soft: #EEF3E8;
  --warn-soft: #FAF0E3;
  --focus: #D98A52;

  /* Abstaende 4/8/12/16/24/32/48 */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px;
  /* Radien */
  --r-sm: 8px; --r-md: 12px; --r-lg: 16px; --r-pill: 999px;
  /* eine Kontrollhoehe fuer Knoepfe, Felder, Selects, Segmente */
  --ctl: 40px;
  /* Schrift */
  --serif: "DM Serif Display", Georgia, "Times New Roman", serif;
  --sans: "Familjen Grotesk", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --fs-xs: 12px; --fs-sm: 13px; --fs-ui: 14px; --fs-body: 15px; --fs-md: 17px; --fs-lg: 20px; --fs-xl: 24px; --fs-2xl: 30px;
  /* Tiefe: Dialoge und Menues tragen Schatten, Karten nur Rahmen */
  --shadow-pop: 0 12px 32px -8px rgba(46, 44, 41, .22), 0 2px 6px rgba(46, 44, 41, .08);
  --shadow-dlg: 0 24px 64px -16px rgba(46, 44, 41, .32), 0 4px 12px rgba(46, 44, 41, .08);
  /* Bewegung */
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);
  /* Grundgeruest */
  --side-w: 248px; --rail-w: 84px; --top-h: 56px; --tab-h: 62px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);

}
@media (pointer: coarse) { :root { --ctl: 44px; } }

/* ═══ Basis ════════════════════════════════════════════════════════ */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scrollbar-color: var(--line-2) transparent; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 var(--fs-body)/1.5 var(--sans); caret-color: var(--accent-deep); -webkit-tap-highlight-color: transparent; }
::selection { background: var(--accent-soft); color: var(--ink); }
img { max-width: 100%; }
[hidden] { display: none !important; }
a { color: var(--ink); text-decoration-color: var(--accent); text-decoration-thickness: 2px; text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--accent-deep); }
h1, h2, h3, h4 { margin: 0; font-weight: 400; text-wrap: balance; }
h1 { font: 400 var(--fs-2xl)/1.15 var(--serif); letter-spacing: -0.01em; }
h2 { font: 400 var(--fs-xl)/1.2 var(--serif); }
h3 { font: 600 var(--fs-md)/1.3 var(--sans); }
p { margin: 0 0 var(--s3); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.ic { width: 1em; height: 1em; flex: none; display: inline-block; vertical-align: -0.125em; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.small { font-size: var(--fs-sm); }
.nowrap { white-space: nowrap; }
.il { display: inline-flex; align-items: center; gap: var(--s2); }
.il > .ic { vertical-align: 0; }
.grow { flex: 1 1 auto; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: var(--s4); }
.row-flex { display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; }
.pos { color: var(--ok); }
.neg { color: var(--bad); }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; } }

/* Abschnittstitel: klein, Grossbuchstaben, Symbol auf einer Linie */
.sec-title { display: flex; align-items: center; gap: var(--s2); margin: var(--s6) 0 var(--s3); font: 600 var(--fs-xs)/1 var(--sans); letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); }
.sec-title .ic { font-size: 14px; vertical-align: 0; }
.sec-title .act { margin-left: auto; text-transform: none; letter-spacing: 0; font-weight: 600; }
.sec-title:first-child { margin-top: 0; }

/* ═══ Grundgeruest: Handy oben + unten, iPad Leiste, Laptop Seitenleiste ═══ */
.app { min-height: 100vh; }
.side { display: none; }
.top { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: var(--s3); height: calc(var(--top-h) + var(--safe-t)); padding: var(--safe-t) var(--s4) 0; background: color-mix(in srgb, var(--bg) 90%, transparent); backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line); }
.top-title { flex: 1; min-width: 0; font: 400 var(--fs-lg)/1.2 var(--serif); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand { display: flex; align-items: center; gap: var(--s2); text-decoration: none; color: var(--text-2); font-weight: 600; letter-spacing: .02em; }
.brand img { display: block; height: auto; }
.main { padding: var(--s5) var(--s4) calc(var(--tab-h) + var(--s6) + var(--safe-b)); max-width: 1280px; margin: 0 auto; }
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: grid; grid-template-columns: repeat(5, 1fr); height: calc(var(--tab-h) + var(--safe-b)); padding-bottom: var(--safe-b); background: var(--surface); border-top: 1px solid var(--line); }
.tabbar a, .tabbar button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-width: 0; font: 500 11px/1 var(--sans); color: var(--text-2); text-decoration: none; background: none; border: 0; cursor: pointer; padding: 0 2px; }
.tabbar .ic { font-size: 22px; }
.tabbar .lbl { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tabbar .on { color: var(--ink); font-weight: 600; }
.tabbar .on .ic { color: var(--accent-deep); }
.tabbar .tb-ic { position: relative; display: inline-flex; }
.tabbar .tb-ic .dot { position: absolute; top: -2px; right: -5px; width: 9px; height: 9px; border-radius: 50%; background: var(--accent-deep); border: 2px solid var(--surface); }
.tabbar .tb-ic .dot:empty { display: block; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { position: relative; display: flex; align-items: center; gap: var(--s3); min-height: var(--ctl); padding: 0 var(--s3); border-radius: var(--r-sm); color: var(--text-2); text-decoration: none; font: 500 var(--fs-ui)/1.2 var(--sans); transition: background-color 120ms ease, color 120ms ease; }
.nav a .ic { font-size: 18px; }
.nav a:hover { background: color-mix(in srgb, var(--surface-3) 70%, transparent); color: var(--ink); }
.nav a.on { background: var(--accent-soft); color: var(--ink); font-weight: 600; }
.nav a.on .ic { color: var(--accent-deep); }
.nav .lbl { flex: 1; min-width: 0; }
.nav .badge { font: 600 var(--fs-xs)/1 var(--sans); color: var(--accent-deep); font-variant-numeric: tabular-nums; }
.nav .badge:empty { display: none; }
.side-foot { margin-top: auto; padding-top: var(--s3); border-top: 1px solid var(--line); display: flex; align-items: center; gap: var(--s3); }
.side-foot .who { min-width: 0; flex: 1; font-size: var(--fs-ui); line-height: 1.25; text-decoration: none; color: var(--ink); }
.side-foot .who b { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-foot .who span { color: var(--text-3); font-size: var(--fs-sm); }

@media (min-width: 768px) {
  .top, .tabbar { display: none; }
  .side { display: flex; flex-direction: column; position: fixed; inset: 0 auto 0 0; z-index: 20; padding: var(--s5) var(--s3) var(--s4); background: var(--surface-2); border-right: 1px solid var(--line); overflow-y: auto; scrollbar-width: none; }
  .main { padding: var(--s6) var(--s6) var(--s7); }
}
/* iPad hoch und quer: schmale Leiste, Symbol mit kurzem Wort darunter */
@media (min-width: 768px) and (max-width: 1279px) {
  .side { width: var(--rail-w); padding: var(--s4) 6px; }
  .side .brand { justify-content: center; padding: 0 0 var(--s4); }
  .side .brand img { width: 54px; }
  .side .brand span { display: none; }
  .nav { gap: 4px; }
  .nav a { flex-direction: column; justify-content: center; gap: 5px; min-height: 60px; padding: var(--s2) 2px; font-size: 11px; text-align: center; }
  .nav a .ic { font-size: 21px; }
  .nav .lbl { flex: none; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .nav .badge { position: absolute; top: 8px; right: 14px; }
  .side-foot { flex-direction: column; gap: var(--s2); padding-top: var(--s3); }
  .side-foot .who { display: none; }
  .main { margin-left: var(--rail-w); padding: var(--s5) var(--s5) var(--s7); }
}
@media (min-width: 1280px) {
  .side { width: var(--side-w); }
  .side .brand { padding: 0 var(--s3) var(--s5); }
  .main { margin-left: var(--side-w); padding: var(--s6) var(--s7) var(--s7); }
}

/* Seitenkopf: Titel links, hoechstens eine Hauptaktion rechts */
.ph { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--s3) var(--s4); margin-bottom: var(--s5); }
.ph .tt { flex: 1 1 240px; min-width: 0; }
.ph .sub { color: var(--text-2); margin-top: var(--s1); font-size: var(--fs-ui); }
.ph .acts { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; }
@media (max-width: 767px) { .ph h1 { font-size: 26px; } .ph { margin-bottom: var(--s4); } .ph .acts:has(.btn.primary) { flex: 1 1 100%; } .ph .acts .btn.primary { flex: 1 1 auto; } }

/* Werkzeugleiste: alles eine Hoehe, eine Zeile solange Platz ist */
.bar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); margin-bottom: var(--s4); }
.bar > * { flex: none; }
.bar .spacer { flex: 1 1 0; min-width: 0; }
.bar .select { min-width: 160px; }
.bar .label { font-weight: 600; font-size: var(--fs-md); min-width: 140px; text-align: center; font-variant-numeric: tabular-nums; }
.bar .group { display: inline-flex; align-items: center; gap: var(--s1); }
@media (max-width: 767px) {
  .bar .select { flex: 1 1 140px; min-width: 0; }
  .bar .spacer { display: none; }
  .bar .group.fill { flex: 1 1 100%; justify-content: space-between; }
  .bar .group.fill .label { flex: 1; }
}
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); margin-bottom: var(--s4); }

/* ═══ Knoepfe ══════════════════════════════════════════════════════ */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--s2); height: var(--ctl); padding: 0 var(--s4); border-radius: var(--r-sm); border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); font: 600 var(--fs-ui)/1 var(--sans); white-space: nowrap; cursor: pointer; text-decoration: none; transition: background-color 150ms ease, border-color 150ms ease, transform 160ms var(--ease-out); user-select: none; -webkit-user-select: none; }
.btn .ic { font-size: 16px; vertical-align: 0; }
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.danger { color: var(--bad); }
.btn.icon { width: var(--ctl); padding: 0; flex: none; }
.btn.icon .ic { font-size: 18px; }
.btn.sm { height: 32px; padding: 0 var(--s3); font-size: var(--fs-sm); }
.btn.sm.icon { width: 32px; padding: 0; }
.btn.sm.icon .ic { font-size: 16px; }
.btn.lg { height: 56px; padding: 0 var(--s5); font-size: var(--fs-md); border-radius: var(--r-md); }
.btn.block { width: 100%; }
.btn.on { background: var(--accent-soft); border-color: var(--accent); }
.btn:disabled { opacity: .45; cursor: default; }
@media (hover: hover) and (pointer: fine) {
  .btn:hover:not(:disabled) { background: var(--surface-2); }
  .btn.primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }
  .btn.ghost:hover:not(:disabled) { background: var(--surface-2); color: var(--ink); }
  .btn.danger:hover:not(:disabled) { background: var(--bad-soft); }
}
/* alter Name, gleiche Optik wie .btn.icon */
.icon-btn { display: inline-flex; align-items: center; justify-content: center; flex: none; width: var(--ctl); height: var(--ctl); border-radius: var(--r-sm); border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); cursor: pointer; font-size: 18px; padding: 0; transition: background-color 150ms ease, transform 160ms var(--ease-out); }
.icon-btn:active { transform: scale(0.97); }
.icon-btn.sm { width: 32px; height: 32px; font-size: 16px; }
.icon-btn.plain { border-color: transparent; background: transparent; color: var(--text-2); }
@media (hover: hover) and (pointer: fine) { .icon-btn:hover { background: var(--surface-2); color: var(--ink); } }

/* Segment-Umschalter */
.seg { display: inline-flex; align-items: stretch; height: var(--ctl); padding: 3px; gap: 2px; border-radius: var(--r-sm); background: var(--surface-2); border: 1px solid var(--line); max-width: 100%; overflow-x: auto; scrollbar-width: none; vertical-align: middle; }
.seg::-webkit-scrollbar { display: none; }
.seg button { display: inline-flex; align-items: center; gap: 6px; padding: 0 var(--s3); border: 0; border-radius: 6px; background: transparent; color: var(--text-2); font: 500 var(--fs-ui)/1 var(--sans); white-space: nowrap; cursor: pointer; transition: background-color 150ms ease, color 150ms ease; }
.seg button .ic { font-size: 15px; vertical-align: 0; }
.seg button .cnt { font-size: var(--fs-xs); color: var(--accent-deep); font-weight: 600; font-variant-numeric: tabular-nums; }
.seg button .cnt:empty { display: none; }
.seg button.on { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(46, 44, 41, .14); }
.seg.block { display: flex; width: 100%; }
.seg.block button { flex: 1; justify-content: center; }

/* ═══ Felder ═══════════════════════════════════════════════════════ */
.f { display: flex; flex-direction: column; gap: 6px; min-width: 0; margin: 0; }
.f > .lbl { font: 500 var(--fs-sm)/1.3 var(--sans); color: var(--text-2); }
.f > .hint { font-size: var(--fs-xs); color: var(--text-3); line-height: 1.4; }
.form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s4); }
.form > .full, .form > .msg, .form > .sec-title, .form > .drop, .form > .sw, .form > .cbs, .form > .preview { grid-column: 1 / -1; }
.form > .sec-title { margin: var(--s2) 0 0; }
.form.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form.one { grid-template-columns: minmax(0, 1fr); }
@media (max-width: 520px) { .form { grid-template-columns: minmax(0, 1fr); } .form.three { grid-template-columns: repeat(2, minmax(0, 1fr)); } .form.three > .full { grid-column: 1 / -1; } }
.input, .select select {
  display: block; width: 100%; height: var(--ctl); margin: 0; padding: 0 var(--s3); border: 1px solid var(--line-2); border-radius: var(--r-sm); background: #fff; color: var(--ink);
  font: 400 16px/1.2 var(--sans); transition: border-color 150ms ease, box-shadow 150ms ease; }
textarea.input { height: auto; min-height: 96px; padding: 10px var(--s3); line-height: 1.45; resize: vertical; }
.input::placeholder { color: var(--text-3); }
.input:focus, .select select:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 45%, transparent); }
.input:disabled, .select select:disabled { background: var(--surface-2); color: var(--text-3); }
.input[type=date], .input[type=time], .input[type=month] { padding-right: var(--s2); min-width: 0; }
.input[type=date]::-webkit-calendar-picker-indicator, .input[type=time]::-webkit-calendar-picker-indicator { opacity: .55; cursor: pointer; }
.input.invalid { border-color: var(--bad); }
/* Eingabe mit Einheit rechts (z. B. Euro) */
.affix { position: relative; display: block; }
.affix .input { padding-right: 40px; }
.affix .sfx { position: absolute; right: 1px; top: 1px; bottom: 1px; width: 38px; display: flex; align-items: center; justify-content: center; color: var(--text-2); font-weight: 600; pointer-events: none; border-left: 1px solid var(--line); }
/* eigenes Select: natives Element ohne Pfeil, Lucide-Pfeil daneben */
.select { position: relative; display: block; min-width: 0; }
.select select { appearance: none; -webkit-appearance: none; padding-right: 36px; cursor: pointer; text-overflow: ellipsis; white-space: nowrap; overflow: hidden; }
.select select::-ms-expand { display: none; }
.select .chev { position: absolute; right: 12px; top: 50%; margin-top: -8px; font-size: 16px; color: var(--text-2); pointer-events: none; }

/* eigene Checkbox */
.cb { display: inline-flex; align-items: flex-start; gap: var(--s3); min-height: 24px; cursor: pointer; font-size: var(--fs-body); line-height: 1.35; position: relative; user-select: none; }
.cb input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; pointer-events: none; }
.cb .box { flex: none; width: 22px; height: 22px; border-radius: 6px; border: 1.5px solid var(--line-2); background: #fff; display: inline-flex; align-items: center; justify-content: center; color: transparent; font-size: 15px; transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease, transform 160ms var(--ease-out); }
.cb .box .ic { stroke-width: 3; vertical-align: 0; }
.cb:active .box { transform: scale(0.92); }
.cb input:checked + .box { background: var(--accent-deep); border-color: var(--accent-deep); color: #fff; }
.cb input:focus-visible + .box { outline: 2px solid var(--focus); outline-offset: 2px; }
.cb input:disabled + .box { background: var(--surface-2); }
.cb .txt { padding-top: 1px; min-width: 0; }
.cb .txt small { display: block; color: var(--text-3); font-size: var(--fs-xs); }
.cbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: var(--s3) var(--s4); }
/* Schalter */
.sw { display: flex; align-items: center; gap: var(--s3); min-height: var(--ctl); cursor: pointer; position: relative; user-select: none; }
.sw input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; pointer-events: none; }
.sw .txt { flex: 1; min-width: 0; line-height: 1.35; }
.sw .txt small { display: block; color: var(--text-3); font-size: var(--fs-xs); }
.sw .track { flex: none; width: 44px; height: 26px; border-radius: var(--r-pill); background: var(--surface-3); position: relative; transition: background-color 180ms ease; }
.sw .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(46, 44, 41, .28); transition: transform 200ms var(--ease-out); }
.sw input:checked ~ .track { background: var(--accent-deep); }
.sw input:checked ~ .track::after { transform: translateX(18px); }
.sw input:focus-visible ~ .track { outline: 2px solid var(--focus); outline-offset: 2px; }
.sw.boxed { padding: var(--s2) var(--s3); border: 1px solid var(--line); border-radius: var(--r-sm); background: #fff; }

/* Datei-Ablageflaeche */
.drop { position: relative; display: flex; align-items: center; gap: var(--s4); padding: var(--s4); border: 1.5px dashed var(--line-2); border-radius: var(--r-md); background: #fff; cursor: pointer; transition: border-color 150ms ease, background-color 150ms ease; }
.drop input[type=file] { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.drop.over { border-color: var(--accent-deep); background: var(--accent-soft); }
.drop.has { border-style: solid; border-color: var(--line); cursor: default; }
.drop .pv { flex: none; width: 96px; height: 96px; border-radius: var(--r-sm); background: var(--surface-2); display: flex; align-items: center; justify-content: center; color: var(--text-3); font-size: 28px; overflow: hidden; }
.drop .pv img { width: 100%; height: 100%; object-fit: contain; }
.drop .tx { flex: 1; min-width: 0; font-size: var(--fs-ui); color: var(--text-2); }
.drop .tx b { display: block; color: var(--ink); font-size: var(--fs-body); margin-bottom: 2px; }
.drop .tx .fn { display: block; margin-top: var(--s1); color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drop .acts { display: flex; gap: var(--s2); margin-top: var(--s3); flex-wrap: wrap; }
.drop.big { flex-direction: column; justify-content: center; text-align: center; padding: var(--s6) var(--s4); }
.drop.big .pv { width: 56px; height: 56px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-deep); font-size: 24px; }
@media (max-width: 420px) { .drop .pv { width: 72px; height: 72px; } }

/* Meldungen inline */
.msg { display: flex; align-items: flex-start; gap: 10px; padding: 10px var(--s3); border-radius: var(--r-sm); font-size: var(--fs-ui); line-height: 1.45; background: var(--surface-2); color: var(--ink); }
.msg .ic { font-size: 16px; margin-top: 2px; }
.msg.err { background: var(--bad-soft); color: #7E3222; }
.msg.ok { background: var(--ok-soft); color: #3F5A2B; }
.msg.warn { background: var(--warn-soft); color: #6F4D25; }
.msg:empty { display: none; }
.msg .act { margin-left: auto; }

/* ═══ Flaechen ═════════════════════════════════════════════════════ */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: var(--s5); }
.card.tight { padding: var(--s4); }
.card.flush { padding: 0; overflow: hidden; }
.card + .card { margin-top: var(--s4); }
.card-h { display: flex; align-items: center; gap: var(--s3); margin-bottom: var(--s4); }
.card-h h3 { flex: 1; min-width: 0; }
.grid-2 { display: grid; gap: var(--s5); }
@media (min-width: 1100px) { .grid-2 { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); align-items: start; } }
@media (max-width: 767px) { .card { padding: var(--s4); } }

/* Listen */
.list { list-style: none; margin: 0; padding: 0; }
.list > li { display: flex; align-items: center; gap: var(--s3); padding: var(--s3) var(--s4); border-top: 1px solid var(--line); min-height: 56px; }
.list > li:first-child { border-top: 0; }
.list .main-col { flex: 1; min-width: 0; }
.list .t { font-weight: 600; line-height: 1.3; }
.list .s { color: var(--text-2); font-size: var(--fs-ui); line-height: 1.4; margin-top: 2px; }
.list .right { margin-left: auto; text-align: right; flex: none; }
.list > li.click { cursor: pointer; transition: background-color 120ms ease; }
@media (hover: hover) and (pointer: fine) { .list > li.click:hover { background: color-mix(in srgb, var(--surface-2) 55%, var(--surface)); } }
.list > li.click:active { background: var(--surface-2); }
.list.plain > li { padding-left: 0; padding-right: 0; }
.kind-ic { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 10px; background: var(--surface-2); color: var(--text-2); font-size: 17px; }
.kind-ic.acc { background: var(--accent-soft); color: var(--accent-deep); }

/* Kennzahlen */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(132px, 1fr)); border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); overflow: hidden; }
.stats > div { padding: var(--s3) var(--s4); box-shadow: -1px 0 0 var(--line), 0 -1px 0 var(--line); }
.stats .k { font: 600 var(--fs-xs)/1.2 var(--sans); letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); }
.stats .v { font: 600 var(--fs-lg)/1.3 var(--sans); font-variant-numeric: tabular-nums; margin-top: 4px; }
.stats .v small { font-size: var(--fs-ui); font-weight: 500; color: var(--text-2); }

.kv { display: grid; grid-template-columns: minmax(120px, max-content) 1fr; gap: var(--s2) var(--s5); font-size: var(--fs-body); margin: 0; }
.kv dt { color: var(--text-2); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 420px) { .kv { grid-template-columns: 1fr; gap: 0; } .kv dt { font-size: var(--fs-sm); } .kv dd { margin-bottom: var(--s3); } }

/* Status: 7px-Punkt plus Wort */
.st { display: inline-flex; align-items: center; gap: 7px; font-size: var(--fs-ui); line-height: 1.2; color: var(--text-2); white-space: nowrap; }
.st::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--text-3); flex: none; }
.st-ok::before { background: var(--ok); }
.st-wait::before { background: var(--warn); }
.st-bad::before { background: var(--bad); }
.st-new::before { background: var(--accent-hover); }
.st-off::before { background: var(--line-2); }

/* Kennzeichen (z. B. Empfehlung) */
.tag { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: var(--r-pill); background: var(--accent-soft); color: #7A4B22; font: 600 var(--fs-xs)/1 var(--sans); white-space: nowrap; vertical-align: middle; }
.tag .ic { font-size: 12px; vertical-align: 0; }
.tag.neutral { background: var(--surface-2); color: var(--text-2); }

/* Avatar: Initialen exakt mittig */
.av { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 50%; background: var(--av, var(--surface-3)); color: #4A3F33; font: 600 12px/1 var(--sans); letter-spacing: .02em; text-transform: uppercase; user-select: none; text-indent: .02em; }
.av.sm { width: 26px; height: 26px; font-size: 10.5px; }
.av.lg { width: 56px; height: 56px; font-size: 19px; }
.av.xl { width: 72px; height: 72px; font-size: 24px; }
.avs { display: inline-flex; vertical-align: middle; }
.avs .av { box-shadow: 0 0 0 2px var(--surface); }
.avs .av + .av { margin-left: -6px; }

/* Tabellen: Zahlen rechts (Kopf und Wert), feste Spalten */
.tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tbl { width: 100%; border-collapse: collapse; font-size: var(--fs-ui); }
.tbl.fixed { table-layout: fixed; }
.tbl th { text-align: left; font: 600 var(--fs-xs)/1.2 var(--sans); letter-spacing: .05em; text-transform: uppercase; color: var(--text-3); padding: 10px var(--s3); border-bottom: 1px solid var(--line); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tbl td { padding: 10px var(--s3); border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl th.num, .tbl td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl th.act, .tbl td.act { text-align: right; white-space: nowrap; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr.click { cursor: pointer; }
@media (hover: hover) and (pointer: fine) { .tbl tr.click:hover td { background: color-mix(in srgb, var(--surface-2) 55%, var(--surface)); } }
.tbl tr.dim td { color: var(--text-3); }
.tbl tfoot td { font-weight: 600; border-top: 1px solid var(--line-2); border-bottom: 0; background: var(--surface-2); }
.tbl .cell-t { font-weight: 600; display: block; }
.tbl .cell-s { display: block; color: var(--text-3); font-size: var(--fs-sm); font-weight: 400; }

/* Leerzustand: klein und ruhig */
.empty { display: flex; align-items: center; gap: var(--s3); padding: var(--s4); color: var(--text-2); font-size: var(--fs-ui); }
.empty .ic { font-size: 18px; color: var(--text-3); }
.empty.center { justify-content: center; text-align: center; padding: var(--s6) var(--s4); }
.empty.bare { padding: var(--s2) 0; }
.loading { padding: var(--s5) 0; }
.skel { height: 14px; border-radius: 6px; background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2)); background-size: 200% 100%; animation: skel 1.2s ease-in-out infinite; margin-bottom: var(--s3); }
@keyframes skel { from { background-position: 100% 0; } to { background-position: -100% 0; } }

/* Menue (Popover am Ausloeser) */
.pop { position: fixed; z-index: 120; min-width: 220px; max-width: calc(100vw - 24px); padding: 6px; border-radius: var(--r-md); background: var(--surface); box-shadow: var(--shadow-pop); opacity: 0; transform: scale(0.97); transition: opacity 140ms ease, transform 180ms var(--ease-out); }
.pop.in { opacity: 1; transform: none; }
.pop button { display: flex; align-items: center; gap: var(--s3); width: 100%; min-height: var(--ctl); padding: 0 var(--s3); border: 0; border-radius: var(--r-sm); background: none; color: var(--ink); font: 500 var(--fs-ui)/1.2 var(--sans); text-align: left; cursor: pointer; }
.pop button .ic { font-size: 16px; color: var(--text-2); vertical-align: 0; }
.pop button:hover, .pop button:focus-visible { background: var(--surface-2); outline: none; }
.pop button.danger, .pop button.danger .ic { color: var(--bad); }
.pop hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }

/* ═══ Dialoge: ein System, Breiten sm/md/lg, am Handy als Blatt von unten ═══ */
.ov { position: fixed; inset: 0; z-index: 100; display: flex; align-items: flex-end; justify-content: center; background: rgba(46, 44, 41, .36); opacity: 0; transition: opacity 200ms ease; }
.ov.in { opacity: 1; }
.dlg { position: relative; display: flex; flex-direction: column; width: 100%; max-height: 92vh; max-height: 92dvh; background: var(--surface); border-radius: 20px 20px 0 0; box-shadow: var(--shadow-dlg); padding-bottom: var(--safe-b); transform: translateY(100%); transition: transform 340ms var(--ease-drawer); }
.ov.in .dlg { transform: none; }
.dlg::before { content: ""; position: absolute; top: 8px; left: 50%; width: 36px; height: 4px; margin-left: -18px; border-radius: 2px; background: var(--line-2); }
.dlg-h { display: flex; align-items: center; gap: var(--s3); padding: var(--s5) var(--s5) var(--s3); }
.dlg-h h2 { flex: 1; min-width: 0; font-size: 22px; line-height: 1.2; overflow-wrap: anywhere; }
.dlg-h .x { margin: -4px -8px -4px 0; }
.dlg-pre:empty { display: none; }
.dlg-b { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; padding: var(--s3) var(--s5) var(--s5); }
.dlg-b > .msg + *, .dlg-b > * + .msg { margin-top: var(--s4); }
.dlg-f { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); padding: var(--s4) var(--s5); border-top: 1px solid var(--line); background: var(--surface); border-radius: 0 0 var(--r-lg) var(--r-lg); }
.dlg-f .left { margin-right: auto; }
.dlg-f[hidden] { display: none; }
.dlg .guard:empty { display: none; }
.dlg .guard { padding: 0 var(--s5) var(--s3); }
.dlg .guard .row-flex { justify-content: flex-end; margin-top: var(--s2); }
@media (max-width: 639px) {
  .dlg-h { padding: var(--s5) var(--s4) var(--s2); }
  .dlg-b { padding: var(--s3) var(--s4) var(--s4); }
  .dlg-f { padding: var(--s3) var(--s4); border-radius: 0; }
  .dlg-f .btn { flex: 1 1 0; min-width: 0; }
  .dlg-f .btn.left { flex: 0 0 auto; }
  .dlg .guard { padding: 0 var(--s4) var(--s3); }
}
@media (min-width: 640px) {
  .ov { align-items: center; padding: var(--s5); }
  .dlg { max-width: 600px; max-height: min(88vh, 920px); border-radius: var(--r-lg); padding-bottom: 0; transform: translateY(8px) scale(0.98); opacity: 0; transition: transform 220ms var(--ease-out), opacity 180ms ease; }
  .ov.in .dlg { opacity: 1; }
  .dlg::before { display: none; }
  .dlg.sm { max-width: 440px; }
  .dlg.lg, .dlg.wide { max-width: 880px; }
}
/* Schrittanzeige als eigene Leiste unter dem Kopf */
.steps { display: flex; align-items: center; gap: var(--s2); margin: 0 var(--s5); padding: var(--s2) 0 var(--s4); border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.steps::-webkit-scrollbar { display: none; }
.steps .st-i { display: inline-flex; align-items: center; gap: var(--s2); flex: none; font: 500 var(--fs-sm)/1 var(--sans); color: var(--text-3); white-space: nowrap; }
.steps .st-i .n { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 50%; border: 1.5px solid var(--line-2); font: 600 12px/1 var(--sans); color: var(--text-2); background: #fff; }
.steps .st-i .n .ic { font-size: 13px; stroke-width: 3; vertical-align: 0; }
.steps .st-i.on { color: var(--ink); font-weight: 600; }
.steps .st-i.on .n { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.steps .st-i.done .n { background: var(--accent-deep); border-color: var(--accent-deep); color: #fff; }
.steps .sep { flex: 1 1 16px; min-width: 12px; height: 1.5px; background: var(--line-2); }
.steps .st-i.done + .sep { background: var(--accent-deep); }
@media (max-width: 639px) {
  .steps { margin: 0 var(--s4); }
  .steps .st-i:not(.on) .t { display: none; }
}

/* ═══ Anmeldung ════════════════════════════════════════════════════ */
.screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: var(--s5) var(--s4); }
.auth { width: 100%; max-width: 400px; }
.auth .logo { display: block; margin: 0 auto var(--s5); width: 112px; }
.auth h1 { text-align: center; margin-bottom: var(--s2); }
.auth .sub { text-align: center; color: var(--text-2); margin-bottom: var(--s5); }
.auth .card { display: flex; flex-direction: column; gap: var(--s4); }

/* ═══ Druckansicht ═════════════════════════════════════════════════ */
.print-page { background: #fff; color: #000; padding: var(--s5); border: 1px solid var(--line); border-radius: var(--r-md); }
.print-page h1 { font-size: 26px; }
.print-page .tbl th, .print-page .tbl td { padding: 5px 8px; font-size: 13px; }
.sig { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; margin-top: 48px; font-size: 13px; color: #444; }
.sig div { border-top: 1px solid #555; padding-top: 6px; }
.print-break { break-after: page; page-break-after: always; margin-bottom: 30px; }
@media print {
  body { background: #fff; }
  .side, .top, .tabbar, .no-print, #modals { display: none !important; }
  .main { margin: 0 !important; padding: 0 !important; max-width: none; }
  .print-page { border: 0; padding: 0; }
  .print-break:last-child { break-after: auto; }
}
