/* lw-brain Panel – Design-Tokens und Komponenten.
   Seit 2026-10-20 im Look von Flows (SPEC §11.10): Plus Jakarta Sans, Weiss mit Schieferblau, schwebende
   Seitenleiste, Dunkelmodus Blaugrau. Vorher Variante A „Moos & Terrakotta“ (2026-10-10).
   Farben nur über Tokens, nie direkt in Templates. */

/* ===================================================================== Schrift (selbst gehostet, OFL, wie Flows) */
@font-face { font-family: "Plus Jakarta Sans"; font-weight: 200 800; font-display: swap; src: url("../fonts/plus-jakarta-sans-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Plus Jakarta Sans"; font-weight: 200 800; font-display: swap; src: url("../fonts/plus-jakarta-sans-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }

/* ===================================================================== Tokens */
:root {
  --font-ui: "Plus Jakarta Sans", ui-sans-serif, system-ui, sans-serif;
  --font-display: var(--font-ui);  /* Flows hat keine zweite Schrift; Überschriften nur kräftiger */
  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px; --space-5: 24px; --space-6: 32px; --space-7: 48px;
  --text-xs: 0.75rem; --text-sm: 0.8125rem; --text-md: 0.9rem; --text-lg: 1.1rem; --text-xl: 1.35rem; --text-2xl: 1.6rem;
  --sidebar-w: 268px; --sidebar-w-narrow: 68px; --shell-gap: 12px;
  --ease: cubic-bezier(.2,.7,.2,1);
  --radius-sm: 8px; --radius: 12px; --radius-lg: 16px; --radius-xl: 24px;
  --heading-font: var(--font-display); --heading-weight: 600; --heading-tracking: -0.02em;
}

/* Hell: wie Flows – Weiss, warmes Hellgrau, Schieferblau */
:root, [data-theme="light"] {
  --bg: #FFFFFF; --surface: #FFFFFF; --surface-2: #F8F8F6; --sunken: #F0F0EC;
  --line: #ECECE8; --line-strong: #DCDCD5;
  --ink: #1A1A18; --ink-2: #4E4E49; --muted: #73736B;
  --primary: #4A6278; --primary-hover: #3D5266; --on-primary: #FFFFFF; --primary-soft: #EDF1F4; --primary-ink: #3A4F63;
  --accent: #C0632F; --accent-soft: #FBEDE4;
  --ok: #2F7A4C; --ok-soft: #E6F2EA; --warn: #9A6A00; --warn-soft: #FDF6E3; --bad: #C0392B; --bad-soft: #FDF0EE;
  --chart-1: #4A6278; --chart-2: #B07800; --grid: #EFEFEB;
  --shadow: 0 1px 2px rgba(16,24,40,.05), 0 10px 30px rgba(16,24,40,.07);
  /* Seitenleiste: Milchglas wie in Flows */
  --shell-panel: rgba(243,246,251,.82); --shell-panel-border: rgba(255,255,255,.75);
  --nav-hover: rgba(31,53,80,.06); --nav-active: #D8E3F4; --nav-active-ink: #1F3550;
  --count-ink: #FFFFFF;
}

/* Dunkel: Blaugrau wie Flows */
[data-theme="dark"] {
  --bg: #14181F; --surface: #1C2028; --surface-2: #21262F; --sunken: #2A303A;
  --line: #2A2F38; --line-strong: #3A414D;
  --ink: #E7E9EE; --ink-2: #C3C8D0; --muted: #A0A8B4;
  --primary: #7D9FC4; --primary-hover: #93B1D2; --on-primary: #10161F; --primary-soft: #253244; --primary-ink: #A9C3E0;
  --accent: #E39272; --accent-soft: #3A251D;
  --ok: #8CCB9C; --ok-soft: #1F3324; --warn: #E0B04A; --warn-soft: #3A3120; --bad: #EF7A6C; --bad-soft: #3B2421;
  --chart-1: #7D9FC4; --chart-2: #E0B04A; --grid: #262B34;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 10px 30px rgba(0,0,0,.35);
  --shell-panel: rgba(30,35,44,.82); --shell-panel-border: rgba(255,255,255,.06);
  --nav-hover: rgba(255,255,255,.05); --nav-active: #253244; --nav-active-ink: #A9C3E0;
  --count-ink: #10161F;
}

/* Icon-Farben (Wiki-Plan 7.4): je ein Wert für hell und dunkel, mindestens 3:1 zur Fläche. Abgestimmt im Prototyp. */
:root, [data-theme="light"] {
  --ic-moos: #2F6A45; --ic-salbei: #5E7F5A; --ic-petrol: #1F6F78; --ic-ozean: #2A5C9A; --ic-indigo: #4B4FA8;
  --ic-lavendel: #7656A8; --ic-pflaume: #8A3F78; --ic-himbeere: #B0345A; --ic-terrakotta: #B5573A; --ic-koralle: #C4523F;
  --ic-bernstein: #A86A0C; --ic-senf: #8A7A12; --ic-oliv: #5F6B2A; --ic-graphit: #565A4C;
}
[data-theme="dark"] {
  --ic-moos: #8FC29C; --ic-salbei: #A9C7A3; --ic-petrol: #7CC4CB; --ic-ozean: #8DB4E8; --ic-indigo: #A7A9EE;
  --ic-lavendel: #C3A9EC; --ic-pflaume: #DDA0CF; --ic-himbeere: #F09AB4; --ic-terrakotta: #E39272; --ic-koralle: #F2A08E;
  --ic-bernstein: #E8B860; --ic-senf: #D8C863; --ic-oliv: #B9C47A; --ic-graphit: #BEBCB5;
}

/* ===================================================================== Basis */
*, *::before, *::after { box-sizing: border-box; }
html { color-scheme: light; }
html[data-theme="dark"] { color-scheme: dark; }
body {
  margin: 0; font-family: var(--font-ui); font-size: var(--text-md); line-height: 1.5;
  color: var(--ink); background: var(--bg);
  -webkit-font-smoothing: antialiased; font-feature-settings: "ss01", "cv11";
  transition: background-color .25s var(--ease), color .25s var(--ease);
}
a { color: var(--primary-ink); text-decoration-thickness: 1px; text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 4px; }
.num { font-variant-numeric: tabular-nums; }
h1, h2, h3 { font-family: var(--heading-font); font-weight: var(--heading-weight); letter-spacing: var(--heading-tracking); margin: 0; line-height: 1.2; }
h1 { font-size: var(--text-2xl); }
h2 { font-size: var(--text-lg); }
h3 { font-size: var(--text-md); font-family: var(--font-ui); font-weight: 600; letter-spacing: 0; }
p { margin: 0; }
.muted { color: var(--muted); }
.ink-2 { color: var(--ink-2); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
svg.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }

/* ===================================================================== Layout */
.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: var(--space-5);
  padding: var(--space-5) var(--space-4); border-right: 1px solid var(--line); background: var(--bg);
}
.brand { display: flex; align-items: center; gap: var(--space-3); padding: 0 var(--space-2); color: var(--ink); text-decoration: none; }
.brand-mark { width: 34px; height: 34px; border-radius: 10px; background: var(--primary); color: var(--on-primary); display: grid; place-items: center; }
.brand-mark svg { width: 22px; height: 22px; }
.brand-name { font-family: var(--heading-font); font-weight: var(--heading-weight); font-size: 1.15rem; letter-spacing: var(--heading-tracking); line-height: 1; }
.brand-sub { font-size: var(--text-xs); color: var(--muted); margin-top: 3px; }
.nav { display: flex; flex-direction: column; gap: var(--space-5); overflow-y: auto; flex: 1; }
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-label { font-size: var(--text-xs); font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; padding: 0 var(--space-3) var(--space-2); }
.nav a {
  display: flex; align-items: center; gap: var(--space-3); padding: 8px var(--space-3); border-radius: var(--radius-sm);
  color: var(--ink-2); text-decoration: none; font-weight: 500; font-size: var(--text-md);
  transition: background-color .15s var(--ease), color .15s var(--ease);
}
.nav a:hover { background: var(--sunken); color: var(--ink); }
.nav a[aria-current="page"] { background: var(--primary-soft); color: var(--primary-ink); }
.nav .count { margin-left: auto; font-size: var(--text-xs); font-weight: 600; background: var(--accent); color: var(--count-ink); border-radius: 999px; padding: 1px 8px; }
.me { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3); border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); text-decoration: none; color: var(--ink); }
.me:hover { border-color: var(--line-strong); }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-weight: 600; font-size: var(--text-sm); flex: none; overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.av-0 { background: #DCE5EE; color: #2E4A63; } .av-1 { background: #F3DED2; color: #8A3F27; } .av-2 { background: #F1E6C8; color: #6E4F12; } .av-3 { background: var(--sunken); color: var(--ink-2); }
[data-theme="dark"] .av-0 { background: #253244; color: #B5CCE6; } [data-theme="dark"] .av-1 { background: #452A20; color: #F2C3AE; } [data-theme="dark"] .av-2 { background: #3E331A; color: #EBD39A; }
.me-name { font-weight: 600; font-size: var(--text-sm); line-height: 1.2; }
.me-role { font-size: var(--text-xs); color: var(--muted); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: var(--space-4);
  padding: var(--space-4) var(--space-6); background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(10px); border-bottom: 1px solid transparent;
}
.topbar.scrolled { border-bottom-color: var(--line); }
.crumb { font-size: var(--text-sm); color: var(--muted); }
.topbar .spacer { flex: 1; }
.btn.menu-btn { display: none; }
.content { padding: var(--space-5) var(--space-6) var(--space-7); max-width: 1240px; width: 100%; }
/* Reiter unter „Einstellungen“ (base.html, settings_tabs) */
.subnav { display: flex; gap: 2px; max-width: 100%; width: fit-content; overflow-x: auto; margin-bottom: var(--space-5); padding: 4px; background: var(--sunken); border-radius: var(--radius); scrollbar-width: none; }
.subnav a { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: var(--radius-sm); color: var(--ink-2); text-decoration: none; font-weight: 500; font-size: var(--text-sm); white-space: nowrap; }
.subnav a:hover { color: var(--ink); }
.subnav a[aria-current="page"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.subnav svg.i { width: 15px; height: 15px; }
/* Einstellungen wie das Einstellungsfenster von Flows: Bereiche links untereinander, Inhalt rechts */
.settings-layout { display: grid; grid-template-columns: 236px minmax(0, 1fr); gap: var(--space-5); align-items: start; }
.settings-nav { position: sticky; top: var(--space-4); display: flex; flex-direction: column; gap: 2px; padding: 14px 10px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-xl); }
.settings-nav-head { padding: 4px 12px 12px; font-weight: 600; font-size: 0.95rem; color: var(--ink); }
.settings-nav a { display: flex; align-items: center; gap: 12px; min-height: 40px; padding: 0 12px; border-radius: var(--radius); color: var(--ink); text-decoration: none; font-size: 0.87rem; }
.settings-nav a svg.i { width: 19px; height: 19px; flex-shrink: 0; color: var(--muted); }
.settings-nav a:hover { background: var(--nav-hover); }
.settings-nav a[aria-current="page"] { background: var(--nav-active); color: var(--nav-active-ink); font-weight: 600; }
.settings-nav a[aria-current="page"] svg.i { color: currentColor; }
.settings-body { min-width: 0; }
@media (max-width: 1000px) {
  .settings-layout { grid-template-columns: minmax(0, 1fr); gap: var(--space-4); }
  .settings-nav { position: static; flex-direction: row; overflow-x: auto; padding: 6px; border-radius: 999px; scrollbar-width: none; }
  .settings-nav-head { display: none; }
  .settings-nav a { flex-shrink: 0; white-space: nowrap; border-radius: 999px; }
}
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--space-4); margin-bottom: var(--space-5); flex-wrap: wrap; }
.page-head p { color: var(--ink-2); margin-top: var(--space-2); max-width: 62ch; }

