:root {
    --gruen: #3b8a5a;
    --gruen-dunkel: #2a5e4e;
    --gruen-hell: #e6f0e9;
    --gruen-sehr-hell: #f3f8f4;
    --text: #1d2a22;
    --text-leise: #5d6b62;
    --linie: #d5e0d8;
    --hintergrund: #f4f7f5;
    --karte: #ffffff;
    --rot: #c0392b;
    --rot-hell: #fbeae8;
    --gelb: #b7791f;
    --gelb-hell: #fdf4e3;
    --blau: #2b6cb0;
    --blau-hell: #e8f1fb;
    --radius: 10px;
    --schatten: 0 1px 2px rgba(29, 42, 34, .06), 0 2px 8px rgba(29, 42, 34, .05);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font: 15px/1.5 "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
    color: var(--text);
    background: var(--hintergrund);
}

a { color: var(--gruen-dunkel); }
a:hover { color: var(--gruen); }

h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1rem; }

/* ---------- Grundgerüst ---------- */

.rahmen { display: flex; min-height: 100vh; }

.seitenleiste {
    width: 230px;
    flex: 0 0 230px;
    background: var(--gruen-dunkel);
    color: #fff;
    padding: 18px 14px;
    display: flex;
    flex-direction: column;
    gap: 18px;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.marke { font-weight: 700; font-size: 1.05rem; display: flex; align-items: center; gap: 8px; color: #fff; text-decoration: none; }
.marke span { opacity: .75; font-weight: 400; font-size: .85rem; display: block; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
    color: #e3efe7;
    text-decoration: none;
    padding: 8px 10px;
    border-radius: 8px;
    display: flex;
    gap: 10px;
    align-items: center;
}
.nav a:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.nav a.aktiv { background: rgba(255, 255, 255, .16); color: #fff; font-weight: 600; }
.nav .symbol { width: 20px; text-align: center; }

.seitenleiste select { width: 100%; color: var(--text); }
.seitenleiste .klein { color: #c8dccf; }
.seitenleiste form.saisonwahl { display: flex; flex-direction: column; gap: 4px; }
.benutzer { margin-top: auto; font-size: .85rem; color: #c8dccf; }
.benutzer button { margin-top: 6px; }

.haupt { flex: 1; min-width: 0; padding: 22px 28px 60px; }

.kopf { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.kopf .unter { color: var(--text-leise); margin-top: -4px; }

.mobil-kopf { display: none; }

@media (max-width: 860px) {
    .rahmen { display: block; }
    .seitenleiste { display: none; }
    .seitenleiste.offen { display: flex; position: fixed; inset: 0; width: auto; z-index: 50; height: auto; }
    .mobil-kopf {
        display: flex;
        align-items: center;
        justify-content: space-between;
        background: var(--gruen-dunkel);
        color: #fff;
        padding: 10px 16px;
        position: sticky;
        top: 0;
        z-index: 40;
    }
    .mobil-kopf button { background: transparent; color: #fff; border-color: rgba(255,255,255,.4); }
    .haupt { padding: 16px 16px 60px; }
}

/* ---------- Bausteine ---------- */

.karte {
    background: var(--karte);
    border: 1px solid var(--linie);
    border-radius: var(--radius);
    box-shadow: var(--schatten);
    padding: 16px 18px;
    margin-bottom: 18px;
}
.karte > h2:first-child, .karte > h3:first-child { margin-top: 0; }
.karte-kopf { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.karte-kopf h2 { margin: 0; }

.raster { display: grid; gap: 18px; }
.raster-2 { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.raster-3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }

.kennzahlen { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; }
.kennzahl { background: var(--karte); border: 1px solid var(--linie); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--schatten); }
.kennzahl .wert { font-size: 1.6rem; font-weight: 700; line-height: 1.1; }
.kennzahl .label { color: var(--text-leise); font-size: .85rem; }
.kennzahl.warn .wert { color: var(--rot); }

.klein { font-size: .85rem; }
.leise { color: var(--text-leise); }
.rechts { text-align: right; }
.zentriert { text-align: center; }
.nowrap { white-space: nowrap; }
.mt { margin-top: 12px; }
.ohne-abstand { margin: 0; }

.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 10px; border: 1px solid; }
.flash.ok { background: var(--gruen-hell); border-color: #b9d6c3; }
.flash.fehler { background: var(--rot-hell); border-color: #f0c3bd; color: #7d2318; }
.flash.warnung { background: var(--gelb-hell); border-color: #f0d9a8; color: #6b4a12; }
.hinweis { background: var(--blau-hell); border: 1px solid #c6daf2; border-radius: 8px; padding: 10px 14px; margin-bottom: 14px; }

.badge {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 999px;
    font-size: .78rem;
    font-weight: 600;
    background: var(--gruen-hell);
    color: var(--gruen-dunkel);
    white-space: nowrap;
}
.badge.rot { background: var(--rot-hell); color: var(--rot); }
.badge.gelb { background: var(--gelb-hell); color: var(--gelb); }
.badge.blau { background: var(--blau-hell); color: var(--blau); }
.badge.grau { background: #eceeed; color: #555; }

.farbpunkt { display: inline-block; width: 10px; height: 10px; border-radius: 3px; vertical-align: middle; margin-right: 6px; }

.balken { height: 8px; background: #e3ebe5; border-radius: 99px; overflow: hidden; min-width: 80px; }
.balken > span { display: block; height: 100%; background: var(--gruen); border-radius: 99px; }
.balken.gross { height: 12px; }

/* ---------- Tabellen ---------- */

.tabelle-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { border-collapse: collapse; width: 100%; }
th, td { padding: 7px 10px; border-bottom: 1px solid var(--linie); text-align: left; vertical-align: middle; }
th { font-size: .82rem; color: var(--text-leise); font-weight: 600; background: var(--gruen-sehr-hell); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
tfoot td { font-weight: 700; background: var(--gruen-sehr-hell); border-top: 2px solid var(--linie); }
td.zahl, th.zahl { text-align: right; font-variant-numeric: tabular-nums; }
tr.puffer td { background: #fafbfa; color: var(--text-leise); }
tr.erledigt td { color: var(--text-leise); }
tr.erledigt .titel { text-decoration: line-through; text-decoration-color: #9fb3a6; }
tr.ueberfaellig td:first-child { box-shadow: inset 3px 0 0 var(--rot); }

/* ---------- Formulare ---------- */

input, select, textarea, button {
    font: inherit;
    color: inherit;
}
input[type=text], input[type=email], input[type=number], input[type=date], input[type=time], input[type=password], input[type=file], select, textarea {
    border: 1px solid #c5d3c9;
    border-radius: 7px;
    padding: 6px 9px;
    background: #fff;
    max-width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid #9cc8ac; border-color: var(--gruen); }
textarea { width: 100%; min-height: 90px; }
input.menge { width: 72px; text-align: right; }
input.breit, select.breit { width: 100%; }
input.geaendert, select.geaendert, textarea.geaendert { background: #fffbe8; border-color: #e5c96b; }

label { display: block; font-size: .85rem; color: var(--text-leise); margin-bottom: 3px; }
label.inline { display: inline-flex; align-items: center; gap: 6px; color: var(--text); font-size: .95rem; margin: 0; }

.feld { margin-bottom: 12px; }
.feldreihe { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.feldreihe .feld { margin-bottom: 0; }
.formular-raster { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }

button, .knopf {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid #b8cbbf;
    background: #fff;
    border-radius: 7px;
    padding: 6px 12px;
    cursor: pointer;
    text-decoration: none;
    color: var(--text);
    white-space: nowrap;
    line-height: 1.3;
}
button:hover, .knopf:hover { background: var(--gruen-sehr-hell); color: var(--text); }
button.primaer, .knopf.primaer { background: var(--gruen); border-color: var(--gruen); color: #fff; font-weight: 600; }
button.primaer:hover, .knopf.primaer:hover { background: var(--gruen-dunkel); }
button.gefahr { color: var(--rot); border-color: #e7b5ae; }
button.gefahr:hover { background: var(--rot-hell); }
button.mini, .knopf.mini { padding: 2px 8px; font-size: .82rem; }
button.link { border: 0; background: none; padding: 0; color: var(--gruen-dunkel); text-decoration: underline; }
button:disabled { opacity: .5; cursor: not-allowed; }
.knopfleiste { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
form.inline { display: inline; }

details.aufklapp > summary { cursor: pointer; color: var(--gruen-dunkel); font-weight: 600; list-style: none; }
details.aufklapp > summary::-webkit-details-marker { display: none; }
details.aufklapp > summary::before { content: '＋ '; }
details.aufklapp[open] > summary::before { content: '－ '; }
details.aufklapp[open] > summary { margin-bottom: 10px; }

/* ---------- Tabs ---------- */

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--linie); margin-bottom: 18px; overflow-x: auto; }
.tabs a {
    padding: 8px 14px;
    text-decoration: none;
    color: var(--text-leise);
    border-bottom: 3px solid transparent;
    white-space: nowrap;
}
.tabs a.aktiv { color: var(--gruen-dunkel); border-bottom-color: var(--gruen); font-weight: 600; }

/* ---------- Cockpit ---------- */

.countdown { text-align: right; }
.countdown .tage { font-size: 2rem; font-weight: 700; color: var(--gruen); line-height: 1; }

.todo { list-style: none; margin: 0; padding: 0; }
.todo li { display: flex; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--linie); }
.todo li:last-child { border-bottom: 0; }
.todo .symbol { width: 26px; height: 26px; border-radius: 7px; background: var(--gruen-hell); display: grid; place-items: center; flex: 0 0 26px; font-size: .9rem; }
.todo .text { flex: 1; min-width: 0; }
.todo .text small { color: var(--text-leise); display: block; }
.todo li.rot .symbol { background: var(--rot-hell); }
.todo li.mail .symbol { background: var(--blau-hell); }

.aktionsliste td:first-child a { font-weight: 600; text-decoration: none; }

.zeitleiste { overflow-x: auto; }
.zeitleiste table { min-width: 900px; table-layout: fixed; }
.zeitleiste th, .zeitleiste td { padding: 4px 2px; text-align: center; border-left: 1px solid #edf2ee; font-size: .78rem; }
.zeitleiste th:first-child, .zeitleiste td:first-child { width: 190px; text-align: left; padding-left: 8px; border-left: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.zeitleiste .aktuell { background: #fff6dc; }
.zeitleiste .punkt { display: inline-block; min-width: 18px; height: 18px; line-height: 18px; border-radius: 5px; margin: 1px; font-size: .7rem; background: var(--gruen-hell); cursor: help; }
.zeitleiste .punkt.erledigt { background: #dfe7e2; opacity: .6; }
.zeitleiste .punkt.ueberfaellig { background: var(--rot-hell); color: var(--rot); }
.zeitleiste .punkt.mail { background: var(--blau-hell); }

/* ---------- Checkliste ---------- */

.schritt-haken { width: 30px; }
.haken {
    width: 24px; height: 24px; border-radius: 6px; border: 2px solid #9fb8a8; background: #fff;
    display: grid; place-items: center; padding: 0; color: #fff; font-weight: 700; font-size: 14px;
}
.haken.an { background: var(--gruen); border-color: var(--gruen); }
.typ { font-size: 1rem; width: 24px; text-align: center; }
.unterpunkt .titel { padding-left: 22px; position: relative; }
.unterpunkt .titel::before { content: '└'; position: absolute; left: 4px; color: #9fb3a6; }
.schritt-bearbeiten { background: var(--gruen-sehr-hell); }
.schritt-bearbeiten td { padding: 14px; }

/* ---------- Verteilliste ---------- */

.status-knopf { min-width: 118px; justify-content: center; }
.status-offen { }
.status-angefragt { background: var(--blau-hell); border-color: #c6daf2; }
.status-rueckmeldung { background: #eef3ff; border-color: #bccdf2; }
.status-gepackt { background: var(--gelb-hell); border-color: #f0d9a8; }
.status-verteilt, .status-nachgereicht { background: var(--gruen-hell); border-color: #b9d6c3; }
.fest-haken { font-size: .75rem; color: var(--text-leise); display: inline-flex; gap: 2px; align-items: center; margin-left: 4px; }
.vorjahr { font-size: .72rem; color: #8a9a90; display: block; }

/* ---------- Mail ---------- */

.mail-raster { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 18px; align-items: start; }
@media (max-width: 1100px) { .mail-raster { grid-template-columns: 1fr; } }
.mail-vorschau { border: 1px solid var(--linie); border-radius: 8px; background: #fff; }
.mail-vorschau .mail-kopf { padding: 10px 14px; border-bottom: 1px solid var(--linie); background: var(--gruen-sehr-hell); font-size: .9rem; }
.mail-vorschau .mail-text { padding: 14px; overflow-x: auto; }
.platzhalter { display: flex; flex-wrap: wrap; gap: 4px; }
.platzhalter button { font-size: .78rem; padding: 2px 7px; }
textarea.mailtext { min-height: 300px; font-family: inherit; }
.status-zeile { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ---------- Woche ---------- */

.woche { display: grid; grid-template-columns: repeat(5, minmax(170px, 1fr)); gap: 10px; overflow-x: auto; }
.tag { background: var(--karte); border: 1px solid var(--linie); border-radius: var(--radius); min-height: 180px; display: flex; flex-direction: column; }
.tag h3 { margin: 0; padding: 8px 10px; border-bottom: 1px solid var(--linie); font-size: .9rem; background: var(--gruen-sehr-hell); border-radius: var(--radius) var(--radius) 0 0; }
.tag.heute h3 { background: var(--gruen); color: #fff; }
.tag .inhalt { padding: 8px; display: flex; flex-direction: column; gap: 8px; }
.wkarte { border: 1px solid var(--linie); border-left: 4px solid var(--blau); border-radius: 8px; padding: 7px 9px; background: #fff; font-size: .86rem; }
.wkarte.schritt { border-left-color: var(--gruen); }
.wkarte.mail { border-left-color: #8e6bbf; }
.wkarte.erledigt { opacity: .55; }
.wkarte .meta { color: var(--text-leise); font-size: .78rem; }
.wkarte details summary { font-size: .78rem; color: var(--gruen-dunkel); cursor: pointer; }
.wkarte form { margin-top: 6px; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.spalten-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }
@media (max-width: 860px) { .woche { grid-template-columns: 1fr; } }

/* ---------- Öffentlich (Login, Formular) ---------- */

.oeffentlich { min-height: 100vh; display: grid; place-items: start center; padding: 40px 16px; }
.oeffentlich .karte { width: 100%; max-width: 560px; }
.oeffentlich .marke-gross { color: var(--gruen-dunkel); font-weight: 700; font-size: 1.1rem; margin-bottom: 14px; display: flex; gap: 8px; align-items: center; }
.trenner { display: flex; align-items: center; gap: 10px; color: var(--text-leise); font-size: .85rem; margin: 16px 0; }
.trenner::before, .trenner::after { content: ''; flex: 1; border-top: 1px solid var(--linie); }

@media print {
    .seitenleiste, .mobil-kopf, .tabs, button, .knopf, form { display: none !important; }
    .haupt { padding: 0; }
    .karte { box-shadow: none; }
}
