:root {
  --grund: #f7f3ec;
  --papier: #fffdf9;
  --text: #2f2a24;
  --leise: #7a7065;
  --linie: #e4dccf;
  --akzent: #2f5d50;
  --rot: #a33a2b;
  --rot-hell: #f6e3df;
  --gelb-hell: #f7edd5;
  --gruen-hell: #e3eee8;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--grund); color: var(--text);
  font: 16px/1.5 -apple-system, "Segoe UI", system-ui, sans-serif;
}
h1, h2, .marke, .zahl { font-family: Charter, "Iowan Old Style", Georgia, serif; font-weight: 600; }
h1 { font-size: 1.7rem; margin: 0 0 .3rem; }
h2 { font-size: 1.15rem; margin: 0 0 .5rem; }
a { color: var(--akzent); }
small { display: block; color: var(--leise); font-size: .85rem; }
main { max-width: 1180px; margin: 0 auto; padding: 1.5rem 1.25rem 4rem; }

.kopf {
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .5rem;
  padding: .9rem 1.25rem; background: var(--papier); border-bottom: 1px solid var(--linie);
}
.marke { font-size: 1.25rem; color: var(--text); text-decoration: none; }
.marke span { color: var(--leise); font-weight: 400; }
.kopf nav a { margin-left: 1.1rem; text-decoration: none; color: var(--text); }
.kopf nav a.aktiv { border-bottom: 2px solid var(--akzent); }
.leise { color: var(--leise) !important; }

/* Lage oben */
.lage { display: flex; gap: 2.5rem; flex-wrap: wrap; margin: .5rem 0 1.75rem; }
.lage p { margin: 0; color: var(--leise); }
.lage .zahl { font-size: 1.9rem; color: var(--text); }
.lage .rot .zahl { color: var(--rot); }

.werkzeuge { display: flex; justify-content: space-between; align-items: end; gap: 1rem; flex-wrap: wrap;
  border-bottom: 1px solid var(--linie); margin-bottom: 1rem; }
.reiter a { display: inline-block; padding: .5rem .2rem; margin-right: 1.1rem; text-decoration: none; color: var(--leise); }
.reiter a.aktiv { color: var(--text); border-bottom: 2px solid var(--akzent); margin-bottom: -1px; }
.reiter span { font-size: .8rem; }
.suche input { width: 280px; margin-bottom: .5rem; }
.filter { color: var(--leise); }

