:root {
    /* CAMPUS-WELT (Pat-Go 29.07.): Palette 1:1 aus dem OX-Campus-Discourse-Theme
       (about.json "OX Campus Light/Dark"), Campus-Blau -> Nexus-Teal.
       HELL = Default, Dunkel als [data-theme="dark"]-Override unten. */
    --bg: #f5f3ef;               /* Surface 0 — warmes Off-White (Campus) */
    --bg-card: #eae7e2;          /* Surface 1 — Cards, Header-Basis */
    --bg-elevated: #e0ddd8;      /* Surface 2 — Inputs, Tags, Hover */
    --bg-raised: #d6d3ce;        /* Surface 3 — Hover auf Surface 2 */
    --border: rgba(0, 0, 0, 0.08);        /* Hairline ueberall */
    --border-strong: rgba(0, 0, 0, 0.14); /* Hairline im Hover/Fokus-Umfeld */
    --text: #2d2b28;
    --text-muted: #6f6b64;
    --text-dim: #8a867e;
    --accent: #148271;           /* Nexus-Teal (dunkel genug fuer Text auf Off-White) */
    --accent-hover: #0f6a5c;
    --accent-ink: #ffffff;       /* Text AUF Akzentflaeche */
    --accent-rgb: 20, 130, 113;
    --accent-soft: rgba(52, 192, 168, 0.14);
    --grad: linear-gradient(135deg, #148271 0%, #34c0a8 50%, #148271 100%);
    --counter: #e0336a;          /* OX-Pink fuer Zaehler-/Unread-Badges (Campus-Konvention) */
    --danger: #dc3545;
    --success: #22a06b;
    --warning: #d4890a;
    --recording: #ff4d6a;        /* bleibt rot: Aufnahme-Signal, keine Markenfarbe */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    --radius: 10px;              /* Campus-Radien: 10 Basis / 6 klein / 14 gross */
    --radius-sm: 6px;
    --radius-lg: 14px;
    --content-max: 1240px;       /* EINE einheitliche Inhaltsbreite fuer ALLE Seiten */
    --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', Roboto, 'Helvetica Neue', sans-serif;
    --font-serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
    --font-mono: 'JetBrains Mono', 'SF Mono', Menlo, monospace;
}

[data-theme="dark"] {
    /* DUNKEL — "OX Campus Dark", Werte aus dem LIVE-Scheme (color_definitions
       v23) statt der stale about.json-Kopie (Pat-Abgleich 30.07.): Grund =
       secondary #0f0f11 (Near-Black), Stufen = header_background ->
       primary-very-low -> primary-low. Weiss-Alpha-Hairlines unveraendert. */
    --bg: #0f0f11;
    --bg-card: #1a1b1e;
    --bg-elevated: #2d2a25;
    --bg-raised: #37332e;
    --border: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(255, 255, 255, 0.14);
    --text: #e8e6e3;
    --text-muted: #a19d95;
    --text-dim: #8e8c89;
    --accent: #34c0a8;
    --accent-hover: #5ad1c4;
    --accent-ink: #0b201b;
    --accent-rgb: 52, 192, 168;
    --accent-soft: rgba(52, 192, 168, 0.15);
    --grad: linear-gradient(135deg, #34c0a8 0%, #7ee0cf 50%, #34c0a8 100%);
    --counter: #ff4477;
    --danger: #f87171;
    --success: #34d399;
    --warning: #f0a030;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.12);
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.16);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-sans);
    font-size: 15px;
    line-height: 1.5;
    min-height: 100vh;
    overflow-x: clip;   /* Sicherheitsnetz: nie horizontaler Scroll */
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

code {
    font-family: var(--font-mono);
    font-size: 0.9em;
    background: var(--bg-elevated);
    padding: 2px 5px;
    border-radius: 4px;
    color: var(--accent);
}

/* ====== App-Shell: linke Sidebar + schlanke Topbar ======
   Coaches-Corner-/Notion-Muster (COACHES-CORNER-INSPO.md, Layout-Muster 1+4):
   Navigation links als eigene Spalte, oben nur Werkzeuge (Scope/Suche/Bediener).
   Unter 900px kollabiert die Sidebar zur Icon-Rail — Labels weg, Icons bleiben. */
.shell { display: flex; min-height: 100vh; }

.sidebar {
    flex: 0 0 212px;
    width: 212px;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    padding: 16px 10px 12px;
    /* Campus-Regel: Sidebar verschmilzt mit dem Body, kein Panel. */
    background: var(--bg);
    border-right: none;
}

.sidebar .brand { padding: 0 10px 14px; }

.side-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }

.side-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 10px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    position: relative;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
}
.side-link:hover { background: var(--bg-elevated); color: var(--text); }
.side-link--active { background: var(--bg-elevated); color: var(--text); font-weight: 600; }
.side-link--active::before {
    content: "";
    position: absolute;
    left: -10px;
    top: 7px;
    bottom: 7px;
    width: 2px;
    border-radius: 1px;
    background: var(--accent);
}
/* Sidebar-Gruppen-Label (Campus: Gradient-Text, uppercase) */
.side-group-label {
    margin: 16px 10px 4px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: var(--grad);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    width: fit-content;
}
.side-nav > .side-group-label:first-child { margin-top: 0; }
.side-icon { width: 20px; text-align: center; font-size: 15px; flex: 0 0 20px; }
.side-badge { margin-left: auto; }
.side-bottom { border-top: 1px solid var(--border); padding-top: 8px; margin-top: 8px; }

.shell-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    padding: 10px 24px;
    /* Campus-Header: transluzent + Blur, KEINE Border. */
    background: color-mix(in srgb, var(--bg-card) 82%, transparent);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: none;
    position: sticky;
    top: 0;
    z-index: 10;
}

.brand a {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text);
    font-weight: 600;
    font-size: 17px;
}

/* Der App-Schriftzug behaelt die Broadsheet-Serife (Pat-Wunsch 06.07.) —
   seit dem DNA-Pass 07/28 ziehen die Seitentitel (h1) dosiert nach. */
.brand-name {
    font-family: var(--font-serif);
    font-size: 18px;
    letter-spacing: 0.01em;
}

.brand-logo {
    color: var(--accent);
    font-size: 22px;
    text-shadow: 0 0 12px var(--accent);
    animation: pulse 2.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.55; }
}

/* Bediener-Picker (sitzt in der Topbar) */
.member-picker { margin: 0; }

.member-picker select {
    padding: 8px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    max-width: 170px;
}

.member-picker--unset { border-color: var(--danger); color: var(--danger); }

/* ====== Container & Headings ====== */
/* width:100% ist Pflicht: <main class="container"> ist ein Flex-Item der
   body-Spalte (Sticky-Footer). Mit margin:0 auto wuerde das Auto-Margin den
   stretch deaktivieren und der Container auf die INHALTSbreite schrumpfen
   (jede Seite anders breit). Explizite Breite erzwingt den 1240px-Rahmen. */
.container { width: 100%; max-width: var(--content-max); margin: 0 auto; padding: 32px 28px 64px; }

.page-section { margin-bottom: 32px; }
.page-header { margin-bottom: 24px; }

/* Seitentitel im Campus-Stil: Sans 800, negatives Tracking, Gradient-Text.
   Serife lebt nur noch im Wordmark (.brand-name). */
h1 {
    margin: 0 0 6px;
    font-size: 30px;
    font-weight: 800;
    letter-spacing: -0.02em;
    background: var(--grad);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    width: fit-content;
}
/* Gradient-Reset fuer Dokument-/Sonderkontexte */
.kb-prose h1, .wodl-preview h1, .setup-card h1, .auth-title {
    background: none;
    -webkit-text-fill-color: currentColor;
    width: auto;
}
/* Status-Badge IM Titel (Entwurf/final/KI-Entwurf): der Gradient-Text der h1
   faerbt sonst auch die Badge-Schrift transparent — die Pille blieb leer. */
h1 .badge { -webkit-text-fill-color: currentColor; }

h2 {
    margin: 32px 0 16px;
    font-size: 19px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

h3 { margin: 16px 0 8px; font-size: 16px; font-weight: 600; }

.subtitle { margin: 0; color: var(--text-muted); font-size: 14px; }

/* ====== Flash ====== */
.flash-container { max-width: var(--content-max); margin: 16px auto 0; padding: 0 28px; }
.flash { padding: 10px 16px; border-radius: var(--radius-sm); margin-bottom: 8px; font-size: 14px; }
.flash-success { background: rgba(56, 211, 159, 0.1); color: var(--success); border: 1px solid rgba(56, 211, 159, 0.3); }
.flash-error { background: rgba(255, 91, 110, 0.1); color: var(--danger); border: 1px solid rgba(255, 91, 110, 0.3); }

/* ====== Buttons ====== */
.btn {
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-strong);
    background: var(--bg-elevated);
    color: var(--text);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, transform 0.1s;
    font-family: inherit;
}

.btn:hover { background: var(--bg-card); border-color: var(--accent); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-ghost { background: transparent; }
.btn-large { padding: 14px 28px; font-size: 16px; width: 100%; margin-top: 8px; }

.btn-icon {
    background: transparent;
    border: none;
    color: var(--text-dim);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    padding: 4px 10px;
    border-radius: 6px;
    transition: background 0.15s, color 0.15s;
}

.btn-icon:hover { background: rgba(255, 91, 110, 0.12); color: var(--danger); }
/* SVG-Icons (z.B. Papierkorb) im Icon-Button: feste Groesse, erbt currentColor */
.btn-icon svg { width: 17px; height: 17px; display: block; }

.action-row { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }

/* ====== Forms ====== */
.field { margin-bottom: 16px; }

.field label { display: block; margin-bottom: 6px; font-size: 13px; font-weight: 500; color: var(--text-muted); }

.field input[type="text"],
.field input[type="email"],
.field input[type="password"],
.field input[type="search"],
.field input[type="number"],
.field input[type="date"],
.field textarea,
.field select {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 15px;
    font-family: inherit;
    transition: border-color 0.15s;
}

.field input:focus, .field textarea:focus, .field select:focus { outline: none; border-color: var(--accent); }

.inline-form { display: flex; gap: 8px; align-items: center; margin-bottom: 24px; flex-wrap: wrap; }

.inline-form input[type="text"], .inline-form select {
    flex: 1;
    min-width: 160px;
    padding: 10px 14px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
}

.stacked-form {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 24px;
}

.inline-delete { display: inline; }

/* ====== Data Lists ====== */
.data-list { display: flex; flex-direction: column; gap: 8px; }

.data-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.data-content { flex: 1; }
.data-key { font-weight: 600; color: var(--accent); }
.data-value { color: var(--text); }
.data-sub { color: var(--text-muted); font-size: 13px; }
.data-meta { color: var(--text-dim); font-size: 12px; font-family: var(--font-mono); }

.empty-state {
    color: var(--text-dim);
    font-style: italic;
    padding: 24px;
    text-align: center;
    background: var(--bg-card);
    border: 1px dashed var(--border);
    border-radius: var(--radius-sm);
}

.section-divider { border: none; border-top: 1px solid var(--border); margin: 32px 0; }

/* ====== Recorder / Schnell-Eingabe ====== */
.entry-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
    box-shadow: var(--shadow);
    margin-bottom: 24px;
}