/* ===================================================================== Bausteine */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow); }
.card-pad { padding: var(--space-5); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: var(--space-4) var(--space-5); border-bottom: 1px solid var(--line); }
.card-head .sub { font-size: var(--text-sm); color: var(--muted); }
.grid { display: grid; gap: var(--space-4); }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); align-items: start; }
.stack { display: flex; flex-direction: column; gap: var(--space-4); }
.row { display: flex; align-items: center; gap: var(--space-3); }
.wrap { flex-wrap: wrap; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2); height: 36px; padding: 0 14px;
  font: inherit; font-size: var(--text-sm); font-weight: 600; border-radius: var(--radius-sm); cursor: pointer;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); text-decoration: none;
  transition: background-color .15s var(--ease), border-color .15s var(--ease), transform .1s var(--ease);
}
.btn:hover { background: var(--surface-2); border-color: var(--muted); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--sunken); border-color: transparent; }
.btn-sm { height: 30px; padding: 0 10px; font-size: var(--text-xs); }
.btn svg.i { width: 16px; height: 16px; }

.chip { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 999px; font-size: var(--text-xs); font-weight: 600; background: var(--sunken); color: var(--ink-2); white-space: nowrap; }
.chip svg.i { width: 13px; height: 13px; }
.chip-ok { background: var(--ok-soft); color: var(--ok); }
.chip-warn { background: var(--warn-soft); color: var(--warn); }
.chip-bad { background: var(--bad-soft); color: var(--bad); }
.chip-primary { background: var(--primary-soft); color: var(--primary-ink); }
.chip-accent { background: var(--accent-soft); color: var(--accent); }

.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: calc(var(--radius-sm) + 3px); background: var(--sunken); border: 1px solid var(--line); }
.seg button { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--ink-2); font: inherit; font-size: var(--text-xs); font-weight: 600; cursor: pointer; }
.seg button[aria-pressed="true"], .seg a[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.seg a.btn { height: 28px; border: 0; color: var(--ink-2); }
.seg svg.i { width: 15px; height: 15px; }
/* Erscheinungsbild in der Kopfzeile: ein Knopf pro Wahl, sichtbar ist der zur aktuellen. */
.theme-cycle [data-theme-shows] { display: none; }
html[data-theme-pref="light"] .theme-cycle [data-theme-shows="light"],
html[data-theme-pref="dark"] .theme-cycle [data-theme-shows="dark"],
html[data-theme-pref="system"] .theme-cycle [data-theme-shows="system"] { display: inline-flex; }
.theme-cycled .theme-cycle svg.i { animation: theme-turn .35s var(--ease); }
@keyframes theme-turn { from { transform: rotate(-180deg) scale(.5); opacity: 0; } to { transform: none; opacity: 1; } }

/* Kennzahl-Kacheln */
.stat { padding: var(--space-4) var(--space-5); display: flex; flex-direction: column; gap: var(--space-2); }
.stat-label { font-size: var(--text-sm); color: var(--ink-2); display: flex; align-items: center; gap: var(--space-2); }
.stat-value { font-family: var(--heading-font); font-weight: var(--heading-weight); font-size: 1.85rem; letter-spacing: -0.02em; line-height: 1.1; }
.stat-foot { font-size: var(--text-xs); color: var(--muted); }
.meter { height: 8px; border-radius: 999px; background: var(--sunken); overflow: hidden; }
.meter > span { display: block; height: 100%; border-radius: 999px; background: var(--chart-1); }

/* Bereichs-Kacheln der Startseite (Verlauf), wie die Startseite von Flows (.home-tile): farbiger Streifen oben, Icon, Name, Zeile */
.mod-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: var(--space-4); }
.mod-tile {
  position: relative; overflow: hidden; display: flex; flex-direction: column; min-height: 124px;
  padding: var(--space-4) var(--space-4) var(--space-3); border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); color: var(--ink); text-decoration: none; transition: transform .15s, box-shadow .15s;
}
.mod-tile[hidden] { display: none; }
.mod-tile::before { content: ""; position: absolute; inset: 0 0 auto; height: 4px; background: var(--primary); }
.mod-tile:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.mod-tile:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.mod-tile-icon { color: var(--primary); margin-bottom: var(--space-3); }
.mod-tile-icon svg.i { width: 28px; height: 28px; stroke-width: 1.6; }
.mod-tile-name { font-weight: 600; margin-bottom: auto; }
.mod-tile-foot { margin-top: var(--space-3); font-size: var(--text-xs); color: var(--muted); }
.mod-tile-foot b { color: var(--ink); font-weight: 600; }
@media (max-width: 520px) { .mod-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3); } }

/* Listen */
.list { list-style: none; margin: 0; padding: 0; }
.list > li { display: flex; gap: var(--space-3); padding: var(--space-3) var(--space-5); border-top: 1px solid var(--line); align-items: flex-start; }
.list > li:first-child { border-top: 0; }
.mod-icon { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; flex: none; background: var(--sunken); color: var(--ink-2); }
.mod-icon svg.i { width: 17px; height: 17px; }
.mod-rec { background: var(--accent-soft); color: var(--accent); }
.mod-fund { background: var(--primary-soft); color: var(--primary-ink); }
.mod-intake { background: var(--warn-soft); color: var(--warn); }
.item-title { font-weight: 500; }
.item-title a { color: inherit; text-decoration: none; }
.item-title a:hover { text-decoration: underline; }
.item-meta { font-size: var(--text-xs); color: var(--muted); display: flex; gap: var(--space-2); flex-wrap: wrap; align-items: center; margin-top: 2px; }
.item-meta a { color: var(--ink-2); }
.dot-sep::before { content: "·"; margin-right: var(--space-2); }
.time { font-size: var(--text-xs); color: var(--muted); white-space: nowrap; margin-left: auto; padding-left: var(--space-3); }

