/* Steuerungscockpit Inkonstellation GmbH
   Design-Tokens 1:1 aus dem Original-Artifact uebernommen (nicht neu erfunden). */
:root {
    --paper: #FCFBF9;
    --paper-raised: #FFFFFF;
    --ink: #303030;
    --ink-soft: #666666;
    --ink-faint: #999999;
    --line: rgba(48,48,48,0.14);
    --line-strong: rgba(48,48,48,0.24);
    --primary: #0E7A8C;
    --primary-strong: #0B5F6E;
    --primary-soft: rgba(80,187,206,0.16);
    --accent: #ED8C30;
    --accent-strong: #C96F1D;
    --accent-soft: rgba(237,140,48,0.14);
    --danger: #B23B2A;
    --danger-soft: #F4DCD5;
    --warn: #ED8C30;
    --warn-soft: #FBE4CB;
    --ok: #4C8C5C;
    --ok-soft: #DCEBDD;
    --shadow: 0 1px 2px rgba(48,48,48,0.07), 0 10px 28px -14px rgba(48,48,48,0.22);
    --radius: 10px;
    --schrift-anzeige: "Fraunces", Georgia, serif;
    --schrift-text: "Public Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --schrift-daten: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --paper: #15191A;
        --paper-raised: #1D2224;
        --ink: #EDEDEA;
        --ink-soft: #ABABAB;
        --ink-faint: #808080;
        --line: rgba(237,237,234,0.14);
        --line-strong: rgba(237,237,234,0.26);
        --primary: #5FC2D4;
        --primary-strong: #8AD6E4;
        --primary-soft: rgba(95,194,212,0.18);
        --accent: #F2A85C;
        --accent-strong: #F6C089;
        --accent-soft: rgba(242,168,92,0.16);
        --danger: #E28A72;
        --danger-soft: rgba(226,138,114,0.18);
        --warn: #F2A85C;
        --warn-soft: rgba(242,168,92,0.18);
        --ok: #7FBE87;
        --ok-soft: rgba(127,190,135,0.16);
        --shadow: 0 1px 2px rgba(0,0,0,0.35), 0 10px 28px -14px rgba(0,0,0,0.55);
    }
}
:root[data-theme="dark"] {
    --paper: #15191A;
    --paper-raised: #1D2224;
    --ink: #EDEDEA;
    --ink-soft: #ABABAB;
    --ink-faint: #808080;
    --line: rgba(237,237,234,0.14);
    --line-strong: rgba(237,237,234,0.26);
    --primary: #5FC2D4;
    --primary-strong: #8AD6E4;
    --primary-soft: rgba(95,194,212,0.18);
    --accent: #F2A85C;
    --accent-strong: #F6C089;
    --accent-soft: rgba(242,168,92,0.16);
    --danger: #E28A72;
    --danger-soft: rgba(226,138,114,0.18);
    --warn: #F2A85C;
    --warn-soft: rgba(242,168,92,0.18);
    --ok: #7FBE87;
    --ok-soft: rgba(127,190,135,0.16);
    --shadow: 0 1px 2px rgba(0,0,0,0.35), 0 10px 28px -14px rgba(0,0,0,0.55);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: var(--schrift-text);
    background: var(--paper);
    color: var(--ink);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-family: var(--schrift-anzeige); font-optical-sizing: auto; font-weight: 600; letter-spacing: -0.01em; margin: 0 0 4px; }

a { color: var(--primary); }

header.topbar {
    background: var(--paper-raised);
    border-bottom: 1px solid var(--line);
    color: var(--ink);
    padding: 14px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

header.topbar .marke {
    font-family: var(--schrift-anzeige);
    font-weight: 600;
    font-size: 1.15em;
    color: var(--ink);
    text-decoration: none;
}
header.topbar nav a { color: var(--ink-soft); text-decoration: none; margin-right: 18px; font-weight: 600; font-size: 0.9em; }
header.topbar nav a.aktiv { color: var(--primary); text-decoration: underline; text-underline-offset: 4px; }
header.topbar nav a:hover { color: var(--ink); }
header.topbar .konto { color: var(--ink-faint); font-size: 0.85em; }
header.topbar .konto a { color: var(--ink-soft); }

.eyebrow {
    font-family: var(--schrift-daten);
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--accent-strong);
    display: block;
    margin-bottom: 6px;
}

main {
    max-width: 1240px;
    margin: 28px auto;
    padding: 0 16px 60px;
}

.karte {
    background: var(--paper-raised);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}

