/* Vertrieb-PWA. Farben und Schriften wie elzaim.tech, alles lokal (kein fremder Server). */

@font-face {
  font-family: 'Source Sans 3';
  font-style: normal;
  font-weight: 200 900;
  font-display: swap;
  src: url('fonts/SourceSans3-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Source Sans 3';
  font-style: normal;
  font-weight: 200 900;
  font-display: swap;
  src: url('fonts/SourceSans3-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Source Serif 4';
  font-style: normal;
  font-weight: 200 900;
  font-display: swap;
  src: url('fonts/SourceSerif4-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --paper: #F1EBE1;
  --paper-2: #E6DDD0;
  --paper-3: #FAF6EF;
  --ink: #1F1A16;
  --ink-2: #5C534A;
  --line: #D4CBBC;
  --accent: #8F3D1B;
  --accent-tint: #F2E2D8;
  --gut: #2F6B3A;
  --warn: #9A5B00;
  --rot: #A3261B;
  --f-serif: "Source Serif 4", Georgia, serif;
  --f-sans: "Source Sans 3", -apple-system, "Helvetica Neue", Arial, sans-serif;
  --r: 14px;
  --reiter-h: 3.75rem;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 17px/1.45 var(--f-sans);
  padding-bottom: calc(var(--reiter-h) + env(safe-area-inset-bottom) + 1.5rem);
}
[hidden] { display: none !important; }

h1, h2 { font-family: var(--f-serif); font-weight: 600; line-height: 1.2; margin: 0 0 .6rem; }
h1 { font-size: clamp(1.35rem, 5.2vw, 1.6rem); text-wrap: balance; }
h2 { font-size: 1.2rem; }
p { margin: 0 0 .6rem; }
.klein { font-size: .86rem; color: var(--ink-2); }
.mitte { text-align: center; margin-top: 3rem; }
.fehler { color: var(--rot); font-weight: 600; }

.kopf {
  position: sticky; top: 0; z-index: 5;
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  padding: calc(.7rem + env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right)) .7rem max(1rem, env(safe-area-inset-left));
  background: var(--paper); border-bottom: 1px solid var(--line);
}
.marke { font: 600 1.15rem var(--f-serif); color: var(--accent); }
.kopf-rechts { display: flex; gap: .6rem; align-items: center; font-size: .9rem; color: var(--ink-2); }
.netz { background: var(--ink); color: var(--paper); border-radius: 99px; padding: .1rem .6rem; font-size: .8rem; }

main { max-width: 760px; margin: 0 auto; padding: 1rem max(1rem, env(safe-area-inset-left)); }

.blatt { margin: .5rem 0 1rem; }
.hervor { background: var(--accent-tint); border-left: 3px solid var(--accent); padding: .7rem .9rem; border-radius: 0 var(--r) var(--r) 0; font-size: .95rem; }

.karte {
  background: var(--paper-3); border: 1px solid var(--line); border-radius: var(--r);
  padding: 1rem; margin: 0 0 1rem; min-width: 0;
}
fieldset.karte { padding-top: .4rem; }
legend { font: 600 1.05rem var(--f-serif); padding: 0 .3rem; margin-left: -.3rem; }
legend .klein { font-family: var(--f-sans); font-weight: 400; }
.unterkopf { font-weight: 600; margin: .8rem 0 .2rem; }

.feld { display: block; font-weight: 600; font-size: .92rem; margin: .7rem 0 0; }
.feld input, .feld select, textarea {
  display: block; width: 100%; margin-top: .3rem;
  font: 400 17px var(--f-sans); color: var(--ink);
  background: #fff; border: 1px solid var(--line); border-radius: 10px;
  padding: .7rem .8rem; min-height: 48px;
  -webkit-appearance: none; appearance: none;
}
.feld select {
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-2) 50%), linear-gradient(135deg, var(--ink-2) 50%, transparent 50%);
  background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%;
  background-size: 6px 6px; background-repeat: no-repeat; padding-right: 2.2rem;
}
textarea { resize: vertical; min-height: 6rem; margin-top: .5rem; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, canvas:focus-visible {
  outline: 3px solid var(--accent); outline-offset: 2px;
}
.zwei { display: grid; grid-template-columns: 1fr 1fr; gap: 0 .8rem; }
@media (max-width: 560px) { .zwei { grid-template-columns: 1fr; } }

.wahl {
  display: flex; align-items: flex-start; gap: .7rem;
  padding: .7rem .2rem; min-height: 48px; border-bottom: 1px solid var(--line);
  cursor: pointer;
}
.wahl:last-child { border-bottom: 0; }
.wahl input { width: 1.35rem; height: 1.35rem; margin: .05rem 0 0; flex: none; accent-color: var(--accent); }
.wahl span { flex: 1; }
.wahl em { font-style: normal; white-space: nowrap; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.haken { border-bottom: 0; }

.paar { display: flex; justify-content: space-between; gap: 1rem; padding: .45rem 0; border-bottom: 1px solid var(--line); }
.paar span { color: var(--ink-2); }
.paar strong { font-variant-numeric: tabular-nums; text-align: right; }
.paar.gross { margin-top: .8rem; font-size: 1.1rem; border-bottom: 0; }

#unterschriftBox { margin: .6rem 0 .4rem; }
#unterschrift {
  display: block; width: 100%; height: 200px; touch-action: none;
  background: #fff; border: 1px solid var(--line); border-radius: 10px;
  background-image: linear-gradient(var(--line), var(--line));
  background-size: calc(100% - 3rem) 1px; background-position: 1.5rem 75%; background-repeat: no-repeat;
}
.unter-leiste { display: flex; justify-content: space-between; align-items: center; margin-top: .4rem; }

.fehlt { border-color: var(--rot) !important; }
.fehlt > input, .fehlt > select { border-color: var(--rot); }
fieldset.fehlt, .karte .fehlt { box-shadow: inset 3px 0 0 var(--rot); }
label.fehlt { color: var(--rot); }

.meldungen {
  list-style: none; margin: 0 0 1rem; padding: .8rem 1rem;
  background: #FBE9E6; border: 1px solid #E8B9B2; border-radius: var(--r); color: var(--rot);
}
.meldungen li { padding: .2rem 0; }
.meldungen li::before { content: "– "; }

button { font: inherit; cursor: pointer; }
.haupt {
  display: block; width: 100%; min-height: 54px; border: 0; border-radius: var(--r);
  background: var(--accent); color: #fff; font-weight: 700; font-size: 1.05rem;
}
.haupt:active { filter: brightness(.92); }
.haupt[disabled] { opacity: .5; }
.leise {
  min-height: 40px; padding: .4rem .9rem; border-radius: 10px;
  border: 1px solid var(--line); background: var(--paper); color: var(--ink);
}
.leise.rot { color: var(--rot); border-color: #E8B9B2; }

.reiter {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 6;
  display: grid; grid-template-columns: repeat(3, 1fr);
  height: calc(var(--reiter-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: var(--paper-3); border-top: 1px solid var(--line);
}
.reiter button { border: 0; background: none; color: var(--ink-2); font-weight: 600; }
.reiter button[aria-current="page"] { color: var(--accent); box-shadow: inset 0 3px 0 var(--accent); }
.zahl { display: inline-block; min-width: 1.4em; padding: 0 .35em; border-radius: 99px; background: var(--accent); color: #fff; font-size: .78rem; }

.hinweis {
  position: fixed; left: 50%; transform: translateX(-50%); z-index: 7;
  bottom: calc(var(--reiter-h) + env(safe-area-inset-bottom) + .8rem);
  width: min(92vw, 560px); padding: .8rem 1rem; border-radius: var(--r);
  background: var(--ink); color: var(--paper); box-shadow: 0 6px 24px rgba(31, 26, 22, .25);
}

/* Übersicht */
.saldo { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .8rem; }
.zahlbox { background: var(--paper-3); border: 1px solid var(--line); border-radius: var(--r); padding: .8rem 1rem; }
.zahlbox span { display: block; color: var(--ink-2); font-size: .86rem; }
.zahlbox strong { font: 600 1.5rem var(--f-serif); font-variant-numeric: tabular-nums; }
.zahlbox.akzent strong { color: var(--accent); }
.zahlbox.rot strong { color: var(--rot); }
.eintrag { padding: .8rem 0; border-bottom: 1px solid var(--line); }
.eintrag:last-child { border-bottom: 0; }
.eintrag-kopf { display: flex; justify-content: space-between; gap: 1rem; }
.teil { display: grid; grid-template-columns: 1fr 5.5rem 12.5rem; gap: .2rem .8rem; font-size: .92rem; padding: .15rem 0; }
.teil strong { font-variant-numeric: tabular-nums; text-align: right; }
.gut { color: var(--gut); font-weight: 600; }
.warn { color: var(--warn); }
@media (max-width: 480px) { .teil { grid-template-columns: 1fr auto; } .teil .stand { grid-column: 1 / -1; } }