.recorder-row { display: flex; align-items: center; gap: 18px; margin-bottom: 14px; }

.recorder-status {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 6px 14px;
    border-radius: var(--radius);
    font-size: 13px;
    font-family: var(--font-mono);
}

.recorder-status.status-recording { background: rgba(255, 77, 106, 0.12); color: var(--recording); border-color: rgba(255, 77, 106, 0.4); }
.recorder-status.status-success { background: rgba(56, 211, 159, 0.12); color: var(--success); border-color: rgba(56, 211, 159, 0.4); }
.recorder-status.status-error { background: rgba(255, 91, 110, 0.12); color: var(--danger); border-color: rgba(255, 91, 110, 0.4); }

.rec-button {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
    color: var(--accent-ink);
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 24px rgba(52, 192, 168, 0.35);
    transition: transform 0.15s, box-shadow 0.15s;
    flex-shrink: 0;
}

.rec-button:hover { transform: scale(1.05); }
.rec-button--xl { width: 96px; height: 96px; font-size: 36px; }

.rec-meta { display: flex; flex-direction: column; gap: 8px; }
.rec-upload { font-size: 12px; color: var(--text-dim); }
.rec-upload input { font-size: 12px; color: var(--text-muted); max-width: 220px; }

.rec-button.recording {
    background: linear-gradient(135deg, var(--recording), #ff8b9a);
    box-shadow: 0 6px 24px rgba(255, 77, 106, 0.5);
    animation: rec-pulse 1.4s ease-in-out infinite;
}

@keyframes rec-pulse {
    0%, 100% { box-shadow: 0 6px 24px rgba(255, 77, 106, 0.5); }
    50% { box-shadow: 0 6px 36px rgba(255, 77, 106, 0.8); }
}

.rec-button:disabled { background: var(--bg-elevated); cursor: not-allowed; box-shadow: none; opacity: 0.5; }

/* ====== Timeline (Kunden-Akte) ====== */
.timeline { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }

.timeline-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-left: 3px solid var(--text-dim);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
}

.timeline-item--voice { border-left-color: var(--accent); }
.timeline-item--text { border-left-color: var(--text-dim); }

.timeline-item header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 6px;
    font-size: 12px;
    color: var(--text-dim);
    font-family: var(--font-mono);
}

.ti-source { color: var(--text-muted); font-weight: 600; }
.ti-author { color: var(--text-muted); }
.ti-date { color: var(--text-dim); }
.timeline-item header .btn-icon { margin-left: auto; font-size: 18px; }
.ti-body { margin: 0; color: var(--text); white-space: pre-wrap; }

/* ====== Aufgaben ====== */
.task-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.task-row--done { opacity: 0.6; }
.task-row--done .task-desc { text-decoration: line-through; color: var(--text-muted); }

/* Aufgaben-Checkbox: echtes Checkbox-Pattern (eckig, leer = offen, ✓ = erledigt) —
   kein Kreis-Button (Pat-Feedback 28.07., „übliche Vorgehensweisen"). */
.task-check {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    border-radius: 5px;
    border: 1.5px solid var(--border-strong);
    background: var(--bg-elevated);
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.15s, background 0.15s;
}
.task-check:hover { border-color: var(--accent); background: var(--accent-soft); }

.task-row--done .task-check { background: var(--success); border-color: var(--success); color: #131210; }
.task-desc { flex: 1; color: var(--text); }
.task-meta { color: var(--text-dim); font-size: 12px; font-family: var(--font-mono); white-space: nowrap; }

/* ====== Briefing-Vorschau ====== */
.briefing-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    border-radius: var(--radius);
    padding: 20px 22px;
    margin-bottom: 24px;
}

.briefing-card h2 { margin: 0 0 14px; }
.briefing-block { margin-bottom: 16px; }
.briefing-block:last-child { margin-bottom: 0; }

.briefing-label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 6px;
    font-weight: 600;
}

.briefing-note { color: var(--text); background: var(--accent-soft); padding: 10px 14px; border-radius: var(--radius-sm); }
.briefing-list { margin: 0; padding-left: 18px; color: var(--text-muted); }
.briefing-list li { margin-bottom: 4px; }

.note-edit { margin-top: 6px; }
.note-edit summary { font-size: 13px; color: var(--text-muted); cursor: pointer; }
.note-edit summary:hover { color: var(--accent); }
.note-edit .inline-form { margin-top: 8px; }

/* ====== Textbausteine — /-Trigger im Composer (v1.1 A1) ====== */
.snip-anchor { position: relative; }
.snip-menu {
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    margin-top: 4px;
    background: var(--bg-card);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
    z-index: 40;
    max-height: 240px;
    overflow-y: auto;
}
.snip-item {
    display: flex;
    align-items: baseline;
    gap: 10px;
    width: 100%;
    padding: 9px 12px;
    background: none;
    border: 0;
    cursor: pointer;
    text-align: left;
    color: var(--text);
}
.snip-item.is-active,
.snip-item:hover { background: var(--accent-soft); }
.snip-key {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--accent);
    white-space: nowrap;
}
.snip-text {
    flex: 1;
    min-width: 0;
    color: var(--text-muted);
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ====== Setup-Wizard ====== */
.setup-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 24px;
    background: radial-gradient(ellipse at top, rgba(52, 192, 168, 0.10), transparent 60%), var(--bg);
}

.setup-card {
    width: 100%;
    max-width: 520px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 36px 32px;
    box-shadow: var(--shadow);
    text-align: center;
}

.setup-logo { font-size: 44px; color: var(--accent); text-shadow: 0 0 24px var(--accent); margin-bottom: 12px; }
.setup-card h1 { font-size: 26px; margin-bottom: 6px; }
.setup-form { text-align: left; margin-top: 24px; }
.setup-hint { margin-top: 24px; color: var(--text-dim); font-size: 13px; line-height: 1.5; }

.member-rows { display: flex; flex-direction: column; gap: 8px; }
.member-rows .member-line { display: flex; gap: 8px; }
.member-rows .member-line input { flex: 2; }
.member-rows .member-line select { flex: 1; }

/* ====== Login (card-los, KnowledgeHub-Stil mit T2-Akzent-Badge) ====== */
.auth-page {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    padding: 24px;
    background:
        radial-gradient(70% 55% at 50% -5%, var(--accent-soft), transparent 65%),
        var(--bg);
}
.auth-box { width: 100%; max-width: 380px; text-align: center; position: relative; }
.auth-badge {
    width: 58px; height: 58px; border-radius: 8px; margin: 0 auto 20px;
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 10px 28px rgba(52, 192, 168, 0.30);
}
.auth-badge-logo { height: 30px; width: auto; display: block; }
.auth-title { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; margin: 0 0 4px; }
.auth-sub { color: var(--text-muted); font-size: 14px; margin: 0; }
.auth-form { text-align: left; margin-top: 28px; }
.auth-form .field { margin-bottom: 14px; }
.auth-submit { width: 100%; padding: 12px; margin-top: 4px; }
.auth-flash { margin-top: 16px; text-align: left; }
.auth-foot { margin-top: 24px; color: var(--text-dim); font-size: 12px; }

/* ====== Topbar-Werkzeuge: Suche, Bediener, Theme ====== */
.brand-logo-img { height: 26px; width: auto; display: block; }

.search-trigger {
    display: flex; align-items: center; gap: 8px;
    padding: 7px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 13px; font-family: inherit; cursor: pointer;
}
/* Diktat-Schnellzugriff (v1.6): gleicher Look als Link, Icon erbt die Textfarbe. */
a.capture-trigger { text-decoration: none; }
a.capture-trigger:hover { color: var(--text); border-color: var(--accent); }
.search-trigger:hover { border-color: var(--accent); color: var(--text); }
.search-trigger kbd {
    font-family: var(--font-mono); font-size: 11px;
    background: var(--bg-elevated); border: 1px solid var(--border-strong);
    border-radius: 4px; padding: 1px 5px; color: var(--text-dim);
}

.nav-logout, .theme-toggle {
    color: var(--text-dim); font-size: 18px; text-decoration: none;
    padding: 4px 9px; border-radius: 6px;
    background: transparent; border: none; cursor: pointer; line-height: 1;
    font-family: inherit;
}
.nav-logout:hover, .theme-toggle:hover { background: var(--accent-soft); color: var(--text); }

