:root {
  --blau: #1f3a5f; --blau2: #2f6db5; --grau: #5b6b7b; --linie: #dde3ea; --hell: #f4f7fb;
  --gruen: #2e9d6a; --rot: #c0392b; --gelb: #b7791f; --weiss: #fff; --text: #22313f;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: "Segoe UI", system-ui, sans-serif; background: var(--hell); color: var(--text); font-size: 15px; }
[hidden] { display: none !important; }
button, .knopf { background: var(--blau2); color: #fff; border: 0; border-radius: 8px; padding: 9px 16px; font-size: 14px; cursor: pointer; text-decoration: none; display: inline-block; font-family: inherit; }
button:hover, .knopf:hover { filter: brightness(1.08); }
button.zweit, .knopf.zweit { background: #e6ecf3; color: var(--blau); }
button.gefahr { background: #fbe9e7; color: var(--rot); }
button.gruen { background: var(--gruen); }
button.klein, .knopf.klein { padding: 5px 10px; font-size: 13px; }
input, select, textarea { font: inherit; padding: 8px 10px; border: 1px solid #c8d0d8; border-radius: 8px; width: 100%; background: #fff; color: var(--text); }
textarea { min-height: 60px; resize: vertical; }
label { display: block; font-size: 13px; color: var(--grau); margin: 0 0 10px; }
label > input, label > select, label > textarea { margin-top: 3px; }
label.check { display: flex; gap: 8px; align-items: center; }
label.check input { width: auto; }
h1 { font-size: 22px; margin: 0 0 14px; color: var(--blau); }
h2 { font-size: 18px; margin: 0 0 12px; color: var(--blau); }
h3 { font-size: 15px; margin: 18px 0 8px; color: var(--blau); }

.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.karte { background: #fff; border-radius: 14px; box-shadow: 0 4px 24px #1f3a5f14; padding: 22px; }
.login .karte { width: 100%; max-width: 380px; }
.meldung { color: var(--rot); min-height: 1em; }
.meldung.ok { color: #1d6b47; background: #e6f5ee; border: 1px solid #b6e0cb; border-radius: 10px; padding: 10px 12px; }

header { background: var(--blau); color: #fff; display: flex; align-items: center; gap: 14px; padding: 10px 16px; flex-wrap: wrap; position: sticky; top: 0; z-index: 5; }
.marke { font-weight: 700; font-size: 18px; }
header select { width: auto; max-width: 340px; background: #2a4a75; color: #fff; border-color: #3d5f8f; }
nav { display: flex; gap: 4px; flex-wrap: wrap; margin-left: auto; }
nav button { background: transparent; color: #cfe0f5; padding: 8px 12px; }
nav button.aktiv { background: #fff; color: var(--blau); }
.zurueck { color: #fff; text-decoration: none; font-size: 20px; padding: 2px 6px; }
main { max-width: 1100px; margin: 0 auto; padding: 18px 16px 60px; }
.hinweis { background: #fff6e0; border-bottom: 1px solid #f0d58a; color: #7a5600; padding: 10px 16px; text-align: center; }
.hinweis a { color: var(--blau2); }

.leiste { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.leiste .rechts { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.kacheln { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 18px; }
.kachel { background: #fff; border-radius: 12px; padding: 14px; box-shadow: 0 2px 10px #1f3a5f0d; }
.kachel .zahl { font-size: 22px; font-weight: 700; color: var(--blau); margin-top: 4px; }
.kachel .titel { font-size: 12px; color: var(--grau); text-transform: uppercase; letter-spacing: .04em; }

table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 10px #1f3a5f0d; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--linie); vertical-align: top; }
th { background: #eef2f7; color: var(--blau); font-size: 13px; white-space: nowrap; }
td.zahl, th.zahl { text-align: right; white-space: nowrap; }
td.datum { white-space: nowrap; }
tr.klickbar { cursor: pointer; }
tr.klickbar:hover td { background: #f8fafc; }
.tabelle-rahmen { overflow-x: auto; }

.status { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 10px; white-space: nowrap; font-weight: 600; }
.status.entwurf { background: #eef2f7; color: var(--grau); }
.status.offen { background: #fff3d6; color: var(--gelb); }
.status.ueberfaellig { background: #fde2df; color: var(--rot); }
.status.bezahlt { background: #dff3e9; color: var(--gruen); }
.status.storniert { background: #eceff3; color: #7d8a97; text-decoration: line-through; }

.raster { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 14px; }
.positionen { width: 100%; }
.positionen td { padding: 6px 4px; border: 0; }
.positionen th { background: none; padding: 4px; color: var(--grau); }
.positionen .p-text { min-width: 260px; width: 100%; }
.positionen input { padding: 6px 8px; }
.summen { text-align: right; margin: 10px 0; font-size: 15px; }
.summen b { font-size: 18px; color: var(--blau); }
.fehlt { background: #fff6e0; border: 1px solid #f0d58a; color: #7a5600; padding: 10px 14px; border-radius: 10px; margin: 10px 0; }
.ok { background: #e6f5ee; border: 1px solid #b6e0cb; color: #1d6b47; padding: 10px 14px; border-radius: 10px; margin: 10px 0; }
.klein-grau { color: var(--grau); font-size: 13px; }
.knoepfe { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }

.dialog { position: fixed; inset: 0; background: #0f1d2e88; display: grid; place-items: center; padding: 16px; z-index: 20; overflow-y: auto; }
.dialog .karte { width: 100%; max-width: 560px; max-height: 92vh; overflow-y: auto; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--blau); color: #fff; padding: 10px 18px; border-radius: 10px; z-index: 30; box-shadow: 0 4px 16px #0003; max-width: 90vw; }
.toast.fehler { background: var(--rot); }
.leer { text-align: center; color: var(--grau); padding: 30px; background: #fff; border-radius: 12px; }

@media (max-width: 700px) {
  header { gap: 8px; }
  nav { margin-left: 0; width: 100%; }
  header select { max-width: 100%; flex: 1; }
  .ausblenden-mobil { display: none; }
  th, td { padding: 8px; }
}
