/* Rechnungen – ruhiges, reduziertes Oberflächendesign */

:root {
  --bg:        #faf9f7;
  --flaeche:   #ffffff;
  --flaeche-2: #f2f1ee;
  --tinte:     #1f2124;
  --tinte-2:   #5c6167;
  --tinte-3:   #8e9399;
  --linie:     #e5e3de;
  --linie-2:   #d5d2cb;
  --akzent:    #a9682f;
  --akzent-bg: #f7efe6;
  --gut:       #3c6f4d;
  --warn:      #9c5320;
  --warn-bg:   #fbf1e7;
  --fehler:    #a03a32;
  --fehler-bg: #fbeeed;
  --radius:    12px;
  --schatten:  0 1px 2px rgba(31,33,36,.06), 0 1px 1px rgba(31,33,36,.04);
  --sicher-u:  env(safe-area-inset-bottom, 0px);
  --sicher-o:  env(safe-area-inset-top, 0px);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:        #17191c;
    --flaeche:   #1f2225;
    --flaeche-2: #26292d;
    --tinte:     #e8e6e2;
    --tinte-2:   #a7abb0;
    --tinte-3:   #7c8085;
    --linie:     #303438;
    --linie-2:   #3d4247;
    --akzent:    #cf8b4d;
    --akzent-bg: #2c2520;
    --gut:       #6fae84;
    --warn:      #d79457;
    --warn-bg:   #2c2520;
    --fehler:    #d98079;
    --fehler-bg: #2e2121;
    --schatten:  0 1px 2px rgba(0,0,0,.3);
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--tinte);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

h1, h2, h3 { font-weight: 600; letter-spacing: -0.01em; margin: 0; }

a { color: inherit; }

/* ---------- Grundgerüst ---------- */

