/* Kratzbaumrechner – Oberflaeche
   Farbwelt: Werkstatt-Petrol + Sisalfaser-Gold auf hellem Steingrau. */

:root {
  --petrol:      #0E3A44;
  --petrol-dark: #082A32;
  --petrol-soft: #2B5A64;
  --sisal:       #BE7D1E;
  --sisal-hell:  #F3E3C6;
  --paper:       #EBEEEA;
  --karte:       #FFFFFF;
  --linie:       #D3D9D3;
  --tinte:       #16232A;
  --gedaempft:   #5F6F6E;
  --warnung:     #A33724;

  --radius:   10px;
  --radius-s: 6px;
  --tab-h:    62px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--tinte);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

input, select, button, textarea { font: inherit; color: inherit; }

.zahl { font-variant-numeric: tabular-nums; }

/* ---------- Kopfzeile ---------- */

.kopf {
  background: var(--petrol);
  color: #fff;
  padding: calc(env(safe-area-inset-top) + 14px) 18px 14px;
  position: sticky;
  top: 0;
  z-index: 20;
}

.kopf h1 {
  margin: 0;
  font-size: 19px;
  font-weight: 620;
  letter-spacing: -0.01em;
}

.kopf p {
  margin: 2px 0 0;
  font-size: 13px;
  color: #A9C3C7;
}

/* Massband-Streifen: greift das Ausmessen der Saeule auf */
.massband {
  height: 9px;
  background:
    repeating-linear-gradient(90deg,
      var(--petrol-soft) 0 1px, transparent 1px 8px),
    var(--petrol-dark);
  border-bottom: 1px solid rgba(0, 0, 0, .25);
}

.massband--gold {
  background:
    repeating-linear-gradient(90deg,
      rgba(190, 125, 30, .55) 0 1px, transparent 1px 8px),
    transparent;
  border: 0;
  border-top: 1px solid var(--linie);
}

/* ---------- Grundgeruest ---------- */

.inhalt {
  padding: 16px 14px calc(var(--tab-h) + env(safe-area-inset-bottom) + 140px);
  max-width: 620px;
  margin: 0 auto;
}

.abschnitt-titel {
  margin: 22px 2px 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--gedaempft);
}

.abschnitt-titel:first-child { margin-top: 4px; }

.karte {
  background: var(--karte);
  border: 1px solid var(--linie);
  border-radius: var(--radius);
  margin-bottom: 12px;
  overflow: hidden;
}

.karte-kopf {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--linie);
  background: #F7F8F6;
}

.karte-kopf h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  flex: 1;
}

.nummer {
  width: 26px;
  height: 26px;
  flex: none;
  display: grid;
  place-items: center;
  background: var(--petrol);
  color: #fff;
  border-radius: var(--radius-s);
  font-size: 13px;
  font-weight: 600;
}

.karte-koerper { padding: 14px; }

/* ---------- Formular ---------- */

.feld { margin-bottom: 12px; }
.feld:last-child { margin-bottom: 0; }

.feld label {
  display: block;
  font-size: 13px;
  font-weight: 550;
  margin-bottom: 5px;
  color: var(--gedaempft);
}

.eingabe, select.eingabe {
  width: 100%;
  padding: 11px 12px;
  background: #fff;
  border: 1px solid var(--linie);
  border-radius: var(--radius-s);
  font-size: 17px;
  appearance: none;
}

.eingabe:focus-visible,
button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--sisal);
  outline-offset: 1px;
}

select.eingabe {
  background-image:
    linear-gradient(45deg, transparent 50%, var(--gedaempft) 50%),
    linear-gradient(135deg, var(--gedaempft) 50%, transparent 50%);
  background-position: right 17px center, right 12px center;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 32px;
}

.mit-einheit { position: relative; }

.mit-einheit .einheit {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
  color: var(--gedaempft);
  pointer-events: none;
}

.mit-einheit .eingabe { padding-right: 46px; }

.zeile { display: flex; gap: 10px; }
.zeile > * { flex: 1; min-width: 0; }

/* Umschalter Umfang / Durchmesser */
.schalter {
  display: inline-flex;
  background: var(--paper);
  border: 1px solid var(--linie);
  border-radius: var(--radius-s);
  padding: 2px;
  margin-bottom: 5px;
}

.schalter button {
  border: 0;
  background: none;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 550;
  color: var(--gedaempft);
}

.schalter button[aria-pressed="true"] {
  background: var(--petrol);
  color: #fff;
}

/* ---------- Knoepfe ---------- */

.knopf {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: 100%;
  padding: 13px 16px;
  border: 1px solid transparent;
  border-radius: var(--radius-s);
  background: var(--petrol);
  color: #fff;
  font-size: 16px;
  font-weight: 600;
}

.knopf:active { background: var(--petrol-dark); }

.knopf--zweit {
  background: #fff;
  color: var(--petrol);
  border-color: var(--linie);
}