/* Pipeline-Schritte */
.steps { display: flex; gap: 6px; margin-top: var(--space-3); }
.steps span { flex: 1; height: 6px; border-radius: 999px; background: var(--sunken); }
.steps span.done { background: var(--chart-1); }
.steps span.now { background: linear-gradient(90deg, var(--chart-1) 0 50%, var(--sunken) 50%); background-size: 200% 100%; animation: flow 1.6s linear infinite; }
@keyframes flow { from { background-position: 100% 0; } to { background-position: 0 0; } }
.step-labels { display: flex; justify-content: space-between; font-size: var(--text-xs); color: var(--muted); margin-top: 6px; }

/* Rückfragen */
.inq { padding: var(--space-5); display: flex; flex-direction: column; gap: var(--space-4); }
.inq-head { display: flex; gap: var(--space-3); align-items: flex-start; }
.inq-q { font-weight: 600; font-size: var(--text-lg); font-family: var(--heading-font); font-weight: var(--heading-weight); letter-spacing: var(--heading-tracking); }
.quote { border-left: 3px solid var(--line-strong); padding: var(--space-2) var(--space-4); color: var(--ink-2); font-style: italic; background: var(--surface-2); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.audio { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-2) var(--space-3); border: 1px solid var(--line); border-radius: 999px; background: var(--surface-2); max-width: 420px; }
.audio .play { width: 32px; height: 32px; border-radius: 50%; border: 0; display: grid; place-items: center; background: var(--primary); color: var(--on-primary); cursor: pointer; }
.audio .play svg.i { width: 14px; height: 14px; fill: currentColor; }
.wave { flex: 1; display: flex; align-items: center; gap: 2px; height: 26px; }
.wave i { flex: 1; background: var(--line-strong); border-radius: 2px; }
.choice-row { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.choice { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3) var(--space-4); border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); cursor: pointer; text-align: left; font: inherit; color: var(--ink); width: 100%; }
.choice:hover { border-color: var(--primary); background: var(--primary-soft); }
.conf { margin-left: auto; font-size: var(--text-xs); color: var(--muted); white-space: nowrap; }
.path { font-size: var(--text-sm); }
.path b { font-weight: 600; }
.inq-foot { display: flex; align-items: center; gap: var(--space-3); font-size: var(--text-xs); color: var(--muted); flex-wrap: wrap; }

/* Glocke in der Kopfzeile mit Popover der offenen Rückfragen */
.bell { position: relative; }
.bell-btn { position: relative; width: 38px; padding: 0; }
.bell-btn svg.i { width: 19px; height: 19px; transform-origin: 50% 2px; }
.bell[data-open] .bell-btn { background: var(--sunken); color: var(--ink); }
.bell-count {
  position: absolute; top: 1px; right: 0; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
  display: grid; place-items: center; font-size: 0.6875rem; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums;
  background: var(--accent); color: var(--count-ink); box-shadow: 0 0 0 2px var(--bg); pointer-events: none;
}
.bell-count[hidden] { display: none; }
.bell-btn:has(.bell-count:not([hidden])) svg.i { animation: bell-ring 1.2s var(--ease) .4s 1; }
@keyframes bell-ring { 0%, 100% { transform: rotate(0); } 15% { transform: rotate(14deg); } 30% { transform: rotate(-12deg); } 45% { transform: rotate(8deg); } 60% { transform: rotate(-4deg); } }
.bell-pop {
  position: absolute; top: calc(100% + 10px); right: -8px; z-index: 40; width: min(420px, calc(100vw - 24px));
  max-height: min(72vh, 640px); display: flex; flex-direction: column;
  background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: 0 24px 60px rgba(0,0,0,.18), 0 2px 8px rgba(0,0,0,.06);
  opacity: 0; visibility: hidden; transform: translateY(-6px) scale(.98); transform-origin: calc(100% - 26px) 0;
  transition: opacity .16s var(--ease), transform .2s var(--ease), visibility 0s linear .2s;
}
.bell-pop::before {
  content: ""; position: absolute; top: -7px; right: 21px; width: 12px; height: 12px; background: var(--surface);
  border-left: 1px solid var(--line); border-top: 1px solid var(--line); border-top-left-radius: 3px; transform: rotate(45deg);
}
.bell[data-open] .bell-pop { opacity: 1; visibility: visible; transform: none; transition: opacity .16s var(--ease), transform .2s var(--ease), visibility 0s; }
.bell-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: var(--space-4) var(--space-4) var(--space-3) var(--space-5); border-bottom: 1px solid var(--line); }
.bell-title { font-family: var(--heading-font); font-weight: var(--heading-weight); letter-spacing: var(--heading-tracking); font-size: var(--text-lg); line-height: 1.2; }
.bell-sub { font-size: var(--text-xs); color: var(--muted); margin-top: 2px; }
.bell-list { overflow-y: auto; overscroll-behavior: contain; border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.bell-list .inq { border: 0; border-radius: 0; box-shadow: none; background: transparent; padding: var(--space-4) var(--space-5); gap: var(--space-3); border-top: 1px solid var(--line); }
.bell-list .inq:first-child { border-top: 0; }
.bell-list .inq-q { font-family: var(--font-ui); font-size: var(--text-md); font-weight: 600; letter-spacing: 0; line-height: 1.35; }
.bell-list .mod-icon { width: 28px; height: 28px; border-radius: 8px; background: var(--accent-soft); color: var(--accent); }
.bell-list .mod-icon svg.i { width: 15px; height: 15px; }
.bell-list .inq[role="status"] .mod-icon { background: var(--primary-soft); color: var(--primary-ink); }
.bell-list .choice { padding: var(--space-2) var(--space-3); border-radius: var(--radius-sm); background: var(--surface-2); transition: border-color .15s var(--ease), background-color .15s var(--ease); }
.bell-list .choice:hover { background: var(--primary-soft); }
.bell-list .inq .flash { margin-bottom: 0; }
.bell-empty { display: flex; flex-direction: column; align-items: center; gap: var(--space-2); padding: var(--space-6) var(--space-5); text-align: center; }
.bell-empty-icon { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--ok-soft); color: var(--ok); margin-bottom: var(--space-1); }
.bell-empty-title { font-weight: 600; }
.bell-loading { display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-4) var(--space-5); }
.bell-loading i { display: block; height: 14px; border-radius: 7px; background: linear-gradient(90deg, var(--sunken), var(--surface-2), var(--sunken)); background-size: 200% 100%; animation: flow 1.2s linear infinite; }
.bell-loading i:nth-child(2) { width: 70%; } .bell-loading i:nth-child(3) { width: 45%; }
/* Schmal: Rechts neben der Glocke steht noch das Erscheinungsbild. Das Popover hängt deshalb an der ganzen
   Kopfzeile (sticky, also Bezugsrahmen) statt an der Glocke, sonst ragt es links aus dem Bild. */
@media (max-width: 820px) {
  .bell { position: static; }
  .bell-pop { top: calc(100% - 6px); right: 12px; width: min(420px, calc(100% - 24px)); }
  .bell-pop::before { display: none; }
}