/* ====== ⌘K Such-Modal ====== */
.search-modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: flex-start; justify-content: center; }
.search-modal[hidden] { display: none; }
.search-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.6); }
.search-box {
    position: relative; margin-top: 12vh; width: 100%; max-width: 540px;
    background: var(--bg-card); border: 1px solid var(--border-strong);
    border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden;
}
.search-input {
    width: 100%; padding: 16px 18px; background: transparent; border: none;
    border-bottom: 1px solid var(--border); color: var(--text);
    font-size: 16px; font-family: inherit; outline: none;
}
.search-results { max-height: 50vh; overflow-y: auto; }
.search-result {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 10px 18px; border-bottom: 1px solid var(--border);
    color: var(--text); text-decoration: none;
}
.search-result.active, .search-result:hover { background: var(--accent-soft); }
.sr-body { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.sr-name { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-ctx { color: var(--text-muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-side { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.sr-tag { font-size: 10px; padding: 2px 7px; border-radius: 6px; background: var(--bg-elevated); border: 1px solid var(--border); color: var(--text-dim); }
.sr-date { font-size: 11px; color: var(--text-dim); font-family: var(--font-mono); white-space: nowrap; }
.search-empty { padding: 16px 18px; color: var(--text-dim); font-style: italic; }
/* Gruppen-Überschrift im ⌘K-Modal */
.search-group-label {
    display: flex; align-items: center; gap: 7px;
    padding: 9px 18px 5px; font-size: 11px; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted);
    background: var(--bg-elevated); border-bottom: 1px solid var(--border);
    position: sticky; top: 0;
}
.search-result.search-all { justify-content: center; color: var(--accent); font-weight: 600; }
.search-result.search-all .sr-name { font-size: 13px; }

/* Volle Ergebnisseite (/suche) */
.gsearch-group { margin-bottom: 26px; }
.gsearch-group-head {
    display: flex; align-items: center; gap: 8px; margin-bottom: 10px;
    font-size: 13px; font-weight: 600; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: 0.05em;
}
.gsearch-ico { font-size: 16px; }
.gsearch-count { background: var(--accent-soft); color: var(--accent); border-radius: 3px; font-size: 11px; padding: 1px 8px; font-family: var(--font-mono); }

/* ====== Dashboard: Stats + Activity ====== */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 28px; }
.stat-card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 18px 20px;
}
.stat-num { font-size: 32px; font-weight: 700; color: var(--accent); line-height: 1; font-variant-numeric: tabular-nums; }
.stat-label { margin-top: 6px; color: var(--text-muted); font-size: 13px; }

.dash-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 24px 28px; margin-bottom: 8px; }
.dash-col h2 { margin-top: 0; }
/* In den schmalen Dashboard-Spalten: Meta unter den Aufgaben-Text statt daneben,
   sonst wird der Text Wort fuer Wort umgebrochen. */
.dash-col .task-row { flex-wrap: wrap; }
.dash-col .task-meta { width: 100%; padding-left: 32px; }

.activity-feed { display: flex; flex-direction: column; gap: 8px; }
.activity-item {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 14px; background: var(--bg-card);
    border: 1px solid var(--border); border-radius: var(--radius);
    color: var(--text); text-decoration: none;
    transition: background 0.15s ease, box-shadow 0.15s ease;
}
.activity-item:hover { background: var(--bg-elevated); box-shadow: var(--shadow-sm); }
.activity-src { font-size: 16px; flex-shrink: 0; }
.activity-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.activity-client { font-weight: 600; font-size: 13px; }
.activity-text { color: var(--text-muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.activity-meta { color: var(--text-dim); font-size: 11px; font-family: var(--font-mono); white-space: nowrap; flex-shrink: 0; }

/* ====== Setup/Login Logo + Hint ====== */
.setup-logo-img { height: 56px; width: auto; margin: 0 auto 16px; display: block; }
.field-hint { margin: 6px 0 0; color: var(--text-dim); font-size: 12px; }

/* ====== Responsive ====== */
/* iPad-Touch: groessere Touch-Targets */
@media (max-width: 1024px) {
    .btn, .btn-icon, .rec-button, .member-picker select { min-height: 44px; }
    /* Checkbox bleibt quadratisch — auf Touch nur etwas groesser statt 44px hoch. */
    .task-check { width: 26px; height: 26px; font-size: 15px; }
}

/* Unter 900px: Sidebar wird zur Icon-Rail (Coaches-Corner-Muster) —
   Labels/Badges/Brand-Text weg, Icons zentriert, Topbar kompakter. */
@media (max-width: 900px) {
    .sidebar { flex-basis: 56px; width: 56px; padding: 14px 6px 10px; }
    .sidebar .brand { padding: 0 0 12px; text-align: center; }
    .sidebar .brand-name { display: none; }
    .side-label, .side-badge, .side-group-label { display: none; }
    .side-link { justify-content: center; padding: 9px 0; gap: 0; }
    .side-link--active::before { left: -6px; }
    .search-trigger span { display: none; }
    .topbar { padding: 10px 14px; gap: 8px; }
}

@media (max-width: 680px) {
    .container { padding: 22px 16px 48px; }
    .recorder-row { flex-direction: column; align-items: stretch; }
    /* Aufgaben-Zeile: Meta unter den Text statt gequetscht daneben */
    .task-row { flex-wrap: wrap; }
    .task-meta { width: 100%; padding-left: 38px; }
}

@media (max-width: 380px) {
    .member-picker select { max-width: 130px; }
}

/* ====== Pläne: Tokens (ct-block aus KnowledgeHub + Focus-Ring aus ProfileFlow) ====== */
:root {
    --ct-bg: #f8f9fc; --ct-bg-alt: #eef1f7; --ct-border: #e2e5ed;
    --ct-label: #5b54c9; --ct-accent: #b3309e; --ct-key: #2563eb;
    --ct-number: #ea580c; --ct-string: #16a34a; --ct-comment: #98a0ad; --ct-muted: #687385;
    --focus-ring: rgba(20, 130, 113, 0.22);
}
[data-theme="dark"] {
    --ct-bg: #15181d; --ct-bg-alt: #1f242c; --ct-border: #2a2e36;
    --ct-label: #818cf8; --ct-accent: #c084fc; --ct-key: #60a5fa;
    --ct-number: #fb923c; --ct-string: #4ade80; --ct-comment: #6b7280; --ct-muted: #9098a5;
    --focus-ring: rgba(52, 192, 168, 0.25);
}

/* Focus-Ring — die „Leichtigkeit" aus ProfileFlow (weicher Glow statt nur Border) */
.field input:focus, .field textarea:focus, .field select:focus,
.inline-form input:focus, .inline-form select:focus,
.member-picker select:focus, .member-picker input:focus,
.stacked-form input:focus, .stacked-form select:focus, .stacked-form textarea:focus,
.search-input:focus, .pb-in:focus {
    box-shadow: 0 0 0 3px var(--focus-ring);
}

/* ====== Plan-Viewer (ct-block, Monospace „Code-Block"-Look) ====== */
.ct-block {
    background: var(--ct-bg); border: 1px solid var(--ct-border);
    border-radius: var(--radius-sm); padding: 16px; margin-bottom: 14px;
    font-family: var(--font-mono); font-size: 14px; line-height: 1.65;
}
.ct-header {
    background: var(--ct-bg-alt); margin: -16px -16px 12px; padding: 10px 16px;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    border-bottom: 1px solid var(--ct-border);
    display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
}
.ct-label { color: var(--ct-label); font-weight: 600; }
.ct-accent { color: var(--ct-accent); font-weight: 500; }
.ct-key { color: var(--ct-key); flex: 1; min-width: 120px; }
.ct-number { color: var(--ct-number); font-weight: 500; }
.ct-tempo { color: var(--ct-accent); }
.ct-string { color: var(--ct-string); }
.ct-comment { color: var(--ct-comment); font-style: italic; }
.ct-muted { color: var(--ct-muted); }
.ct-desc { font-size: 12px; margin: 0 0 10px; }
.ct-row { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; padding: 5px 0; border-bottom: 1px solid var(--ct-border); }
.ct-row:last-child { border-bottom: none; }
.ct-note { padding: 2px 0 6px 12px; font-size: 12px; color: var(--ct-comment); font-style: italic; }

/* ====== Plan-Liste, Karten, Badges, Filter ====== */
.plan-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.plan-head-actions { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }
.breadcrumb { font-size: 13px; color: var(--text-dim); margin: 0 0 12px; }
.breadcrumb a { color: var(--text-muted); }
.filter-pills { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 20px; }
.pill { font-size: 13px; padding: 4px 12px; border-radius: var(--radius); border: 1px solid var(--border); color: var(--text-muted); }
.pill:hover { border-color: var(--accent); color: var(--text); }
.pill--active { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.plan-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; }
.plan-card { display: block; padding: 16px 18px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-card); transition: border-color .15s, box-shadow .15s; }
.plan-card:hover { border-color: var(--accent); box-shadow: var(--shadow); }
.plan-card-title { font-weight: 600; font-size: 15px; color: var(--text); margin-bottom: 4px; }
.plan-card-excerpt { font-size: 13px; color: var(--text-muted); margin: 0 0 12px; }
.plan-card-badges { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.plan-meta-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px 14px; margin-bottom: 14px; }
.plan-notes { white-space: pre-wrap; color: var(--text-muted); background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px; font-size: 14px; }

/* Badges als Gradient-Tint-Pillen (Campus-Subcategory-Technik):
   Semantikfarbe als subtiler Wash + getoenter Text, Radius 6. */
.badge {
    --bc: var(--text-dim);
    font-size: 11px; padding: 3px 9px; border-radius: var(--radius-sm); font-weight: 600;
    display: inline-block;
    background: linear-gradient(135deg, color-mix(in srgb, var(--bc) 16%, var(--bg-card)), var(--bg-elevated));
    color: color-mix(in srgb, var(--bc) 62%, var(--text));
    border: 1px solid color-mix(in srgb, var(--bc) 22%, transparent);
}
.badge-kind { --bc: var(--text-dim); }
.badge-area { --bc: var(--accent); }
.badge-leicht { --bc: var(--success); }
.badge-mittel { --bc: var(--warning); }
.badge-schwer { --bc: var(--danger); }
.badge-status { --bc: var(--text-dim); }
.badge-dur { font-size: 11px; color: var(--text-dim); background: none; border: none; padding: 0; }
/* Verordnungs-Check: Befund-Stufen (Heilmittel-Modul) */
.badge-ok { --bc: var(--success); }
.badge-hinweis { --bc: var(--text-muted); }
.badge-warnung { --bc: var(--warning); }
.badge-fehler { --bc: var(--danger); }

/* ====== Plan-Builder (Editor) ====== */
.pb-phase { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; margin-bottom: 12px; background: var(--bg-card); }
.pb-phase-head { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; flex-wrap: wrap; }
.pb-phase-label { font-size: 12px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; }
.pb-phase-title { flex: 1; min-width: 160px; font-weight: 500; }
.pb-in { padding: 8px 10px; background: var(--bg-elevated); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); color: var(--text); font-size: 13px; font-family: inherit; }
.pb-in:focus { outline: none; border-color: var(--accent); }
.pb-phase-desc { width: 100%; margin-bottom: 10px; }
.pb-ex { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; padding: 5px 0; }
.pb-ex-name { flex: 2; min-width: 150px; }
.pb-ex-num { width: 66px; }
.pb-ex-sm { width: 80px; }
.pb-ex-note { flex: 1; min-width: 120px; }
.pb-ctrls { display: flex; gap: 2px; margin-left: auto; }
.pb-add-ex, .pb-add-phase { margin-top: 6px; }
.btn-sm { padding: 6px 12px; font-size: 13px; }

/* ====== Footer + Sticky-Layout (aus ProfileFlow) ====== */
/* Sticky-Footer lebt jetzt in der Shell-Hauptspalte (Sidebar-Layout). */
main.container { flex: 1 0 auto; }
.nx-footer { border-top: 1px solid var(--border); padding: 24px; margin-top: 48px; }
.nx-footer-inner { max-width: var(--content-max); margin: 0 auto; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 4px 8px; font-size: 12px; color: var(--text-dim); }
.nx-footer-name { font-weight: 600; color: var(--text-muted); }
.nx-footer-badge { padding: 2px 6px; border: 1px solid var(--border); border-radius: 6px; font-size: 10px; font-family: var(--font-mono); color: var(--text-muted); }
.nx-footer a { color: var(--text-muted); }
.nx-footer a:hover { color: var(--accent); }

/* Tap-Changelog am Versions-Badge (v1.1 A6) — Popover klappt nach oben. */
.nx-changelog { position: relative; display: inline-block; }
.nx-changelog > summary { list-style: none; cursor: pointer; display: inline-block; }
.nx-changelog > summary::-webkit-details-marker { display: none; }
.nx-changelog[open] > summary,
.nx-changelog > summary:hover { border-color: var(--accent); color: var(--accent); }
.nx-changelog-pop {
    position: absolute;
    bottom: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%);
    width: 360px;
    max-width: calc(100vw - 32px);
    padding: 14px 16px;
    text-align: left;
    background: var(--bg-card);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    z-index: 50;
}
.nx-changelog-title {
    margin: 0 0 8px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-dim);
}
.nx-changelog-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.nx-changelog-list li { display: flex; gap: 8px; font-size: 12.5px; line-height: 1.4; color: var(--text); }
.nx-changelog-date {
    flex: 0 0 auto;
    font-family: var(--font-mono);
    font-size: 10.5px;
    color: var(--text-dim);
    padding-top: 1px;
    font-variant-numeric: tabular-nums;
}

