/* ==========================================================================
   Klaro – Stylesheet
   Aufbau: 1. Farb- und Maßtokens  2. Grundlagen  3. Bausteine  4. Ansichten
   Farben werden ausschließlich über Tokens gesetzt, damit der Dunkelmodus
   an einer einzigen Stelle definiert ist.
   ========================================================================== */

/* 1. Tokens ---------------------------------------------------------------- */
:root {
    /* Bindet auch die vom Browser gezeichneten Bedienelemente (Ankreuzfelder, Datumsauswahl,
       Bildlaufleisten) an das Farbschema der Anwendung statt an das des Betriebssystems. */
    color-scheme: light;

    --bg:            #f4f5f7;
    --bg-sunken:     #eceef1;
    --surface:       #ffffff;
    --surface-2:     #f8fafc;
    --surface-hover: #f1f5f9;
    --border:        #e2e8f0;
    --border-strong: #cbd5e1;
    --text:          #0f172a;
    --text-muted:    #64748b;
    --text-faint:    #94a3b8;

    --accent:        #2563eb;
    --accent-hover:  #1d4ed8;
    --accent-soft:   #eff6ff;
    --on-accent:     #ffffff;

    --danger:        #dc2626;
    --danger-soft:   #fef2f2;
    --warn:          #b45309;
    --warn-soft:     #fffbeb;
    --ok:            #15803d;
    --ok-soft:       #f0fdf4;

    --radius:    10px;
    --radius-sm: 7px;
    --radius-lg: 16px;

    --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06), 0 1px 3px rgba(15, 23, 42, .04);
    --shadow:    0 2px 6px rgba(15, 23, 42, .07), 0 8px 24px rgba(15, 23, 42, .06);
    --shadow-lg: 0 12px 40px rgba(15, 23, 42, .18);

    --header-h: 56px;
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

:root[data-theme="dark"] {
    color-scheme: dark;

    --bg:            #0f1420;
    --bg-sunken:     #0b0f18;
    --surface:       #171d2b;
    --surface-2:     #1c2333;
    --surface-hover: #212a3c;
    --border:        #2a3446;
    --border-strong: #3b4759;
    --text:          #e8edf5;
    --text-muted:    #9aa8bd;
    --text-faint:    #6b7a91;

    --accent:        #4d84f7;
    --accent-hover:  #6d9bff;
    --accent-soft:   #17233c;
    --on-accent:     #0b1220;

    --danger:        #f87171;
    --danger-soft:   #2a1a1c;
    --warn:          #fbbf24;
    --warn-soft:     #2a2318;
    --ok:            #4ade80;
    --ok-soft:       #142418;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow:    0 2px 8px rgba(0, 0, 0, .35);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, .55);
}

/* 2. Grundlagen ------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }

html, body { height: 100%; }

body {
    margin: 0;
    font-family: var(--font);
    font-size: 14.5px;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

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

h1, h2, h3, h4 { margin: 0; font-weight: 600; line-height: 1.25; }
h1 { font-size: 20px; }
h2 { font-size: 17px; }
h3 { font-size: 15px; }

p { margin: 0 0 10px; }
p:last-child { margin-bottom: 0; }

code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: .9em;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 1px 4px;
}

.icon { width: 18px; height: 18px; flex: none; }
.icon-sm { width: 15px; height: 15px; }

.muted { color: var(--text-muted); }
.faint { color: var(--text-faint); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.right { margin-left: auto; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.row { display: flex; align-items: center; gap: 8px; }
.row-wrap { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.hidden { display: none !important; }

/* 3. Bausteine ------------------------------------------------------------- */

/* Kopfzeile */
.topbar {
    position: sticky; top: 0; z-index: 40;
    display: flex; align-items: center; gap: 14px;
    height: var(--header-h);
    padding: 0 16px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}
.brand {
    display: flex; align-items: center; gap: 9px;
    font-weight: 650; font-size: 15.5px; color: var(--text);
}
.brand:hover { text-decoration: none; }
.brand-mark {
    width: 26px; height: 26px; border-radius: 7px;
    background: linear-gradient(135deg, var(--accent), #7c3aed);
    display: grid; place-items: center; color: #fff;
}
.brand-mark .icon { width: 15px; height: 15px; }

.topnav { display: flex; align-items: center; gap: 2px; }
.topnav a {
    display: flex; align-items: center; gap: 7px;
    padding: 7px 11px; border-radius: var(--radius-sm);
    color: var(--text-muted); font-weight: 500;
}
.topnav a:hover { background: var(--surface-hover); color: var(--text); text-decoration: none; }
.topnav a.active { background: var(--accent-soft); color: var(--accent); }

.searchbox { position: relative; margin-left: auto; }
.searchbox .icon { position: absolute; left: 9px; top: 50%; transform: translateY(-50%); color: var(--text-faint); }
/* Der Typ-Selektor muss mit angegeben werden: die allgemeine Formularregel weiter unten
   hat sonst dieselbe Spezifitaet, steht spaeter und wuerde den Platz fuer das Lupensymbol
   wieder ueberschreiben. */
.searchbox input[type="search"] {
    width: 210px; padding: 7px 10px 7px 34px;
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    background: var(--surface-2); color: var(--text); font-size: 13.5px;
}
.searchbox input[type="search"]:focus { width: 280px; }

/* Buttons */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    padding: 8px 13px;
    font: inherit; font-size: 13.5px; font-weight: 550;
    color: var(--text); background: var(--surface);
    border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
    cursor: pointer; white-space: nowrap;
    transition: background .12s, border-color .12s, transform .06s;
}
.btn:hover { background: var(--surface-hover); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--surface-hover); color: var(--text); }
.btn-danger { color: var(--danger); border-color: var(--border-strong); }
.btn-danger:hover { background: var(--danger-soft); border-color: var(--danger); }
.btn-sm { padding: 5px 9px; font-size: 12.5px; }
.btn-icon { padding: 7px; }
.btn-block { width: 100%; }

/* Umschalter Hell/Dunkel: immer nur das Symbol des jeweils anderen Modus zeigen */
:root[data-theme="dark"] .theme-dark { display: none; }
:root:not([data-theme="dark"]) .theme-light { display: none; }

/* Formulare */
label { font-size: 13px; font-weight: 550; color: var(--text-muted); }
input[type="text"], input[type="password"], input[type="email"], input[type="date"],
input[type="number"], input[type="time"], input[type="search"], select, textarea {
    width: 100%; padding: 8px 10px;
    font: inherit; font-size: 14px; color: var(--text);
    background: var(--surface); border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
}
textarea { resize: vertical; min-height: 80px; line-height: 1.5; }
input:focus, select:focus, textarea:focus {
    outline: none; border-color: var(--accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}
.field { display: flex; flex-direction: column; gap: 5px; }
.field-row { display: flex; gap: 12px; flex-wrap: wrap; }
.field-row > .field { flex: 1 1 160px; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); width: 15px; height: 15px; }
.check { display: inline-flex; align-items: center; gap: 7px; font-size: 13.5px; color: var(--text); font-weight: 450; cursor: pointer; }

/* Flächen */
.panel {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.panel-pad { padding: 16px; }
.panel-head {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 16px; border-bottom: 1px solid var(--border);
}
.page { max-width: 1400px; margin: 0 auto; padding: 18px 16px 60px; }
.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }

/* Abzeichen und Chips */
.badge {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 2px 7px; border-radius: 999px;
    font-size: 11.5px; font-weight: 600; line-height: 1.6;
    background: var(--surface-2); color: var(--text-muted); border: 1px solid var(--border);
}
.badge .icon { width: 12px; height: 12px; }
.due-overdue { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
.due-today   { background: var(--warn-soft); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 35%, transparent); }
.due-soon    { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.due-future  { background: var(--surface-2); color: var(--text-muted); }
.due-done    { background: var(--ok-soft); color: var(--ok); border-color: transparent; }

.chip {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 2px 8px; border-radius: 999px;
    font-size: 11.5px; font-weight: 600;
    border: 1px solid transparent;
}
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }

.avatar {
    width: 24px; height: 24px; border-radius: 50%;
    display: inline-grid; place-items: center; flex: none;
    font-size: 10.5px; font-weight: 700; letter-spacing: .2px;
    color: #fff; user-select: none;
}
.avatar-lg { width: 32px; height: 32px; font-size: 12.5px; }
.avatar-sm { width: 20px; height: 20px; font-size: 9.5px; }

.prio { width: 3px; border-radius: 2px; align-self: stretch; }
.prio-urgent { background: var(--danger); }
.prio-high   { background: #f59e0b; }
.prio-normal { background: transparent; }
.prio-low    { background: transparent; }

/* Meldungen */
.notice {
    display: flex; gap: 10px; align-items: flex-start;
    padding: 11px 14px; border-radius: var(--radius);
    background: var(--surface-2); border: 1px solid var(--border); font-size: 13.5px;
}
.notice-warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 30%, transparent); color: var(--warn); }
.notice-error { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 30%, transparent); color: var(--danger); }

.empty {
    display: flex; flex-direction: column; align-items: center; gap: 8px;
    padding: 44px 20px; text-align: center; color: var(--text-muted);
}
.empty .icon { width: 30px; height: 30px; color: var(--text-faint); }

/* Hinweisfenster (Toast) */
#toasts {
    position: fixed; right: 16px; bottom: 16px; z-index: 200;
    display: flex; flex-direction: column; gap: 8px; max-width: min(400px, calc(100vw - 32px));
}
.toast {
    display: flex; align-items: flex-start; gap: 9px;
    padding: 11px 14px; border-radius: var(--radius);
    background: var(--surface); border: 1px solid var(--border);
    box-shadow: var(--shadow); font-size: 13.5px;
    animation: toast-in .18s ease-out;
}
.toast-error { border-color: color-mix(in srgb, var(--danger) 45%, transparent); color: var(--danger); }
.toast-ok { border-color: color-mix(in srgb, var(--ok) 45%, transparent); }
.toast-warn { border-color: color-mix(in srgb, var(--warn) 45%, transparent); color: var(--warn); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* Menü */
.menu-wrap { position: relative; }
.menu {
    position: absolute; right: 0; top: calc(100% + 5px); z-index: 60;
    min-width: 200px; padding: 5px;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow);
}
.menu button, .menu a {
    display: flex; align-items: center; gap: 9px; width: 100%;
    padding: 8px 10px; border: 0; border-radius: var(--radius-sm);
    background: none; color: var(--text); font: inherit; font-size: 13.5px;
    text-align: left; cursor: pointer;
}
.menu button:hover, .menu a:hover { background: var(--surface-hover); text-decoration: none; }
.menu-sep { height: 1px; background: var(--border); margin: 5px 0; }
.menu-title { padding: 7px 10px 4px; font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--text-faint); }

/* Modal */
.modal-backdrop {
    position: fixed; inset: 0; z-index: 100;
    background: rgba(15, 23, 42, .45); backdrop-filter: blur(2px);
    display: flex; align-items: flex-start; justify-content: center;
    padding: 40px 16px; overflow-y: auto;
}
.modal {
    width: 100%; max-width: 880px;
    background: var(--surface); border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg); overflow: hidden;
    animation: modal-in .16s ease-out;
}
.modal-sm { max-width: 460px; }
@keyframes modal-in { from { opacity: 0; transform: translateY(-8px) scale(.99); } to { opacity: 1; transform: none; } }

/* 4. Ansichten ------------------------------------------------------------- */

/* Projektkopf und Ansichtswechsel */
.project-head {
    display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
    padding: 14px 16px 0;
    max-width: 1600px; margin: 0 auto;
}
.project-title { display: flex; align-items: center; gap: 10px; font-size: 19px; font-weight: 650; }
.project-swatch { width: 12px; height: 22px; border-radius: 4px; flex: none; }
.viewtabs { display: flex; gap: 2px; background: var(--bg-sunken); padding: 3px; border-radius: var(--radius-sm); }
.viewtabs a {
    display: flex; align-items: center; gap: 6px;
    padding: 6px 11px; border-radius: 5px;
    font-size: 13px; font-weight: 550; color: var(--text-muted);
}
.viewtabs a:hover { color: var(--text); text-decoration: none; }
.viewtabs a.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

/* Filterleiste */
.filterbar {
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
    padding: 12px 16px; max-width: 1600px; margin: 0 auto;
}
.filterbar input[type="search"], .filterbar select { width: auto; min-width: 130px; padding: 6px 9px; font-size: 13px; }
.filterbar .searchfield { position: relative; }
.filterbar .searchfield input { padding-left: 30px; min-width: 190px; }
.filterbar .searchfield .icon { position: absolute; left: 8px; top: 50%; transform: translateY(-50%); color: var(--text-faint); }

/* Leiste am unteren Rand - nur auf dem Telefon, siehe Mobilblock weiter unten.
   Am Rechner bleibt die Navigation oben, dort ist die Maus ohnehin überall schnell. */
.tabbar { display: none; }

/* Board */
.board {
    display: flex; gap: 12px; align-items: flex-start;
    padding: 4px 16px 24px;
    overflow-x: auto; min-height: calc(100vh - var(--header-h) - 120px);
    scroll-padding: 16px;
}
.column {
    flex: 0 0 288px; width: 288px;
    display: flex; flex-direction: column; max-height: calc(100vh - var(--header-h) - 118px);
    background: var(--bg-sunken); border-radius: var(--radius);
    border: 1px solid transparent;
}
.column.over { border-color: var(--accent); background: var(--accent-soft); }
.column-head {
    display: flex; align-items: center; gap: 8px;
    padding: 10px 11px 8px;
}
.column-name { font-weight: 650; font-size: 13.5px; }
.column-count {
    font-size: 11.5px; font-weight: 650; color: var(--text-muted);
    background: var(--surface); border-radius: 999px; padding: 1px 7px;
}
.column-count.over-limit { background: var(--danger-soft); color: var(--danger); }
.column-body {
    display: flex; flex-direction: column; gap: 8px;
    padding: 0 8px 8px; overflow-y: auto; flex: 1; min-height: 24px;
}
.column-foot { padding: 0 8px 9px; }
.column-add { width: 100%; justify-content: flex-start; color: var(--text-muted); border-style: dashed; background: transparent; }
.column-add:hover { background: var(--surface); color: var(--text); }

/* Aufgabenkarte */
.card {
    display: flex; gap: 9px;
    padding: 10px 11px;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-sm); box-shadow: var(--shadow-sm);
    cursor: pointer; position: relative;
}
.card:hover { border-color: var(--border-strong); }
.card.dragging { opacity: .45; }
.card-ghost { opacity: .35; }
.card-chosen { box-shadow: var(--shadow); }
.card-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.card-title { font-size: 13.8px; font-weight: 520; line-height: 1.35; word-break: break-word; }
.card-done .card-title { text-decoration: line-through; color: var(--text-muted); }
.card-labels { display: flex; gap: 4px; flex-wrap: wrap; }
.card-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 11.5px; color: var(--text-muted); }
.card-meta .icon { width: 13px; height: 13px; }
.card-meta .with-icon { display: inline-flex; align-items: center; gap: 3px; }
.card-ref { font-size: 11px; font-weight: 650; color: var(--text-faint); letter-spacing: .3px; }
.card-blocked { color: var(--danger); }