/* Verlauf */
.filters { display: flex; gap: var(--space-2); flex-wrap: wrap; align-items: center; margin-bottom: var(--space-4); }
.filter { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font: inherit; font-size: var(--text-sm); color: var(--ink-2); cursor: pointer; }
.filter[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.filter svg.i { width: 15px; height: 15px; }
.day { font-size: var(--text-sm); font-weight: 600; color: var(--ink-2); margin: var(--space-5) 0 var(--space-2); display: flex; align-items: center; gap: var(--space-3); }
.day::after { content: ""; flex: 1; height: 1px; background: var(--line); }
/* Vorgänge im Verlauf (history/entry.html): Ergebnis-Links, Vorschläge, frühere Schritte */
.filters .filter-select { width: auto; height: 32px; border-radius: 999px; }
.htl { display: flex; flex-direction: column; gap: var(--space-2); }
.hentry {
  position: relative; display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: var(--space-3);
  padding: var(--space-3) var(--space-4); border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface);
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.hentry:hover { border-color: var(--line-strong); }
.hentry-icon { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary-ink); }
.hentry-icon svg.i { width: 18px; height: 18px; }
.hentry-fehler { border-color: color-mix(in srgb, var(--bad) 35%, var(--line)); }
.hentry-fehler .hentry-icon { background: var(--bad-soft); color: var(--bad); }
.hentry-warnung .hentry-icon, .hentry-wartet .hentry-icon { background: var(--warn-soft); color: var(--warn); }
.hentry-body { min-width: 0; }
.hentry-top { display: flex; align-items: baseline; gap: var(--space-3); }
.hentry-title { flex: 1; min-width: 0; font-family: var(--font-ui); font-size: var(--text-md); font-weight: 600; letter-spacing: 0; line-height: 1.35; overflow-wrap: anywhere; }
.hentry-time { font-size: var(--text-xs); color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.hentry-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); margin-top: var(--space-2); }
.result-link {
  display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 3px 9px; border-radius: var(--radius-sm);
  background: var(--surface-2); border: 1px solid var(--line); color: var(--ink); text-decoration: none; font-size: var(--text-sm); font-weight: 500;
}
.result-link span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.result-link svg.i { width: 15px; height: 15px; color: var(--primary-ink); flex: none; }
.result-link:hover { border-color: var(--primary); background: var(--primary-soft); }
.hentry-next-label { display: inline-flex; align-items: center; gap: 4px; font-size: var(--text-xs); font-weight: 600; color: var(--accent); margin-left: var(--space-2); }
.hentry-actions > .hentry-next-label:first-child { margin-left: 0; }
.hentry-next-label svg.i { width: 14px; height: 14px; }
.next-chip {
  display: inline-flex; align-items: center; gap: 4px; padding: 3px 6px 3px 11px; border-radius: 999px;
  background: var(--accent-soft); color: var(--ink); text-decoration: none; font-size: var(--text-sm); font-weight: 500;
}
.next-chip svg.i { width: 14px; height: 14px; color: var(--accent); }
.next-chip:hover { background: color-mix(in srgb, var(--accent) 22%, var(--surface)); }
.hentry-steps summary svg.i { width: 13px; height: 13px; transition: transform .15s var(--ease); }
.hentry-steps ol { list-style: none; margin: var(--space-2) 0 0 6px; padding-left: var(--space-4); border-left: 2px solid var(--line); display: flex; flex-direction: column; gap: 6px; font-size: var(--text-sm); color: var(--ink-2); }
.hentry-steps li { display: flex; gap: var(--space-3); align-items: center; flex-wrap: wrap; }
.hentry-steps time { color: var(--muted); font-size: var(--text-xs); width: 40px; font-variant-numeric: tabular-nums; }
.hentry-compact { padding: var(--space-3); border: 0; border-radius: 0; background: transparent; grid-template-columns: 30px minmax(0, 1fr); }
.hentry-compact .hentry-icon { width: 30px; height: 30px; border-radius: 8px; }
.hentry-compact .hentry-icon svg.i { width: 15px; height: 15px; }
.hentry-compact .hentry-title { font-size: var(--text-sm); }
.recent, .history-waiting { margin-bottom: var(--space-5); }
.recent-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); margin-bottom: var(--space-3); }
.recent-head h2 { font-size: var(--text-lg); display: flex; align-items: center; gap: var(--space-2); }
.bell-list .recent { margin: 0; border-top: 1px solid var(--line); padding-top: var(--space-3); }
.bell-list .recent-head { padding: 0 var(--space-5); margin-bottom: 0; }
.bell-list .recent-head h2 { font-family: var(--font-ui); font-size: var(--text-xs); font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.bell-list .htl { gap: 0; padding: 0 var(--space-2) var(--space-2); }
.link-chip { display: inline-flex; align-items: center; gap: 5px; font-size: var(--text-xs); padding: 3px 8px; border-radius: var(--radius-sm); border: 1px solid var(--line); color: var(--ink-2); text-decoration: none; background: var(--surface); }
.link-chip:hover { border-color: var(--line-strong); color: var(--ink); }
.link-chip svg.i { width: 13px; height: 13px; }
details summary { cursor: pointer; font-size: var(--text-xs); color: var(--muted); margin-top: var(--space-2); list-style: none; display: inline-flex; align-items: center; gap: 4px; }
details summary::-webkit-details-marker { display: none; }
details[open] summary svg { transform: rotate(90deg); }

/* Meetings (recordings/meetings*.html). Farbe pro Art aus den Symbolfarben, in beiden Modi abgestimmt. */
.mk-team { --mk: var(--ic-moos); } .mk-partner { --mk: var(--ic-ozean); } .mk-workshop { --mk: var(--ic-terrakotta); }
.mtoolbar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); margin-bottom: var(--space-3); }
.mtoolbar .spacer { flex: 1; }
.mkinds { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 4px; background: var(--sunken); border-radius: var(--radius); }
.mkind { position: relative; }
.mkind input { position: absolute; opacity: 0; pointer-events: none; }
.mkind span { display: inline-flex; align-items: center; height: 30px; padding: 0 12px; border-radius: var(--radius-sm); font-size: var(--text-sm); font-weight: 500; color: var(--ink-2); cursor: pointer; }
.mkind span:hover { color: var(--ink); }
.mkind input:checked + span { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.mkind input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 1px; }
.msearch { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--muted); min-width: min(260px, 100%); }
.msearch input { border: 0; background: transparent; font: inherit; font-size: var(--text-sm); color: var(--ink); outline: none; flex: 1; min-width: 0; }
.msearch:focus-within { border-color: var(--primary); }
.msearch svg.i { width: 16px; height: 16px; }
.mcounts { display: flex; gap: var(--space-3); min-height: 18px; margin-bottom: var(--space-2); }
.mmonth { margin-top: var(--space-5); }
.mmonth-head { position: sticky; top: 64px; z-index: 2; display: flex; align-items: baseline; gap: var(--space-2); padding: var(--space-2) 0; margin-bottom: var(--space-2); font-size: var(--text-lg); background: var(--bg); }
.mgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: var(--space-3); }
.mcard {
  position: relative; display: grid; grid-template-columns: 52px minmax(0, 1fr) 16px; gap: var(--space-4); align-items: center;
  padding: var(--space-4); border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface);
  color: var(--ink); text-decoration: none; overflow: hidden;
  transition: border-color .15s var(--ease), transform .15s var(--ease), box-shadow .15s var(--ease);
}
.mcard::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--mk, var(--primary)); }
.mcard:hover { border-color: var(--line-strong); box-shadow: var(--shadow); transform: translateY(-1px); }
.mdate { display: flex; flex-direction: column; align-items: center; justify-content: center; width: 52px; height: 56px; border-radius: 12px; background: color-mix(in srgb, var(--mk, var(--primary)) 14%, var(--surface)); color: var(--mk, var(--primary)); line-height: 1; }
.mday { font-family: var(--heading-font); font-weight: var(--heading-weight); font-size: 1.5rem; }
.mmon { font-size: var(--text-xs); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; margin-top: 3px; }
.mbody { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.mtitle { font-weight: 600; font-size: var(--text-md); line-height: 1.3; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.mkind-dot { display: inline-flex; align-items: center; gap: 6px; }
.mkind-dot::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--mk, var(--primary)); }
.mbadges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; }
.mbadges .chip { height: 22px; padding: 0 8px; }
.mchev { color: var(--muted); }
.mchev svg.i { width: 16px; height: 16px; }
.avatars { display: inline-flex; padding-left: 6px; }
.avatars .avatar { margin-left: -6px; box-shadow: 0 0 0 2px var(--surface); }
.back-link { display: inline-flex; align-items: center; gap: 4px; font-size: var(--text-sm); color: var(--ink-2); text-decoration: none; margin-bottom: var(--space-4); }
.back-link svg.i { width: 15px; height: 15px; transform: rotate(180deg); }
.back-link:hover { color: var(--ink); }
.mhead { display: flex; gap: var(--space-5); align-items: flex-start; margin-bottom: var(--space-5); }
.mhead h1 { margin: 4px 0 var(--space-3); overflow-wrap: anywhere; }
.mdate-lg { width: 76px; height: 80px; flex: none; border-radius: 16px; }
.mdate-lg .mday { font-size: 2.1rem; }
.mdate-lg .mmon { display: none; }
.mpeople { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.mperson { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 3px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); font-size: var(--text-sm); }
.mlayout { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: var(--space-4); align-items: start; }
.mpage-main { display: flex; gap: var(--space-3); align-items: center; padding: var(--space-3); margin-bottom: var(--space-4); border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2); color: var(--ink); text-decoration: none; }
.mpage-main:hover { border-color: var(--primary); }
.mpage-main .item-title, .mpage-main .item-meta { display: block; }
.row-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); margin-top: var(--space-3); }
.mdrop { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); border-top: 1px dashed var(--line); }
#files.drop-active .mdrop, #files .mdrop:hover { background: var(--primary-soft); }
.linklike { border: 0; padding: 0; background: none; font: inherit; color: inherit; cursor: pointer; text-align: left; }
.linklike:hover { text-decoration: underline; }
.mfiles .item-title { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dlg-wide { width: min(620px, calc(100vw - 32px)); }
.field-row { display: flex; flex-wrap: wrap; gap: var(--space-3); }
.people-pick { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.person-pick { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px 4px 4px; border: 1px solid var(--line); border-radius: 999px; cursor: pointer; font-size: var(--text-sm); font-weight: 500; }
.person-pick input { position: absolute; opacity: 0; pointer-events: none; }
.person-pick:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-ink); }
.person-pick:has(input:focus-visible) { outline: 2px solid var(--primary); outline-offset: 1px; }
fieldset.field { border: 0; padding: 0; margin: 0; }
/* Treffen über mehrere Tage (SPEC §7.3.7) und Vorschauen aus dem Wiki */
.msummary { margin: 2px 0 0; padding-left: 1.1em; font-size: var(--text-sm); color: var(--ink-2); line-height: 1.45; }
.msummary li + li { margin-top: 2px; }
.msummary-lg { font-size: var(--text-md); margin-bottom: var(--space-3); max-width: 46rem; }
.mlead { font-size: var(--text-sm); color: var(--ink-2); line-height: 1.45; }
.mdays { list-style: none; margin: 2px 0 0; padding: 0; font-size: var(--text-sm); color: var(--ink); display: flex; flex-direction: column; gap: 2px; }
.mdays b { font-weight: 600; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.mcard-event { grid-column: 1 / -1; }
.evday { padding: var(--space-3) var(--space-4) 0; }
.evday + .evday { border-top: 1px solid var(--line); margin-top: var(--space-2); }
.evday h3 { margin: 0 0 var(--space-2); font-size: var(--text-sm); text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.evday .list { margin: 0 calc(-1 * var(--space-4)); }
.ovstatus { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); font-size: var(--text-sm); }
.ovfail { display: inline-flex; align-items: center; gap: 6px; color: var(--bad); }
.wevent { flex-wrap: wrap; }
.wevent .ovstatus { flex-basis: 100%; }
.wevent-days { flex-basis: 100%; list-style: none; margin: 0; padding: 0 0 0 28px; display: flex; flex-direction: column; gap: 2px; font-size: var(--text-sm); }
.wevent-days b { font-weight: 600; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.wevent .ovstatus { padding-left: 28px; }
.spinner { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--line-strong); border-top-color: var(--primary); animation: spin .8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } }
.mprev { margin-top: var(--space-4); border-top: 1px solid var(--line); padding-top: var(--space-3); }
.mprev > summary { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; font-size: var(--text-sm); font-weight: 500; color: var(--ink-2); }
.mprev > summary:hover { color: var(--ink); }
.mprev-body { margin-top: var(--space-3); }
.prev-dialog { width: min(820px, calc(100vw - 32px)); }
.prev-body { padding: var(--space-4) var(--space-5); overflow: auto; max-height: calc(100vh - 140px); }
.prev-toc { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: var(--space-3); }
.prev-toc .chip { text-decoration: none; }
.prev-toc .chip:hover { background: var(--primary-soft); color: var(--primary-ink); }
.prose { color: var(--ink); line-height: 1.6; overflow-wrap: anywhere; }
.prose > :first-child { margin-top: 0; }
.prose h1, .prose h2, .prose h3, .prose h4 { font-family: var(--heading-font); font-weight: var(--heading-weight); line-height: 1.25; margin: 1.4em 0 .4em; scroll-margin-top: 72px; }
.prose h1 { font-size: var(--text-xl); } .prose h2 { font-size: var(--text-lg); } .prose h3, .prose h4 { font-size: var(--text-md); }
.prose p, .prose ul, .prose ol, .prose blockquote, .prose table, .prose pre { margin: 0 0 .8em; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose ul[data-type="taskList"] { list-style: none; padding-left: 0; }
.prose ul[data-type="taskList"] li { display: flex; gap: 8px; align-items: baseline; }
.prose ul[data-type="taskList"] li > div > :last-child { margin-bottom: 0; }
.prose ul[data-type="taskList"] li[data-checked="true"] > div { color: var(--muted); text-decoration: line-through; }
.prose li > p { margin: 0; }
.prose blockquote { border-left: 3px solid var(--line-strong); padding-left: var(--space-3); color: var(--ink-2); }
.prose [data-callout] { padding: 10px 14px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--line); margin: 0 0 .8em; font-size: var(--text-sm); }
.prose [data-callout] > :last-child { margin-bottom: 0; }
.prose [data-callout][data-kind="warning"] { background: var(--warn-soft); border-color: transparent; }
.prose [data-callout][data-kind="success"] { background: var(--ok-soft); border-color: transparent; }
.prose table { border-collapse: collapse; width: 100%; font-size: var(--text-sm); }
.prose th, .prose td { border: 1px solid var(--line); padding: 6px 8px; text-align: left; vertical-align: top; }
.prose code { font-size: .9em; background: var(--sunken); padding: 1px 4px; border-radius: 4px; }
.prose pre { background: var(--sunken); padding: var(--space-3); border-radius: var(--radius-sm); overflow: auto; }
.prose a { color: var(--primary-ink); }
.prose .mention { font-weight: 600; color: var(--primary-ink); }
.prose .file-ref { color: var(--ink-2); font-size: var(--text-sm); }
.tx { max-width: 46rem; }
.tx-head { margin-bottom: var(--space-5); }
.tx-head h1 { margin: 4px 0 var(--space-3); }
.tx-audio { height: 36px; max-width: 100%; }
.tx-turns { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-4); }
.tx-turn { display: flex; gap: var(--space-3); align-items: flex-start; }
.tx-turn > .avatar { flex: none; margin-top: 2px; }
.tx-body { min-width: 0; }
.tx-body p { margin: 2px 0 0; line-height: 1.6; color: var(--ink); overflow-wrap: anywhere; }
.tx-who { display: flex; align-items: baseline; gap: var(--space-2); font-size: var(--text-sm); }
.tx-time { border: 0; padding: 0 4px; border-radius: 4px; background: none; font: inherit; font-size: var(--text-xs); color: var(--muted); font-variant-numeric: tabular-nums; }
button.tx-time { cursor: pointer; }
button.tx-time:hover, button.tx-time:focus-visible { background: var(--sunken); color: var(--ink); }
@media (max-width: 1100px) { .mlayout { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 820px) {
  .mgrid { grid-template-columns: minmax(0, 1fr); }
  .mmonth-head { top: 56px; }
  .mhead { gap: var(--space-3); }
  .mdate-lg { width: 60px; height: 64px; }
  .mdate-lg .mday { font-size: 1.6rem; }
}

/* Diagramm */
.chart-wrap { position: relative; padding: var(--space-4) var(--space-5) var(--space-5); }
.legend { display: flex; gap: var(--space-4); font-size: var(--text-sm); color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart text { fill: var(--muted); font-size: 11px; font-family: var(--font-ui); font-variant-numeric: tabular-nums; }
.tip { position: absolute; pointer-events: none; background: var(--ink); color: var(--bg); padding: 8px 10px; border-radius: 8px; font-size: var(--text-xs); line-height: 1.5; box-shadow: 0 6px 20px rgba(0,0,0,.18); opacity: 0; transform: translate(-50%, -100%); transition: opacity .1s; white-space: nowrap; z-index: 3; }
.tip b { font-weight: 600; }
.tip .sw { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; }

/* Tabellen */
table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
th { text-align: left; font-weight: 600; color: var(--muted); font-size: var(--text-xs); text-transform: uppercase; letter-spacing: .05em; padding: var(--space-3) var(--space-5); border-bottom: 1px solid var(--line); background: var(--surface-2); }
td { padding: var(--space-3) var(--space-5); border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
td.r, th.r { text-align: right; font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; }
/* Tabellen in Karten: Kopfzeile und letzte Zeile folgen den runden Ecken der Karte. */
.card > .table-wrap { border-radius: inherit; }
.card > .card-head + .table-wrap { border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.bar-inline { height: 6px; border-radius: 999px; background: var(--sunken); min-width: 80px; }
.bar-inline span { display: block; height: 100%; border-radius: 999px; background: var(--chart-1); }

/* Formulare */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label, .label { font-size: var(--text-sm); font-weight: 600; }
.hint { font-size: var(--text-xs); color: var(--muted); }
.input, select.input {
  height: 38px; padding: 0 12px; border-radius: var(--radius-sm); border: 1px solid var(--line-strong); background: var(--surface);
  color: var(--ink); font: inherit; font-size: var(--text-sm); width: 100%;
}
textarea.input { height: auto; padding: 10px 12px; line-height: 1.5; resize: vertical; }
.input:focus { outline: 2px solid var(--primary); outline-offset: 0; border-color: var(--primary); }
.input-suffix { position: relative; }
.input-suffix .input { padding-right: 52px; }
.input-suffix span { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); font-size: var(--text-xs); color: var(--muted); }
.switch { display: inline-block; position: relative; width: 40px; height: 24px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--line-strong); transition: background-color .15s; pointer-events: none; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .2s var(--ease); box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + span { background: var(--primary); }
.switch input:checked + span::after { transform: translateX(16px); }
.switch input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 2px; }
.setting { display: flex; gap: var(--space-4); align-items: center; justify-content: space-between; padding: var(--space-4) var(--space-5); border-top: 1px solid var(--line); }
.setting:first-child { border-top: 0; }
/* Längerer Text (z. B. Anweisung an die KI): Feld unter der Beschriftung, volle Breite. */
.setting-stacked { flex-direction: column; align-items: stretch; }
.setting-stacked .row { flex-direction: column; align-items: stretch; gap: var(--space-2); }
.setting .txt { display: flex; flex-direction: column; gap: 2px; }
.setting .txt b { font-weight: 600; font-size: var(--text-md); }

.profile-opt { position: relative; display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-5); border: 1.5px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); cursor: pointer; text-align: left; font: inherit; color: var(--ink); transition: border-color .15s, box-shadow .15s; }
.profile-opt:hover { border-color: var(--line-strong); }
.profile-opt[aria-checked="true"] { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent); }
.profile-opt .check { position: absolute; top: var(--space-4); right: var(--space-4); width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--line-strong); display: grid; place-items: center; color: var(--on-primary); }
.profile-opt[aria-checked="true"] .check { background: var(--primary); border-color: var(--primary); }
.profile-opt .check svg { width: 13px; height: 13px; stroke-width: 3; }
.profile-opt h3 { font-family: var(--heading-font); font-weight: var(--heading-weight); font-size: var(--text-lg); letter-spacing: var(--heading-tracking); }
.profile-opt ul { margin: 0; padding-left: 18px; font-size: var(--text-sm); color: var(--ink-2); display: flex; flex-direction: column; gap: 3px; }
.profile-cost { font-size: var(--text-sm); color: var(--ink-2); }
.profile-cost b { font-family: var(--heading-font); font-weight: var(--heading-weight); font-size: 1.35rem; color: var(--ink); letter-spacing: -0.02em; }
.save-bar { position: sticky; bottom: var(--space-4); display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3) var(--space-4); border-radius: var(--radius); background: var(--ink); color: var(--bg); box-shadow: 0 10px 30px rgba(0,0,0,.2); margin-top: var(--space-5); }
.save-bar .btn { border-color: transparent; }
.save-bar .btn-ghost { color: var(--bg); }
.save-bar .btn-ghost:hover { background: rgba(255,255,255,.1); }
.save-bar .btn-primary { background: var(--bg); color: var(--ink); }