/* ====== Bediener-Identität: Avatar-Dropdown (statt offener Felder) ====== */
.op-menu { position: relative; }
.op-menu > summary { list-style: none; cursor: pointer; }
.op-menu > summary::-webkit-details-marker { display: none; }
.op-trigger {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 4px 12px 4px 5px; border: 1px solid var(--border-strong);
    border-radius: var(--radius); color: var(--text); font-size: 13px;
}
.op-menu[open] .op-trigger, .op-trigger:hover { border-color: var(--accent); }
.op-avatar {
    width: 26px; height: 26px; border-radius: 50%;
    background: var(--accent); color: var(--accent-ink);
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 600; flex-shrink: 0;
}
.op-avatar--off { background: var(--bg-elevated); color: var(--text-dim); border: 1px solid var(--border-strong); }
.op-name { max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.op-panel {
    position: absolute; top: calc(100% + 8px); right: 0; z-index: 50; width: 244px;
    background: var(--bg-card); border: 1px solid var(--border-strong);
    border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px;
}
.op-form { display: flex; flex-direction: column; gap: 9px; }
.op-label { font-size: 12px; color: var(--text-muted); }
.op-form select, .op-form input {
    width: 100%; padding: 9px 12px; background: var(--bg-elevated);
    border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
    color: var(--text); font-size: 14px; font-family: inherit;
}
.op-form select:focus, .op-form input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus-ring); }
.op-form .btn { width: 100%; margin-top: 2px; }

/* ====== Wissensdatenbank (KnowledgeHub-Modul) ====== */
/* KB-Shell: Docs-Layout = persistente linke Themen-Sidebar + Inhalt (wie KnowledgeHub) */
.kb-shell { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 36px; align-items: start; }
.kb-main { min-width: 0; }
.kb-rail {
    position: sticky; top: 80px; align-self: start;
    border-right: 1px solid var(--border); padding-right: 18px;
    display: flex; flex-direction: column; gap: 1px;
    max-height: calc(100vh - 96px); overflow-y: auto;
}
.kb-rail-link {
    display: flex; align-items: center; gap: 8px; padding: 6px 10px;
    border-radius: var(--radius-sm); font-size: 13px; color: var(--text-muted);
    transition: background .15s, color .15s;
}
.kb-rail-link:hover { background: var(--accent-soft); color: var(--text); }
.kb-rail-link.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.kb-rail-link .kb-rail-ico { width: 16px; text-align: center; flex-shrink: 0; }
.kb-rail-cat { padding-left: 12px; }
.kb-rail-group {
    display: block; margin: 14px 0 4px; padding: 0 10px;
    font-size: 11px; text-transform: uppercase; letter-spacing: .06em;
    color: var(--text-dim); font-weight: 600;
}
.kb-rail-group:hover { color: var(--text-muted); }
.kb-rail-group.active { color: var(--accent); }
.kb-rail-badge { margin-left: auto; background: var(--counter); color: #fff; border-radius: var(--radius-sm); font-size: 10px; font-weight: 700; padding: 0 6px; }
.kb-rail-divider { border: none; border-top: 1px solid var(--border); margin: 12px 0; }

/* Rail ein-/ausklappbar (Notion-Stil) — gilt fuer ALLE KB-Seiten inkl. Landkarte */
.kb-rail-collapse {
    align-self: flex-end; margin: -2px -6px 4px 0; padding: 4px 8px;
    background: transparent; border: none; color: var(--text-dim); cursor: pointer;
    font-size: 15px; line-height: 1; border-radius: var(--radius-sm);
    transition: background .15s, color .15s;
}
.kb-rail-collapse:hover { background: var(--accent-soft); color: var(--accent); }
.kb-rail-show {
    display: none; align-items: center; gap: 6px; margin-bottom: 16px;
    background: transparent; border: 1px solid var(--border); color: var(--text-muted);
    cursor: pointer; font-size: 13px; padding: 6px 12px; border-radius: var(--radius-sm);
    transition: background .15s, color .15s;
}
.kb-rail-show:hover { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
.kb-shell.rail-collapsed { grid-template-columns: minmax(0, 1fr); }
.kb-shell.rail-collapsed .kb-rail { display: none; }
.kb-shell.rail-collapsed .kb-rail-show { display: inline-flex; }

/* Such-Treffer-Highlight (⌘K + Suchseiten) + TOC-Scroll-Spy (aktive Überschrift) */
mark { background: var(--accent-soft); color: var(--accent); padding: 0 2px; border-radius: 3px; }
.kb-toc a.active { color: var(--accent); border-left-color: var(--accent); font-weight: 600; }

/* Unter ~860px: Rail einklappen, Home-Sublinks als mobiler Ersatz zeigen. */
@media (max-width: 860px) {
    .kb-shell { grid-template-columns: 1fr; gap: 0; }
    .kb-rail { display: none; }
}
@media (min-width: 861px) { .kb-sublinks { display: none; } }

/* Suchleiste (Home/Suche) */
.kb-search-bar { display: flex; gap: 8px; margin-bottom: 28px; }
.kb-search-bar input[type="search"] {
    flex: 1; padding: 11px 16px; background: var(--bg-elevated);
    border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
    color: var(--text); font-size: 15px; font-family: inherit;
}
.kb-search-bar input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus-ring); }

/* Themen-/Kategorie-Raster */
.kb-topic-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; margin-bottom: 8px; }
.kb-topic-card {
    display: flex; flex-direction: column; gap: 4px;
    padding: 18px; border: 1px solid var(--border); border-radius: var(--radius);
    background: var(--bg-card); transition: border-color .15s, box-shadow .15s;
}
.kb-topic-card:hover { border-color: var(--accent); box-shadow: var(--shadow); }
.kb-topic-icon { font-size: 26px; line-height: 1; margin-bottom: 4px; }
.kb-topic-title { font-weight: 600; font-size: 15px; color: var(--text); }
.kb-topic-desc { font-size: 13px; color: var(--text-muted); }
.kb-topic-count { font-size: 12px; color: var(--text-dim); font-family: var(--font-mono); margin-top: 4px; }

/* Artikel-Liste */
.kb-article-list { display: flex; flex-direction: column; gap: 8px; }
.kb-article-row {
    display: flex; align-items: center; gap: 12px;
    padding: 13px 16px; background: var(--bg-card);
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    color: var(--text); transition: border-color .15s;
}
.kb-article-row:hover { border-color: var(--accent); }
.kb-pin { flex-shrink: 0; font-size: 14px; }
.kb-article-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.kb-article-title { font-weight: 600; font-size: 14px; }
.kb-article-excerpt { font-size: 13px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kb-article-meta { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

/* Artikel-Ansicht: zweispaltig (Inhalt + Seitenleiste) */
.kb-layout { display: grid; grid-template-columns: minmax(0, 1fr) 200px; gap: 36px; align-items: start; }
.kb-article-doc { min-width: 0; max-width: 760px; }
.kb-byline { font-family: var(--font-mono); font-size: 12px; }
.kb-read-badge { color: var(--success); }
.kb-draft-banner {
    background: rgba(217, 119, 6, 0.14); color: var(--warning);
    border: 1px solid rgba(217, 119, 6, 0.3); border-radius: var(--radius-sm);
    padding: 8px 14px; font-size: 13px; margin-bottom: 16px;
}

.kb-aside { position: sticky; top: 80px; display: flex; flex-direction: column; gap: 14px; }
.kb-aside-box { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px; }
/* Aktions-Buttons in der Artikel-Seitenleiste stapeln statt nebeneinander
   (200px-Spalte ist zu schmal -> sie ueberlappten vorher beim Umbruch). */
.kb-aside-box .btn { display: block; width: 100%; text-align: center; margin: 0; }
.kb-aside-box .btn + .btn { margin-top: 8px; }
.kb-aside-title { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); font-weight: 600; margin-bottom: 8px; }
.kb-aside-list { margin: 0; padding-left: 16px; font-size: 13px; }
.kb-aside-list li { margin-bottom: 5px; }
.kb-toc { display: flex; flex-direction: column; gap: 5px; }
.kb-toc a { font-size: 13px; color: var(--text-muted); border-left: 2px solid var(--border); padding-left: 10px; }
.kb-toc a:hover { color: var(--accent); border-left-color: var(--accent); }
.kb-toc-l3 { padding-left: 22px !important; font-size: 12px; }

/* Tags + Feedback */
.kb-tags { display: flex; gap: 6px; flex-wrap: wrap; margin: 24px 0 0; }
.kb-tag { font-size: 12px; padding: 3px 10px; border-radius: var(--radius); background: var(--accent-soft); color: var(--accent); }
.kb-feedback { margin-top: 28px; padding-top: 18px; border-top: 1px solid var(--border); display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.kb-feedback form { display: inline-flex; gap: 8px; }
.kb-fb-q { font-size: 14px; color: var(--text-muted); }
.kb-fb-done { font-size: 14px; color: var(--success); margin: 0; }

/* Verwandte Artikel als Karten-Grid unter dem Artikel (wie KnowledgeHub) */
.kb-related { margin-top: 36px; padding-top: 22px; border-top: 1px solid var(--border); }
.kb-related-head { font-size: 13px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; margin: 0 0 14px; }
.kb-related-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.kb-related-card { display: flex; flex-direction: column; gap: 4px; padding: 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-card); transition: border-color .15s; }
.kb-related-card:hover { border-color: var(--accent); }
.kb-related-title { font-weight: 600; font-size: 14px; color: var(--text); }
.kb-related-card:hover .kb-related-title { color: var(--accent); }
.kb-related-excerpt { font-size: 13px; color: var(--text-muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* Prose: gerenderter Markdown-Artikel — eigenes Heading-Schema (NICHT das globale
   uppercase-h2 der App), damit Artikel wie ein Dokument lesen. */
.kb-prose { color: var(--text); font-size: 15px; line-height: 1.7; }
.kb-prose h1, .kb-prose h2, .kb-prose h3, .kb-prose h4 {
    color: var(--text); text-transform: none; letter-spacing: -0.01em; font-weight: 650;
    scroll-margin-top: 80px;
}
.kb-prose h2 { font-size: 22px; margin: 32px 0 12px; padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.kb-prose h3 { font-size: 18px; margin: 24px 0 8px; }
.kb-prose h4 { font-size: 15px; margin: 18px 0 6px; color: var(--text-muted); }
.kb-prose p { margin: 0 0 14px; }
.kb-prose ul, .kb-prose ol { margin: 0 0 14px; padding-left: 24px; }
.kb-prose li { margin-bottom: 5px; }
.kb-prose a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.kb-prose img { max-width: 100%; height: auto; border-radius: var(--radius-sm); }
.kb-prose blockquote {
    margin: 0 0 14px; padding: 8px 16px; border-left: 3px solid var(--accent);
    background: var(--accent-soft); color: var(--text-muted); border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.kb-prose pre {
    background: var(--ct-bg); border: 1px solid var(--ct-border); border-radius: var(--radius-sm);
    padding: 14px 16px; overflow-x: auto; font-family: var(--font-mono); font-size: 13px; margin: 0 0 14px;
}
.kb-prose pre code { background: none; padding: 0; color: var(--text); font-size: 13px; }
.kb-prose :not(pre) > code { font-family: var(--font-mono); font-size: 0.88em; background: var(--bg-elevated); padding: 2px 6px; border-radius: 4px; color: var(--accent); }
.kb-prose table { border-collapse: collapse; width: 100%; margin: 0 0 16px; font-size: 14px; }
.kb-prose th, .kb-prose td { border: 1px solid var(--border); padding: 8px 12px; text-align: left; }
.kb-prose th { background: var(--bg-elevated); font-weight: 600; }
.kb-prose hr { border: none; border-top: 1px solid var(--border); margin: 24px 0; }
.kb-prose .wiki-link { color: var(--ct-accent); text-decoration: none; border-bottom: 1px dashed var(--ct-accent); }
.kb-prose kbd {
    font-family: var(--font-mono); font-size: 0.85em; background: var(--bg-elevated);
    border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 4px; padding: 1px 6px;
}

/* Admonitions (Callouts aus dem markdown 'admonition'-Extension) */
.kb-prose .admonition {
    border: 1px solid var(--border); border-left: 3px solid var(--accent);
    border-radius: var(--radius-sm); padding: 12px 16px; margin: 0 0 16px; background: var(--bg-card);
}
.kb-prose .admonition-title { font-weight: 650; margin: 0 0 6px; font-size: 14px; }
.kb-prose .admonition p:last-child { margin-bottom: 0; }
.kb-prose .admonition.tip, .kb-prose .admonition.hint { border-left-color: var(--success); }
.kb-prose .admonition.warning, .kb-prose .admonition.caution { border-left-color: var(--warning); }
.kb-prose .admonition.danger, .kb-prose .admonition.important { border-left-color: var(--danger); }

@media (max-width: 1024px) {
    .kb-layout { grid-template-columns: 1fr; gap: 8px; }
    .kb-aside { position: static; flex-direction: row; flex-wrap: wrap; }
    .kb-aside-box { flex: 1; min-width: 160px; }
}

/* ====== Wissen-Editor / Verwaltung ====== */
.kb-label-hint { font-weight: 400; color: var(--text-dim); font-size: 12px; }
.kb-label-hint code { font-size: 0.9em; }
.kb-editor-meta { display: grid; grid-template-columns: 2fr 1fr auto; gap: 14px; align-items: end; }
.kb-pin-field { display: flex; flex-direction: column; }
.kb-check { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text); cursor: pointer; padding: 10px 0; }
.kb-check input { width: 18px; height: 18px; accent-color: var(--accent); }

.kb-editor-split { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
.kb-md-input {
    width: 100%; padding: 14px; background: var(--bg-elevated);
    border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
    color: var(--text); font-family: var(--font-mono); font-size: 13.5px; line-height: 1.6;
    resize: vertical; min-height: 360px;
}
.kb-md-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus-ring); }
.kb-preview-pane {
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    padding: 14px 16px; background: var(--bg-card); min-height: 360px;
    max-height: 600px; overflow-y: auto;
}
.kb-preview-pane .kb-prose { font-size: 15px; }

/* Inline-Verwaltungsformulare (Themen/Kategorien) */
.kb-form-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.kb-form-row input[type="text"], .kb-form-row select {
    padding: 9px 12px; background: var(--bg-elevated);
    border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
    color: var(--text); font-size: 14px; font-family: inherit;
}
.kb-form-row input:focus, .kb-form-row select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus-ring); }
.kb-icon-input { width: 56px; text-align: center; }
.kb-grow { flex: 1; min-width: 140px; }
.kb-fullwidth { width: 100%; margin-top: 8px; padding: 9px 12px; background: var(--bg-elevated); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); color: var(--text); font-size: 14px; font-family: inherit; }
.stat-card { color: inherit; text-decoration: none; transition: border-color .15s; }
a.stat-card:hover { border-color: var(--accent); }