/* Liegt lange ohne Regung - ein leiser Hinweis, keine Warnung: die Aufgabe ist
   nicht verspaetet, sie ruht nur laenger als vereinbart. */
/* Aufwandssumme im Spaltenkopf - zurückhaltender als die Anzahl, die Anzahl bleibt
   die Hauptzahl. */
.column-hours { font-size: 11.5px; font-weight: 600; color: var(--text-faint); }

.card-stale { color: var(--text-muted); }
/* Zurückgestellt: die Aufgabe ruht mit Absicht, das darf man sehen. */
.card-snoozed { color: var(--accent); opacity: .85; }
.card-done .card-snoozed { display: none; }
.tile-stale .tile-value { color: var(--text-muted); }
.card-project-bar { position: absolute; left: 0; top: 0; bottom: 0; width: 3px; border-radius: 3px 0 0 3px; }

/* Dashboard */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(148px, 1fr)); gap: 10px; margin-bottom: 18px; }
.tile {
    display: flex; flex-direction: column; gap: 3px;
    padding: 13px 15px; border-radius: var(--radius);
    background: var(--surface); border: 1px solid var(--border);
    box-shadow: var(--shadow-sm); color: var(--text);
}
.tile:hover { text-decoration: none; border-color: var(--border-strong); }
.tile.active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.tile-value { font-size: 26px; font-weight: 680; line-height: 1.1; }
.tile-label { font-size: 12.5px; color: var(--text-muted); font-weight: 550; }
.tile-overdue .tile-value { color: var(--danger); }
.tile-today .tile-value { color: var(--warn); }

.timeline { display: flex; gap: 4px; overflow-x: auto; padding-bottom: 4px; }
.timeline-day {
    flex: 1 0 62px; text-align: center; padding: 8px 4px;
    border-radius: var(--radius-sm); background: var(--surface-2);
    border: 1px solid var(--border); color: var(--text);
}
.timeline-day:hover { text-decoration: none; border-color: var(--border-strong); }
.timeline-day.is-today { border-color: var(--accent); }
.timeline-day.is-weekend { background: var(--bg-sunken); }
.timeline-day .wd { font-size: 11px; color: var(--text-faint); }
.timeline-day .dt { font-size: 12.5px; font-weight: 600; }
.timeline-day .n { margin-top: 4px; font-size: 12px; font-weight: 700; color: var(--accent); }
.timeline-day .n.zero { color: var(--text-faint); font-weight: 500; }

.group-title {
    display: flex; align-items: center; gap: 8px;
    margin: 20px 0 8px; font-size: 13px; font-weight: 700;
    text-transform: uppercase; letter-spacing: .6px; color: var(--text-muted);
}

/* Aufgabenzeile (Dashboard, Liste, Suche) */
.tasklist { display: flex; flex-direction: column; gap: 1px; background: var(--border); border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); }
.taskrow {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 12px; background: var(--surface); color: var(--text);
    cursor: pointer; position: relative;
}
.taskrow:hover { background: var(--surface-hover); text-decoration: none; }
.taskrow-bar { width: 3px; height: 26px; border-radius: 3px; flex: none; }
.taskrow-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.taskrow-done .taskrow-title { text-decoration: line-through; color: var(--text-muted); }
.taskrow-meta { display: flex; align-items: center; gap: 8px; flex: none; }

/* Tabelle */
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th {
    text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .5px;
    color: var(--text-faint); font-weight: 700; padding: 9px 10px;
    border-bottom: 1px solid var(--border); white-space: nowrap; background: var(--surface-2);
}
.table td { padding: 9px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:hover td { background: var(--surface-hover); }
.table tr.is-selected td { background: var(--accent-soft); }
.table .cell-title { font-weight: 520; cursor: pointer; }
/* min-width:0 ist noetig, weil der Rahmen in einer Flex-Spalte sitzt: Ohne das gilt
   min-width:auto, der Rahmen waechst auf die Breite der Tabelle und schiebt die ganze
   Seite auf. Das Eigene-Scrollen greift dann nie. */
.table-wrap { overflow-x: auto; min-width: 0; }

.bulkbar {
    position: sticky; bottom: 0; z-index: 20;
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
    padding: 10px 14px; margin-top: 10px;
    background: var(--surface); border: 1px solid var(--border-strong);
    border-radius: var(--radius); box-shadow: var(--shadow);
}
.bulkbar select, .bulkbar input { width: auto; min-width: 130px; padding: 6px 9px; font-size: 13px; }

/* Kalender */
.calendar { width: 100%; border-collapse: collapse; table-layout: fixed; }
.calendar th {
    padding: 7px; font-size: 11.5px; text-transform: uppercase; letter-spacing: .5px;
    color: var(--text-faint); font-weight: 700; text-align: left;
}
.calendar td {
    height: 116px; vertical-align: top; padding: 5px;
    border: 1px solid var(--border); background: var(--surface);
}
.calendar td.out-month { background: var(--surface-2); }
.calendar td.is-today { box-shadow: inset 0 0 0 2px var(--accent); }
.calendar td.is-weekend { background: var(--bg-sunken); }
.calendar td.over { background: var(--accent-soft); }
.cal-daynum { font-size: 12px; font-weight: 650; color: var(--text-muted); margin-bottom: 4px; }
.cal-items { display: flex; flex-direction: column; gap: 3px; min-height: 20px; }
.cal-item {
    display: flex; align-items: center; gap: 5px;
    padding: 3px 6px; border-radius: 5px; font-size: 11.5px;
    background: var(--surface-2); border: 1px solid var(--border);
    color: var(--text); cursor: pointer;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cal-item:hover { text-decoration: none; border-color: var(--border-strong); }

/* Detailansicht */
.detail { display: grid; grid-template-columns: 1fr 296px; }
.detail-main { padding: 18px 20px 24px; min-width: 0; }
.detail-side {
    padding: 18px 18px 24px; background: var(--surface-2);
    border-left: 1px solid var(--border); display: flex; flex-direction: column; gap: 14px;
}
.detail-head {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 14px 18px; border-bottom: 1px solid var(--border);
}
.detail-title {
    font-size: 18px; font-weight: 620; line-height: 1.3;
    border: 1px solid transparent; border-radius: var(--radius-sm);
    padding: 3px 6px; margin: -3px -6px; width: 100%;
}
.detail-title:hover { background: var(--surface-hover); }
.detail-title:focus { background: var(--surface); border-color: var(--accent); outline: none; }
.detail-section { margin-bottom: 22px; }
.detail-section > h3 {
    display: flex; align-items: center; gap: 7px; margin-bottom: 9px;
    font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--text-muted);
}
.editable {
    border: 1px solid transparent; border-radius: var(--radius-sm);
    padding: 8px 10px; margin: -8px -10px; cursor: text; min-height: 40px;
}
.editable:hover { background: var(--surface-hover); }

.linked-task {
    display: flex; align-items: center; gap: 8px;
    padding: 7px 9px; border: 1px solid var(--border); border-radius: var(--radius-sm);
    background: var(--surface); font-size: 13px;
}
.linked-task.is-open { border-left: 3px solid var(--danger); }
.linked-task.is-done { opacity: .65; }

.filelist { display: flex; flex-direction: column; gap: 6px; }
.file {
    display: flex; align-items: center; gap: 9px;
    padding: 7px 9px; border: 1px solid var(--border); border-radius: var(--radius-sm);
    background: var(--surface); font-size: 13px;
}
.file-thumb { width: 34px; height: 34px; border-radius: 5px; object-fit: cover; background: var(--surface-2); flex: none; }
/* display:block ist hier nicht Kosmetik: Ein <label> ist von Haus aus inline und
   zerfällt mit Innenabstand und Rahmen in mehrere Zeilenkästen - der gestrichelte
   Rahmen wurde dann dreimal gezeichnet und wirkte verschoben. */
.dropzone {
    display: block;
    border: 1.5px dashed var(--border-strong); border-radius: var(--radius);
    padding: 16px; text-align: center; color: var(--text-muted); font-size: 13px;
    cursor: pointer;
}
.dropzone.over { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }

.comment { display: flex; gap: 9px; padding: 9px 0; border-bottom: 1px solid var(--border); }
.comment:last-child { border-bottom: 0; }
.comment-body { flex: 1; min-width: 0; }
.comment-body .mention { background: var(--accent-soft); color: var(--accent); border-radius: 4px; padding: 0 3px; font-weight: 600; }

.activity-item { display: flex; gap: 8px; padding: 6px 0; font-size: 12.5px; color: var(--text-muted); }
.checkitem { display: flex; align-items: center; gap: 8px; padding: 4px 0; }
.checkitem.done .title { text-decoration: line-through; color: var(--text-muted); }
.checkitem input { flex: none; }
.checkitem .title { flex: 1; }

.progress { height: 5px; border-radius: 3px; background: var(--border); overflow: hidden; }
.progress > div { height: 100%; background: var(--ok); }

/* Assistent */
.wizard-step { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--text-faint); font-weight: 550; }
.wizard-step .n {
    width: 21px; height: 21px; border-radius: 50%; display: grid; place-items: center;
    background: var(--bg-sunken); color: var(--text-muted); font-size: 11.5px; font-weight: 700;
}
.wizard-step.active { color: var(--text); }
.wizard-step.active .n { background: var(--accent); color: var(--on-accent); }