.status { display: inline-flex; align-items: center; gap: 6px; font-size: var(--text-sm); font-weight: 600; }
.status svg.i { width: 16px; height: 16px; }
.st-ok { color: var(--ok); } .st-warn { color: var(--warn); } .st-bad { color: var(--bad); }

.code { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: var(--text-sm); background: var(--sunken); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px 12px; display: flex; align-items: center; gap: var(--space-3); justify-content: space-between; }
.steps-list { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: var(--space-2); color: var(--ink-2); font-size: var(--text-sm); }
.consent { border: 1px solid var(--line); border-radius: var(--radius); padding: var(--space-4); background: var(--surface-2); font-size: var(--text-sm); color: var(--ink-2); display: flex; flex-direction: column; gap: var(--space-2); }
.callout { display: flex; gap: var(--space-3); padding: var(--space-3) var(--space-4); border-radius: var(--radius); background: var(--warn-soft); color: var(--warn); font-size: var(--text-sm); align-items: flex-start; }
.callout p { color: var(--ink); }

.empty { padding: var(--space-7) var(--space-5); text-align: center; color: var(--muted); }

/* ===================================================================== Ergänzungen Produkt */
.flash { padding: var(--space-3) var(--space-4); border-radius: var(--radius); font-size: var(--text-sm); margin-bottom: var(--space-4); }
.flash-ok { background: var(--ok-soft); color: var(--ok); }
.flash-bad { background: var(--bad-soft); color: var(--bad); }
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: var(--space-5); }
.login-card { width: 100%; max-width: 400px; padding: var(--space-6); display: flex; flex-direction: column; gap: var(--space-5); }
.login-card .brand { padding: 0; }
.btn-block { width: 100%; height: 44px; font-size: var(--text-md); }
.dev-box { border: 1px dashed var(--line-strong); border-radius: var(--radius); padding: var(--space-4); display: flex; flex-direction: column; gap: var(--space-2); }
.pager { display: flex; justify-content: center; padding: var(--space-4); }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: var(--space-2) var(--space-5); font-size: var(--text-sm); margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
button.link-chip { font: inherit; font-size: var(--text-xs); cursor: pointer; }
.inline-form { display: contents; }
.field-error { color: var(--bad); font-size: var(--text-xs); }