@media (max-width: 680px) {
    .kb-editor-split { grid-template-columns: 1fr; }
    .kb-editor-meta { grid-template-columns: 1fr; }
    .kb-preview-pane { min-height: 0; }
}

/* ====== Wissen: Sekundaer-Nav, Fortschritt, Benachrichtigungen, Graph ====== */
.kb-sublinks { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 22px; }
.kb-sublink {
    display: inline-flex; align-items: center; gap: 6px; font-size: 13px;
    padding: 5px 12px; border-radius: var(--radius); border: 1px solid var(--border);
    color: var(--text-muted); background: var(--bg-card);
}
.kb-sublink:hover { border-color: var(--accent); color: var(--text); }
.kb-sublink-badge { background: var(--counter); color: #fff; font-weight: 700; border-radius: var(--radius-sm); font-size: 11px; padding: 0 6px; min-width: 16px; text-align: center; }
.nav-badge { background: var(--counter); color: #fff; font-weight: 700; border-radius: var(--radius-sm); font-size: 10px; padding: 0 5px; margin-left: 3px; vertical-align: top; }

.kb-progress-bar { height: 10px; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: 2px; overflow: hidden; margin-bottom: 8px; }
/* Balkenbreite kommt server-gerendert als Inline-Style und aendert sich im
   Browser nie -> eine width-Transition konnte hier gar nicht feuern (tote
   Deklaration, dafuer ein Layout-Animations-Fund im Design-Check). */
.kb-progress-bar span { display: block; height: 100%; background: var(--accent); border-radius: 0; }
.kb-progress-bar--sm { height: 7px; margin: 0; flex: 1; }
.kb-cat-progress { display: flex; align-items: center; gap: 14px; padding: 7px 4px; }
.kb-cat-progress-name { flex: 0 0 200px; font-size: 14px; color: var(--text); }
.kb-cat-progress-name:hover { color: var(--accent); }
.kb-cat-progress .data-meta { flex-shrink: 0; min-width: 44px; text-align: right; }
@media (max-width: 560px) { .kb-cat-progress-name { flex-basis: 110px; } }

.kb-notif-unread { border-left: 3px solid var(--accent); }

/* Wissens-Landkarte (vis-network): Steuer-Sidebar + Canvas */
.kb-graph-shell { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 16px; height: calc(100vh - 250px); min-height: 460px; }
/* Filter-Panel der Landkarte einklappbar (zweite, minimierbare Sidebar) */
.kb-graph-shell.filters-collapsed { grid-template-columns: minmax(0, 1fr); }
.kb-graph-shell.filters-collapsed .kb-graph-side { display: none; }
.kb-graph-side { border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-card); padding: 16px; overflow-y: auto; display: flex; flex-direction: column; gap: 18px; }
.kb-graph-canvas {
    border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-elevated);
    background-image: radial-gradient(circle at 1px 1px, var(--border) 1px, transparent 0);
    background-size: 24px 24px; position: relative; overflow: hidden;
}
.kb-g-section { display: flex; flex-direction: column; gap: 3px; }
.kb-g-section[hidden] { display: none; }
.kb-g-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); margin-bottom: 4px; }
.kb-g-search { width: 100%; padding: 8px 11px; font-size: 13px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--bg-elevated); color: var(--text); font-family: inherit; }
.kb-g-search:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus-ring); }
.kb-g-chip { display: flex; align-items: center; gap: 8px; padding: 5px 7px; border-radius: var(--radius-sm); font-size: 13px; color: var(--text); cursor: pointer; }
.kb-g-chip:hover { background: var(--accent-soft); }
.kb-g-chip input { margin: 0; accent-color: var(--accent); flex-shrink: 0; }
.kb-g-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.kb-g-count { margin-left: auto; color: var(--text-dim); font-size: 11px; font-family: var(--font-mono); }
.kb-g-catlist { display: flex; flex-direction: column; gap: 1px; max-height: 180px; overflow-y: auto; }
.kb-g-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.kb-g-stat { background: var(--bg-elevated); border: 1px solid var(--border); padding: 8px; border-radius: var(--radius-sm); text-align: center; }
.kb-g-stat-val { font-size: 18px; font-weight: 700; color: var(--accent); }
.kb-g-stat-label { font-size: 10px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); }
.kb-g-detail { background: var(--accent-soft); border-left: 3px solid var(--accent); padding: 10px 12px; border-radius: var(--radius-sm); font-size: 13px; }
.kb-g-detail-title { font-weight: 600; margin-bottom: 4px; }
.kb-g-detail-meta { color: var(--text-muted); font-size: 11px; margin-bottom: 6px; font-family: var(--font-mono); }
.kb-g-detail-excerpt { color: var(--text-muted); line-height: 1.5; margin-bottom: 8px; }
.kb-g-detail-link { font-size: 13px; font-weight: 600; }
.kb-g-hint { font-size: 11px; color: var(--text-dim); line-height: 1.5; margin: auto 0 0; padding-top: 10px; border-top: 1px solid var(--border); }
/* Cluster-Achsen-Umschalter (Region/Equipment/Ziel) */
.kb-g-axes { display: flex; gap: 4px; }
.kb-g-axes .g-axis {
    flex: 1; padding: 6px 4px; font-size: 12px; cursor: pointer; font-family: inherit;
    background: var(--bg-elevated); color: var(--text-muted);
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    transition: background .15s, color .15s, border-color .15s;
}
.kb-g-axes .g-axis:hover { color: var(--text); }
.kb-g-axes .g-axis.active { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); font-weight: 600; }
@media (max-width: 860px) {
    .kb-graph-shell { grid-template-columns: 1fr; height: auto; }
    .kb-graph-canvas { height: 60vh; }
    .kb-graph-side { max-height: none; }
}

/* ====== Verknuepftes Wissen in der Kundenakte ====== */
.kb-pin-card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-left: 3px solid var(--ct-accent); border-radius: var(--radius);
    padding: 18px 20px; margin-bottom: 24px;
}
.kb-pin-list { display: flex; flex-direction: column; gap: 8px; margin: 10px 0 14px; }
.kb-pin-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.kb-pin-item-link { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; color: var(--text); }
.kb-pin-item-link:hover .kb-article-title { color: var(--accent); }
.kb-pin-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 6px; }
.kb-pin-form select { flex: 1; min-width: 180px; padding: 9px 12px; background: var(--bg-elevated); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); color: var(--text); font-size: 14px; font-family: inherit; }
.kb-pin-form select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus-ring); }

/* WODL — Trainingsplan als Text-DSL: Editor-Split + Cycle-Matrix-Vorschau */
.wodl-edit-head { margin-bottom: 12px; }
.wodl-split { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
@media (max-width: 860px) { .wodl-split { grid-template-columns: 1fr; } }
.wodl-textarea {
    font-family: var(--font-mono); font-size: 13px; line-height: 1.6;
    width: 100%; min-height: 440px; padding: 14px; tab-size: 4;
    background: var(--bg-elevated); color: var(--text);
    border: 1px solid var(--border); border-radius: var(--radius); resize: vertical;
}
.wodl-textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus-ring); }
.wodl-preview {
    background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 16px 18px; min-height: 440px; max-height: 660px; overflow: auto;
}
.wodl-preview h1 { font-size: 18px; margin: 0 0 8px; }
.wodl-preview h2 { font-size: 15px; margin: 18px 0 8px; }
.wodl-msg { font-size: 13px; }
.wodl-error { color: var(--danger); font-family: var(--font-mono); }
.wodl-warn { color: var(--warning); font-size: 12px; }
.wodl-view em, .wodl-preview em { color: var(--text-muted); font-style: italic; }
.wodl-raw {
    font-family: var(--font-mono); font-size: 12px; line-height: 1.55;
    white-space: pre-wrap; overflow-x: auto; margin-top: 12px; padding: 14px;
    background: var(--bg-elevated); border: 1px solid var(--border);
    border-radius: var(--radius); color: var(--text-muted);
}

