:root {
  --navy: #0b3a5b; --navy2: #14527f; --akzent: #f08a24; --bg: #f2f5f8; --karte: #fff;
  --text: #17222d; --grau: #6b7a88; --linie: #dde4ea; --gruen: #1f8a4c; --rot: #c0392b; --gelb: #fff4dd;
  --radius: 14px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }
body { min-height: 100vh; min-height: 100dvh; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3 { margin: 0; }

.kopf { background: var(--navy); color: #fff; padding: calc(env(safe-area-inset-top) + 14px) 18px 14px; position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.kopf h1 { font-size: 19px; letter-spacing: .2px; }
.kopf small { opacity: .75; font-size: 13px; display: block; }
.kopf .klein { background: rgba(255,255,255,.15); border: 0; color: #fff; padding: 8px 12px; border-radius: 10px; font-size: 14px; }

main { padding: 14px 14px calc(96px + env(safe-area-inset-bottom)); max-width: 720px; margin: 0 auto; }

.tabs { position: fixed; left: 0; right: 0; bottom: 0; background: #fff; border-top: 1px solid var(--linie); display: grid; grid-template-columns: repeat(4, 1fr); padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); z-index: 6; max-width: 720px; margin: 0 auto; }
.tabs button { background: none; border: 0; padding: 6px 2px; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 12px; color: var(--grau); min-height: 52px; }
.tabs button .ic { font-size: 22px; line-height: 1; }
.tabs button.aktiv { color: var(--navy); font-weight: 600; }
.tabs button.plus .ic { background: var(--akzent); color: #fff; width: 44px; height: 44px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 28px; margin-top: -18px; box-shadow: 0 4px 12px rgba(240,138,36,.45); }
.tabs button.plus { color: var(--text); }

.karte { background: var(--karte); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 12px; box-shadow: 0 1px 2px rgba(0,0,0,.04); }
.karte h2 { font-size: 15px; color: var(--grau); font-weight: 600; margin-bottom: 8px; text-transform: uppercase; letter-spacing: .4px; }
.raster3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.kachel { background: var(--karte); border-radius: var(--radius); padding: 12px 10px; text-align: center; box-shadow: 0 1px 2px rgba(0,0,0,.04); }
.kachel .z { font-size: 12px; color: var(--grau); }
.kachel .w { font-size: 17px; font-weight: 700; margin-top: 3px; white-space: nowrap; }
.pos { color: var(--gruen); } .neg { color: var(--rot); }
.hinweis { background: var(--gelb); border: 1px solid #f3d9a0; border-radius: 12px; padding: 12px 14px; margin-bottom: 12px; font-size: 14.5px; }
.hinweis button { margin-top: 8px; }
.info { color: var(--grau); font-size: 13.5px; }

.jahr { display: flex; align-items: center; justify-content: center; gap: 16px; margin: 2px 0 12px; }
.jahr button { background: #fff; border: 1px solid var(--linie); width: 40px; height: 40px; border-radius: 50%; font-size: 18px; }
.jahr b { font-size: 20px; min-width: 64px; text-align: center; }

.balken { height: 9px; background: #e8edf2; border-radius: 6px; overflow: hidden; margin-top: 4px; }
.balken i { display: block; height: 100%; background: var(--navy2); border-radius: 6px; }
.balken.warn i { background: var(--akzent); }
.zeile { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--linie); font-size: 15px; }
.zeile:last-child { border-bottom: 0; }
.zeile span:last-child { white-space: nowrap; font-variant-numeric: tabular-nums; font-weight: 600; }
.monate { display: flex; align-items: flex-end; gap: 4px; height: 90px; margin-top: 6px; }
.monate div { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 2px; height: 100%; font-size: 10px; color: var(--grau); }
.monate .s { display: flex; align-items: flex-end; gap: 2px; height: 72px; width: 100%; }
.monate .s i { flex: 1; border-radius: 3px 3px 0 0; min-height: 1px; }
.monate .e { background: var(--gruen); } .monate .a { background: var(--rot); opacity: .85; }

.chips { display: flex; gap: 8px; overflow-x: auto; margin-bottom: 10px; padding-bottom: 2px; }
.chips button { flex: none; background: #fff; border: 1px solid var(--linie); border-radius: 999px; padding: 7px 14px; font-size: 14px; }
.chips button.aktiv { background: var(--navy); color: #fff; border-color: var(--navy); }
.suche { width: 100%; padding: 11px 14px; border: 1px solid var(--linie); border-radius: 12px; background: #fff; margin-bottom: 10px; }

.eintrag { display: flex; gap: 12px; align-items: center; background: #fff; border-radius: 12px; padding: 12px 14px; margin-bottom: 8px; width: 100%; text-align: left; border: 0; box-shadow: 0 1px 2px rgba(0,0,0,.04); }
.eintrag .l { flex: 1; min-width: 0; }
.eintrag .t { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.eintrag .u { font-size: 13px; color: var(--grau); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.eintrag .r { text-align: right; font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.eintrag .r small { display: block; font-weight: 400; font-size: 12px; color: var(--grau); }
.eintrag.storno { opacity: .5; } .eintrag.storno .t { text-decoration: line-through; }
.fehlt { color: #b36a00; }
.leer { text-align: center; color: var(--grau); padding: 34px 10px; }

.btn { border: 0; border-radius: 12px; padding: 13px 18px; font-weight: 600; background: var(--navy); color: #fff; min-height: 46px; }
.btn.zweit { background: #fff; color: var(--navy); border: 1px solid var(--linie); }
.btn.akzent { background: var(--akzent); }
.btn.gefahr { background: #fff; color: var(--rot); border: 1px solid #efc6c1; }
.btn.voll { width: 100%; }
.btn:disabled { opacity: .55; }
.btnreihe { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.btnreihe .btn { flex: 1; min-width: 140px; }

.blatt-bg { position: fixed; inset: 0; background: rgba(10,25,40,.55); z-index: 20; display: flex; align-items: flex-end; justify-content: center; }
.blatt { background: var(--bg); width: 100%; max-width: 720px; max-height: 94dvh; overflow-y: auto; border-radius: 20px 20px 0 0; padding: 16px 16px calc(24px + env(safe-area-inset-bottom)); }
.blatt .oben { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.blatt .oben h2 { font-size: 19px; }
.blatt .zu { background: #e4eaf0; border: 0; width: 36px; height: 36px; border-radius: 50%; font-size: 18px; }

label.f { display: block; margin-bottom: 12px; font-size: 13.5px; color: var(--grau); font-weight: 600; }
label.f > input, label.f > select, label.f > textarea { display: block; width: 100%; margin-top: 5px; padding: 12px 13px; border: 1px solid var(--linie); border-radius: 12px; background: #fff; font-size: 16px; font-weight: 400; color: var(--text); }
textarea { min-height: 64px; resize: vertical; }
.art { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.art button { padding: 13px; border-radius: 12px; border: 2px solid var(--linie); background: #fff; font-weight: 700; }
.art button.aktiv.aus { border-color: var(--rot); color: var(--rot); background: #fdf1ef; }
.art button.aktiv.ein { border-color: var(--gruen); color: var(--gruen); background: #eef8f1; }
.betrag { font-size: 28px !important; font-weight: 700 !important; text-align: center; }
.beleg-box { border: 2px dashed #b9c6d2; border-radius: 14px; padding: 12px; text-align: center; background: #fff; margin-bottom: 12px; }
.beleg-box img { max-width: 100%; max-height: 260px; border-radius: 10px; display: block; margin: 0 auto 10px; }
.beleg-box .btnreihe { margin-top: 0; }
input[type=file] { display: none; }
.fehlertext { color: var(--rot); font-size: 14.5px; margin: 6px 0; }
.dl { display: grid; grid-template-columns: 110px 1fr; gap: 6px 10px; font-size: 15px; margin-bottom: 8px; }
.dl dt { color: var(--grau); } .dl dd { margin: 0; word-break: break-word; }
.beleg-ansicht img { max-width: 100%; border-radius: 12px; border: 1px solid var(--linie); background: #fff; }

.login { max-width: 380px; margin: 0 auto; padding: calc(env(safe-area-inset-top) + 56px) 22px 30px; text-align: center; }
.login .logo { width: 84px; height: 84px; border-radius: 20px; margin: 0 auto 14px; display: block; }
.login h1 { font-size: 24px; margin-bottom: 4px; color: var(--navy); }
.wahl { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 20px 0 12px; }
.wahl button { padding: 16px 8px; border-radius: 14px; border: 2px solid var(--linie); background: #fff; font-weight: 700; font-size: 17px; }
.wahl button.aktiv { border-color: var(--navy); background: #eaf2f8; color: var(--navy); }
.login input { width: 100%; padding: 15px; border-radius: 12px; border: 1px solid var(--linie); text-align: center; font-size: 24px; letter-spacing: 8px; background: #fff; margin-bottom: 12px; }

#toast { position: fixed; left: 50%; bottom: calc(92px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(20px); background: #17222d; color: #fff; padding: 11px 18px; border-radius: 12px; font-size: 15px; opacity: 0; pointer-events: none; transition: .25s; z-index: 40; max-width: 90vw; text-align: center; }
#toast.an { opacity: 1; transform: translateX(-50%) translateY(0); }

#druck { display: none; }
@media print {
  body { background: #fff; font-size: 11pt; }
  #app, #toast { display: none !important; }
  #druck { display: block; }
  #druck h1 { font-size: 18pt; margin-bottom: 2mm; }
  #druck table { width: 100%; border-collapse: collapse; margin: 4mm 0 6mm; }
  #druck th, #druck td { border-bottom: 1px solid #999; padding: 1.6mm 2mm; text-align: left; font-size: 10pt; }
  #druck td.z, #druck th.z { text-align: right; white-space: nowrap; }
  #druck h2 { font-size: 12.5pt; margin-top: 5mm; }
}
