/* Rechnungs-App Reiners – schlicht wie iOS, dicht genug für viel Inhalt (Marc mag es dicht, siehe Web-App) */
:root {
  --hg: #f2f2f7; --karte: #fff; --text: #1c1c1e; --leise: #8e8e93; --linie: #d1d1d6; --blau: #007aff; --rot: #ff3b30;
  --gruen: #34c759; --orange: #ff9500; --lila: #5856d6; --feld: #fff;
  font: 15px/1.35 -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root { --hg: #000; --karte: #1c1c1e; --text: #f2f2f7; --leise: #8e8e93; --linie: #38383a; --feld: #2c2c2e; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--hg); color: var(--text); padding-bottom: calc(64px + env(safe-area-inset-bottom)); -webkit-text-size-adjust: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
header#kopf { display: flex; align-items: center; justify-content: space-between; padding: calc(10px + env(safe-area-inset-top)) 14px 8px; }
.marke { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 20px; }
.logo { width: 28px; height: 28px; border-radius: 6px; }
main { max-width: 920px; margin: 0 auto; padding: 0 12px; }
h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .03em; color: var(--leise); font-weight: 600; margin: 18px 4px 6px; display: flex; gap: 8px; align-items: baseline; }
h2 .summe { margin-left: auto; text-transform: none; letter-spacing: 0; }
.leer { color: var(--leise); padding: 8px 4px; }
.leise { color: var(--leise); }
button.leise { background: none; border: 0; padding: 6px; color: var(--blau); }

/* Liste */
.gruppe { background: var(--karte); border-radius: 12px; overflow: hidden; }
.zeile { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 9px 12px; border-bottom: 1px solid var(--linie); cursor: pointer; }
.zeile:last-child { border-bottom: 0; }
.zeile .z1 { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.zeile .z2 { color: var(--leise); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.zeile .betrag { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.zeile .minus { color: var(--rot); }
.etikett { display: inline-block; font-size: 11px; padding: 1px 6px; border-radius: 6px; background: var(--hg); color: var(--leise); font-weight: 600; margin-left: 4px; vertical-align: 1px; }
.etikett.blau { background: #e5f0ff; color: var(--blau); } .etikett.gruen { background: #e3f8e8; color: #1f8a3b; }
.etikett.rot { background: #ffe5e3; color: var(--rot); } .etikett.orange { background: #fff1dc; color: #b86b00; } .etikett.lila { background: #ecebff; color: var(--lila); }
@media (prefers-color-scheme: dark) { .etikett.blau, .etikett.gruen, .etikett.rot, .etikett.orange, .etikett.lila { background: #2c2c2e; } }

.werkzeug { display: flex; gap: 8px; align-items: center; margin: 4px 0 6px; flex-wrap: wrap; }
.werkzeug input[type=search] { flex: 1; min-width: 160px; padding: 8px 10px; border-radius: 10px; border: 0; background: var(--karte); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 6px 0; }
.chips button { border: 0; background: var(--karte); padding: 5px 11px; border-radius: 14px; font-size: 13px; }
.chips button.aktiv { background: var(--blau); color: #fff; }
.knopf { border: 0; background: var(--blau); color: #fff; padding: 8px 14px; border-radius: 10px; font-weight: 600; cursor: pointer; }
.knopf.zweit { background: var(--karte); color: var(--blau); }
.knopf.rot { background: var(--karte); color: var(--rot); }
.knopf:disabled { opacity: .45; }
details.taifun summary { cursor: pointer; color: var(--leise); margin: 16px 4px 6px; font-size: 13px; }

/* Reiter unten */
nav#reiter { position: fixed; bottom: 0; left: 0; right: 0; display: flex; background: color-mix(in srgb, var(--karte) 92%, transparent);
  backdrop-filter: blur(12px); border-top: 1px solid var(--linie); padding-bottom: env(safe-area-inset-bottom); z-index: 5; }
nav#reiter button { flex: 1; border: 0; background: none; padding: 12px 0; color: var(--leise); font-weight: 600; }
nav#reiter button.aktiv { color: var(--blau); }

/* Editor */
.blatt { position: fixed; inset: 0; background: var(--hg); overflow-y: auto; z-index: 10; padding: calc(8px + env(safe-area-inset-top)) 0 calc(90px + env(safe-area-inset-bottom)); }
.blatt .inhalt { max-width: 920px; margin: 0 auto; padding: 0 12px; }
.blattkopf { display: flex; align-items: center; justify-content: space-between; gap: 8px; position: sticky; top: 0; background: var(--hg); padding: 6px 0; z-index: 2; }
.blattkopf h1 { font-size: 18px; margin: 0; flex: 1; text-align: center; }
.feldgruppe { background: var(--karte); border-radius: 12px; padding: 4px 12px; margin-bottom: 10px; }
.feld { display: grid; grid-template-columns: 120px 1fr; align-items: center; gap: 8px; padding: 7px 0; border-bottom: 1px solid var(--linie); }
.feld:last-child { border-bottom: 0; }
.feld label { color: var(--leise); font-size: 13px; }
.feld input, .feld select, .feld textarea { width: 100%; border: 0; background: transparent; padding: 4px 0; outline: none; }
.feld textarea { resize: vertical; }
.kunde-anzeige { white-space: pre-line; }
.titel-block { background: var(--karte); border-radius: 12px; padding: 8px 10px; margin-bottom: 10px; }
.titel-kopf { display: flex; gap: 6px; align-items: center; }
.titel-kopf input { flex: 1; font-weight: 700; border: 0; border-bottom: 1px dashed var(--linie); background: transparent; padding: 4px 2px; }
.pos { border-top: 1px solid var(--linie); padding: 8px 0; display: grid; grid-template-columns: 46px 74px 70px 90px 70px 1fr; gap: 6px; align-items: start; }
.pos .nr { color: var(--leise); font-size: 12px; padding-top: 7px; font-variant-numeric: tabular-nums; }
.pos input, .pos select, .pos textarea { width: 100%; border: 1px solid var(--linie); border-radius: 8px; padding: 5px 6px; background: var(--feld); }
.pos textarea { grid-column: 2 / -1; min-height: 52px; resize: vertical; }
.pos .gp { text-align: right; font-variant-numeric: tabular-nums; padding-top: 7px; font-weight: 600; }
.pos .posknoepfe { grid-column: 2 / -1; display: flex; gap: 4px; justify-content: flex-end; }
.pos .posknoepfe button { border: 0; background: var(--hg); border-radius: 7px; padding: 3px 9px; font-size: 13px; }
@media (max-width: 560px) {
  .pos { grid-template-columns: 38px 1fr 1fr 1fr; }
  .pos .gp { grid-column: 2 / -1; text-align: right; padding-top: 0; }
  .pos .art { grid-column: auto; }
}
.zusatz { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.zusatz button { border: 0; background: var(--hg); color: var(--blau); border-radius: 8px; padding: 6px 10px; font-size: 13px; font-weight: 600; }
.summen { background: var(--karte); border-radius: 12px; padding: 8px 12px; margin-bottom: 10px; font-variant-numeric: tabular-nums; }
.summen div { display: flex; justify-content: space-between; padding: 2px 0; }
.summen .gesamt { font-weight: 700; border-top: 1px solid var(--linie); margin-top: 4px; padding-top: 6px; }
.hinweis { background: #fff8e5; color: #6b4e00; border-radius: 12px; padding: 10px 12px; margin-bottom: 10px; white-space: pre-line; }
.hinweis.fehler { background: #ffe9e7; color: #9b1c12; }
.hinweis.ok { background: #e6f7ea; color: #1f6b33; }
@media (prefers-color-scheme: dark) { .hinweis { background: #3a3000; color: #ffe08a; } .hinweis.fehler { background: #3d1210; color: #ffb4ad; } .hinweis.ok { background: #0f3318; color: #9be7ad; } }
.leiste { position: fixed; left: 0; right: 0; bottom: 0; background: color-mix(in srgb, var(--karte) 94%, transparent); backdrop-filter: blur(12px);
  border-top: 1px solid var(--linie); padding: 8px 12px calc(8px + env(safe-area-inset-bottom)); display: flex; gap: 6px; flex-wrap: nowrap; overflow-x: auto;
  justify-content: flex-start; z-index: 11; -webkit-overflow-scrolling: touch; }
.leiste .knopf { flex: 0 0 auto; padding: 8px 11px; font-size: 14px; white-space: nowrap; }
@media (min-width: 700px) { .leiste { justify-content: center; } }
.verlauf { font-size: 13px; color: var(--leise); background: var(--karte); border-radius: 12px; padding: 8px 12px; margin-bottom: 10px; }
.liste-wahl .zeile { grid-template-columns: 1fr; }
.liste-wahl .baustein-text { white-space: pre-line; font-size: 13px; }

/* Login */
.login { max-width: 360px; margin: 40px auto; background: var(--karte); border-radius: 14px; padding: 18px; }
.login input { width: 100%; padding: 10px; margin: 6px 0; border-radius: 10px; border: 1px solid var(--linie); background: var(--feld); }
.login .knopf { width: 100%; margin-top: 8px; }
#meldung { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(80px + env(safe-area-inset-bottom)); background: rgba(30,30,30,.92); color: #fff;
  padding: 9px 14px; border-radius: 12px; z-index: 20; max-width: 90vw; }