/* T2-Standards: Phasen-Karten mit Ziel/Kriterien/Möglichkeiten-Raster */
.std-phase {
    background: var(--bg-card); border: 1px solid var(--border);
    border-left: 3px solid var(--accent); border-radius: var(--radius);
    padding: 18px 20px; margin-bottom: 18px;
}
.std-phase-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.std-phase-head h2 { margin: 0; font-size: 17px; flex: 1; min-width: 0; }
.std-timeframe { font-size: 12px; color: var(--text-dim); white-space: nowrap; }
.std-phase-actions { display: flex; gap: 4px; align-items: center; }
.std-phase-actions .inline-form { display: flex; gap: 4px; margin: 0; }
.std-phase-actions .btn-icon:disabled { opacity: .3; cursor: default; }
.std-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
@media (max-width: 860px) { .std-grid { grid-template-columns: 1fr; } }
.std-col h3 {
    margin: 0 0 6px; font-size: 11px; font-weight: 700; letter-spacing: .08em;
    text-transform: uppercase; color: var(--text-dim);
}
.std-text { margin: 0; color: var(--text-muted); line-height: 1.55; white-space: pre-line; }
.std-new { margin-top: 20px; }
.std-admin { margin-bottom: 20px; }

/* ====== Aufmerksamkeits-Schicht (BRIEFING-SPEC): Slipping / Dein Briefing / Eingang ====== */
.briefing-card--warn { border-left-color: var(--warning); }
.briefing-card--warn .briefing-note { background: rgba(217, 119, 6, 0.10); }
.slip-days { color: var(--warning); font-weight: 600; }

.section-title { margin: 0 0 16px; }
.dash-col-followup { margin-top: 24px; }
.resurface-card { margin-top: 24px; margin-bottom: 0; }
.resurface-card .data-row { border: none; padding-left: 0; padding-right: 0; }

.inbox-capture { display: flex; gap: 12px; align-items: flex-start; }
.inbox-capture textarea {
    flex: 1;
    resize: vertical;
    background: var(--bg-elevated);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    color: var(--text);
    padding: 10px 14px;
    font: inherit;
}
.inbox-capture textarea:focus { outline: none; box-shadow: var(--focus-ring, 0 0 0 3px var(--accent-soft)); border-color: var(--accent); }

.inbox-row { flex-wrap: wrap; gap: 10px; }
.inbox-row--done { opacity: 0.65; }
.inbox-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inbox-actions form { display: flex; gap: 8px; align-items: center; margin: 0; }
.inbox-actions select {
    background: var(--bg-elevated);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    color: var(--text);
    padding: 6px 10px;
    font: inherit;
    font-size: 13px;
}

/* Verordnungs-Check: Ampel-Badge + Prüf-Checkliste an der Klientenakte */
.vo-badge {
    --bc: var(--text-dim);
    display: inline-block; margin-left: 8px; padding: 2px 9px;
    font-size: 11px; font-weight: 700; letter-spacing: .03em;
    border-radius: var(--radius-sm); vertical-align: middle;
    background: linear-gradient(135deg, color-mix(in srgb, var(--bc) 16%, var(--bg-card)), var(--bg-elevated));
    color: color-mix(in srgb, var(--bc) 65%, var(--text));
    border: 1px solid color-mix(in srgb, var(--bc) 22%, transparent);
}
.vo-badge.vo-ok   { --bc: var(--success); }
.vo-badge.vo-warn { --bc: var(--warning); }
.vo-badge.vo-fail { --bc: var(--danger); }
.vo-details > summary { cursor: pointer; font-size: 13px; color: var(--text-muted); margin: 6px 0; }
/* ====== Termine / Kalender (v1.3) ====== */
.cal-nav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.cal-week-label { font-weight: 600; font-variant-numeric: tabular-nums; color: var(--text-muted); }
.cal-filter { margin-left: auto; }
.cal-form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 10px 14px;
    margin-bottom: 10px;
}

.cal-week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; align-items: start; }
@media (max-width: 1000px) { .cal-week { grid-template-columns: repeat(2, 1fr); } .cal-empty { display: none; } }
.cal-day {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 8px;
    min-height: 90px;
}
.cal-day--today { border-color: var(--accent); }
.cal-day-head {
    display: flex; justify-content: space-between; align-items: baseline;
    margin-bottom: 8px; color: var(--text-muted); text-decoration: none;
}
.cal-day-head:hover .cal-day-date { color: var(--accent); }
.cal-day-name { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; }
.cal-day-date { font-size: 12px; font-variant-numeric: tabular-nums; }
.cal-empty { min-height: 22px; }

/* Status faerbt die Flaeche (Tint statt Kanten — Campus-Konvention). */
.cal-appt, .cal-block { border-radius: var(--radius-sm); padding: 7px 9px; font-size: 13px; }
.cal-appt { margin-bottom: 6px; }
.cal-appt--geplant { background: color-mix(in srgb, var(--accent) 10%, transparent); }
.cal-appt--wahrgenommen { background: color-mix(in srgb, var(--success) 11%, transparent); }
.cal-appt--abgesagt_patient, .cal-appt--abgesagt_praxis {
    background: transparent; border: 1px dashed var(--border-strong); opacity: 0.72;
}
.cal-appt--no_show { background: color-mix(in srgb, var(--danger) 10%, transparent); }
.cal-appt-head { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.cal-appt-time { font-family: var(--font-mono); font-size: 11.5px; color: var(--text-muted); white-space: nowrap; }
.cal-appt-client { display: block; font-weight: 600; color: var(--text); text-decoration: none; }
.cal-appt-client:hover { color: var(--accent); }
.cal-appt-sub, .cal-appt-rx { font-size: 12px; color: var(--text-muted); }
.cal-status-tag { display: inline-block; margin-top: 2px; font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-dim); }
.cal-status--wahrgenommen { color: var(--success); }
.cal-status--no_show { color: var(--danger); }

/* Termin-Aktionsmenue (tap) */
.appt-menu { position: relative; }
.appt-menu > summary {
    list-style: none; cursor: pointer; padding: 0 7px;
    color: var(--text-dim); border-radius: var(--radius-sm); line-height: 1.4;
}
.appt-menu > summary::-webkit-details-marker { display: none; }
.appt-menu > summary:hover { color: var(--text); background: var(--bg-elevated); }
.appt-menu-panel {
    position: absolute; right: 0; top: calc(100% + 6px); z-index: 45;
    width: 300px; max-width: 82vw;
    background: var(--bg-card);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 12px;
    display: flex; flex-direction: column; gap: 10px;
}
.appt-menu-row { display: flex; flex-wrap: wrap; gap: 6px; }
.appt-doku-form .field { margin-bottom: 8px; }
.appt-move-form { flex-wrap: wrap; }

/* Tagesraster: Zeitspalte + eine Spalte je Therapeut:in */
.cal-daygrid-wrap { overflow-x: auto; }
.cal-daygrid {
    display: grid;
    grid-template-columns: 56px repeat(var(--cal-cols), minmax(180px, 1fr));
    grid-template-rows: auto repeat(var(--cal-rows), 16px);
    column-gap: 8px;
}
.cal-corner { grid-row: 1; grid-column: 1; }
.cal-col-head {
    grid-row: 1; padding-bottom: 8px;
    font-size: 12px; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.05em; color: var(--text-muted);
}
.cal-hour {
    grid-column: 1;
    font-family: var(--font-mono); font-size: 11px; color: var(--text-dim);
    border-top: 1px solid var(--border); padding-top: 2px;
}
.cal-block { overflow: hidden; margin: 1px 0; padding: 4px 8px; font-size: 12.5px; line-height: 1.35; }
.cal-block .cal-appt-client { font-size: 12.5px; }
.cal-block .cal-appt-head { margin-bottom: 0; }

/* Quick-Info-Peek an der Klienten-Liste (v1.1 A5) */
.client-row .data-content { color: inherit; text-decoration: none; }
.client-row .data-content:hover .data-key { color: var(--accent-hover); }
.peek-btn .icon { transition: transform 0.15s ease; }
.peek-btn.peek-open .icon { transform: rotate(180deg); }
@media (prefers-reduced-motion: reduce) { .peek-btn .icon { transition: none; } }
.client-peek {
    margin: -4px 0 4px;
    padding: 12px 14px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}
.peek-line {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0 0 6px;
}
.peek-line:last-of-type { margin-bottom: 0; }
.peek-actions { margin-top: 10px; }

/* Fortschritts-Donut an VO-Karten und Dashboard-Zeilen (v1.1 A4) */
.vo-donut { flex: 0 0 auto; vertical-align: -3px; }
.vo-label .vo-donut { margin-right: 4px; }
.vo-label .vo-count { margin-right: 8px; }
.vo-donut-track { stroke: var(--border-strong); }
.vo-donut-fill { stroke: var(--text-dim); }
.vo-donut-ok .vo-donut-fill { stroke: var(--success); }
.vo-donut-warn .vo-donut-fill { stroke: var(--warning); }
.vo-donut-fail .vo-donut-fill { stroke: var(--danger); }
.vo-count {
    font-variant-numeric: tabular-nums;
    font-size: 12.5px;
    color: var(--text-muted);
    white-space: nowrap;
}

/* Katalog-Kontext im VO-Formular + Bestaetigungs-Dialog (v1.1 A2) */
.vo-katalog-hint {
    margin: 6px 0 0;
    font-size: 12.5px;
    color: var(--accent);
}
.vo-confirm {
    max-width: 560px;
    padding: 20px 22px;
    background: var(--bg-card);
    color: var(--text);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.vo-confirm::backdrop { background: rgba(0, 0, 0, 0.45); }
.vo-confirm h3 { margin: 0 0 6px; }
.vo-confirm .action-row { margin-top: 14px; }

.vo-checks { list-style: none; margin: 8px 0 4px; padding: 0; }
.vo-line { display: flex; gap: 8px; align-items: baseline; padding: 4px 0; font-size: 13px; color: var(--text-muted); line-height: 1.5; }
.vo-line strong { color: var(--text); font-weight: 600; }
.vo-dot { flex: 0 0 8px; width: 8px; height: 8px; border-radius: 50%; position: relative; top: -1px; }
.vo-ok   > .vo-dot { background: var(--success); }
.vo-warn > .vo-dot { background: var(--warning); }
.vo-fail > .vo-dot { background: var(--danger); }
.vo-info > .vo-dot { background: var(--text-dim); }
.vo-disclaimer { border-top: 1px solid var(--border); padding-top: 8px; margin-top: 8px; }
.vo-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.vo-start-form { display: flex; gap: 6px; align-items: center; }
.vo-start-form input[type="date"] { padding: 6px 8px; font-size: 13px; background: var(--bg-elevated); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); color: var(--text); font-family: inherit; }
.vo-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
@media (max-width: 700px) { .vo-form-grid { grid-template-columns: 1fr; } }
.vo-form-checks { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 4px 0 12px; font-size: 13px; color: var(--text-muted); }
.vo-form-checks label { display: flex; gap: 6px; align-items: center; cursor: pointer; }

