:root {
  --akzent: #2F6FB0; --akzent-hell: #E7EFF8;
  --tinte: #1F2A30; --text: #2B3439; --grau: #6B7780; --linie: #DCE3E6; --flaeche: #F5F7F8;
  --rot: #C0392B; --rot-hell: #FBE5E2; --gruen: #1E7B34; --gruen-hell: #E1F3E5; --orange: #D9822B; --orange-hell: #FCEBD8;
  --we: #EEF4F6; --ft: #FDEBDD;
  --radius: 8px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; color: var(--text); background: var(--flaeche); }
a { color: var(--akzent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0 0 4px; color: var(--tinte); }
h2 { font-size: 16px; margin: 24px 0 10px; color: var(--tinte); }
.unter { color: var(--grau); margin: 0 0 18px; }

/* Layout */
.rahmen { display: grid; grid-template-columns: 230px 1fr; min-height: 100vh; }
.seite { background: var(--tinte); color: #CFD8DC; padding: 18px 14px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.seite .marke { color: #fff; font-weight: 700; font-size: 17px; letter-spacing: .3px; margin: 2px 6px 16px; display: flex; gap: 8px; align-items: center; }
.seite .marke span { width: 10px; height: 10px; border-radius: 50%; background: var(--akzent); display: inline-block; }
.seite select { width: 100%; padding: 7px 8px; border-radius: 6px; border: 0; background: #2C3A41; color: #fff; margin-bottom: 16px; font-size: 13px; }
.seite nav a { display: block; color: #CFD8DC; padding: 7px 10px; border-radius: 6px; margin: 1px 0; }
.seite nav a:hover { background: #2C3A41; text-decoration: none; color: #fff; }
.seite nav a.aktiv { background: var(--akzent); color: #fff; }
.seite .gruppe { font-size: 11px; text-transform: uppercase; letter-spacing: .8px; color: #7E8E96; margin: 16px 10px 4px; }
.seite .wer { border-top: 1px solid #34444C; margin-top: 18px; padding: 12px 10px 0; font-size: 12px; color: #9FB0B8; }
.seite .wer button { background: none; border: 0; color: #CFD8DC; padding: 0; cursor: pointer; font-size: 12px; text-decoration: underline; }
main { padding: 26px 30px 60px; min-width: 0; }

/* Elemente */
.karte { background: #fff; border: 1px solid var(--linie); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 18px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 18px; }
.kpi { background: #fff; border: 1px solid var(--linie); border-radius: var(--radius); padding: 14px 16px; }
.kpi b { display: block; font-size: 24px; color: var(--tinte); }
.kpi small { color: var(--grau); }
.kpi.warn b { color: var(--rot); }
.leiste { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 16px; }
.leiste .rechts { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.knopf, button.knopf { display: inline-flex; align-items: center; gap: 6px; padding: 7px 13px; border-radius: 6px; border: 1px solid var(--akzent); background: var(--akzent); color: #fff; cursor: pointer; font-size: 13px; font-weight: 600; text-decoration: none; }
.knopf:hover { filter: brightness(1.07); text-decoration: none; }
.knopf.leer { background: #fff; color: var(--akzent); }
.knopf.klein { padding: 3px 8px; font-size: 12px; }
.knopf.rot { background: #fff; border-color: var(--rot); color: var(--rot); }
.monatwahl { display: inline-flex; align-items: center; gap: 4px; background: #fff; border: 1px solid var(--linie); border-radius: 6px; padding: 2px; }
.monatwahl a { padding: 4px 9px; border-radius: 4px; color: var(--tinte); font-weight: 700; }
.monatwahl a:hover { background: var(--flaeche); text-decoration: none; }
.monatwahl span { padding: 4px 8px; font-weight: 600; min-width: 120px; text-align: center; }
table.liste { width: 100%; border-collapse: collapse; background: #fff; }
table.liste th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .4px; color: var(--grau); font-weight: 600; padding: 9px 10px; border-bottom: 2px solid var(--linie); }
table.liste td { padding: 9px 10px; border-bottom: 1px solid var(--linie); vertical-align: top; }
table.liste tr:hover td { background: #FAFCFC; }
.zahl { text-align: right; font-variant-numeric: tabular-nums; }
.marke-ok { color: var(--gruen); font-weight: 600; }
.marke-offen { color: var(--rot); font-weight: 700; }
.inaktiv td { color: #A0AAB0; }
form.gitter, div.karte.gitter { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px 16px; }
label { display: block; font-size: 12px; font-weight: 600; color: var(--grau); margin-bottom: 4px; }
input[type=text], input[type=password], input[type=number], input[type=date], input[type=time], select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid #C8D2D6; border-radius: 6px; font: inherit; background: #fff; color: var(--text); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--akzent-hell); border-color: var(--akzent); }
.voll { grid-column: 1 / -1; }
.meldung { padding: 10px 14px; border-radius: 6px; margin-bottom: 14px; }
.meldung.fehler { background: var(--rot-hell); color: var(--rot); border: 1px solid #F1C2BC; }
.meldung.ok { background: var(--gruen-hell); color: var(--gruen); border: 1px solid #BFE3C7; }
.hinweis { color: var(--grau); font-size: 12px; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 4px 2px 8px; border-radius: 12px; background: var(--akzent-hell); color: var(--tinte); font-size: 12px; margin: 2px 2px 2px 0; white-space: nowrap; }
.chip button { border: 0; background: none; color: var(--grau); cursor: pointer; font-size: 13px; line-height: 1; padding: 0 3px; }
.chip button:hover { color: var(--rot); }

/* Monatsplan */
.plan { width: 100%; border-collapse: separate; border-spacing: 0; background: #fff; border: 1px solid var(--linie); border-radius: var(--radius); overflow: hidden; }
.plan th { background: var(--tinte); color: #fff; font-size: 12px; font-weight: 600; padding: 8px; text-align: left; position: sticky; top: 0; z-index: 2; }
.plan td { border-bottom: 1px solid var(--linie); padding: 6px 8px; vertical-align: top; }
.plan td.tag { width: 92px; font-weight: 600; white-space: nowrap; }
.plan td.tag small { display: block; font-weight: 400; color: var(--grau); font-size: 11px; }
.plan tr.we td { background: var(--we); }
.plan tr.ft td { background: var(--ft); }
.plan td.zelle { width: 38%; }
.plan td.sonder { width: 18%; }
.zkopf { display: flex; justify-content: space-between; gap: 6px; font-size: 11px; color: var(--grau); margin-bottom: 3px; }
.zkopf .soll { font-weight: 700; padding: 0 6px; border-radius: 10px; }
.soll.voll { background: var(--gruen-hell); color: var(--gruen); }
.soll.fehlt { background: var(--rot-hell); color: var(--rot); }
.leerzeit { color: #B5BEC2; font-size: 12px; }
.plus { border: 1px dashed #B9C5CA; background: #fff; color: var(--akzent); border-radius: 12px; padding: 1px 9px; cursor: pointer; font-size: 12px; }
.plus:hover { border-color: var(--akzent); }
.auswahl { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: 4px; }
.auswahl select { width: auto; min-width: 170px; padding: 4px 6px; font-size: 12px; }
.auswahl input[type=time] { width: 90px; padding: 4px 6px; font-size: 12px; }
.zelle .fehler { color: var(--rot); font-size: 12px; margin-top: 3px; background: var(--rot-hell); padding: 4px 6px; border-radius: 4px; }
.zeiten-tabelle td, .zeiten-tabelle th { padding: 6px 8px; }
.zeiten-tabelle input { width: 110px; }
.zeiten-tabelle input[type=number] { width: 70px; }

/* Login */
.login { min-height: 100vh; display: grid; place-items: center; background: var(--tinte); }
.login .karte { width: 360px; padding: 30px; }
.login h1 { margin-bottom: 18px; }
.login .knopf { width: 100%; justify-content: center; padding: 10px; margin-top: 12px; }

@media (max-width: 900px) {
  .rahmen { grid-template-columns: 1fr; }
  .seite { position: static; height: auto; }
  main { padding: 18px 14px; }
  .plan td.zelle { width: auto; }
}
@media print { .seite, .leiste, .plus { display: none !important; } .rahmen { display: block; } }
table.liste th.zahl { text-align: right; }

/* Version 2.0 */
.warnung { color: #8A5A00; font-size: 12px; margin-top: 3px; background: #FFF4D6; padding: 4px 6px; border-radius: 4px; border: 1px solid #F3DE9C; }
.kpi.gelb b { color: var(--orange); }
.status { display: inline-block; font-size: 11px; font-weight: 700; padding: 1px 8px; border-radius: 10px; white-space: nowrap; }
.status.neu { background: var(--flaeche); color: var(--grau); border: 1px solid var(--linie); }
.status.versendet { background: var(--gruen-hell); color: var(--gruen); }
.status.geaendert { background: var(--rot-hell); color: var(--rot); }
.knopf.wa { background: #25D366; border-color: #25D366; }
.gesamt-wrap { overflow-x: auto; background: #fff; border: 1px solid var(--linie); border-radius: var(--radius); }
table.gesamt { border-collapse: collapse; font-size: 11px; min-width: 100%; }
table.gesamt th, table.gesamt td { border: 1px solid var(--linie); padding: 3px 1px; text-align: center; min-width: 26px; white-space: nowrap; }
table.gesamt th { background: var(--tinte); color: #fff; font-weight: 600; position: sticky; top: 0; z-index: 2; }
table.gesamt th.we { background: #3B4B53; } table.gesamt th.ft { background: var(--orange); }
table.gesamt td.name, table.gesamt th.name { text-align: left; padding: 3px 8px; position: sticky; left: 0; background: #fff; z-index: 1; min-width: 140px; font-size: 12px; }
table.gesamt th.name { background: var(--tinte); z-index: 3; }
table.gesamt td.we { background: var(--we); } table.gesamt td.ft { background: var(--ft); }
table.gesamt td.t { color: var(--tinte); font-weight: 600; }
table.gesamt td.n { background: #DDE3F5; color: #22306B; font-weight: 600; }
table.gesamt td.s { background: #EFE3F7; font-weight: 600; }
table.gesamt td.u { background: var(--gruen-hell); color: var(--gruen); font-weight: 700; }
table.gesamt td.k { background: var(--rot-hell); color: var(--rot); font-weight: 700; }
table.gesamt td.w { outline: 2px solid #E0A800; outline-offset: -2px; }
table.gesamt td.sum { font-weight: 700; text-align: right; padding: 3px 6px; }
.legende { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--grau); margin: 10px 0; }
.legende i { display: inline-block; width: 14px; height: 14px; border-radius: 3px; vertical-align: -2px; margin-right: 4px; border: 1px solid var(--linie); }
.radio-zeile { display: flex; gap: 18px; align-items: center; }
.radio-zeile label { display: inline-flex; gap: 6px; align-items: center; font-size: 13px; color: var(--text); margin: 0; }

/* Version 2.1 */
.status.rs-entwurf { background: var(--flaeche); color: var(--grau); border: 1px solid var(--linie); }
.status.rs-offen { background: #E6F0FA; color: #1F5F99; }
.status.rs-bezahlt { background: var(--gruen-hell); color: var(--gruen); }
.status.rs-storniert { background: #EEE; color: #777; text-decoration: line-through; }
.status.rs-ueber { background: var(--rot-hell); color: var(--rot); }
details.karte summary { cursor: pointer; }
table.liste tfoot td { border-bottom: 0; padding: 6px 10px; }
/* 2.7 Posten */
.plan.breit td.zelle { width: auto; min-width: 150px; }
.posten-kz { display: inline-block; min-width: 22px; text-align: center; font-weight: 700; font-size: 11px; padding: 1px 5px; border-radius: 4px; background: var(--akzent-hell); color: var(--tinte); }
.wt-wahl label { display: inline-block; font-weight: 400; margin-right: 10px; }
/* 2.8 Subunternehmer */
.chip.sub { background: #EEF0FA; }
.chip.nn { background: #FFF4D6; border: 1px dashed #E0B84C; }
.chip .nn-link { color: #8A5A00; text-decoration: none; font-weight: 600; }
.subkz { font-size: 10px; font-weight: 700; color: #4B57A8; background: #fff; border-radius: 3px; padding: 0 3px; }
.ampel { display: inline-block; width: 10px; height: 10px; border-radius: 50%; vertical-align: middle; }
.ampel.rot { background: var(--rot); } .ampel.gelb { background: #E0A100; } .ampel.gruen { background: var(--gruen); }
.st-ok { color: var(--gruen); font-weight: 600; } .st-bald, .st-ungeprueft { color: #8A5A00; font-weight: 600; }
.st-abgelaufen, .st-fehlt { color: var(--rot); font-weight: 700; } .st-optional { color: var(--grau); }