.template-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(232px, 1fr)); gap: 10px; }
.template {
    display: flex; flex-direction: column; gap: 8px; text-align: left;
    padding: 13px; border: 1.5px solid var(--border); border-radius: var(--radius);
    background: var(--surface); cursor: pointer; color: var(--text); font: inherit;
}
.template:hover { border-color: var(--border-strong); }
.template.selected { border-color: var(--accent); background: var(--accent-soft); }
.template-name { font-weight: 640; font-size: 14px; }
.template-cols { display: flex; gap: 3px; flex-wrap: wrap; }
.template-col { font-size: 10.5px; padding: 2px 6px; border-radius: 4px; background: var(--bg-sunken); color: var(--text-muted); font-weight: 600; }

.swatches { display: flex; gap: 6px; flex-wrap: wrap; }
.swatch {
    width: 27px; height: 27px; border-radius: 50%; border: 2px solid transparent;
    cursor: pointer; padding: 0; position: relative;
}
.swatch.selected { border-color: var(--text); box-shadow: 0 0 0 2px var(--surface) inset; }

.sortable-list { display: flex; flex-direction: column; gap: 6px; }
.sortable-row {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 10px; background: var(--surface);
    border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.sortable-row .handle { cursor: grab; color: var(--text-faint); display: flex; }
.sortable-row input[type="text"],
.sortable-row input[type="email"] { flex: 1; min-width: 90px; }
.sortable-row input[type="number"] { width: 88px; flex: none; }

/* Login / Profilauswahl */
.center-page {
    min-height: 100vh; display: grid; place-items: center; padding: 24px;
    background: radial-gradient(1000px 500px at 50% -10%, color-mix(in srgb, var(--accent) 12%, var(--bg)), var(--bg));
}
.center-card { width: 100%; max-width: 400px; }
.center-card.wide { max-width: 620px; }
.people-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 9px; }
.person-btn {
    display: flex; align-items: center; gap: 9px;
    padding: 11px; border: 1px solid var(--border); border-radius: var(--radius);
    background: var(--surface); cursor: pointer; font: inherit; color: var(--text); text-align: left;
}
.person-btn:hover { border-color: var(--accent); background: var(--accent-soft); }

/* Projektübersicht */
.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(252px, 1fr)); gap: 12px; }
.project-card {
    display: flex; flex-direction: column; gap: 9px; padding: 15px;
    border-radius: var(--radius); background: var(--surface);
    border: 1px solid var(--border); box-shadow: var(--shadow-sm); color: var(--text);
    border-top: 3px solid var(--project-color, var(--accent));
}
.project-card:hover { text-decoration: none; box-shadow: var(--shadow); }

/* Einstellungen */
.settings-grid { display: grid; grid-template-columns: 210px 1fr; gap: 20px; align-items: start; }
.settings-nav { display: flex; flex-direction: column; gap: 2px; position: sticky; top: calc(var(--header-h) + 16px); }
.settings-nav a { padding: 8px 11px; border-radius: var(--radius-sm); color: var(--text-muted); font-size: 13.5px; font-weight: 550; }
.settings-nav a:hover { background: var(--surface-hover); color: var(--text); text-decoration: none; }

/* Kleine Bildschirme */
@media (max-width: 900px) {
    /* --- Aufgabenfenster: Angaben nach oben --------------------------------
       Sobald die zwei Spalten untereinander rutschen, landet die Seitenspalte
       hinter Beschreibung, Checkliste, Abhängigkeiten, Dateien und Kommentaren.
       Gemessen auf 390x844: "Zuständig" lag dann bei 1297 px, "Fällig am" bei
       1377 - anderthalb Bildschirme Wischen für die beiden Felder, die man am
       häufigsten ändert. Deshalb hier umgekehrt: erst die Angaben, dann der
       Inhalt. Am Rechner bleibt alles nebeneinander wie gehabt. */
    /* --- Aufgabenfenster: die wichtigsten Angaben nach oben ------------------
       Untereinander gestapelt landete die Seitenspalte hinter Beschreibung,
       Checkliste, Abhängigkeiten, Dateien und Kommentaren. Gemessen auf 390x844:
       "Zuständig" bei 1297 px, "Fällig am" bei 1377 - anderthalb Bildschirme
       Wischen für die zwei Felder, die man am häufigsten ändert.

       Nach oben wandert aber NUR .detail-kurz (Spalte, Zuständig, Fällig). Die
       ganze Seitenspalte hochzuziehen wäre die Überkorrektur - dann stünden beim
       Öffnen neunhundert Pixel Formular vor der Beschreibung.

       display:contents löst die Seitenspalte als Kasten auf, sodass ihre Kinder
       direkte Geschwister von .detail-main werden und sich einzeln einordnen
       lassen. Ihr Innenabstand geht dabei verloren und wird unten neu gesetzt. */
    .detail { grid-template-columns: 1fr; display: flex; flex-direction: column; }
    .detail-side { display: contents; }
    .detail-side > * { padding-left: 20px; padding-right: 20px; }
    .detail-side > *:last-child { padding-bottom: 20px; }

    .detail-kurz {
        order: -1;
        display: flex; flex-direction: column; gap: 12px;
        padding: 14px 20px 16px;
        border-bottom: 1px solid var(--border);
        background: var(--surface-2);
    }
    .settings-grid { grid-template-columns: 1fr; }
    .settings-nav { position: static; flex-direction: row; overflow-x: auto; }
    /* Ohne min-width:0 richtet sich die Spalte nach der Summe aller Verweise in der
       Navigation - die Seite wird dann doppelt so breit wie das Gerät. */
    .settings-grid > *, .settings-nav { min-width: 0; }
}