.kopf {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--linie);
  padding-top: var(--sicher-o);
}
.kopf-inner {
  max-width: 720px; margin: 0 auto;
  height: 52px; padding: 0 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.kopf h1 { font-size: 17px; }
.kopf-person {
  border: 1px solid var(--linie-2); background: transparent; color: var(--tinte-2);
  font: inherit; font-size: 13px; line-height: 1;
  padding: 7px 12px; border-radius: 999px; cursor: pointer;
  max-width: 45vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.kopf-person:active { background: var(--flaeche-2); }

main {
  max-width: 720px; margin: 0 auto;
  padding: 20px 16px calc(84px + var(--sicher-u));
  outline: none;
}

.navi {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: flex; justify-content: center;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-top: 1px solid var(--linie);
  padding-bottom: var(--sicher-u);
}
.navi a {
  flex: 1 1 0; max-width: 180px;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 9px 4px 10px;
  text-decoration: none; color: var(--tinte-3);
  font-size: 11px; letter-spacing: .01em;
  -webkit-tap-highlight-color: transparent;
}
.navi a svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.navi a[aria-current="page"] { color: var(--tinte); }

/* ---------- Bausteine ---------- */

.karte {
  background: var(--flaeche);
  border: 1px solid var(--linie);
  border-radius: var(--radius);
  box-shadow: var(--schatten);
}
.karte + .karte { margin-top: 12px; }
.karte-inhalt { padding: 16px; }

.abschnitt { margin-bottom: 26px; }
.abschnitt > h2 {
  font-size: 12px; text-transform: uppercase; letter-spacing: .07em;
  color: var(--tinte-3); font-weight: 600; margin: 0 2px 9px;
}

.knopf {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-size: 15px; font-weight: 500;
  padding: 12px 18px; min-height: 46px;
  border-radius: 10px; border: 1px solid var(--linie-2);
  background: var(--flaeche); color: var(--tinte);
  cursor: pointer; text-decoration: none; text-align: center;
  -webkit-tap-highlight-color: transparent;
}
.knopf:active { background: var(--flaeche-2); }
.knopf:disabled { opacity: .45; cursor: default; }
.knopf-haupt { background: var(--tinte); color: var(--bg); border-color: var(--tinte); }
.knopf-haupt:active { background: var(--tinte-2); }
.knopf-breit { width: 100%; }
.knopf-still { border-color: transparent; background: transparent; color: var(--tinte-2); }
.knopf-still:active { background: var(--flaeche-2); }
.knopf-gefahr { color: var(--fehler); border-color: color-mix(in srgb, var(--fehler) 35%, transparent); }
.knopf-reihe { display: flex; gap: 10px; }
.knopf-reihe > * { flex: 1; }

.knopf svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* Große Auswahlflächen zum Erfassen */
.wahl {
  display: flex; align-items: center; gap: 14px; width: 100%;
  padding: 18px 16px; text-align: left;
  border: 1px solid var(--linie); border-radius: var(--radius);
  background: var(--flaeche); box-shadow: var(--schatten);
  font: inherit; color: var(--tinte); cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.wahl + .wahl { margin-top: 10px; }
.wahl:active { background: var(--flaeche-2); }
.wahl-symbol {
  flex: none; width: 42px; height: 42px; border-radius: 11px;
  background: var(--flaeche-2); display: grid; place-items: center; color: var(--tinte-2);
}
.wahl-symbol svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.wahl-text { min-width: 0; }
.wahl-titel { display: block; font-weight: 550; font-size: 15.5px; }
.wahl-unter { display: block; font-size: 13px; color: var(--tinte-3); margin-top: 1px; }

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

.feld { margin-bottom: 14px; }
.feld > label, .feld-titel {
  display: block; font-size: 12.5px; color: var(--tinte-2);
  margin-bottom: 5px; font-weight: 500;
}
.feld input[type="text"], .feld input[type="date"], .feld input[type="number"],
.feld input[type="search"], .feld textarea, .feld select {
  width: 100%; font: inherit; font-size: 16px; /* 16px verhindert Zoom auf Android */
  padding: 11px 12px; min-height: 46px;
  border: 1px solid var(--linie-2); border-radius: 10px;
  background: var(--flaeche); color: var(--tinte);
  -webkit-appearance: none; appearance: none;
}
.feld textarea { min-height: 72px; resize: vertical; line-height: 1.45; }
.feld input:focus, .feld textarea:focus, .feld select:focus {
  outline: 2px solid color-mix(in srgb, var(--akzent) 55%, transparent); outline-offset: 1px;
  border-color: var(--akzent);
}
.feld-hinweis { font-size: 12px; color: var(--tinte-3); margin-top: 5px; }
.feld-paar { display: flex; gap: 10px; }
.feld-paar > * { flex: 1; min-width: 0; }
.feld input.geschaetzt { border-color: var(--akzent); background: var(--akzent-bg); }

input[type="date"] { min-height: 46px; }
input::placeholder, textarea::placeholder { color: var(--tinte-3); }

/* Steuersatz-Umschalter */
.satzwahl { display: flex; gap: 8px; }
.satzwahl button {
  flex: 1; font: inherit; font-size: 15px; padding: 11px 6px; min-height: 46px;
  border: 1px solid var(--linie-2); border-radius: 10px;
  background: var(--flaeche); color: var(--tinte-2); cursor: pointer;
}
.satzwahl button[aria-pressed="true"] {
  background: var(--tinte); color: var(--bg); border-color: var(--tinte); font-weight: 550;
}

/* ---------- Liste ---------- */

.suche { position: relative; margin-bottom: 12px; }
.suche input { padding-left: 38px !important; }
.suche svg {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  width: 17px; height: 17px; color: var(--tinte-3);
  fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round;
}

.filterreihe {
  display: flex; gap: 8px; overflow-x: auto; margin: 0 -16px 14px; padding: 2px 16px 6px;
  scrollbar-width: none;
}
.filterreihe::-webkit-scrollbar { display: none; }
.filterreihe select {
  flex: none; font: inherit; font-size: 13.5px; padding: 8px 30px 8px 12px;
  border: 1px solid var(--linie-2); border-radius: 999px;
  background: var(--flaeche) no-repeat right 11px center;
  background-size: 12px 12px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'><path d='M2.5 4.5 6 8l3.5-3.5' fill='none' stroke='%238e9399' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  color: var(--tinte); -webkit-appearance: none; appearance: none; cursor: pointer;
}
.filterreihe select.aktiv { border-color: var(--tinte); color: var(--tinte); font-weight: 500; }

.monatskopf {
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
  margin: 22px 2px 8px; padding-top: 4px;
}
.monatskopf:first-child { margin-top: 4px; }
.monatskopf h2 { font-size: 14px; font-weight: 600; }
.monatskopf span { font-size: 12.5px; color: var(--tinte-3); font-variant-numeric: tabular-nums; }

.eintrag {
  display: flex; align-items: center; gap: 13px; width: 100%;
  padding: 13px 14px; border: none; border-bottom: 1px solid var(--linie);
  background: var(--flaeche); font: inherit; color: inherit; text-align: left; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.eintrag:first-child { border-top-left-radius: var(--radius); border-top-right-radius: var(--radius); }
.eintrag:last-child { border-bottom: none; border-bottom-left-radius: var(--radius); border-bottom-right-radius: var(--radius); }
.eintrag:active { background: var(--flaeche-2); }
.eintrag-bild {
  flex: none; width: 42px; height: 42px; border-radius: 8px; object-fit: cover;
  background: var(--flaeche-2); display: grid; place-items: center;
  color: var(--tinte-3); font-size: 10px; font-weight: 600; letter-spacing: .04em;
  border: 1px solid var(--linie); overflow: hidden;
}
.eintrag-mitte { flex: 1; min-width: 0; }
.eintrag-titel {
  font-size: 15px; font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.eintrag-unter {
  font-size: 12.5px; color: var(--tinte-3); margin-top: 1px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.eintrag-betrag {
  flex: none; text-align: right; font-size: 15px;
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.eintrag-betrag small { display: block; font-size: 11.5px; color: var(--tinte-3); font-weight: 400; }

.gruppe { background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--radius); box-shadow: var(--schatten); overflow: hidden; }

/* ---------- Tabelle für Summen ---------- */

.tabelle { width: 100%; border-collapse: collapse; font-size: 14px; }
.tabelle th, .tabelle td { padding: 10px 14px; text-align: right; font-variant-numeric: tabular-nums; }
.tabelle th:first-child, .tabelle td:first-child { text-align: left; font-variant-numeric: normal; }
.tabelle thead th {
  font-size: 11px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--tinte-3); font-weight: 600; padding-top: 12px; padding-bottom: 8px;
}
.tabelle tbody tr { border-top: 1px solid var(--linie); }
.tabelle tbody td:first-child { max-width: 42vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tabelle tfoot td { border-top: 2px solid var(--linie-2); font-weight: 600; padding-top: 12px; padding-bottom: 14px; }
.tabelle-huelle { overflow-x: auto; }

/* ---------- Meldungen ---------- */

.hinweis {
  display: flex; gap: 11px; align-items: flex-start;
  padding: 13px 15px; border-radius: var(--radius);
  font-size: 13.5px; line-height: 1.45;
  background: var(--flaeche-2); color: var(--tinte-2);
  border: 1px solid var(--linie);
}
.hinweis svg { width: 18px; height: 18px; flex: none; margin-top: 1px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.hinweis-warnung { background: var(--warn-bg); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 25%, transparent); }
.hinweis-fehler  { background: var(--fehler-bg); color: var(--fehler); border-color: color-mix(in srgb, var(--fehler) 25%, transparent); }
.hinweis strong { font-weight: 600; }
.hinweis + .hinweis { margin-top: 10px; }
.hinweis-knopf { margin-left: auto; align-self: center; }

.leer { text-align: center; padding: 48px 20px; color: var(--tinte-3); }
.leer svg { width: 34px; height: 34px; margin-bottom: 12px; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; opacity: .7; }
.leer p { margin: 0 0 4px; font-size: 14.5px; }
.leer .klein { font-size: 13px; opacity: .85; }

.klein { font-size: 12.5px; color: var(--tinte-3); line-height: 1.5; }

/* ---------- Fortschritt ---------- */

.fortschritt { padding: 40px 20px; text-align: center; }
.fortschritt-balken {
  height: 4px; border-radius: 2px; background: var(--flaeche-2);
  overflow: hidden; margin: 18px auto 0; max-width: 260px;
}
.fortschritt-balken i { display: block; height: 100%; background: var(--tinte-2); border-radius: 2px; transition: width .25s ease; }
.fortschritt p { margin: 0; font-size: 14.5px; }
.fortschritt .klein { margin-top: 6px; }

.spinner {
  width: 26px; height: 26px; margin: 0 auto 16px;
  border: 2px solid var(--linie-2); border-top-color: var(--tinte-2);
  border-radius: 50%; animation: dreh .8s linear infinite;
}
@keyframes dreh { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2.4s; } }

/* ---------- Belegansicht ---------- */

.beleg-bild {
  width: 100%; border-radius: var(--radius); border: 1px solid var(--linie);
  display: block; background: var(--flaeche-2);
}
.beleg-voll {
  position: fixed; inset: 0; z-index: 60; background: #0e0f11;
  display: flex; align-items: center; justify-content: center; padding: 0;
}
.beleg-voll img { max-width: 100%; max-height: 100%; object-fit: contain; }
.beleg-voll button {
  position: absolute; top: calc(12px + var(--sicher-o)); right: 12px;
  width: 40px; height: 40px; border-radius: 999px; border: none;
  background: rgba(255,255,255,.16); color: #fff; font-size: 22px; line-height: 1; cursor: pointer;
}

/* ---------- Meldungsstreifen unten ---------- */

.toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(78px + var(--sicher-u)); z-index: 70;
  background: var(--tinte); color: var(--bg);
  padding: 11px 17px; border-radius: 999px; font-size: 14px;
  box-shadow: 0 6px 20px rgba(0,0,0,.18);
  max-width: calc(100vw - 32px); text-align: center;
  animation: auf .18s ease;
}
@keyframes auf { from { opacity: 0; transform: translate(-50%, 6px); } }

/* ---------- Dialog ---------- */

.dialog-hintergrund {
  position: fixed; inset: 0; z-index: 80; background: rgba(20,21,23,.42);
  display: flex; align-items: flex-end; justify-content: center;
  padding: 16px; padding-bottom: calc(16px + var(--sicher-u));
}
@media (min-width: 560px) { .dialog-hintergrund { align-items: center; } }
.dialog {
  background: var(--flaeche); border-radius: 16px; width: 100%; max-width: 380px;
  padding: 20px; box-shadow: 0 10px 40px rgba(0,0,0,.22);
  animation: hoch .2s ease;
}
@keyframes hoch { from { transform: translateY(14px); opacity: 0; } }
.dialog h2 { font-size: 16.5px; margin-bottom: 7px; }
.dialog p { margin: 0 0 18px; font-size: 14px; color: var(--tinte-2); line-height: 1.5; }
.dialog .knopf-reihe { margin-top: 4px; }

/* ---------- Startfehler ---------- */

.startfehler { max-width: 520px; margin: 60px auto; padding: 0 24px; }
.startfehler h1 { font-size: 19px; margin-bottom: 10px; }
.startfehler p { color: var(--tinte-2); font-size: 14.5px; }
.startfehler code { background: var(--flaeche-2); padding: 1px 5px; border-radius: 4px; font-size: 13px; }

/* ---------- Kleinigkeiten ---------- */

.versteckt { display: none !important; }
.trenner { height: 1px; background: var(--linie); margin: 16px 0; border: none; }
.zeile { display: flex; justify-content: space-between; gap: 14px; padding: 9px 0; font-size: 14.5px; }
.zeile + .zeile { border-top: 1px solid var(--linie); }
.zeile dt { color: var(--tinte-2); flex: none; }
.zeile dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; min-width: 0; overflow-wrap: anywhere; }
dl { margin: 0; }

/* [hidden] muss auch bei display:flex greifen */
[hidden] { display: none !important; }

/* Beträge in Tabellen nie umbrechen – die Tabelle scrollt stattdessen */
.tabelle th, .tabelle td { white-space: nowrap; }
.filterreihe select { padding-right: 34px; }

/* Auf schmalen Geräten müssen alle vier Spalten nebeneinander passen */
@media (max-width: 480px) {
  .tabelle th, .tabelle td { padding: 9px 7px; font-size: 13px; }
  .tabelle thead th { font-size: 10px; letter-spacing: .04em; }
  .tabelle tbody td:first-child { max-width: 30vw; }
}