/* Verordnungs-Check Stufe B: Fortschritt, Behandlungen, Dashboard-Warnungen */
.vo-progress { display: flex; align-items: center; gap: 12px; margin: 8px 0 6px; font-size: 13px; color: var(--text-muted); flex-wrap: wrap; }
.vo-progress strong { color: var(--text); }
.vo-bar { flex: 1; min-width: 120px; max-width: 240px; height: 6px; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: 2px; overflow: hidden; }
.vo-bar-fill { display: block; height: 100%; background: var(--accent); border-radius: 0; }
.vo-treatments > summary { cursor: pointer; font-size: 13px; color: var(--text-muted); margin: 4px 0; }
.vo-treatments .vo-line { justify-content: flex-start; }
.vo-treatments .inline-delete { margin: 0 0 0 auto; }
.vo-treat-form { margin: 8px 0; flex-wrap: wrap; }
.vo-treat-form input[type="text"] { flex: 1; min-width: 160px; padding: 6px 8px; font-size: 13px; background: var(--bg-elevated); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); color: var(--text); font-family: inherit; }
.vo-alert { display: flex; align-items: center; gap: 10px; }
.vo-alert .data-content { flex: 1; min-width: 0; }

/* Therapieberichte */
.report-row .data-meta { white-space: nowrap; }
.report-textarea {
    width: 100%; font-family: var(--font-mono); font-size: 13px; line-height: 1.6;
    padding: 14px; background: var(--bg-elevated); color: var(--text);
    border: 1px solid var(--border); border-radius: var(--radius); resize: vertical;
}
.report-textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus-ring); }
.report-ai-note { margin-bottom: 16px; }

/* Dashboard-Ruhe-Pass (DESIGN-RULES.md, Notion-nah): Sektionen statt Boxen */
.dash-statline { margin: 6px 0 0; color: var(--text-muted); font-size: 14px; }
.dash-statline strong { color: var(--text); font-weight: 650; font-variant-numeric: tabular-nums; }
.today { border-top: 1px solid var(--border); padding-top: 20px; }
.today-title { margin: 0 0 2px; font-size: 17px; }
.today-sub { margin: 0 0 16px; color: var(--text-dim); font-size: 12.5px; }
.today-group { margin-bottom: 18px; }
.today-group:last-child { margin-bottom: 0; }
.today-label {
    margin: 0 0 2px; font-size: 11px; font-weight: 700; letter-spacing: .08em;
    text-transform: uppercase; color: var(--text-dim);
}
.today-row {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 14px;
}
.today-group .today-row:last-child { border-bottom: 0; }
.today-link { flex: 1; min-width: 0; color: var(--text); text-decoration: none; }
.today-link:hover .data-key { color: var(--accent); }
.today-row .data-meta { white-space: nowrap; }
.today-action { margin: 0; opacity: .55; transition: opacity .15s; }
.today-row:hover .today-action { opacity: 1; }

/* --- "Nur eigene Klienten"-Schalter (Coaches-Corner N1) ---------------------- */
.scope-form { display: flex; align-items: center; margin: 0; }
.scope-toggle { display: inline-flex; align-items: center; gap: 6px; font-size: 13px;
    padding: 5px 10px; border-radius: var(--radius); border: 1px solid var(--border);
    background: transparent; color: var(--text-muted); cursor: pointer; white-space: nowrap; }
.scope-toggle:hover { border-color: var(--accent); color: var(--text); }
.scope-toggle--on { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.scope-box { display: inline-flex; align-items: center; justify-content: center;
    width: 15px; height: 15px; border-radius: 4px; border: 1px solid var(--border);
    font-size: 11px; line-height: 1; background: var(--bg-elevated); }
.scope-toggle--on .scope-box { border-color: var(--accent); color: var(--accent); }

/* --- Wochen-Trend in der Statzeile (Coaches-Corner N3a) ---------------------- */
.trend { font-size: 12px; padding: 2px 8px; border-radius: 3px; margin-left: 8px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.trend-up { background: rgba(5, 150, 105, 0.12); color: var(--success); }
.trend-down { background: rgba(239, 68, 68, 0.12); color: var(--danger); }
.trend-flat { background: var(--bg-elevated); color: var(--text-muted); border: 1px solid var(--border); }

/* --- Uebungs-Facetten (Coaches-Corner N3b) ----------------------------------- */
.facet-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 14px 0 10px; }
.facet-bar select, .facet-search { padding: 7px 10px; border-radius: 8px;
    border: 1px solid var(--border); background: var(--bg-elevated); color: var(--text); font-size: 14px; }
.facet-search { min-width: 180px; }
.facet-count { margin-left: auto; }
.exercise-badges { display: inline-flex; flex-wrap: wrap; gap: 5px; margin-top: 3px; }

/* --- Abwesenheiten (Coaches-Corner N2): Monats-Matrix ------------------------ */
.abs-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
    gap: 10px; margin: 14px 0 10px; }
