/* Fundament: gemeinsame Schrift, Größen, Abstände, Radien, Knöpfe/Chips/Kacheln für alle Themes (Design-Audit 18.11.2026, Paket P1).
   Lädt nach app.css und vor mobile.css und den Theme-Dateien (anthrazit, noir, papier, blaupause).
   Themes liefern Farben und Stimmung; Schrift, Skala, Radien, Abstände und Bausteine stehen hier.
   Ein Theme ändert Form und Schrift nur über die Tokens unten (z. B. --r-card, --r-btn, --theme-ui), nicht über eigene Selektor-Listen. */

/* ---------- 1 · Schriften (lokal, OFL: fonts/OFL-Geist.txt) ---------- */
@font-face { font-family: "Geist"; src: url("../fonts/geist-latin-wght.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Geist Mono"; src: url("../fonts/geist-mono-latin-wght.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }

/* ---------- 2 · Tokens ---------- */
:root {
  /* Schrift: Geist für Text, Geist Mono für Zahlenspalten, Achsen, Schlüssel, Tasten, Code. Kein System-Monospace mehr.
     Themes mit eigener Schrift setzen --theme-ui / --theme-mono / --theme-nav / --theme-fs in ihrem Token-Block. */
  --font-ui: "Geist", system-ui, "Segoe UI", sans-serif;
  --font-mono: "Geist Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  --ui: var(--theme-ui, var(--font-ui));
  --mono: var(--theme-mono, var(--font-mono));
  --nav-font: var(--theme-nav, var(--ui));
  --ax-sans: var(--font-ui); /* alter Name aus anthrazit.css, noch in app.css benutzt */

  /* Typo-Skala: sieben Größen. Schaugrößen einzelner Grafiken (Hero-Zahlen ab 22 px, clamp) bleiben bei ihrer Grafik. */
  --fs-micro: 11px;   /* Etiketten, Achsen, Zähler – kleiner wird nichts */
  --fs-meta: 12px;    /* Zusatzangaben, Chips, Tabellenkopf */
  --fs-sm: 13px;      /* Knöpfe, dichte Listen, Erklärtexte */
  --fs-body: var(--theme-fs, 14px); /* Fließtext, Eingaben, Kachel-Titel */
  --fs-lead: 15px;    /* Briefing, hervorgehobene Zeile */
  --fs-title: 20px;   /* Seitentitel, Dialogtitel */
  --fs-num: 28px;     /* Kennzahl */
  --fs: var(--fs-body); --lh: 1.5;

  /* Abstände: 4er-Raster */
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 24px; --sp-6: 32px;

  /* Radien: Stufen … */
  --r-xs: 3px; --r-s: 6px; --r-m: 8px; --r-l: 12px; --r-xl: 14px; --r-full: 999px;
  /* … und wofür sie stehen (diese Namen in neuen Regeln benutzen) */
  --r-card: var(--r-xl);   /* Kachel, Panel, Dialog */
  --r-inner: var(--r-l);   /* Karte in der Kachel, Bühne einer Grafik */
  --r-btn: var(--r-m);     /* Knopf, Segment */
  --r-in: var(--r-m);      /* Eingabe, Auswahl */
  --r-chip: var(--r-full); /* Chip, Pille */
  --r-row: var(--r-s);     /* Zeile, kleine Fläche */

  /* Flächen */
  --panel-bg: var(--surf);          /* deckende Farbe der Kachel: klebender Kachelkopf, Ausblend-Kante, Tabellenkopf in der Kachel */
  --panel-title: var(--acc);        /* Farbe der Kachel-Titel */
  --panel-pad-y: 12px; --panel-pad-x: 14px; --panel-gap: 8px;
  --th-bg: var(--bg);               /* Tabellenkopf außerhalb einer Kachel */

  /* Bedienhöhen: Knopf, Eingabe, Segment; am Handy (grober Zeiger) mindestens 40 px */
  --ctl: 32px; --tap: 0px;

  /* Licht und Bewegung */
  --fx-glow: 1;                                                     /* 1 = Grafiken leuchten (dunkle Themes), 0 = ruhig (helle) */
  --scroll-glow: color-mix(in srgb, var(--acc) 55%, transparent);   /* Roll-Schein an Kästen (.sg) */
  --focus: var(--acc);                                              /* Fokus-Ring */
  --ease: cubic-bezier(.2,.7,.2,1); --t-fast: 120ms; --t-slow: 320ms;

  /* KI-Terminal (.term-box): Farben als Tokens; Themes setzen sie in ihrem Token-Block */
  --term-bg: #020b03; --term-ink: #39e75f; --term-hi: #7dff7a; --term-dim: #2fa84a; --term-faint: #238a3a; --term-ph: #1f7a33;
  --term-line: #14531f; --term-line-2: #0f3d17; --term-tint: rgba(57, 231, 95, .05); --term-glow: 0 0 6px rgba(57, 231, 95, .35);
  --term-shade: inset 0 0 40px rgba(20, 120, 40, .12), 0 0 0 1px rgba(57, 231, 95, .04);
  --term-scan: repeating-linear-gradient(to bottom, transparent 0 2px, rgba(57, 231, 95, .025) 2px 3px);
  --term-r: var(--r);

  color-scheme: dark;
}
/* Helle Themes: ein Merkmal statt Namenslisten. js/theme.js setzt data-mode aus der Theme-Liste (light: true). */
:root[data-mode="light"] { color-scheme: light; --fx-glow: 0; }
@media (pointer: coarse) { :root { --ctl: 40px; --tap: 40px; } }

/* ---------- 3 · Basis ---------- */
body { font-variant-numeric: tabular-nums; font-feature-settings: "ss01", "cv11"; letter-spacing: -.003em; text-rendering: optimizeLegibility; }
h1, h2 { font-family: var(--ui); letter-spacing: -.02em; }
.mono, pre, code, kbd, samp { font-family: var(--mono); }
/* Geist Mono nur, wo Zahlen als Spalte oder Skala stehen, für Tasten, Pfade und das Terminal */
.planrow .tm, .nav .k, .cmd kbd, .t .id, .ov-fp-amt, .ov-fp-k b, .ov-fp-st b, .sp-txt, .sysrow .ms, .ov-gp-gap, .table td.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.cmd, .cmd input, .term-box, .term-in, .prompt input, .sb-json, .fp-in, .jobrow { font-family: var(--mono); }
.cmd input { font-size: var(--fs-sm); }

/* Fokus: ein Ring für alles, was per Tastatur erreicht wird; Eingaben zeigen ihn am Rand */
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
:is(.in, .title-in, .cmd input, .tagbox input, .prompt input, .term-in):focus-visible { outline: none; }

/* ---------- 4 · Bausteine ---------- */
/* Knopf: Sekundär = Umriss, Primär (.acc) = gefüllt, Tertiär (.ghost) = nur Text */
.btn { border-radius: var(--r-btn); padding: 6px 12px; font-size: var(--fs-sm); line-height: 1.3; font-weight: 500; min-height: var(--tap); min-width: var(--tap); }
.btn.acc { background: var(--acc); border-color: var(--acc); color: var(--on-acc); font-weight: 600; }
.btn.ghost { border-color: transparent; color: var(--dim); }
:where(a.btn) { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
@media (hover: hover) {
  .btn.acc:hover { background: color-mix(in srgb, var(--acc) 86%, var(--text)); border-color: transparent; color: var(--on-acc); box-shadow: 0 6px 22px -8px color-mix(in srgb, var(--acc) 60%, transparent); }
}
.btn:active:not(:disabled) { transform: translateY(1px); }

/* Eingaben */
.in, select.in, textarea.in { border-radius: var(--r-in); padding: 6px 10px; line-height: 1.3; min-height: var(--tap); }
textarea.in { line-height: 1.5; }
.in:focus { box-shadow: 0 0 0 3px color-mix(in srgb, var(--acc) 16%, transparent); }
.tagbox { border-radius: var(--r-in); }
.cmd, .prompt { border-radius: var(--r-in); }

/* Segment-Umschalter */
.seg { border-radius: var(--r-btn); }
.seg button { padding: 5px 11px; font-size: var(--fs-sm); min-height: var(--tap); }

/* Chip: eine Form für alle Marken (Farben bleiben bei der jeweiligen Klasse) */
.pill, .pchip, .tagbox .chip, .panel .chip, .aictx .chip, .dtag, .cpl-ch, .lchip { border-radius: var(--r-chip); }
.pill, .dtag, .cpl-ch { padding: 1px 8px; font-size: var(--fs-micro); line-height: 1.5; white-space: nowrap; }
.pchip { padding: 3px 11px; font-size: var(--fs-meta); line-height: 1.35; min-height: var(--tap); }
.tagbox .chip { padding: 1px 8px; }
.dtag { max-width: 100%; overflow: hidden; text-overflow: ellipsis; vertical-align: top; }
/* Dokumente am Handy: die Tag-Spalte bleibt schmal, lange Marken kürzen statt die Tabelle über den Rand zu schieben */
@media (max-width: 760px) {
  .docs .table td:last-child > .row { max-width: 88px; }
  .docs .table th, .docs .table td { padding-left: 5px; padding-right: 5px; }
  .docs .table td:nth-child(3) { overflow-wrap: anywhere; }
}

/* Kachel / Panel */
.panel { border-radius: var(--r-card); background: var(--panel-bg); padding: var(--panel-pad-y) var(--panel-pad-x); gap: var(--panel-gap); --th-bg: var(--panel-bg); }
.panel h3 { font-family: var(--ui); font-size: var(--fs-body); font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--panel-title); align-items: baseline; }
.panel h3 .faint, .panel h3 .tlink, .panel h3 .dim { font-weight: 400; }
.col { border-radius: var(--r-card); }
.ch { font-family: var(--ui); font-size: var(--fs-meta); letter-spacing: .02em; text-transform: none; font-weight: 500; }
.modal, .login { border-radius: var(--r-card); }
.menu, .ctx { border-radius: var(--r-inner); }
.toast { border-radius: var(--r-m); }

/* Die Seite rollt in .main (Spalten-Flex): Kinder behalten ihre Höhe, statt bei langem Inhalt zusammengedrückt zu werden.
   Ohne Gewicht (:where), damit Ansichten, die bewusst schrumpfen (Board, Post, KI), ihre eigene Regel behalten. */
:where(.main) > * { flex-shrink: 0; }

/* Seitenkopf: Titel groß, Zähler daneben leise, Aktionen rechts */
.head { font-size: var(--fs-sm); min-height: 34px; flex-shrink: 0; }
.head > span:first-child > b:first-child, .head > b:first-child { font-size: var(--fs-title); font-weight: 650; letter-spacing: -.02em; line-height: 1.2; margin-right: 2px; }

/* Tabellenkopf */
.table th { font-size: var(--fs-meta); font-weight: 500; letter-spacing: .01em; color: var(--dim); padding: 8px; background: var(--th-bg); }
.table td { padding: 7px 8px; }

/* Etiketten über Feldern und Abschnitten */
.field > span, .sec, .lt .lab { font-size: var(--fs-meta); }

/* Leerzustand */
.empty:not(.gnext) { border-radius: var(--r-inner); font-size: var(--fs-sm); padding: 22px 12px; }

/* Lesetext: Briefing und Listenzeilen in Satzgröße */
.brief { font-size: var(--fs-lead); line-height: 1.55; padding: 12px 16px; border-radius: var(--r-card); display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; gap: 0 10px; align-items: start; }
.brief.handyhint { display: flex; }
@media (max-width: 760px) { .brief { font-size: var(--fs-body); padding: 10px 12px; } }
.orow, .planrow, .t .tt { font-size: var(--fs-body); }
.orow .m, .ov-done, .ov-morgen, .tlink { font-size: var(--fs-sm); }
.ov-empty { font-size: var(--fs-sm); }
.title-in { font-family: var(--ui); font-size: var(--fs-title); font-weight: 650; letter-spacing: -.02em; }
.brand { font-family: var(--ui); font-weight: 650; letter-spacing: -.02em; font-size: var(--fs-lead); }
.ov-count b, .lt-val b { font-family: var(--ui); font-weight: 600; letter-spacing: -.02em; }
.ov-count b { font-size: var(--fs-title); }
.ov-fp-title { font-size: var(--fs-title); }
.ov-fp-lab, .fp-h, .ov-ts-st, .ov-ct-st { font-size: var(--fs-micro); letter-spacing: .1em; }

/* Seitenleiste: Schrift wie der Rest; die kleinen Marken nicht unter 11 px */
.nav .k, .nav .lbl, .rail-tip kbd { font-size: var(--fs-micro); }
@media (min-width: 761px) {
  .nav.rail.wide a { font-size: var(--fs-sm); font-weight: 450; letter-spacing: 0; }
  .nav.rail.wide a .rk, .nav.rail.wide .rail-grp { font-size: var(--fs-micro); }
  .nav.rail .rail-btn { font-size: var(--fs-meta); }
}
@media (min-width: 761px) and (max-width: 1100px) { .nav .ns { font-size: var(--fs-micro); } }
.rail-tip { font-size: var(--fs-meta); border-radius: var(--r-m); }

/* ---------- 5 · Handy / grober Zeiger: Tippziele ---------- */
@media (pointer: coarse) {
  /* Knöpfe, Eingaben, Segmente, Filter-Chips kommen über --tap auf 40 px; dazu die übrigen wiederkehrenden Ziele */
  .fbar .fk, .fswitch button, .syncb { min-height: 40px; }
  .seg button { min-width: 40px; }
  label.chk { min-height: 40px; }
  .menu .it { min-height: 40px; }
  /* kleine Knöpfe in Titelzeilen und Listen bleiben schlank, bekommen aber die Fläche */
  .panel h3 .btn, .sec .btn, .lrow .btn { padding-top: 2px; padding-bottom: 2px; }
  /* Kästchen: sichtbar 20 px, Trefferfläche über das Etikett bzw. den Rand */
  input[type="checkbox"], input[type="radio"] { width: 20px; height: 20px; }
}
/* ohne Hover (Handy): was sonst erst beim Überfahren erscheint, ist sichtbar */
@media (hover: none) {
  .cl li .x { opacity: .7; }
  .dcard .dsel, .table td.selcol .dsel { opacity: .7; }
}