.flash {
    padding: 10px 14px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-weight: 500;
    border: 1px solid var(--line);
}
.flash.info { background: var(--primary-soft); color: var(--primary-strong); border-color: transparent; }
.flash.error { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.flash.success { background: var(--ok-soft); color: var(--ok); border-color: transparent; }

/* Statistik-Kacheln */
.statistik-reihe {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 10px;
    margin-bottom: 20px;
}
.statistik-kachel {
    background: var(--paper-raised);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.statistik-kachel .zahl {
    font-family: var(--schrift-anzeige);
    font-size: 24px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    line-height: 1.15;
    color: var(--ink);
}
.statistik-kachel.dringend .zahl { color: var(--danger); }
.statistik-kachel .label {
    font-size: 12px;
    color: var(--ink-soft);
}

/* Abteilungsfilter */
.filterleiste {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}
.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--paper-raised);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 6px 14px;
    font-size: 12.5px;
    cursor: pointer;
    color: var(--ink-soft);
    font-weight: 600;
    font-family: inherit;
}
.filter-chip:hover { border-color: var(--line-strong); color: var(--ink); }
.filter-chip .anzahl { font-family: var(--schrift-daten); color: inherit; opacity: 0.75; }
.filter-chip.aktiv { background: var(--primary); color: var(--paper-raised); border-color: var(--primary); }
.filter-chip.aktiv .anzahl { color: inherit; opacity: 0.85; }

table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-faint); font-weight: 600; white-space: nowrap; }
tbody tr:hover { background: var(--primary-soft); }
tbody tr:last-child td { border-bottom: none; }

/* Projekt-/Abteilungs-Gruppierung: farbige Ueberschriftszeile ueber den zugehoerigen Aufgaben. */
.projekt-titel {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--primary-soft);
    color: var(--primary-strong);
    font-weight: 600;
    font-size: 12.5px;
    padding: 8px 14px;
    border-radius: 8px;
    margin-bottom: 10px;
}
.projekt-titel.ohne-projekt {
    background: transparent;
    color: var(--ink-faint);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 11px;
    padding: 4px 4px 8px;
}
.projekt-gruppe { margin-bottom: 20px; }

/* Dringlichkeit als farbige Pille */
select.dringlichkeit-auswahl, span.pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    font-weight: 600;
    font-family: inherit;
    padding: 4px 10px;
    border-radius: 999px;
    border: none;
    white-space: nowrap;
    cursor: pointer;
}
select.dringlichkeit-auswahl::before, span.pill::before {
    content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor;
}
select.dringlichkeit-auswahl.hoch, span.pill.hoch { background: var(--danger-soft); color: var(--danger); }
select.dringlichkeit-auswahl.mittel, span.pill.mittel { background: var(--warn-soft); color: var(--warn); }
select.dringlichkeit-auswahl.niedrig, span.pill.niedrig { background: var(--ok-soft); color: var(--ok); }
select.dringlichkeit-auswahl:not(.hoch):not(.mittel):not(.niedrig) { background: var(--line); color: var(--ink-soft); }

/* Status als farbiger Chip */
select.status-auswahl {
    font-size: 12px;
    font-weight: 600;
    font-family: inherit;
    padding: 5px 8px;
    border-radius: 6px;
    border: 1px solid var(--line);
    background: var(--paper);
    color: var(--ink-soft);
    cursor: pointer;
}
select.status-auswahl[data-status="Offen"] { color: var(--ink-soft); border-color: var(--line); background: var(--paper); }
select.status-auswahl[data-status="In Arbeit"] { color: var(--primary); border-color: var(--primary-soft); background: var(--primary-soft); }
select.status-auswahl[data-status="blockiert"] { color: var(--danger); border-color: var(--danger-soft); background: var(--danger-soft); }
select.status-auswahl[data-status="Erledigt"] { color: var(--ok); border-color: var(--ok-soft); background: var(--ok-soft); }

.status-punkt { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
[data-status="Offen"] .status-punkt { background: var(--ink-soft); }
[data-status="In Arbeit"] .status-punkt { background: var(--primary); }
[data-status="blockiert"] .status-punkt { background: var(--danger); }
[data-status="Erledigt"] .status-punkt { background: var(--ok); }

form.inline { display: inline; }

button, .btn {
    background: var(--primary);
    color: var(--paper-raised);
    border: none;
    padding: 8px 14px;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.95em;
    font-family: var(--schrift-text);
    font-weight: 600;
    text-decoration: none;
    display: inline-block;
}
button:hover, .btn:hover { background: var(--primary-strong); }
button.sekundaer, .btn.sekundaer {
    background: transparent;
    color: var(--primary);
    border: 1px solid var(--primary);
}
button.sekundaer:hover, .btn.sekundaer:hover { background: var(--primary-soft); }
button.gefahr { background: var(--danger); }
button.akzent { background: var(--accent); }

input, select, textarea {
    width: 100%;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    font-size: 0.95em;
    font-family: inherit;
    background: var(--paper-raised);
    color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary); outline-offset: 1px; }
label { font-weight: 600; font-size: 0.85em; display: block; margin: 10px 0 4px; color: var(--ink-soft); text-transform: uppercase; letter-spacing: 0.03em; }

/* Inline editierbare Tabellenzellen: unauffaellig, bis man reinklickt. */
td input[data-feld], td select[data-feld], td textarea[data-feld] {
    border-color: transparent;
    background: transparent;
    padding: 6px;
    color: var(--ink);
}
td input[data-feld]:hover, td select[data-feld]:hover, td textarea[data-feld]:hover,
td input[data-feld]:focus, td select[data-feld]:focus, td textarea[data-feld]:focus {
    border-color: var(--line);
    background: var(--paper);
}