@media (max-width: 680px) {
    .searchbox { display: none; }

    /* --- Navigation nach unten, in Reichweite des Daumens -------------------
       Oben bleiben nur Name, Farbschema und Profil; die Wege liegen unten.
       env(safe-area-inset-bottom) hält die Leiste über dem Balken des iPhone. */
    .topnav { display: none; }
    .tabbar {
        display: flex; position: fixed; z-index: 60;
        left: 0; right: 0; bottom: 0;
        align-items: center; justify-content: space-around;
        background: var(--surface); border-top: 1px solid var(--border);
        padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
        -webkit-tap-highlight-color: transparent; user-select: none;
    }
    .tabbar a, .tabbar button {
        display: flex; flex-direction: column; align-items: center; gap: 3px;
        flex: 1; min-height: 48px; padding: 4px 2px;
        border: 0; background: none; cursor: pointer;
        color: var(--text-muted); font-size: 10.5px; font-weight: 550;
        text-decoration: none;
    }
    .tabbar a.active { color: var(--accent); }
    .tabbar .icon { width: 22px; height: 22px; }
    .tabbar-plus {
        flex: 0 0 auto !important; min-width: 52px;
    }
    .tabbar-plus .icon {
        width: 44px; height: 44px; padding: 10px; border-radius: 999px;
        background: var(--accent); color: var(--on-accent);
        box-shadow: 0 2px 10px color-mix(in srgb, var(--accent) 45%, transparent);
    }

    /* Platz schaffen, damit die Leiste nichts verdeckt. */
    body { padding-bottom: calc(60px + env(safe-area-inset-bottom)); }
    .board { min-height: calc(100vh - var(--header-h) - 180px); }
    .bulkbar { bottom: calc(66px + env(safe-area-inset-bottom)); }
    #toasts { bottom: calc(70px + env(safe-area-inset-bottom)); }

    /* Größere Ziele für den Finger - 44px ist das gängige Mindestmaß. */
    .btn { min-height: 40px; }
    .btn-sm { min-height: 36px; }
    .btn-icon { min-width: 40px; }
    .menu a, .menu button { min-height: 44px; }

    .page { padding: 14px 12px 48px; }
    .board { padding: 4px 12px 20px; }
    .column { flex-basis: 82vw; width: 82vw; }
    .modal-backdrop { padding: 0; }
    .modal { max-width: none; min-height: 100vh; border-radius: 0; }
    .tile-value { font-size: 22px; }

    /* Auf dem Handy ist fuer Titel und Merkmale nebeneinander kein Platz - der Titel
       wurde nach wenigen Zeichen abgeschnitten. Deshalb zweizeilig: oben der Titel,
       darunter Termin, Sanduhr, Etiketten und die Zustaendigkeit. */
    .taskrow { flex-wrap: wrap; row-gap: 4px; }
    .taskrow-title { white-space: normal; }
    .taskrow-meta { flex: 1 0 100%; justify-content: flex-end; }

    .calendar td { height: 78px; }
    .cal-item { font-size: 10.5px; }
}