.knopf--gold { background: var(--sisal); }
.knopf--gold:active { background: #A26A15; }

.knopf--klein {
  width: auto;
  padding: 7px 12px;
  font-size: 14px;
}

.knopf--text {
  background: none;
  border: 0;
  color: var(--warnung);
  font-size: 14px;
  font-weight: 550;
  padding: 6px 4px;
  width: auto;
}

/* ---------- Ergebnis je Saeule ---------- */

.ergebnis {
  border-top: 1px dashed var(--linie);
  margin-top: 12px;
  padding-top: 11px;
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

.ergebnis .laenge {
  font-size: 26px;
  font-weight: 650;
  letter-spacing: -0.02em;
  color: var(--petrol);
}

.ergebnis .kosten {
  font-size: 16px;
  font-weight: 600;
  color: var(--sisal);
}

.ergebnis .detail {
  flex-basis: 100%;
  font-size: 13px;
  color: var(--gedaempft);
}

.leer {
  padding: 26px 18px;
  text-align: center;
  color: var(--gedaempft);
  font-size: 14px;
}

/* ---------- Summenleiste ---------- */

.summe {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(var(--tab-h) + env(safe-area-inset-bottom));
  z-index: 15;
  background: #fff;
  border-top: 1px solid var(--linie);
  padding-bottom: 0;
}

.summe-inhalt {
  max-width: 620px;
  margin: 0 auto;
  padding: 10px 16px 12px;
  display: flex;
  align-items: flex-end;
  gap: 14px;
}

.summe-block { flex: 1; }

.summe-block span {
  display: block;
  font-size: 12px;
  color: var(--gedaempft);
  margin-bottom: 1px;
}

.summe-block strong {
  font-size: 22px;
  font-weight: 650;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.summe-block--kosten strong { color: var(--sisal); }

/* ---------- Tableiste ---------- */

.tabs {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 18;
  display: flex;
  background: var(--petrol);
  padding-bottom: env(safe-area-inset-bottom);
}

.tabs a {
  flex: 1;
  height: var(--tab-h);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: #93B0B5;
  text-decoration: none;
  font-size: 12px;
  font-weight: 550;
}

.tabs a[aria-current="page"] { color: #fff; }
.tabs a[aria-current="page"] svg { opacity: 1; }
.tabs svg { width: 22px; height: 22px; opacity: .75; }

/* ---------- Einkaufsliste ---------- */

.liste-zeile {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--linie);
}

.liste-zeile:last-child { border-bottom: 0; }

.liste-zeile .haupt { flex: 1; min-width: 0; }

.liste-zeile .haupt b {
  display: block;
  font-size: 15px;
  font-weight: 600;
}

.liste-zeile .haupt small {
  color: var(--gedaempft);
  font-size: 13px;
}

.liste-zeile .wert {
  text-align: right;
  font-weight: 600;
  white-space: nowrap;
}

.liste-zeile .wert small {
  display: block;
  font-weight: 500;
  color: var(--sisal);
}

/* ---------- Hinweise ---------- */

.hinweis {
  background: var(--sisal-hell);
  border: 1px solid #E2CDA2;
  border-radius: var(--radius-s);
  padding: 11px 13px;
  font-size: 13.5px;
  color: #6B4A0E;
  margin-bottom: 12px;
}

.fehler {
  background: #F7E2DE;
  border: 1px solid #E3B7AE;
  color: #7C2718;
  border-radius: var(--radius-s);
  padding: 11px 13px;
  font-size: 14px;
  margin-bottom: 14px;
}

/* ---------- Anmeldung ---------- */

.anmelden {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 24px 22px calc(24px + env(safe-area-inset-bottom));
  max-width: 420px;
  margin: 0 auto;
}

.anmelden .marke {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 26px;
}

.anmelden .marke img { width: 52px; height: 52px; border-radius: 12px; }
.anmelden .marke h1 { margin: 0; font-size: 21px; font-weight: 650; }
.anmelden .marke p { margin: 0; font-size: 14px; color: var(--gedaempft); }

/* ---------- Oeffentliche Seite ---------- */

.oeffentlich {
  min-height: 100dvh;
  background: var(--petrol);
  color: #E9F0F0;
  display: flex;
  flex-direction: column;
}

.oeffentlich .band {
  height: 10px;
  background: repeating-linear-gradient(90deg,
    rgba(190, 125, 30, .8) 0 2px, transparent 2px 10px);
}

.oeffentlich .mitte {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 40px 26px;
  max-width: 560px;
  margin: 0 auto;
  width: 100%;
}

.oeffentlich h1 {
  font-size: clamp(28px, 8vw, 40px);
  line-height: 1.12;
  font-weight: 640;
  letter-spacing: -0.025em;
  margin: 0 0 16px;
  max-width: 15ch;
}

.oeffentlich p {
  font-size: 16.5px;
  line-height: 1.6;
  color: #B7CBCD;
  margin: 0 0 14px;
  max-width: 60ch;
}

.oeffentlich .status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  align-self: flex-start;
  border: 1px solid rgba(190, 125, 30, .55);
  color: var(--sisal-hell);
  border-radius: 100px;
  padding: 5px 13px;
  font-size: 13px;
  font-weight: 550;
  margin-bottom: 22px;
}

.oeffentlich .punkt {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--sisal);
}

.oeffentlich .fuss {
  border-top: 1px solid rgba(255, 255, 255, .12);
  padding: 18px 26px calc(18px + env(safe-area-inset-bottom));
  font-size: 13.5px;
  color: #8FA9AC;
}

.oeffentlich .fuss b { color: #C6D6D7; font-weight: 600; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