/* Tabelle */
.liste { width: 100%; border-collapse: collapse; background: var(--papier); border: 1px solid var(--linie); border-radius: 6px; }
.liste th { text-align: left; font-weight: 500; color: var(--leise); font-size: .85rem; padding: .6rem .8rem; border-bottom: 1px solid var(--linie); }
.liste td { padding: .7rem .8rem; border-bottom: 1px solid var(--linie); vertical-align: top; }
.liste tbody tr { cursor: pointer; }
.liste tbody tr:hover { background: #faf6ef; }
.liste td a { color: var(--text); font-weight: 500; text-decoration: none; }
.liste tfoot td { color: var(--leise); border-bottom: 0; }
.rechts { text-align: right !important; }
.betrag { font-variant-numeric: tabular-nums; white-space: nowrap; }
.frist { white-space: nowrap; }
tr.ueberfaellig .frist strong, tr.ueberfaellig .frist small { color: var(--rot); }
tr.ueberfaellig td:first-child { box-shadow: inset 3px 0 var(--rot); }
tr.bald td:first-child { box-shadow: inset 3px 0 #c9962b; }
tr.bezahlt { color: var(--leise); }
.aktion { width: 1%; white-space: nowrap; }
.marke-pruefen { font-size: .75rem; background: var(--gelb-hell); color: #7a5a12; padding: .05rem .4rem; border-radius: 3px; margin-left: .3rem; }
.leer { color: var(--leise); padding: 2rem 0; }

/* Formulare */
input, select, textarea {
  font: inherit; color: inherit; width: 100%; padding: .45rem .6rem;
  border: 1px solid #d6ccbd; border-radius: 4px; background: #fff;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--akzent); outline-offset: -1px; }
label { display: block; font-size: .85rem; color: var(--leise); margin-bottom: .7rem; }
label input, label select, label textarea { margin-top: .2rem; color: var(--text); font-size: 1rem; }
button {
  font: inherit; cursor: pointer; border: 1px solid var(--akzent); background: var(--akzent); color: #fff;
  padding: .5rem 1rem; border-radius: 4px;
}
button.klein { padding: .2rem .6rem; font-size: .85rem; background: transparent; color: var(--akzent); }
button.klein:hover { background: var(--gruen-hell); }
button.zweit { background: transparent; color: var(--akzent); }
button.leise { background: transparent; border-color: transparent; padding: .3rem 0; text-decoration: underline; }
.hinweis { background: var(--gelb-hell); padding: .5rem .75rem; border-radius: 4px; font-size: .9rem; }
.hinweis.fehler { background: var(--rot-hell); color: var(--rot); }
.hinweis.ok { background: var(--gruen-hell); }

/* Unten: neue Rechnung + Postfach */
.unten { display: flex; gap: 3rem; flex-wrap: wrap; margin-top: 2.5rem; padding-top: 1.5rem; border-top: 1px solid var(--linie); }
.unten > div { flex: 1 1 300px; }
.adresse { font-size: 1.1rem; user-select: all; }
.status p { color: var(--leise); }
.hochladen label { margin-top: 1rem; }

/* Detail */
.zurueck { margin: 0 0 1rem; }
.zurueck a { text-decoration: none; }
.detail { display: grid; grid-template-columns: minmax(300px, 400px) 1fr; gap: 2rem; align-items: start; }
.untertitel { font-size: 1.25rem; margin: 0 0 1rem; font-variant-numeric: tabular-nums; }
.frist-marke { font-size: .85rem; padding: .15rem .5rem; border-radius: 3px; margin-right: .5rem; vertical-align: middle; background: var(--linie); }
.frist-marke.ueberfaellig { background: var(--rot-hell); color: var(--rot); }
.frist-marke.bald { background: var(--gelb-hell); color: #7a5a12; }
.frist-marke.bezahlt { background: var(--gruen-hell); color: var(--akzent); }
.zwei { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.zwei label:last-child:has(input[maxlength]) { max-width: 6rem; }
.knoepfe { margin-top: .5rem; }
.schnell { margin: .75rem 0 1.5rem; }
.herkunft { display: grid; grid-template-columns: auto 1fr; gap: .2rem .8rem; font-size: .9rem; color: var(--leise); }
.herkunft dd { margin: 0; color: var(--text); }
.mailtext { margin: 1rem 0; font-size: .9rem; }
.mailtext pre { white-space: pre-wrap; font: .85rem/1.45 ui-monospace, Menlo, monospace; background: var(--papier); border: 1px solid var(--linie); padding: .75rem; max-height: 400px; overflow: auto; }
.loeschen { margin-top: 2rem; }
.beleg { position: sticky; top: 1rem; }
.dateien { margin-bottom: .5rem; font-size: .9rem; }
.dateien a { margin-right: .75rem; }
.beleg iframe { width: 100%; height: calc(100vh - 140px); min-height: 500px; border: 1px solid var(--linie); background: #fff; border-radius: 4px; }

/* Anmeldung */
body.login { display: grid; place-items: center; min-height: 100vh; }
.login-box { background: var(--papier); border: 1px solid var(--linie); padding: 2rem; border-radius: 6px; width: min(360px, 90vw); }
.login-box h1 { font-size: 1.4rem; margin-bottom: 1rem; }

@media (max-width: 800px) {
  .detail { grid-template-columns: 1fr; }
  .beleg { position: static; }
  .liste th:nth-child(3), .liste td:nth-child(3) { display: none; }
  .suche input { width: 100%; }
  .lage { gap: 1.5rem; }
}

/* Mögliche Duplikate */
.marke-doppelt { font-size: .75rem; background: var(--rot-hell); color: var(--rot); padding: .05rem .4rem; border-radius: 3px; margin-left: .3rem; }
.doppelt-hinweis { background: var(--rot-hell); margin: 0 0 1rem; }
.vergleich { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; margin-top: 1rem; }
.vergleich section { min-width: 0; }
.vergleich iframe { width: 100%; height: 70vh; border: 1px solid var(--linie); border-radius: 4px; }
.vergleich-felder { display: grid; grid-template-columns: auto 1fr; gap: .2rem 1rem; margin: 0 0 1rem; }
.vergleich-felder dt { color: var(--leise); }
.vergleich-felder dd { margin: 0; }
.entscheiden { display: flex; gap: .75rem; flex-wrap: wrap; margin: 1.5rem 0; }
@media (max-width: 800px) { .vergleich { grid-template-columns: 1fr; } .vergleich iframe { height: 50vh; } }