/* ===================================================================== Responsive */
@media (max-width: 1100px) {
  .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-main { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 820px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 280px; z-index: 20; transform: translateX(-100%); transition: transform .25s var(--ease); background: var(--surface); box-shadow: var(--shadow); }
  .sidebar.open { transform: none; }
  .btn.menu-btn { display: inline-flex; }
  .topbar, .content { padding-left: var(--space-4); padding-right: var(--space-4); }
  .g-3, .g-2 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 520px) { .g-4 { grid-template-columns: minmax(0, 1fr); } .time { display: none; } }


/* ===================================================================== Meldungen, Dialoge (Kern) */
/* Eingebettete App im Inhaltsbereich (Flows, SPEC §3.3), die Seitenleiste des Brain bleibt daneben. Wie in Flows
   schwebt der Inhalt als eigene Fläche unter der Kopfzeile des Brain, die stehen bleibt (Wunsch Johannes
   2026-10-26: Chat, Suche und Abmelden bleiben erreichbar). */
.frame-overlay { flex: 1; min-height: 0; width: 100%; border: 0; background: var(--bg); }
.frame-overlay-open .content { display: none; }
.frame-overlay-open .main { height: calc(100dvh - 2 * var(--shell-gap)); }
.frame-overlay-open, .frame-overlay-open body { overflow: hidden; }
.toasts { position: fixed; left: 50%; bottom: var(--space-5); transform: translateX(-50%); z-index: 80; display: flex; flex-direction: column; gap: var(--space-2); align-items: center; pointer-events: none; }
.toast { pointer-events: auto; background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 999px; font-size: var(--text-sm); font-weight: 500; box-shadow: 0 10px 30px rgba(0,0,0,.2); animation: toast-in .2s var(--ease); max-width: min(560px, 90vw); }
.toast-bad { background: var(--bad); color: #fff; }
.toast-action { margin-left: var(--space-3); border: 0; background: none; color: inherit; font: inherit; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; padding: 0; }
.toast.leaving { opacity: 0; transform: translateY(6px); transition: opacity .5s, transform .5s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

dialog.dlg { border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); color: var(--ink); padding: 0; width: min(480px, calc(100vw - 32px)); box-shadow: 0 24px 60px rgba(0,0,0,.25); }
dialog.dlg::backdrop { background: rgba(20, 18, 14, .45); backdrop-filter: blur(3px); }
.dlg-head { display: flex; align-items: center; justify-content: space-between; padding: var(--space-4) var(--space-5); border-bottom: 1px solid var(--line); }
.dlg-head h2 { font-size: var(--text-lg); }
.dlg-body { padding: var(--space-5); display: flex; flex-direction: column; gap: var(--space-4); }
.dlg-foot { display: flex; justify-content: flex-end; gap: var(--space-2); padding: var(--space-4) var(--space-5); border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }

/* ===================================================================== Dateien */

.files { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: var(--space-5); align-items: start; }
.files.has-details { grid-template-columns: 220px minmax(0, 1fr) 320px; }
.files-side { position: sticky; top: 76px; display: flex; flex-direction: column; gap: var(--space-4); max-height: calc(100vh - 96px); overflow-y: auto; }
.files-side .nav { flex: none; overflow: visible; }
.files-side .nav-group a { padding: 7px var(--space-3); font-size: var(--text-sm); }
.files-side .count { background: var(--sunken); color: var(--ink-2); }
.files-main { min-width: 0; display: flex; flex-direction: column; gap: var(--space-4); }
.files-head { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; }
.files-head h1 { font-size: var(--text-xl); }
.crumbs { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; font-size: var(--text-sm); color: var(--muted); }
.crumbs a { color: var(--ink-2); text-decoration: none; padding: 2px 6px; border-radius: 6px; }
.crumbs a:hover { background: var(--sunken); color: var(--ink); }
.crumbs svg.i { width: 14px; height: 14px; }
.files-tools { display: flex; align-items: center; gap: var(--space-2); margin-left: auto; }
.search-box { position: relative; }
.search-box .input { padding-left: 34px; height: 36px; width: 240px; border-radius: 999px; }
.search-box svg.i { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--muted); }

