:root {
  --bg: #f4f2ee; --karte: #fff; --text: #1d2327; --leise: #5c6670; --linie: #ddd8cf;
  --akzent: #1f5f8b; --akzent-dunkel: #174a6d; --gut: #1e6b3a; --gut-bg: #e4f3e8;
  --warn: #8a5a00; --warn-bg: #fdf1d6; --fehler: #a32222; --fehler-bg: #fbe6e6; --info-bg: #e6f0f7;
}
* { box-sizing: border-box; }
html { font-size: 18px; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; line-height: 1.5; }
a { color: var(--akzent); }
h1 { font-size: 1.7rem; margin: .4rem 0 1rem; line-height: 1.2; }
h2 { font-size: 1.25rem; margin: 1.6rem 0 .7rem; }
h3 { font-size: 1.05rem; margin: .2rem 0 .6rem; }
.karte h2:first-child, .karte h3:first-child { margin-top: 0; }

.kopf { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem 1.4rem; background: var(--akzent-dunkel); padding: .7rem 1.2rem; }
.kopf a { color: #fff; text-decoration: none; padding: .35rem .2rem; }
.kopf a:hover { text-decoration: underline; }
.kopf .marke { font-weight: 700; font-size: 1.15rem; margin-right: .6rem; }
.kopf nav { display: flex; flex-wrap: wrap; gap: .2rem 1.2rem; flex: 1; }
.kopf .abmelden button { color: #cfe0ec; }
.zaehler { background: #e0a100; color: #1d2327; border-radius: 1rem; padding: 0 .5rem; font-weight: 700; font-size: .85rem; }

main { max-width: 1150px; margin: 0 auto; padding: 1.2rem 1rem 4rem; }
main.schmal { max-width: 440px; } main.mittel { max-width: 820px; } main.breit { max-width: 1500px; }
.karte { background: var(--karte); border: 1px solid var(--linie); border-radius: 10px; padding: 1.1rem 1.2rem; margin-bottom: 1rem; overflow-x: auto; }
.raster { display: grid; grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); gap: 1rem; }
.schritte { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1rem; }
.schritt { position: relative; padding-top: 1.3rem; display: flex; flex-direction: column; align-items: flex-start; }
.schritt p { flex: 1; margin-top: 0; }
.schritt .nr { background: var(--akzent); color: #fff; width: 2.1rem; height: 2.1rem; border-radius: 50%; display: grid; place-items: center; font-weight: 700; margin-bottom: .5rem; }
.kennzahlen { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 1rem; }
.kennzahlen .karte { display: flex; flex-direction: column; gap: .2rem; }
.kennzahlen strong { font-size: 1.5rem; }
.titelzeile { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .5rem 1rem; }
.titelzeile h1, .titelzeile h2, .titelzeile h3 { margin-bottom: .4rem; }
.pfad { margin: 0; color: var(--leise); font-size: .9rem; }
.leise { color: var(--leise); font-weight: 400; font-size: .92em; }
.hinweis { color: var(--warn); }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .5rem .5rem; border-bottom: 1px solid var(--linie); vertical-align: top; }
thead th { font-size: .82rem; color: var(--leise); font-weight: 600; white-space: nowrap; }
tr:last-child > td, tr:last-child > th { border-bottom: none; }
.rechts { text-align: right; white-space: nowrap; }
tr.alt td { color: var(--leise); }
tr.summe th, tr.summe td { border-top: 2px solid var(--text); font-weight: 700; }
table.schlicht th { width: 4rem; }

.liste { padding: .3rem .6rem; }
.zeile { display: grid; grid-template-columns: auto minmax(0, 3fr) minmax(0, 1.4fr) 7rem auto; gap: .8rem; align-items: center; padding: .7rem .6rem; border-bottom: 1px solid var(--linie); color: inherit; text-decoration: none; }
.zeile:last-child { border-bottom: none; }
.zeile:hover { background: #f7f5f1; }
.zeile .haupt { font-weight: 600; grid-column: 2; overflow: hidden; text-overflow: ellipsis; }
.zeile .datum { grid-column: 1; }
.marke-status, .etikett { display: inline-block; border-radius: 1rem; padding: .1rem .7rem; font-size: .8rem; font-weight: 600; white-space: nowrap; background: #eceae5; }
.marke-status.analysiert, .etikett.warn { background: var(--warn-bg); color: var(--warn); }
.marke-status.geprueft { background: var(--gut-bg); color: var(--gut); }
.marke-status.fehler { background: var(--fehler-bg); color: var(--fehler); }
.marke-status.neu { background: var(--info-bg); color: var(--akzent-dunkel); }
.saldo { font-weight: 700; white-space: nowrap; }
.saldo.nachzahlung { color: var(--fehler); } .saldo.guthaben { color: var(--gut); }

.meldung { border-radius: 8px; padding: .8rem 1rem; margin-bottom: 1rem; background: var(--info-bg); border: 1px solid #c4d9e8; }
.meldung.success { background: var(--gut-bg); border-color: #b9dcc3; }
.meldung.warning { background: var(--warn-bg); border-color: #ecd699; }
.meldung.error { background: var(--fehler-bg); border-color: #efbcbc; }
.meldung ul { margin: .4rem 0 0; }

.feld { margin-bottom: 1rem; }
.feld label, fieldset legend { display: block; font-weight: 600; margin-bottom: .25rem; }
.feld label small { font-weight: 400; color: var(--leise); }
input, select, textarea, button { font: inherit; }
input[type=text], input[type=password], input[type=email], input[type=number], input[type=date], input[type=search], input:not([type]), select, textarea {
  width: 100%; padding: .55rem .65rem; border: 1.5px solid #b9b3a7; border-radius: 7px; background: #fff; color: var(--text); }
input:focus, select:focus, textarea:focus { outline: 3px solid #9cc3de; border-color: var(--akzent); }
input[type=checkbox] { width: 1.25rem; height: 1.25rem; vertical-align: -.2rem; margin-right: .35rem; }
input.zahl { text-align: right; max-width: 12rem; }
.feld.haken label { font-weight: 600; }
.hilfe { color: var(--leise); font-size: .88rem; margin: .25rem 0 0; }
.fehlerhaft input, .fehlerhaft select, .fehlerhaft textarea { border-color: var(--fehler); }
.fehlertext, .errorlist { color: var(--fehler); font-size: .9rem; margin: .25rem 0 0; padding: 0; list-style: none; }
.felder-raster { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0 1rem; }
.felder-raster .breit2 { grid-column: span 2; }
.felder-raster input.zahl { max-width: none; }
fieldset.position { border: 1px solid var(--linie); border-radius: 8px; margin: 0 0 1rem; padding: .6rem 1rem .8rem; background: #fbfaf8; }
fieldset.position.fehlerhaft { border-color: var(--fehler); }
fieldset legend { padding: 0 .4rem; }
details summary { cursor: pointer; color: var(--akzent); margin-bottom: .6rem; }
.haken-zeile { display: flex; flex-wrap: wrap; gap: .4rem 2rem; }
.formtabelle td { border-bottom: none; padding-left: 0; }
.filter { display: grid; grid-template-columns: 2fr repeat(3, 1fr) auto; gap: .6rem; align-items: center; }
.vorauszahlung { margin: 1rem 0 0; }

.knopf { display: inline-block; background: var(--akzent); color: #fff; border: none; border-radius: 8px; padding: .6rem 1.1rem; font-weight: 600; text-decoration: none; cursor: pointer; }
.knopf:hover { background: var(--akzent-dunkel); }
.knopf.zweit { background: #fff; color: var(--akzent-dunkel); border: 1.5px solid var(--akzent); }
.knopf.zweit:hover { background: var(--info-bg); }
.knopf.gross { font-size: 1.1rem; padding: .8rem 1.5rem; }
.knopf.klein { font-size: .85rem; padding: .35rem .7rem; }
.aktionen { display: flex; flex-wrap: wrap; gap: .7rem; margin-top: 1.2rem; align-items: center; }
.aktionen.unten { justify-content: flex-end; }
button.link { background: none; border: none; padding: 0; color: var(--akzent); text-decoration: underline; cursor: pointer; }
.gefahr, button.link.gefahr { color: var(--fehler); }
form.inline { display: inline; margin-left: .8rem; }
.nebenaktionen { display: flex; flex-wrap: wrap; gap: .5rem 2rem; margin: 0 0 1rem; }

.zweispaltig { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1.2rem; align-items: start; }
.vorschau { position: sticky; top: .8rem; }
.vorschau iframe { width: 100%; height: 86vh; border: 1px solid var(--linie); border-radius: 8px; background: #fff; }
.vorschau img { max-width: 100%; border: 1px solid var(--linie); border-radius: 8px; }
.volltext { white-space: pre-wrap; font-size: .8rem; max-height: 24rem; overflow: auto; }

@media (max-width: 900px) {
  .zweispaltig { grid-template-columns: 1fr; }
  .vorschau { position: static; } .vorschau iframe { height: 60vh; }
  .zeile { grid-template-columns: 1fr auto; } .zeile .haupt, .zeile .datum { grid-column: auto; }
  .filter { grid-template-columns: 1fr; }
  .felder-raster .breit2 { grid-column: auto; }
}

/* Live-Anzeige */
.live-status { display: flex; align-items: center; gap: .7rem; background: #e0a100; color: #1d2327; font-weight: 600; padding: .55rem 1.2rem; }
.live-status[hidden] { display: none; }
.kreisel { display: inline-block; width: 1.1rem; height: 1.1rem; border: 3px solid rgba(0,0,0,.25); border-top-color: #1d2327; border-radius: 50%; animation: drehen 0.9s linear infinite; vertical-align: -.15rem; flex: none; }
@keyframes drehen { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .kreisel { animation-duration: 3s; } }
.meldung.neu-hinweis { position: relative; background: var(--gut-bg); border: 2px solid #6fb486; padding-right: 3rem; }
.meldung.neu-hinweis strong { font-size: 1.05rem; }
.meldung.neu-hinweis .schliessen { position: absolute; top: .3rem; right: .5rem; background: none; border: none; font-size: 1.6rem; line-height: 1; cursor: pointer; color: var(--gut); padding: .2rem .5rem; }
.marke-status.liest { background: var(--info-bg); color: var(--akzent-dunkel); }

/* Nachfrage-Dialog */
dialog.nachfrage { border: none; border-radius: 12px; padding: 0; max-width: min(30rem, calc(100vw - 2rem)); width: 100%; color: var(--text); box-shadow: 0 20px 60px rgba(0,0,0,.35); }
dialog.nachfrage::backdrop { background: rgba(20, 30, 40, .55); }
dialog.nachfrage .innen { padding: 1.5rem 1.6rem 1.3rem; }
dialog.nachfrage h2 { margin: 0 0 .6rem; font-size: 1.3rem; line-height: 1.3; }
dialog.nachfrage p { margin: 0; color: var(--leise); }
dialog.nachfrage .aktionen { justify-content: flex-end; margin-top: 1.5rem; }
.knopf.gefahr { background: var(--fehler); color: #fff; }
.knopf.gefahr:hover { background: #7f1a1a; }