/* Auto-wachsende Textareas (Thema/Ziel): kein Abschneiden, Hoehe passt sich beim Tippen an. */
textarea.auto-groesse {
    resize: none;
    overflow: hidden;
    min-height: 2.2em;
    line-height: 1.4;
    white-space: pre-wrap;
    word-break: break-word;
}
td textarea[data-feld] { resize: vertical; min-height: 2.4em; }
.feld-speichert { opacity: 0.6; }
.feld-fehler { border-color: var(--danger) !important; }

/* Notiz auf-/zuklappen statt immer sichtbar */
.spalte-notiz-schalter { width: 34px; text-align: center; }
.notiz-schalter {
    border: none; background: transparent; color: var(--ink-faint);
    cursor: pointer; font-size: 15px; padding: 5px 6px; border-radius: 6px;
    position: relative; line-height: 1;
}
.notiz-schalter:hover { background: var(--primary-soft); color: var(--primary); }
.notiz-schalter[aria-expanded="true"] { background: var(--primary-soft); color: var(--primary); }
.notiz-schalter.hat-notiz::after {
    content: ""; position: absolute; top: 3px; right: 3px;
    width: 6px; height: 6px; border-radius: 50%; background: var(--accent);
}
tr.notizen-zeile td {
    background: var(--paper);
    padding: 6px 14px 14px 14px;
}
tr.notizen-zeile .notizen-label {
    font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em;
    color: var(--ink-faint); margin: 0 0 4px; font-weight: 600;
}
tr.notizen-zeile textarea {
    min-height: 60px;
}

/* Budget/Ueberstunden: Toggle-Switch plus Notizfeld */
.budget-zelle { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.schalter { position: relative; width: 34px; height: 20px; flex: none; display: inline-block; }
.schalter input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; width: 100%; }
.schalter .schalter-strich {
    position: absolute; inset: 0; border-radius: 999px;
    background: var(--line-strong); transition: background 0.15s; pointer-events: none;
}
.schalter .schalter-strich::after {
    content: ""; position: absolute; top: 2px; left: 2px;
    width: 16px; height: 16px; border-radius: 50%; background: var(--paper-raised);
    box-shadow: 0 1px 2px rgba(0,0,0,0.3);
    transition: transform 0.15s;
}
.schalter input:checked + .schalter-strich { background: var(--primary); }
.schalter input:checked + .schalter-strich::after { transform: translateX(14px); }
.schalter input:focus-visible + .schalter-strich { outline: 2px solid var(--primary); outline-offset: 2px; }
.budget-notiz-feld { min-width: 110px; flex: 1; }

.formular-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 16px;
}
.formular-grid .voll { grid-column: 1 / -1; }

.werkzeugleiste { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; align-items: center; }

.login-box {
    max-width: 380px;
    margin: 80px auto;
}

.speicher-hinweis {
    position: fixed;
    bottom: 18px;
    right: 18px;
    background: var(--ink);
    color: var(--paper);
    padding: 8px 16px;
    border-radius: 999px;
    font-size: 0.85em;
    font-family: var(--schrift-daten);
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.2s ease, transform 0.2s ease;
    pointer-events: none;
    z-index: 50;
    box-shadow: var(--shadow);
}
.speicher-hinweis.sichtbar { opacity: 0.95; transform: translateY(0); }
.speicher-hinweis.fehler { background: var(--danger); }

table.protokoll td, table.protokoll th { font-size: 0.88em; }
table.protokoll .wert-alt { color: var(--ink-faint); text-decoration: line-through; }
table.protokoll .wert-neu { color: var(--primary); font-weight: 600; }
.mono { font-family: var(--schrift-daten); }

/* Einklappbares Erledigt-Archiv */
details.archiv-klappe { border: none; }
details.archiv-klappe > summary {
    list-style: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    border: 1px solid var(--line);
    background: var(--paper-raised);
    border-radius: 999px;
    padding: 8px 16px;
    font-size: 13px;
    color: var(--ink-soft);
    font-weight: 600;
    margin-bottom: 14px;
}
details.archiv-klappe > summary::-webkit-details-marker { display: none; }
details.archiv-klappe > summary:hover { border-color: var(--line-strong); color: var(--ink); }
details.archiv-klappe > summary::before { content: "▸"; font-size: 11px; color: var(--ink-faint); }
details.archiv-klappe[open] > summary::before { content: "▾"; }
.archiv-zeile-erledigt { color: var(--ink-soft); text-decoration: line-through; text-decoration-color: var(--line-strong); }

.hinweistext {
    font-size: 13px;
    color: var(--ink-faint);
    border-top: 1px dashed var(--line);
    padding-top: 16px;
    line-height: 1.6;
    margin-top: 8px;
}

@media (max-width: 640px) {
    .formular-grid { grid-template-columns: 1fr; }
    table, thead, tbody, th, td, tr { display: block; }
    thead { display: none; }
    td { border: none; padding: 4px 0; }
    tr { border-bottom: 1px solid var(--line); padding: 8px 0; }
}