.selection-bar { display: flex; align-items: center; gap: var(--space-2); padding: 8px 8px 8px 16px; border-radius: var(--radius); background: var(--ink); color: var(--bg); font-size: var(--text-sm); }
.selection-bar .btn { height: 30px; font-size: var(--text-xs); background: transparent; color: var(--bg); border-color: color-mix(in srgb, var(--bg) 30%, transparent); }
.selection-bar .btn:hover { background: color-mix(in srgb, var(--bg) 12%, transparent); }
.selection-bar[hidden] { display: none; }

.ftable { width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--text-sm); }
.ftable td { padding: 8px var(--space-4); border-bottom: 1px solid var(--line); }
.ftable tr:last-child td { border-bottom: 0; }
.ftable tr.frow { transition: background-color .1s; }
.ftable tr.frow:hover td { background: var(--surface-2); }
.ftable tr.frow.selected td, .ftable tr.frow.active td { background: var(--primary-soft); }
.ftable tr.frow.drop-target td { background: var(--primary-soft); box-shadow: inset 0 0 0 2px var(--primary); }
.fname { display: flex; align-items: center; gap: var(--space-3); min-width: 0; }
.fname a { color: var(--ink); text-decoration: none; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fname a:hover { text-decoration: underline; }
.ficon { width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center; flex: none; background: var(--sunken); color: var(--ink-2); overflow: hidden; }
.ficon svg.i { width: 18px; height: 18px; }
.ficon img { width: 100%; height: 100%; object-fit: cover; }
.k-ordner { --k-bg: var(--primary-soft); --k-fg: var(--primary-ink); }
.k-bild { --k-bg: var(--accent-soft); --k-fg: var(--accent); }
.k-pdf { --k-bg: var(--bad-soft); --k-fg: var(--bad); }
.k-audio, .k-video { --k-bg: var(--warn-soft); --k-fg: var(--warn); }
.k-tabelle { --k-bg: var(--ok-soft); --k-fg: var(--ok); }
.ficon[class*="k-"], .thumb[class*="k-"] { background: var(--k-bg, var(--sunken)); color: var(--k-fg, var(--ink-2)); }
.fmeta { color: var(--muted); white-space: nowrap; }
.fcheck { width: 16px; height: 16px; accent-color: var(--primary); cursor: pointer; }
.fstar { color: var(--warn); }
.fstar svg.i { width: 14px; height: 14px; fill: currentColor; }
.lock-chip { color: var(--muted); display: inline-flex; }
.lock-chip svg.i { width: 13px; height: 13px; }

.fgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: var(--space-3); }
.fcard { position: relative; display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; text-decoration: none; color: var(--ink); transition: border-color .15s, box-shadow .15s, transform .15s; }
.fcard:hover { border-color: var(--line-strong); box-shadow: var(--shadow); transform: translateY(-1px); }
.fcard.active { border-color: var(--primary); }
.fcard.selected { border-color: var(--primary); box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 30%, transparent); }
.fcard.drop-target { border-color: var(--primary); background: var(--primary-soft); }
.fcard .thumb { aspect-ratio: 4 / 3; display: grid; place-items: center; }
.fcard .thumb img { width: 100%; height: 100%; object-fit: cover; }
.fcard .thumb svg.i { width: 34px; height: 34px; stroke-width: 1.4; }
.fcard .cap { padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; }
.fcard, .ftable tr.frow { cursor: pointer; user-select: none; }
.fcard:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.fcard .cap b { font-weight: 500; font-size: var(--text-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); text-decoration: none; }
.fcard .cap span { font-size: var(--text-xs); color: var(--muted); }
.fcard .fcheck { position: absolute; top: 8px; left: 8px; opacity: 0; transition: opacity .15s; }
.fcard:hover .fcheck, .fcard:focus-within .fcheck, .fcard.selected .fcheck, .fgrid.selecting .fcheck { opacity: 1; }
@media (hover: none) { .fcard .fcheck { opacity: 1; } }
/* Info und Herunterladen stehen immer sichtbar unten rechts, damit klar ist, was wo passiert. */
.fcard .cap { flex-direction: row; align-items: flex-start; gap: 4px; }
.fcard .cap-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.fcard .cap-meta { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fcard .facts { display: flex; gap: 2px; margin: -4px -6px 0 0; }
.btn.icon-btn { width: 30px; padding: 0; }
.facts .btn { color: var(--muted); }
.facts .btn:hover { color: var(--ink); }
.frow-acts { white-space: nowrap; }

.files-empty { border: 2px dashed var(--line-strong); border-radius: var(--radius-lg); padding: var(--space-7) var(--space-5); text-align: center; color: var(--ink-2); display: flex; flex-direction: column; align-items: center; gap: var(--space-3); }
.files-empty svg.i { width: 36px; height: 36px; color: var(--muted); stroke-width: 1.4; }

.details { position: sticky; top: 76px; max-height: calc(100vh - 100px); overflow-y: auto; }
.details .dpreview { aspect-ratio: 16 / 10; display: grid; place-items: center; border-bottom: 1px solid var(--line); border-radius: var(--radius-lg) var(--radius-lg) 0 0; overflow: hidden; }
button.dpreview, a.dpreview { width: 100%; padding: 0; border: 0; background: transparent; border-bottom: 1px solid var(--line); font: inherit; color: inherit; cursor: pointer; }
button.dpreview:hover img, a.dpreview:hover svg.i { opacity: .85; }
.details .dpreview img { width: 100%; height: 100%; object-fit: contain; background: var(--surface-2); }
.details .dpreview svg.i { width: 42px; height: 42px; stroke-width: 1.3; }
.details h2 { font-family: var(--font-ui); font-weight: 600; font-size: var(--text-md); word-break: break-word; }
.dactions { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-2); }
.dsection { padding: var(--space-4) var(--space-5); border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: var(--space-2); }
.dwiki { display: flex; align-items: center; gap: 8px; font-size: var(--text-sm); color: var(--primary-ink); text-decoration: none; }
.dwiki:hover { text-decoration: underline; }
.dwiki svg.i { width: 15px; height: 15px; }
.dsection h3 { font-size: var(--text-xs); text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; }
.vrow, .srow { display: flex; align-items: center; gap: var(--space-2); font-size: var(--text-sm); }
.vrow .muted, .srow .muted { font-size: var(--text-xs); }
.srow { flex-wrap: wrap; padding: var(--space-2) var(--space-3); border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); }

/* Ordnerbaum wie die Seitenleiste von Outline: Pfeil klappt auf, der Name öffnet. */
.tree, .tree ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 1px; font-size: var(--text-sm); }
.tree ul { padding-left: 14px; }
.tree li:not(.open) > ul { display: none; }
.trow { display: flex; align-items: center; border-radius: 6px; color: var(--ink-2); }
.trow:hover { background: var(--sunken); color: var(--ink); }
.trow.current { background: var(--primary-soft); color: var(--primary-ink); font-weight: 600; }
.trow.drop-target { background: var(--primary-soft); box-shadow: inset 0 0 0 2px var(--primary); }
.trow a { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; padding: 5px 8px 5px 2px; color: inherit; text-decoration: none; cursor: pointer; }
.trow a span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ttoggle { flex: none; width: 22px; height: 26px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 4px; background: none; color: var(--muted); cursor: pointer; }
button.ttoggle:hover { color: var(--ink); background: var(--line); }
.ttoggle svg.i { width: 13px; height: 13px; transition: transform .12s; }
.tree li.open > .trow .ttoggle svg.i { transform: rotate(90deg); }
.tree svg.i { width: 15px; height: 15px; flex: none; }
.picker { max-height: 340px; overflow-y: auto; border: 1px solid var(--line); border-radius: var(--radius); padding: var(--space-2); }
.picker label { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 6px; cursor: pointer; font-size: var(--text-sm); }
.picker label:hover { background: var(--sunken); }
.picker input { accent-color: var(--primary); }