@media print {
    /* Alles, was zur Bedienung gehört, hat auf Papier nichts verloren. */
    .topbar, .filterbar, .viewtabs, .btn, .project-head, .nicht-drucken,
    #toasts, .hint-tip, .erste-schritte { display: none !important; }
    .page { padding: 0 !important; max-width: none !important; }
    body { background: #fff; }
    a[href] { text-decoration: none; color: #000; }
}

/* ==========================================================================
   Erklärungen, Hilfe-Seite und Tastaturkürzel
   ========================================================================== */

/* Kleines "?" neben Bedienelementen */
.hint {
    display: inline-grid; place-items: center;
    width: 15px; height: 15px; margin-left: 1px;
    border-radius: 50%; flex: none;
    font-size: 10.5px; font-weight: 700; line-height: 1;
    color: var(--text-muted); background: var(--bg-sunken);
    border: 1px solid var(--border); cursor: help;
    position: relative; vertical-align: middle;
}
.hint:hover, .hint:focus-visible { background: var(--accent); border-color: var(--accent); color: var(--on-accent); outline: none; }

/* Der Sprechblasentext haengt an <body>, damit ihn kein Container abschneidet
   und er sich am Bildschirmrand nicht verabschiedet (siehe assets/js/ui.js). */
.hint-tip {
    position: fixed; z-index: 300; max-width: 280px;
    padding: 8px 11px; border-radius: var(--radius-sm);
    background: var(--text); color: var(--surface);
    font-size: 12.5px; font-weight: 450; line-height: 1.45;
    box-shadow: var(--shadow); pointer-events: none;
}
.hint-tip[hidden] { display: none; }

/* Hilfe-Seite */
.help-grid { display: grid; grid-template-columns: 220px 1fr; gap: 24px; align-items: start; }
.help-nav { position: sticky; top: calc(var(--header-h) + 16px); display: flex; flex-direction: column; gap: 2px; }
.help-nav a { padding: 7px 11px; border-radius: var(--radius-sm); color: var(--text-muted); font-size: 13.5px; font-weight: 550; }
.help-nav a:hover { background: var(--surface-hover); color: var(--text); text-decoration: none; }

.help-section { scroll-margin-top: calc(var(--header-h) + 16px); }
.help-section h2 { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.help-section p, .help-section li { color: var(--text); }
.help-section ul { margin: 0 0 10px; padding-left: 20px; }
.help-section li { margin-bottom: 5px; }

.faq { border-bottom: 1px solid var(--border); }
.faq:last-child { border-bottom: 0; }
.faq summary {
    padding: 11px 2px; cursor: pointer; font-weight: 550;
    list-style: none; display: flex; align-items: center; gap: 9px;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::before { content: '+'; color: var(--text-faint); font-weight: 700; width: 12px; }
.faq[open] summary::before { content: '–'; }
.faq .answer { padding: 0 2px 13px 21px; color: var(--text-muted); font-size: 13.8px; }

/* Tastaturkürzel */
.keys { display: grid; grid-template-columns: auto 1fr; gap: 9px 14px; align-items: center; }
kbd {
    display: inline-block; min-width: 22px; padding: 2px 6px;
    font-family: var(--font); font-size: 12px; font-weight: 600; text-align: center;
    color: var(--text); background: var(--surface-2);
    border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 5px;
}

@media (max-width: 900px) {
    .help-grid { grid-template-columns: 1fr; }
    .help-nav { position: static; flex-direction: row; overflow-x: auto; }
    .help-grid > *, .help-nav { min-width: 0; }
}

/* ==========================================================================
   Bahnen (Swimlanes) - das Board zusätzlich waagrecht gruppiert
   ========================================================================== */

.board-lanes {
    --col-w: 288px;
    display: flex; flex-direction: column; gap: 14px;
    padding: 4px 16px 28px;
    overflow-x: auto;
    min-height: calc(100vh - var(--header-h) - 120px);
}

.lanes-head, .lane-row { display: flex; gap: 12px; min-width: max-content; }

.lane-colhead {
    flex: 0 0 var(--col-w); width: var(--col-w);
    display: flex; align-items: center; gap: 8px;
    padding: 2px 11px 0;
}

.lane { display: flex; flex-direction: column; gap: 6px; }

.lane-head {
    position: sticky; left: 0;
    display: flex; align-items: center; gap: 8px;
    width: fit-content; max-width: 100%;
    padding: 3px 10px 3px 4px;
    background: var(--bg); border-radius: 999px;
}
.lane-name { font-weight: 650; font-size: 13.5px; }
.lane-count {
    font-size: 11.5px; font-weight: 650; color: var(--text-muted);
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 999px; padding: 0 7px;
}
.lane-toggle {
    display: grid; place-items: center;
    width: 22px; height: 22px; padding: 0;
    border: 0; border-radius: 5px; background: none;
    color: var(--text-faint); cursor: pointer;
    transition: transform .15s;
}
.lane-toggle:hover { background: var(--surface-hover); color: var(--text); }
.lane.collapsed .lane-toggle { transform: rotate(-90deg); }
.lane.collapsed .lane-row { display: none; }
.lane.collapsed .lane-head { opacity: .7; }

.lane-cell {
    flex: 0 0 var(--col-w); width: var(--col-w);
    padding: 8px;
    background: var(--bg-sunken); border: 1px solid transparent; border-radius: var(--radius);
}
.lane-cell .column-body {
    max-height: none; min-height: 44px;
    padding: 0; overflow: visible;
}
.lane-cell:has(.card:hover) { border-color: var(--border); }

@media (max-width: 680px) {
    .board-lanes { --col-w: 82vw; padding: 4px 12px 20px; }
}

/* Team statt Person: das Kürzel braucht mehr Platz als zwei Initialen */
.avatar-team {
    width: auto; min-width: 24px; padding: 0 6px;
    border-radius: 6px; font-size: 9.5px; letter-spacing: .3px;
}
.avatar-sm.avatar-team { min-width: 20px; padding: 0 5px; font-size: 9px; }

/* Vorschläge beim @-Zeichen im Kommentarfeld */
.mention-field { position: relative; }
.mention-field .menu {
    left: 0; right: auto; top: auto; bottom: calc(100% + 4px);
    width: 100%; max-height: 240px; overflow-y: auto;
}
.mention-field .menu button.is-active { background: var(--accent-soft); color: var(--accent); }

/* Hinweis mit Knopf, z. B. „Rückgängig“ */
.toast { align-items: center; }
.toast .btn { flex: none; padding: 4px 9px; font-size: 12.5px; }

/* Schnellerfassung */
.quick-preview { display: flex; flex-wrap: wrap; gap: 5px; }
.quick-preview .badge { font-weight: 550; }
.quick-hint { line-height: 1.6; }
.quick-hint strong { color: var(--text); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

/* „Neu seit deinem letzten Besuch“ */
.new-dot {
    display: inline-block; width: 7px; height: 7px; flex: none;
    border-radius: 50%; background: var(--accent);
    margin-right: 5px; vertical-align: 1px;
}

/* Ausgewählter Tag in der Zwei-Wochen-Vorschau */
.timeline-day.is-selected { border-color: var(--accent); background: var(--accent-soft); }
.timeline-day.is-selected .dt { color: var(--accent); }

/* Zuständig, aber stillgelegt: gestrichelter Rand statt voller Farbfläche */
.avatar-inactive {
    background: transparent !important;
    color: var(--text-muted);
    border: 1px dashed var(--border-strong);
    opacity: .85;
}

/* Version & System */
.sysinfo { display: flex; flex-direction: column; gap: 1px; background: var(--border);
           border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.sysrow { display: grid; grid-template-columns: 10px 190px 190px 1fr; gap: 10px;
          align-items: baseline; padding: 8px 12px; background: var(--surface); font-size: 13.5px; }
.sysdot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-faint); align-self: center; }
.sys-ok .sysdot      { background: var(--ok); }
.sys-warnung .sysdot { background: var(--warn); }
.sys-fehler .sysdot  { background: var(--danger); }
.systitel { font-weight: 550; }
.syswert  { color: var(--text-muted); }
.sys-fehler .syswert  { color: var(--danger); font-weight: 550; }
.sys-warnung .syswert { color: var(--warn); font-weight: 550; }
.syshinweis { grid-column: 4; }

@media (max-width: 760px) {
    .sysrow { grid-template-columns: 10px 1fr; }
    .syswert, .syshinweis { grid-column: 2; }
}

/* Erste Schritte ---------------------------------------------------------- */
.erste-schritte {
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    border-radius: var(--radius);
    padding: 18px 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
}
.erste-schritte-kopf { display: flex; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.erste-schritte-kopf h2 { margin: 0 0 3px; font-size: 1.05rem; }
.erste-schritte-stand { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.erste-schritte-zahl {
    font-size: .82rem; font-weight: 700; color: var(--accent);
    background: var(--accent-soft); border-radius: 20px; padding: 3px 11px;
}
.erste-schritte-balken {
    height: 4px; border-radius: 4px; background: var(--border);
    margin: 14px 0 4px; overflow: hidden;
}
.erste-schritte-balken span {
    display: block; height: 100%; background: var(--accent);
    transition: width .3s ease;
}
.erste-schritte-liste { list-style: none; margin: 0; padding: 0; }
.erste-schritte-liste li {
    display: flex; align-items: center; gap: 12px;
    padding: 11px 0; border-bottom: 1px solid var(--border);
}
.erste-schritte-liste li:last-child { border-bottom: none; padding-bottom: 0; }
.erste-schritte-haken {
    width: 22px; height: 22px; flex: none; border-radius: 50%;
    border: 2px solid var(--border-strong);
    display: grid; place-items: center; color: #fff;
}
.ist-fertig .erste-schritte-haken { background: var(--ok); border-color: var(--ok); }
.erste-schritte-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.ist-fertig .erste-schritte-text strong { color: var(--text-muted); text-decoration: line-through; }
.erste-schritte-liste .btn,
.erste-schritte-erledigt { margin-left: auto; flex: none; }
@media (max-width: 640px) {
    .erste-schritte-liste li { flex-wrap: wrap; }
    .erste-schritte-liste .btn { margin-left: 34px; }
}

/* Farbfelder dürfen in Zeilen nicht zusammenschrumpfen - der Browser zeichnet sie
   sonst als schmalen Streifen, in dem die Farbe kaum zu erkennen ist. */
input[type="color"] { flex: none; min-width: 42px; }

/* ==========================================================================
   Handy: enger Kopf, einklappbare Filterleiste, größere Tippflächen
   ========================================================================== */

/* Der Knopf erscheint nur am Handy - am Rechner ist die Leiste ohnehin sichtbar. */
.filter-toggle { display: none; }

@media (max-width: 680px) {
    /* --- Kopfzeile: alles muss nebeneinander passen ---------------------- */
    .topbar { padding-left: 8px; padding-right: 8px; gap: 4px; }
    /* Fünf Symbole müssen neben Logo, Erfassen-Knopf und Profil Platz finden. */
    .topnav { gap: 0; min-width: 0; }
    .topnav a { padding-left: 7px; padding-right: 7px; }
    /* Nur der Schriftzug weicht - das Zeichen bleibt als Weg zur Übersicht. */
    .topbar .brand > span:not(.brand-mark) { display: none; }
    /* Der Pluszeichen-Knopf sitzt jetzt unten in der Mitte - oben wäre er doppelt. */
    .topbar [data-quick-open] { display: none; }
    /* Name bzw. das Wort "Support" weichen, Kürzel und Zeichen bleiben. */
    .topbar [data-menu-toggle] .nowrap { display: none; }

    /* --- Filterleiste: nur Suche und ein Knopf, der Rest klappt auf ------ */
    .filter-toggle { display: inline-flex; }
    .filterbar { gap: 8px; }
    .filterbar > *:not(.searchfield):not(.filter-toggle) { display: none; }
    .filterbar.offen > * { display: revert; }
    .filterbar.offen > .searchfield { display: flex; }
    .filterbar.offen > label.check { display: inline-flex; }
    .filterbar .searchfield { flex: 1 1 auto; min-width: 0; }
    /* Ein gesetzter Filter soll sichtbar sein, auch wenn die Leiste zu ist. */
    .filterbar.hat-filter .filter-toggle {
        border-color: var(--accent); color: var(--accent);
    }

    /* --- Tippflächen: kleiner als 40px trifft man mit dem Daumen nicht --- */
    .btn { min-height: 40px; }
    .btn-sm { min-height: 36px; }
    .btn-icon { min-width: 40px; }
    .viewtabs a { min-height: 38px; }
    select, input[type="text"], input[type="search"], input[type="date"],
    input[type="email"], input[type="number"], input[type="password"], textarea {
        /* Unter 16px zoomt iOS beim Antippen in das Feld hinein. */
        font-size: 16px;
        min-height: 42px;
    }
    .checkitem input[type="checkbox"], label.check input[type="checkbox"] {
        width: 20px; height: 20px;
    }
    /* Der ganze Punkt ist antippbar - das Kästchen allein wäre für den Daumen zu klein. */
    .checkitem { padding-top: 7px; padding-bottom: 7px; }
    .checkitem .title { cursor: pointer; padding: 4px 0; }
}

@media (max-width: 680px) {
    /* Zeilen mit vielen Feldern - Personen, Teams, Spalten, Etiketten - passen am
       Handy nicht nebeneinander. Sie brechen um, statt die Seite breitzuziehen:
       Name und Adresse je eine volle Zeile, die Knöpfe darunter. */
    .sortable-row { flex-wrap: wrap; }
    .sortable-row input[type="text"],
    .sortable-row input[type="email"] { flex: 1 1 100%; min-width: 0; }
    .sortable-row select { flex: 1 1 auto; min-width: 0; }
    .sortable-row .btn { margin-left: 0; }

    /* Erklärtexte, die am Handy nur Platz kosten - die Hilfeseite sagt dasselbe. */
    .nur-breit { display: none; }

    /* Titel einer Aufgabe auf eine eigene, volle Zeile - neben drei Knöpfen
       blieben davon sonst zwei Wörter übrig. */
    .detail-head { flex-wrap: wrap; row-gap: 8px; }
    .detail-headline { flex: 1 1 100% !important; order: 3; }
    .detail-title { font-size: 17px; }
    .detail-head .project-swatch { height: 22px !important; }
}

@media (max-width: 680px) {
    /* --- Ansichtsumschaltung: umbrechen statt seitwärts wischen ---------------
       Sechs Reiter mit Beschriftung brauchen rund 570 px; auf dem Telefon sind
       keine 350 da. Vorher liefen sie in einem eigenen Kasten quer - man musste
       wischen, um an "Verlauf" oder "Einstellungen" zu kommen, und sah nie alle
       auf einmal. Jetzt brechen sie um: zwei Zeilen, alles sichtbar, nichts
       versteckt. Beschriftungen bleiben - Sinnbilder allein sind für Leute, die
       das Programm selten benutzen, zu wenig. */
    .page-head { flex-wrap: wrap; }
    .viewtabs {
        width: 100%;
        overflow-x: visible;
        flex-wrap: wrap;
        gap: 3px;
    }
    .viewtabs a {
        flex: 1 1 auto;
        justify-content: center;
        min-height: 38px;
        padding: 6px 9px;
        white-space: nowrap;
    }
}

/* Band im Vorführbetrieb - auffällig, aber nicht schreiend. Es soll erklären,
   nicht erschrecken. */
.demoband {
    display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap;
    padding: 7px 14px; font-size: 13px; font-weight: 550;
    background: var(--warn-soft); color: var(--warn);
    border-bottom: 1px solid color-mix(in srgb, var(--warn) 35%, transparent);
}
.demoband a { color: inherit; text-decoration: underline; }

/* Landkarte der Funktionen (Hilfe, Abschnitt „Alles auf einen Blick") */
.karte-liste { display: grid; gap: 6px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.karte-eintrag {
    display: flex; flex-direction: column; gap: 2px;
    padding: 9px 11px; border-radius: var(--radius-sm);
    border: 1px solid var(--border); color: var(--text);
}
.karte-eintrag:hover { background: var(--surface-hover); border-color: var(--border-strong); text-decoration: none; }

/* Hinweis auf Neuerungen nach einem Update */
.neuerungen { border-left: 3px solid var(--accent); }
.neuerungen ul { margin: 8px 0 0; padding-left: 18px; }
.neuerungen li { margin-bottom: 5px; }

/* ==========================================================================
   Zeitstrahl (Balkenplan)

   Alle Breiten stehen in Prozent, gerechnet in Domain\Timeline. Dadurch passt sich
   die Darstellung jeder Bildschirmbreite an, ohne eine Zeile JavaScript - und beim
   Drucken stimmt sie auch.
   ========================================================================== */

.zeitstrahl-rahmen { padding: 0; overflow-x: auto; min-width: 0; }

/* Die Mindestbreite richtet sich nach der Zahl der Abschnitte in der Kopfzeile
   (--spalten kommt aus der Ansicht). Sonst quetschen sich bei einem langen Zeitraum
   dreißig Kalenderwochen auf 300 Pixel und die Beschriftung wird unlesbar. Lieber
   ein breiter Kasten, der seitwärts läuft - das ist bei einem Balkenplan ohnehin
   die erwartete Bedienung. */
.zeitstrahl {
    min-width: max(680px, calc(var(--spalten, 10) * 44px + var(--zs-titel, 240px)));
}

.zs-kopf, .zs-zeile { display: flex; align-items: stretch; }

.zs-kopf {
    position: sticky; top: 0; z-index: 2;
    background: var(--surface-2); border-bottom: 1px solid var(--border);
}
.zs-kopf .zs-achse { display: flex; }

.zs-titelspalte {
    flex: 0 0 var(--zs-titel, 240px); width: var(--zs-titel, 240px);
    display: flex; align-items: center; gap: 8px;
    padding: 7px 12px; border-right: 1px solid var(--border);
    font-size: 13px; min-width: 0; cursor: pointer;
}
.zs-zeile .zs-titelspalte:hover { background: var(--surface-hover); }

.zs-achse { position: relative; flex: 1; min-width: 0; min-height: 34px; }

.zs-abschnitt {
    flex: none; padding: 6px 0 6px 6px;
    font-size: 11px; font-weight: 600; color: var(--text-faint);
    border-left: 1px solid var(--border);
    white-space: nowrap; overflow: hidden;
}
.zs-abschnitt.heute { color: var(--accent); background: var(--accent-soft); }

.zs-zeile { border-bottom: 1px solid var(--border); }
.zs-zeile:last-child { border-bottom: 0; }
.zs-zeile:hover .zs-achse { background: var(--surface-hover); }

/* Der Balken selbst: Farbe nach Fälligkeitszustand, wie überall in Klaro. */
.zs-balken, .zs-punkt {
    position: absolute; top: 50%; transform: translateY(-50%);
    cursor: pointer;
}
.zs-balken {
    height: 18px; min-width: 4px; border-radius: 5px;
    background: var(--accent); opacity: .85;
}
.zs-balken:hover, .zs-punkt:hover { opacity: 1; outline: 2px solid var(--text); outline-offset: 1px; }
.zs-punkt {
    width: 12px; height: 12px; border-radius: 999px;
    margin-left: -6px; background: var(--accent);
    border: 2px solid var(--surface);
}

.zs-balken.due-overdue, .zs-punkt.due-overdue { background: var(--danger); }
.zs-balken.due-today,   .zs-punkt.due-today   { background: var(--warn); }
.zs-balken.due-soon,    .zs-punkt.due-soon    { background: var(--warn); opacity: .7; }
.zs-balken.due-done,    .zs-punkt.due-done,
.zs-fertig { background: var(--ok); opacity: .55; }

/* Senkrechte Linie für heute - der Bezugspunkt, ohne den ein Balkenplan nichts sagt. */
.zs-heute {
    position: absolute; top: 0; bottom: 0; width: 2px;
    background: var(--accent); opacity: .35; pointer-events: none;
}
.zs-kopf .zs-heute { opacity: .5; }

.zs-blocker { position: absolute; top: 50%; transform: translate(-22px, -50%); color: var(--danger); }

@media (max-width: 680px) {
    /* Auf dem Telefon ist die Titelspalte schmaler - der Balken braucht den Platz.
       Die Mindestbreite bleibt an die Abschnittszahl gekoppelt, siehe oben. */
    .zeitstrahl { --zs-titel: 130px; }
    .zs-titelspalte .card-ref { display: none; }
}

@media print {
    .zeitstrahl-rahmen { overflow: visible; }
    .zeitstrahl { min-width: 0; }
}

/* ==========================================================================
   Sitzungsansicht: am Bildschirm eine Vorschau, auf dem Papier eine Tagesordnung
   ========================================================================== */

.sitzung {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px 36px;
    max-width: 820px;
}

.sitzung-kopf { border-bottom: 2px solid var(--text); padding-bottom: 10px; margin-bottom: 22px; }
.sitzung-kopf h1 { margin: 0 0 4px; font-size: 1.5rem; }
.sitzung-zeile { margin: 0; color: var(--text-muted); font-size: .95rem; }

.sitzung-abschnitt { margin-bottom: 26px; }
.sitzung-abschnitt-titel {
    font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em;
    color: var(--text-muted); border-bottom: 1px solid var(--border);
    padding-bottom: 5px; margin: 0 0 14px;
}

.sitzung-punkt { margin-bottom: 20px; break-inside: avoid; }
.sitzung-punkt-kopf { display: flex; gap: 10px; align-items: baseline; }
.sitzung-nr { font-weight: 700; min-width: 2.2em; }
.sitzung-punkt-kopf h3 { margin: 0; font-size: 1.02rem; font-weight: 650; }

.sitzung-angaben { margin: 3px 0 0 calc(2.2em + 10px); font-size: .85rem; color: var(--text-muted); }
.sitzung-ref { font-weight: 600; letter-spacing: .03em; }

.sitzung-beschreibung {
    margin: 8px 0 0 calc(2.2em + 10px);
    font-size: .93rem; line-height: 1.55;
}
.sitzung-beschreibung p { margin: 0 0 .5em; }

.sitzung-checkliste { list-style: none; margin: 9px 0 0 calc(2.2em + 10px); padding: 0; font-size: .92rem; }
.sitzung-checkliste li { display: flex; gap: 8px; align-items: baseline; padding: 2px 0; }
.sitzung-checkliste .kasten {
    flex: none; width: 13px; height: 13px; border: 1px solid var(--text-muted);
    border-radius: 2px; font-size: 11px; line-height: 11px; text-align: center;
}
.sitzung-checkliste .erledigt { color: var(--text-muted); }

.sitzung-notizen { margin: 12px 0 0 calc(2.2em + 10px); }
.sitzung-notiz-titel { font-size: .72rem; text-transform: uppercase; letter-spacing: .07em; color: var(--text-faint); }
.sitzung-notizen .linie {
    display: block; border-bottom: 1px solid var(--border-strong);
    height: 20px; margin-top: 4px;
}

.sitzung-fuss { margin: 28px 0 0; font-size: .78rem; color: var(--text-faint); }

/*
 * Was abgewählt wurde, verschwindet - am Bildschirm wie auf dem Papier.
 *
 * Ausdrücklich nur für das Sitzungsblatt: Der Rückblick benutzt dieselbe Formatierung,
 * hat aber keine Häkchen zum Abwählen. Ohne [data-meeting-sheet] wären dort sämtliche
 * Zwischenüberschriften und Angaben unsichtbar - sie stünden im Text, hätten aber
 * die Höhe null.
 */
[data-meeting-sheet]:not(.zeigt-beschreibung) .sitzung-beschreibung,
[data-meeting-sheet]:not(.zeigt-checkliste) .sitzung-checkliste,
[data-meeting-sheet]:not(.zeigt-angaben) .sitzung-angaben,
[data-meeting-sheet]:not(.zeigt-notizen) .sitzung-notizen { display: none; }
[data-meeting-sheet]:not(.zeigt-abschnitte) .sitzung-abschnitt-titel { display: none; }
[data-meeting-sheet]:not(.zeigt-abschnitte) .sitzung-abschnitt { margin-bottom: 0; }

/* --- Der Ausdruck ------------------------------------------------------- */
@media print {
    /* Farben und Kästen kosten Toner und bringen auf Papier nichts. */
    .sitzung {
        border: 0; border-radius: 0; padding: 0; max-width: none;
        background: #fff; color: #000;
    }
    .sitzung-kopf { border-bottom-color: #000; }
    .sitzung-abschnitt-titel, .sitzung-angaben, .sitzung-zeile,
    .sitzung-notiz-titel, .sitzung-fuss { color: #333; }
    .sitzung-abschnitt-titel { border-bottom-color: #999; }
    .sitzung-checkliste .kasten { border-color: #333; }
    .sitzung-notizen .linie { border-bottom-color: #999; }

    /* Ein Punkt soll nicht über den Seitenumbruch zerrissen werden. */
    .sitzung-punkt { page-break-inside: avoid; }
    .sitzung-abschnitt-titel { page-break-after: avoid; }
    .sitzung-kopf { page-break-after: avoid; }
}

/* ==========================================================================
   Schnellwahl der Projekte in der Kopfzeile
   ========================================================================== */

.navmenu-wrap { position: relative; display: inline-flex; }

/* Links statt rechts ausgerichtet - das Menü hängt unter einem Navigationspunkt,
   nicht unter einem Knopf am rechten Rand. */
.navmenu {
    left: 0; right: auto; min-width: 240px; max-width: 320px;
    opacity: 0; visibility: hidden; transform: translateY(-4px);
    transition: opacity .12s ease, transform .12s ease, visibility .12s;
}
.navmenu .dot { flex: none; width: 9px; height: 9px; border-radius: 50%; }
.nowrap-ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/*
 * Nur dort aufklappen, wo es ein Zeigegerät gibt. Am Handy gibt es kein "hover":
 * Dort führt ein Tippen einfach zur Projektliste, wie bisher. Der Zugang über die
 * Tastatur läuft über :focus-within - wer sich durchtabbt, sieht dasselbe Menü.
 */
@media (hover: hover) and (pointer: fine) {
    .navmenu-wrap:hover .navmenu,
    .navmenu-wrap:focus-within .navmenu {
        opacity: 1; visibility: visible; transform: translateY(0);
    }
    /* Kleine Brücke nach oben, damit das Menü beim Hinüberfahren nicht zuklappt. */
    .navmenu::before {
        content: ""; position: absolute; left: 0; right: 0; top: -7px; height: 7px;
    }
}

/* Rückblick: Kennzahlen über dem Bericht --------------------------------- */
.rueckblick-zahlen {
    display: flex; flex-wrap: wrap; gap: 26px;
    padding-bottom: 18px; margin-bottom: 22px;
    border-bottom: 1px solid var(--border);
}
.rueckblick-zahl b { display: block; font-size: 2rem; font-weight: 800; line-height: 1.1; }
.rueckblick-zahl span { font-size: .86rem; color: var(--text-muted); }
.rueckblick-verteilung { font-size: .88rem; color: var(--text-muted); }
.rueckblick-verteilung strong { color: var(--text); }

@media print {
    .rueckblick-zahlen { border-bottom-color: #999; }
    .rueckblick-zahl span, .rueckblick-verteilung { color: #333; }
}