.abs-monthnav { display: flex; align-items: center; gap: 8px; }
.abs-monthlabel { font-weight: 600; min-width: 130px; text-align: center; }
.abs-legend { display: flex; flex-wrap: wrap; gap: 10px; font-size: 12px; color: var(--text-muted); }
.abs-legend-item { display: inline-flex; align-items: center; gap: 5px; }
.abs-swatch { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.abs-scroll { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
.abs-matrix { border-collapse: collapse; width: 100%; min-width: 760px; font-size: 12px; }
.abs-matrix th, .abs-matrix td { border-bottom: 1px solid var(--border); padding: 0; }
.abs-matrix thead th { padding: 4px 2px; font-weight: 500; color: var(--text-muted); text-align: center; }
.abs-dow { display: block; font-size: 10px; opacity: .7; }
.abs-name-col { padding: 6px 10px !important; text-align: left; white-space: nowrap;
    font-weight: 500; position: sticky; left: 0; background: var(--bg); }
.abs-cell { height: 30px; min-width: 20px; }
.abs-weekend { background: var(--bg-elevated); }
.abs-today { box-shadow: inset 0 -2px 0 var(--accent); }
.abs-block { display: block; height: 16px; margin: 7px 0; }
/* Kategorische Farben — bewusst OHNE Teal (kollidiert sonst mit dem Akzent). */
.abs-urlaub { background: #7b9eb8; }
.abs-fortbildung { background: #c2a24f; }
.abs-krank { background: #ef8354; }
.abs-dienstreise { background: #9b8cc4; }
.abs-sonstiges { background: #8a8f98; }

/* --- Dashboard: Hauptspalte + rechte Action-Spalte (Coaches-Corner-Muster) --- */
.dash-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 12px 36px; align-items: start; }
.dash-main { min-width: 0; }
.dash-rail { position: sticky; top: 66px; }
.dash-rail h2 { margin-top: 0; }
.rail-section { margin-bottom: 28px; }
@media (max-width: 1100px) {
    .dash-layout { grid-template-columns: 1fr; }
    .dash-rail { position: static; }
}
/* Task-Zeilen in der schmalen Rail: Meta unter den Text (wie .dash-col) */
.dash-rail .task-row { flex-wrap: wrap; }
.dash-rail .task-meta { width: 100%; padding-left: 32px; }

/* --- Einklappbare Sidebar (User-Toggle) + SVG-Icons -------------------------- */
.side-icon .icon { display: block; }
/* Ein-/Ausklappen springt bewusst OHNE Uebergang: die Sidebar schiebt die
   Inhaltsspalte (flex-basis), eine Breiten-Transition haette also 200 ms lang
   pro Frame die ganze Seite neu ausgelegt — auf dem Wochen-Kalender die
   teuerste Ansicht, ausgerechnet auf dem iPad. Fuer eine schiebende Spalte
   gibt es keine transform-Variante; der Rail-Wechsel ist einmalig und schnell
   genug, um ohne Animation richtig zu wirken (VS-Code-Muster). */

.sidebar-toggle {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 6px; border-radius: 6px; border: none; background: transparent;
    color: var(--text-dim); cursor: pointer; transition: background 0.15s, color 0.15s;
}
.sidebar-toggle:hover { background: var(--accent-soft); color: var(--text); }
.topbar { justify-content: flex-start; }
.topbar-spacer { flex: 1; }

/* Eingeklappt (localStorage nx-sidebar) = gleiche Optik wie die automatische
   Icon-Rail unter 900px. Bewusst dupliziert — Media-Query kann keine Klassen setzen. */
[data-sidebar="collapsed"] .sidebar { flex-basis: 56px; width: 56px; padding: 14px 6px 10px; }
[data-sidebar="collapsed"] .sidebar .brand { padding: 0 0 12px; text-align: center; }
[data-sidebar="collapsed"] .sidebar .brand-name { display: none; }
[data-sidebar="collapsed"] .side-label, [data-sidebar="collapsed"] .side-badge, [data-sidebar="collapsed"] .side-group-label { display: none; }
[data-sidebar="collapsed"] .side-link { justify-content: center; padding: 9px 0; gap: 0; }
[data-sidebar="collapsed"] .side-link--active::before { left: -6px; }

@media (max-width: 900px) {
    .sidebar-toggle { display: none; }
}

/* --- Heilmittel-Seite: Suche zuerst, Werkzeuge als Toggle-Pills -------------- */
.hm-search { margin-bottom: 12px; }
.hm-search input { font-size: 16px; padding: 12px 14px; }

/* Pill-Reihe bleibt STABIL (kein flex-basis-Sprung) — Panels klappen als
   eigene Blöcke UNTER der Reihe auf (app.js, ein Panel zur Zeit). */
.hm-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 18px; }
.hm-tool-btn {
    font-size: 13px; padding: 5px 12px; border-radius: var(--radius);
    border: 1px solid var(--border); background: transparent; color: var(--text-muted);
    cursor: pointer; font-family: inherit; user-select: none;
    transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.hm-tool-btn:hover { border-color: var(--accent); color: var(--text); }
.hm-tool-btn.is-open { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.hm-tool-link {
    font-size: 13px; padding: 5px 12px; border-radius: var(--radius);
    border: 1px solid var(--border); color: var(--text-muted);
}
.hm-tool-link:hover { border-color: var(--accent); color: var(--text); }
.hm-tool-panel { padding: 4px 2px 16px; border-bottom: 1px solid var(--border); margin-bottom: 20px; }

.hm-check-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; margin-bottom: 10px; }
.hm-check-flags { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-bottom: 4px; }
.hm-check-flags label { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; }

.hm-glossar { columns: 2; column-gap: 32px; }
@media (max-width: 680px) { .hm-glossar { columns: 1; } }

.hm-footnote { margin-top: 40px; padding-top: 14px; border-top: 1px solid var(--border);
    font-size: 12px; line-height: 1.6; color: var(--text-dim); }

/* --- Klienten-Akte: Boxen-Flut -> ruhige Sektionen (DESIGN-RULES Regel 1) ----
   Das Briefing (.client-hero) bleibt die eine Objekt-Karte mit Akzent; alle
   weiteren Module (VALD, Verordnungen, Berichte, Uebergabe, Wissen, Recorder)
   werden zu Sektionen: Ueberschrift + Hairline statt Rahmen-Box. */
.client-file .briefing-card:not(.client-hero),
.client-file .kb-pin-card,
.client-file .entry-card {
    background: transparent;
    border: none;
    border-top: 1px solid var(--border);
    border-radius: 0;
    padding: 22px 2px 10px;
    margin-bottom: 10px;
}
.client-file .briefing-card:not(.client-hero) h2 { margin-top: 0; }
.client-file > h2 { border-top: 1px solid var(--border); padding-top: 22px; }

/* Zeilen-Aktionen leiser: sichtbar (iPad!), aber erst beim Hover/Fokus laut. */
.client-file .inline-delete { opacity: 0.35; transition: opacity 0.15s; }
.client-file .briefing-block:hover .inline-delete,
.client-file .data-row:hover .inline-delete,
.client-file .vo-line:hover .inline-delete,
.client-file .kb-pin-item:hover .inline-delete,
.client-file .inline-delete:focus-within { opacity: 1; }

/* --- Listen-Seiten: Anlegen hinter Toggle (Regel 5), Erledigt zuklappbar ----- */
.add-toggle { margin-bottom: 14px; }
.add-toggle > summary {
    list-style: none; cursor: pointer; user-select: none; display: inline-block;
    font-size: 13px; padding: 6px 14px; border-radius: var(--radius-sm);
    border: 1px solid var(--border); color: var(--text-muted);
    transition: border-color 0.15s, color 0.15s;
}
.add-toggle > summary::-webkit-details-marker { display: none; }
.add-toggle > summary:hover { border-color: var(--accent); color: var(--text); }
.add-toggle[open] > summary { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.add-panel { margin-top: 12px; }

.done-toggle > summary { list-style: none; cursor: pointer; user-select: none; }
.done-toggle > summary::-webkit-details-marker { display: none; }
.done-toggle > summary h2 { display: inline-block; margin: 0 0 8px; }
.done-toggle > summary:hover h2 { color: var(--text); }

/* ====== Dashboard "Hub" — Campus-Clone (Pat-Go 2026-07-29) ======
   Eine Sicht pro Tab (Heute/Aktivitaet/Klienten), Top-5-Deckel mit ehrlicher
   Gesamtzahl, Ruhe-Zeile statt leerer Tabellen. Anatomie = Campus-Topic-List. */
.hub-hello-sub { margin: 0 0 22px; color: var(--text-muted); font-size: 14px; }
.hub-hello-sub strong { color: var(--text); font-weight: 650; font-variant-numeric: tabular-nums; }

.hub-search {
    display: flex; align-items: center; gap: 10px; width: 100%; max-width: 620px;
    margin: 0 0 30px; background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 11px 16px; color: var(--text-dim);
    cursor: pointer; font: inherit; text-align: left;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.hub-search:hover, .hub-search:focus-visible { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(var(--accent-rgb), 0.15); outline: none; }
.hub-search kbd {
    margin-left: auto; font-family: var(--font-mono); font-size: 11px;
    background: var(--bg-elevated); border: 1px solid var(--border);
    border-radius: 4px; padding: 1px 6px; color: var(--text-dim);
}

.hub-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 22px; }
.hub-tab {
    background: transparent; border: none; color: var(--text-muted);
    font-size: 14.5px; font-weight: 600; font-family: inherit; cursor: pointer;
    padding: 9px 14px; border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    border-bottom: 2px solid transparent; margin-bottom: -1px;
    transition: background 0.15s ease, color 0.15s ease;
}
.hub-tab:hover { background: var(--accent); color: var(--accent-ink); }
.hub-tab[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); background: transparent; border-radius: 0; }
.hub-tab-n { color: var(--text-dim); font-weight: 500; font-variant-numeric: tabular-nums; }
.hub-tab[aria-selected="true"] .hub-tab-n { color: var(--accent); }
.hub-pane[hidden] { display: none; }

.hub-grp { margin-bottom: 30px; }
.hub-grp-head { display: flex; align-items: baseline; gap: 10px; margin: 0 4px 8px; }
.hub-grp-label { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-dim); }
.hub-grp-hint { font-size: 12px; color: var(--text-dim); margin-left: auto; }

.hub-row {
    display: flex; align-items: center; gap: 12px; padding: 13px 14px;
    border-radius: var(--radius); border-bottom: 1px solid var(--border);
    color: var(--text); text-decoration: none;
    transition: background 0.15s ease, box-shadow 0.15s ease;
}
.hub-row:hover { background: var(--bg-elevated); box-shadow: var(--shadow-sm); border-bottom-color: transparent; }
.hub-row-main { flex: 1; min-width: 0; }
.hub-row-title { display: block; font-weight: 600; letter-spacing: -0.01em; font-size: 14.5px; }
.hub-row-sub { display: block; color: var(--text-muted); font-size: 13px; line-height: 1.5; margin-top: 1px; }
.hub-row-meta { color: var(--text-dim); font-size: 12px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.hub-row .badge { flex: 0 0 auto; text-transform: uppercase; letter-spacing: 0.04em; font-size: 10.5px; font-weight: 700; }
.hub-row .task-check { margin: 0; }
.hub-row .inline-form { margin: 0; }

.hub-more {
    display: block; width: 100%; text-align: left; margin-top: 2px;
    background: transparent; border: none; border-radius: var(--radius);
    padding: 11px 14px; color: var(--accent); font-size: 13.5px; font-weight: 600;
    font-family: inherit; cursor: pointer; text-decoration: none;
    transition: background 0.15s ease;
}
.hub-more:hover { background: var(--bg-elevated); }

.hub-calm { display: flex; align-items: center; gap: 10px; padding: 11px 14px; color: var(--text-dim); font-size: 13.5px; }
.hub-calm-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); flex: 0 0 8px; }

.hub-chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 2px 4px; }
.hub-chip {
    display: inline-flex; align-items: center; gap: 7px; font-size: 13px;
    color: var(--text-muted); background: var(--bg-card);
    border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 6px 11px;
}
.hub-chip-dot { width: 7px; height: 7px; border-radius: 50%; flex: 0 0 7px; }

.hub-ava {
    width: 30px; height: 30px; border-radius: 50%; background: var(--bg-raised);
    color: var(--text-muted); flex: 0 0 30px; display: inline-flex;
    align-items: center; justify-content: center; font-size: 11px; font-weight: 700;
}

/* Hub-Row-Feinschliff: innerer Link erbt Farbe, Zeilen-Aktion leise bis Hover. */
a.hub-row-main { color: inherit; text-decoration: none; }
.hub-action { opacity: 0.55; transition: opacity 0.15s ease; }
.hub-row:hover .hub-action, .hub-action:focus-within { opacity: 1; }

/* ====== Befunde (Erst-/Wiederaufnahme mit Assessment-Delta) ====== */
/* Delta-Zustaende als Tint-Badge (Badge-Technik oben), nicht als Farbkante:
   geaendert = Aufmerksamkeit, neu = Akzent, unveraendert bleibt grau. */
.bf-state { margin-left: 8px; text-transform: none; letter-spacing: 0; }
.bf-geaendert   { --bc: var(--warning); }
.bf-neu         { --bc: var(--accent); }
.bf-entfallen   { --bc: var(--danger); }
.bf-unveraendert { --bc: var(--text-dim); }

.bf-section { margin-bottom: 20px; }
/* Vorbefund am Abschnitt: leise, aufklappbar — der Blick gehoert dem neuen Text. */
.bf-prev > summary {
    margin-top: 6px; font-size: 12px; color: var(--text-dim);
    cursor: pointer; list-style: none;
}
.bf-prev > summary::before { content: '▸ '; }
.bf-prev[open] > summary::before { content: '▾ '; }
.bf-prev p {
    margin: 6px 0 0; padding: 8px 10px; font-size: 13px; line-height: 1.55;
    color: var(--text-muted); white-space: pre-wrap;
    background: color-mix(in srgb, var(--text-dim) 8%, transparent);
    border-radius: var(--radius-sm);
}

/* ====== Rechnungen (Privatabrechnung) ====== */
/* Betraege immer mit Tabellenziffern — Spalten sollen untereinander stehen. */
.inv-amount, .inv-stat-value, .inv-table td.num, .inv-table th.num {
    font-variant-numeric: tabular-nums;
}
.inv-stat { display: flex; align-items: baseline; gap: 10px; margin-bottom: 14px; }
.inv-stat-label { font-size: 13px; color: var(--text-muted); }
.inv-stat-value { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; }

.inv-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.inv-table th {
    text-align: left; font-size: 12px; font-weight: 600; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: .04em; padding: 6px 8px;
}
.inv-table td { padding: 8px; border-top: 1px solid var(--border); }
.inv-table td.num, .inv-table th.num { text-align: right; white-space: nowrap; }
.inv-table tfoot td { border-top: 2px solid var(--border-strong); font-size: 15px; }
/* Zeilen-Aktion leise bis Hover/Fokus — iPad-sicher, wie in der Akte. */
.inv-table .inline-delete { opacity: 0.35; transition: opacity 0.15s ease; }
.inv-table tr:hover .inline-delete, .inv-table .inline-delete:focus-within { opacity: 1; }

/* Termin-Auswahl beim Abrechnen: dichte Checkbox-Liste statt Karten. */
.inv-appt-list { display: flex; flex-direction: column; gap: 2px; margin-bottom: 12px; }
.inv-appt {
    display: flex; align-items: center; gap: 10px; padding: 7px 10px;
    border-radius: var(--radius-sm); font-size: 14px; color: var(--text-muted);
    cursor: pointer;
}
.inv-appt:hover { background: var(--bg-elevated); color: var(--text); }
.inv-inline-edit summary { font-size: 13px; }

/* Filter-Chips der Rechnungsliste: aktiver Chip als Akzent-Tint. */
a.hub-chip { text-decoration: none; }
.hub-chip--on {
    background: color-mix(in srgb, var(--accent) 14%, var(--bg-card));
    border-color: color-mix(in srgb, var(--accent) 30%, transparent);
    color: var(--text);
}

/* ====== VALD-Verlauf (Auswertung Stufe 2) ====== */
.vald-table td, .vald-table th { vertical-align: middle; }
.vald-spark-cell { width: 130px; }
/* Sparkline erbt die Textfarbe -> funktioniert in hell und dunkel ohne Extrawurst. */
.vald-spark { color: var(--accent); display: block; }
/* Richtung ja, WERTUNG nein: gruen/rot wuerde "mehr ist besser" behaupten —
   bei Asymmetrie oder Schmerzskala ist das Gegenteil richtig. Beide Richtungen
   also derselbe ruhige Ton, der Pfeil traegt die Information. */
.vald-delta { font-variant-numeric: tabular-nums; color: var(--text-muted); }
.vald-delta-arrow { color: var(--text-dim); margin-right: 3px; }
/* Seitenunterschied als Flaechen-Tint, keine Farbkante (DESIGN-RULES). */
.vald-side.vald-hinweis td { background: color-mix(in srgb, var(--warning) 10%, transparent); }
.vald-side.vald-deutlich td { background: color-mix(in srgb, var(--danger) 11%, transparent); }

/* Beantragte, noch nicht genehmigte Abwesenheit: gestrichelt + gedimmt —
   sichtbar, aber klar unterscheidbar von einer geltenden Abwesenheit. */
.abs-block--offen { opacity: 0.45; outline: 1px dashed currentColor; outline-offset: -2px; }

/* Modul-Schalter (Einstellungen): ganze Zeile als Label tappbar (iPad),
   Checkbox links, Beschreibung erbt die data-row-Optik. */
.module-toggle { cursor: pointer; justify-content: flex-start; }
.module-toggle input[type="checkbox"] { width: 18px; height: 18px; flex: 0 0 auto; accent-color: var(--accent); }