.dropzone { position: fixed; inset: 12px; z-index: 70; border: 3px dashed var(--primary); border-radius: var(--radius-lg); background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(4px); display: none; place-items: center; text-align: center; pointer-events: none; }
.dropzone.active { display: grid; }
.dropzone b { font-family: var(--heading-font); font-weight: var(--heading-weight); font-size: var(--text-xl); display: block; margin-bottom: 6px; }
.dropzone svg.i { width: 44px; height: 44px; color: var(--primary); margin-bottom: var(--space-3); }

.upload-tray { position: fixed; right: var(--space-4); bottom: var(--space-4); z-index: 75; width: min(360px, calc(100vw - 32px)); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: 0 18px 50px rgba(0,0,0,.22); overflow: hidden; }
.upload-tray[hidden] { display: none; }
.upload-tray .uhead { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; background: var(--surface-2); border-bottom: 1px solid var(--line); font-size: var(--text-sm); font-weight: 600; }
.upload-tray ul { list-style: none; margin: 0; padding: 0; max-height: 280px; overflow-y: auto; }
.upload-tray li { padding: 10px 14px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; font-size: var(--text-sm); }
.upload-tray li:last-child { border-bottom: 0; }
.upload-tray .uname { display: flex; justify-content: space-between; gap: var(--space-2); }
.upload-tray .uname span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-tray .ustate { font-size: var(--text-xs); color: var(--muted); white-space: nowrap; }
.upload-tray .ustate.ok { color: var(--ok); }
.upload-tray .ustate.bad { color: var(--bad); }
.upload-tray progress { width: 100%; height: 4px; appearance: none; border: 0; border-radius: 999px; background: var(--sunken); overflow: hidden; }
.upload-tray progress::-webkit-progress-bar { background: var(--sunken); }
.upload-tray progress::-webkit-progress-value { background: var(--chart-1); border-radius: 999px; }
.upload-tray progress::-moz-progress-bar { background: var(--chart-1); }

dialog.viewer { border: 0; padding: 0; background: transparent; width: min(1100px, 94vw); max-height: 92vh; color: var(--ink); overflow: visible; }
dialog.viewer::backdrop { background: rgba(10, 10, 10, .78); backdrop-filter: blur(4px); }
.viewer-bar { display: flex; align-items: center; gap: var(--space-3); color: #f2efe8; padding: 0 0 var(--space-3); }
.viewer-bar b { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.viewer-bar .btn { background: rgba(255,255,255,.1); border-color: transparent; color: #f2efe8; }
.viewer-bar .btn:hover { background: rgba(255,255,255,.18); }
.viewer-body { background: var(--surface); border-radius: var(--radius-lg); overflow: hidden; display: grid; place-items: center; max-height: calc(92vh - 60px); }
.viewer-body img { max-width: 100%; max-height: calc(92vh - 60px); display: block; }
.viewer-body iframe { width: 100%; height: calc(92vh - 60px); border: 0; background: #fff; }
.viewer-body video { max-width: 100%; max-height: calc(92vh - 60px); }
.viewer-body audio { width: min(560px, 90%); margin: var(--space-7) 0; }
.viewer-body pre { margin: 0; padding: var(--space-5); width: 100%; max-height: calc(92vh - 60px); overflow: auto; font-size: var(--text-sm); white-space: pre-wrap; word-break: break-word; }

.public-wrap { min-height: 100vh; display: flex; flex-direction: column; align-items: center; padding: var(--space-6) var(--space-4); gap: var(--space-5); }
.public-card { width: min(920px, 100%); }
.public-foot { font-size: var(--text-xs); color: var(--muted); }

@media (max-width: 1100px) {
  .files.has-details { grid-template-columns: 220px minmax(0, 1fr); }
  .files.has-details .details { position: fixed; right: 12px; top: 72px; bottom: 12px; width: min(360px, calc(100vw - 24px)); z-index: 30; max-height: none; box-shadow: 0 18px 50px rgba(0,0,0,.25); }
}
@media (max-width: 820px) {
  .files, .files.has-details { grid-template-columns: minmax(0, 1fr); }
  .files-side { position: static; }
  .files-side .tree { display: none; }
  .search-box .input { width: 100%; }
  .files-tools { width: 100%; }
  .ftable .hide-sm { display: none; }
  .btn-upload span { display: none; }
}


/* ===================================================================== Look von Flows (2026-10-20)
   Schwebende Seitenleiste mit Abstand zum Rand, runde Navigation und Knöpfe, Kacheln mit Farbstreifen. */
.app { gap: var(--shell-gap); padding: var(--shell-gap); }
.sidebar {
  top: var(--shell-gap); height: calc(100vh - 2 * var(--shell-gap)); border-right: 0;
  border: 1px solid var(--shell-panel-border); border-radius: var(--radius-xl); background: var(--shell-panel);
  -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); box-shadow: var(--shadow);
  padding: var(--space-4) var(--space-3); gap: var(--space-4);
}
/* Logo von Flows: die Welle mit Punkt, ohne Hintergrund */
.brand-mark { width: 40px; height: 34px; border-radius: 0; background: none; color: var(--primary); }
.brand-mark svg { width: 40px; height: 16px; }
.brand-name { font-weight: 500; font-size: 1.05rem; color: var(--primary); letter-spacing: .04em; }
.nav { gap: var(--space-3); }
.nav a { min-height: 40px; padding: 0 var(--space-3); border-radius: 999px; font-size: 0.88rem; color: var(--ink); }
.nav a:hover { background: var(--nav-hover); color: var(--ink); }
.nav a[aria-current="page"] { background: var(--nav-active); color: var(--nav-active-ink); font-weight: 600; }
.nav-label { font-size: 0.72rem; letter-spacing: .08em; }
.me { border-radius: 999px; border-color: transparent; background: transparent; padding: var(--space-2) var(--space-3); }
.me:hover { background: var(--nav-hover); border-color: transparent; }
.topbar { padding: var(--space-3) var(--space-5); background: color-mix(in srgb, var(--bg) 88%, transparent); }
.content { padding: var(--space-4) var(--space-5) var(--space-7); }
h1 { font-weight: 600; }
.btn { border-radius: 999px; }
.btn-primary { box-shadow: inset 0 1px 0 rgba(255,255,255,.2), 0 4px 12px color-mix(in srgb, var(--primary) 28%, transparent); }
.input, select.input { border-radius: 10px; }
.subnav, .seg { border-radius: 999px; }
.subnav a, .seg button, .seg a.btn { border-radius: 999px; }
.card { border-color: var(--line); }
.stat { position: relative; overflow: hidden; }
/* Kacheln in der Übersicht wie die Projektkacheln in Flows: Farbstreifen oben */
.stat::before { content: ""; position: absolute; left: 0; top: 0; right: 0; height: 4px; background: var(--primary); }
dialog.dlg::backdrop { background: rgba(25,38,60,.22); }
@media (max-width: 820px) {
  .app { padding: 0; gap: 0; }
  .sidebar { border-radius: 0; height: 100vh; top: 0; }
}


/* ===================================================================== Schmale Seitenleiste (wie Flows, 2026-10-20)
   Nur Icons; mit der Maus darüber (app.js setzt .peek) oder mit der Tastatur wird sie breit, der Inhalt rückt nach.
   Nur mit Maus und auf breiten Bildschirmen: Touch-Geräte behalten die breite Leiste, Telefone das Menü.
   :is() statt :has() direkt, damit ältere Browser die Regeln nicht ganz verwerfen. */
@media (hover: hover) and (min-width: 821px) {
  .app { grid-template-columns: auto minmax(0, 1fr); }
  .sidebar { width: var(--sidebar-w-narrow); overflow: hidden; transition: width .25s ease; }
  .sidebar:is(.peek, :has(:focus-visible)) { width: var(--sidebar-w); }
  .sidebar .nav a, .sidebar .brand, .sidebar .me { white-space: nowrap; }
  .sidebar:not(:is(.peek, :has(:focus-visible))) :is(.nav-text, .count, .brand-text, .me-text, .nav-label, .flows-count) { display: none; }
  .sidebar:not(:is(.peek, :has(:focus-visible))) :is(.nav a, .me) {
    width: 42px; min-height: 42px; margin-inline: auto; padding: 0; justify-content: center;
  }
  .sidebar:not(:is(.peek, :has(:focus-visible))) .brand { justify-content: center; padding: 0; }
}
