/* bessERP Web – Design wie die Desktop-App (#191e28-Basis, weißer Primärton, grauer Akzent) */
:root {
  --bg: #191e28;
  --sidebar: #14181f;
  --karte: #1d2333;
  --karte2: #232a3a;
  --rand: #44484f;
  --akzent: #c5c7c4;
  --primaer: #ffffff;
  --auf-primaer: #191e28;
  --gewaehlt: #39414f;
  --gruen: #4ade80;
  --orange: #f59e0b;
  --rot: #f87171;
  --blau: #8ab4f8;
  --text: #f2f3f1;
  --text-dim: #a9adb0;
  --text-leise: #8a919d;
  --radius: 12px;
  --schatten: 0 8px 24px rgba(0, 0, 0, .35);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 "Segoe UI", system-ui, -apple-system, sans-serif;
  -webkit-text-size-adjust: 100%;
}

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

.sprung {
  position: absolute; left: -999px; top: 0; z-index: 50;
  background: var(--primaer); color: var(--auf-primaer); padding: 10px 14px; border-radius: 0 0 8px 0;
}
.sprung:focus { left: 0; }

/* ── Grundgerüst ───────────────────────────────────────────────────────── */
.rahmen { display: grid; grid-template-columns: 1fr; min-height: 100dvh; }

.seite { display: none; }

main {
  padding: 16px 16px calc(84px + env(safe-area-inset-bottom)) 16px;
  min-width: 0;
}

.kopf {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  flex-wrap: wrap;
  padding-top: env(safe-area-inset-top);
  margin-bottom: 12px;
}
/* Schmales Fenster: Suche und Knöpfe bekommen eine eigene Zeile, sonst wird der
   Neu-laden-Knopf abgeschnitten. */
@media (max-width: 699px) {
  .kopf.mit-suche .kopf-werkzeuge { width: 100%; }
  .kopf-werkzeuge .suche { flex: 1 1 auto; }
  .suche input { width: 100%; }
}
h1 { font-size: 22px; margin: 0; letter-spacing: .2px; }
.unter { margin: 2px 0 0; color: var(--text-leise); font-size: 12.5px; }
.kopf-werkzeuge { display: flex; gap: 8px; align-items: center; }

.suche {
  display: flex; align-items: center; gap: 6px;
  background: var(--karte2); border: 1px solid var(--rand); border-radius: 999px;
  padding: 0 12px; height: 40px; color: var(--text-leise);
}
.suche input { background: none; border: 0; outline: none; width: 150px; }
.suche:focus-within { border-color: var(--akzent); }

.knopf {
  background: var(--primaer); color: var(--auf-primaer); border: 0; border-radius: 10px;
  min-height: 40px; padding: 0 14px; cursor: pointer; font-weight: 600;
}
.knopf.leise {
  background: var(--karte2); color: var(--text); border: 1px solid var(--rand); font-weight: 500;
}
.knopf:hover { filter: brightness(1.08); }
.knopf:focus-visible, a:focus-visible, input:focus-visible { outline: 2px solid var(--akzent); outline-offset: 2px; }

/* ── Filter-Chips ──────────────────────────────────────────────────────── */
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 10px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto; background: var(--karte2); border: 1px solid var(--rand); color: var(--text-dim);
  border-radius: 999px; padding: 7px 14px; cursor: pointer; white-space: nowrap;
}
.chip[aria-pressed="true"] { background: var(--gewaehlt); color: var(--text); border-color: var(--gewaehlt); }

/* ── Kacheln ───────────────────────────────────────────────────────────── */
.kacheln { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 18px; }
.kachel {
  background: var(--karte); border: 1px solid var(--rand); border-radius: var(--radius);
  padding: 14px; text-align: left; cursor: pointer; display: block; width: 100%;
}
.kachel .label { display: block; color: var(--text-dim); font-size: 12.5px; }
.kachel .wert { display: block; font-size: 21px; font-weight: 700; margin-top: 6px; letter-spacing: -.3px; }
.kachel .zusatz { display: block; color: var(--text-leise); font-size: 12px; margin-top: 2px; }
.wert.rot { color: var(--rot); }
.wert.gruen { color: var(--gruen); }

h2.abschnitt { font-size: 13px; text-transform: uppercase; letter-spacing: .8px; color: var(--text-leise); margin: 22px 0 8px; }

/* ── Listen ────────────────────────────────────────────────────────────── */
.liste { display: flex; flex-direction: column; gap: 8px; }
.zeile {
  display: grid; grid-template-columns: 14px 1fr auto; gap: 10px; align-items: center;
  background: var(--karte); border: 1px solid var(--rand); border-radius: var(--radius);
  padding: 10px 14px; cursor: pointer; text-align: left; width: 100%; min-height: 58px;
}
.zeile .datum { display: none; }
/* Datum am Handy vorn in der Nebenzeile, am breiten Bildschirm als eigene Spalte */
@media (min-width: 900px) { .nur-schmal { display: none; } }
.zeile:hover { background: var(--karte2); }
.zeile[aria-current="true"] { border-color: var(--akzent); }
.punkt { width: 10px; height: 10px; border-radius: 50%; background: var(--text-leise); }
.punkt.gruen { background: var(--gruen); }
.punkt.orange { background: var(--orange); }
.punkt.rot { background: var(--rot); }
.punkt.blau { background: var(--blau); }
.zeile > span { min-width: 0; }
.zeile .haupt { font-weight: 600; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; overflow-wrap: anywhere; }
.zeile .neben {
  display: block; color: var(--text-leise); font-size: 12.5px; margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.zeile .rechts { text-align: right; white-space: nowrap; }
.zeile .rechts .betrag { font-weight: 600; }
.zeile .rechts .klein { color: var(--text-leise); font-size: 12px; }
.marker {
  font-size: 10px; letter-spacing: .5px; background: var(--gewaehlt); color: var(--text-dim);
  border-radius: 4px; padding: 2px 6px; text-transform: uppercase;
}
.negativ { color: var(--rot); }
.positiv { color: var(--gruen); }

/* ── Meldungen, Leer- und Ladezustand ──────────────────────────────────── */
.meldung { background: #3b1a1a; border: 1px solid var(--rot); color: var(--text); border-radius: 10px; padding: 10px 14px; margin-bottom: 12px; }
.leer { color: var(--text-leise); text-align: center; padding: 40px 10px; }
#bereich.laedt { opacity: .45; transition: opacity .12s ease; pointer-events: none; }
.skelett { background: var(--karte); border: 1px solid var(--rand); border-radius: var(--radius); height: 62px; animation: pulsieren 1.2s ease-in-out infinite; }
@keyframes pulsieren { 0%, 100% { opacity: .5; } 50% { opacity: .85; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ── Detail ────────────────────────────────────────────────────────────── */
.detail {
  position: fixed; inset: 0; z-index: 30; background: var(--bg);
  display: flex; flex-direction: column; overflow: hidden;
}
.detail-kopf {
  display: flex; align-items: center; gap: 10px; padding: calc(10px + env(safe-area-inset-top)) 12px 10px;
  border-bottom: 1px solid var(--rand); background: var(--sidebar); font-weight: 600;
}
.detail-inhalt { overflow: auto; padding: 16px 16px calc(24px + env(safe-area-inset-bottom)); }

.karte { background: var(--karte); border: 1px solid var(--rand); border-radius: var(--radius); padding: 14px; margin-bottom: 12px; }
form.karte { max-width: 900px; }
.karte h3 { margin: 0 0 10px; font-size: 13px; text-transform: uppercase; letter-spacing: .8px; color: var(--text-leise); }
.paare { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; }
.paare dt { color: var(--text-leise); font-size: 13px; }
.paare dd { margin: 0; font-size: 14px; }

.pos { border-top: 1px solid var(--rand); padding: 10px 0; }
.pos:first-of-type { border-top: 0; }
.pos .name { font-weight: 600; }
.pos .desc { color: var(--text-dim); font-size: 13px; white-space: pre-line; margin-top: 2px; }
.pos .zahlen { display: flex; justify-content: space-between; color: var(--text-leise); font-size: 13px; margin-top: 6px; gap: 10px; }
.pos .zahlen b { color: var(--text); }

.summen { display: grid; gap: 4px; }
.summen div { display: flex; justify-content: space-between; }
.summen .gesamt { border-top: 1px solid var(--rand); margin-top: 6px; padding-top: 8px; font-size: 18px; font-weight: 700; }

.aktionen { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.hinweis { color: var(--text-leise); font-size: 12.5px; }

/* ── Balken (EÜR) ──────────────────────────────────────────────────────── */
.balken { display: grid; gap: 8px; }
.balken .b-zeile { display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; }
.balken .b-spur { grid-column: 1 / -1; height: 6px; border-radius: 3px; background: var(--karte2); overflow: hidden; }
.balken .b-fuell { height: 100%; border-radius: 3px; background: var(--akzent); }
.b-fuell.ein { background: var(--gruen); }
.b-fuell.aus { background: var(--orange); }

/* ── Zwölf-Monats-Verlauf (Übersicht) ──────────────────────────────────── */
.v-kopf { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12.5px; color: var(--text-dim); margin-bottom: 10px; }
.v-punkt { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 5px; }
.v-punkt.ein, .v-saeule.ein { background: var(--gruen); }
.v-punkt.aus, .v-saeule.aus { background: var(--orange); }
.v-gewinn { margin-left: auto; font-weight: 600; }
.v-gewinn.gruen { color: var(--gruen); }
.v-gewinn.rot { color: var(--rot); }
.verlauf { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; align-items: end; border-bottom: 1px solid var(--rand); }
.v-monat { background: none; border: 0; padding: 4px 0 0; cursor: pointer; display: grid; gap: 4px; justify-items: center; }
.v-monat:hover .v-saeule { filter: brightness(1.25); }
.v-paar { display: flex; align-items: flex-end; gap: 2px; height: 96px; }
.v-saeule { width: 7px; min-height: 2px; border-radius: 2px 2px 0 0; }
.v-label { color: var(--text-leise); font-size: 10.5px; }

.lex-bericht {
  background: var(--karte2); border: 1px solid var(--rand); border-radius: 10px;
  padding: 10px 12px; margin: 10px 0 0; font-size: 12.5px; line-height: 1.45;
  white-space: pre-wrap; overflow-x: auto; max-height: 320px; overflow-y: auto;
}

/* ── Newsletter-Bausteine ──────────────────────────────────────────────── */
.nl-liste { display: grid; gap: 10px; margin-bottom: 10px; }
.nl-block {
  background: var(--karte2); border: 1px solid var(--rand); border-radius: 10px;
  padding: 10px; display: grid; gap: 6px;
}
.nl-kopf { display: flex; gap: 6px; align-items: center; }
.nl-kopf .nl-art { flex: 1; }
.nl-block select, .nl-block input, .nl-block textarea {
  background: var(--karte); border: 1px solid var(--rand); border-radius: 8px;
  color: var(--text); padding: 8px 10px; width: 100%; min-height: 38px;
}
.nl-block textarea { resize: vertical; }

/* ── Marc ──────────────────────────────────────────────────────────────── */
.marc-lauf {
  display: flex; flex-direction: column; gap: 10px; min-height: 40vh; max-height: 58vh;
  overflow-y: auto; padding: 4px 2px 10px;
}
.blase {
  max-width: 80%; padding: 10px 14px; border-radius: 14px; white-space: pre-wrap;
  overflow-wrap: anywhere; line-height: 1.5;
}
.blase.ich { align-self: flex-end; background: var(--gewaehlt); border-bottom-right-radius: 4px; }
.blase.marc { align-self: flex-start; background: var(--karte); border: 1px solid var(--rand); border-bottom-left-radius: 4px; }
.blase.meta { align-self: center; background: none; color: var(--text-leise); font-size: 12px; padding: 2px 8px; }
.marc-eingabe { display: grid; gap: 8px; }
.marc-eingabe textarea {
  background: var(--karte2); border: 1px solid var(--rand); border-radius: 12px;
  color: var(--text); padding: 12px 14px; min-height: 64px; resize: vertical; width: 100%;
}
.marc-eingabe textarea:focus { outline: none; border-color: var(--akzent); }
.marc-knoepfe { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.marc-knoepfe .schalter { min-height: 32px; font-size: 12.5px; color: var(--text-dim); }
.marc-knoepfe .schalter input { width: 16px; height: 16px; }

/* ── Zeiterfassung ─────────────────────────────────────────────────────── */
.zeit-laeuft {
  display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between;
  border-color: var(--gruen);
}
.zeit-uhr {
  display: block; font-size: 28px; font-weight: 700; letter-spacing: 1px;
  font-variant-numeric: tabular-nums; color: var(--gruen);
}
.zeit-laeuft .hinweis { display: block; margin-top: 2px; }
.zeit-wahl { display: flex; align-items: center; }
.zeit-wahl input { width: 18px; height: 18px; accent-color: var(--primaer); cursor: pointer; }
.zeile .rechts .betrag { font-variant-numeric: tabular-nums; }

/* ── Bankumsatz zuordnen ───────────────────────────────────────────────── */
.bz-kopf { margin: 4px 0 12px; }
.bz-kopf .summen b { font-size: 17px; }
.bz-liste { display: grid; gap: 6px; margin-bottom: 10px; max-height: 320px; overflow: auto; }
.bz-zeile {
  display: grid; grid-template-columns: 20px minmax(0, 1fr) auto 108px; gap: 10px; align-items: center;
  background: var(--karte2); border: 1px solid var(--rand); border-radius: 10px; padding: 8px 10px;
  cursor: pointer;
}
.bz-zeile input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--primaer); }
.bz-text { min-width: 0; display: grid; }
.bz-text .hinweis { font-size: 11.5px; }
.bz-offen { color: var(--text-leise); font-size: 12.5px; white-space: nowrap; }
.bz-betrag { text-align: right; min-height: 38px; }
.bz-betrag:disabled { opacity: .4; }
.bz-summe {
  display: flex; justify-content: space-between; gap: 10px; padding: 10px 2px 2px;
  border-top: 1px solid var(--rand); font-weight: 600;
}

.pille { background: var(--rot); color: #fff; border-radius: 999px; padding: 1px 7px; font-size: 11px; margin-left: 6px; }
.pille.gruen { background: var(--gruen); color: var(--auf-primaer); }

/* ── Tag-Gruppen (Kalender) ────────────────────────────────────────────── */
.tag-kopf {
  display: flex; align-items: baseline; gap: 8px; margin: 18px 0 8px;
  font-size: 13px; text-transform: uppercase; letter-spacing: .8px; color: var(--text-leise);
}
.tag-kopf.heute { color: var(--text); }
.tag-kopf .zahl { text-transform: none; letter-spacing: 0; font-size: 12px; }

/* ── Monatsansicht ─────────────────────────────────────────────────────── */
.monat-kopf { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.monat-kopf strong { flex: 1; font-size: 16px; }
.monat-kopf .knopf { min-width: 44px; }
.wochentage {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px;
  color: var(--text-leise); font-size: 11px; text-transform: uppercase; letter-spacing: .6px;
  margin-bottom: 4px;
}
.wochentage span { text-align: center; }
.monat { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.zelle {
  background: var(--karte); border: 1px solid var(--rand); border-radius: 8px;
  min-height: 62px; padding: 5px 4px; display: flex; flex-direction: column; gap: 3px;
  align-items: stretch; cursor: pointer; color: var(--text); text-align: left; overflow: hidden;
}
.zelle.fremd { background: transparent; border-style: dashed; opacity: .55; }
.zelle.fremd .zahl { color: var(--text-leise); }
.zelle.wochenende { background: var(--sidebar); border-color: #383d46; }
.zelle.heute { border-color: var(--akzent); }
.zelle.heute .zahl { color: var(--akzent); font-weight: 700; }
.zelle.gewaehlt { background: var(--gewaehlt); border-color: var(--akzent); }
.zelle .zahl { font-size: 12px; color: var(--text-dim); }
.zelle .punkte { display: flex; gap: 3px; flex-wrap: wrap; }
.zelle .punkte .punkt { width: 6px; height: 6px; }
.zelle .chips-tag { display: none; }
.chip-tag {
  display: block; font-size: 10.5px; line-height: 1.3; border-radius: 4px; padding: 1px 4px;
  background: var(--karte2); color: var(--text-dim);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  border-left: 3px solid var(--text-leise);
}
.chip-tag.gruen { border-left-color: var(--gruen); }
.chip-tag.orange { border-left-color: var(--orange); }
.chip-tag.rot { border-left-color: var(--rot); }
.chip-tag.blau { border-left-color: var(--blau); }
.mehr-tag { font-size: 10px; color: var(--text-leise); }

/* ── „Mehr“-Blatt (mobil) ──────────────────────────────────────────────── */
.mehr { position: fixed; inset: 0; z-index: 40; background: rgba(0, 0, 0, .5); display: flex; align-items: flex-end; }
.mehr-blatt {
  background: var(--karte); border-top: 1px solid var(--rand); border-radius: 16px 16px 0 0;
  width: 100%; padding: 12px 12px calc(20px + env(safe-area-inset-bottom)); display: grid; gap: 4px;
}
.mehr-blatt h2 { margin: 4px 0 10px; font-size: 13px; text-transform: uppercase; letter-spacing: .8px; color: var(--text-leise); }
.menue-raster { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 12px; }
.mehr-blatt a {
  display: flex; align-items: center; gap: 10px; padding: 14px 12px; border-radius: 10px;
  color: var(--text); text-decoration: none; background: var(--karte2); border: 1px solid var(--rand);
  min-height: 52px;
}
.mehr-blatt a span { width: 20px; text-align: center; opacity: .85; }
.mehr-blatt a[aria-current="page"] { border-color: var(--akzent); }
.mehr-blatt a:hover, .mehr-blatt a:focus-visible { background: var(--gewaehlt); }
.tabs button {
  display: flex; flex-direction: column; align-items: center; gap: 2px; background: none; border: 0;
  color: var(--text-leise); font-size: 11px; padding: 9px 2px; cursor: pointer;
}
.tabs button span { font-size: 17px; line-height: 1; }

/* ── Dialoge und Formulare ─────────────────────────────────────────────── */
.dialog {
  position: fixed; inset: 0; z-index: 60; background: rgba(0, 0, 0, .55);
  display: flex; align-items: flex-end; justify-content: center; padding: 0;
}
.dialog-blatt {
  background: var(--karte); border: 1px solid var(--rand); border-radius: 16px 16px 0 0;
  width: 100%; max-height: 92dvh; overflow: auto;
  padding: 18px 16px calc(16px + env(safe-area-inset-bottom));
  box-shadow: var(--schatten);
}
.dialog-blatt h2 { margin: 0 0 14px; font-size: 17px; }
.dialog-blatt h3.pos-titel { margin: 18px 0 8px; font-size: 13px; text-transform: uppercase; letter-spacing: .8px; color: var(--text-leise); }
.felder { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; }
.feld { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.feld.breit { grid-column: 1 / -1; }
.feld label { font-size: 12px; color: var(--text-dim); }
.feld input, .feld select, .feld textarea, .pos-zeile input, .pos-zeile select, .pos-zeile textarea, .bz-betrag {
  background: var(--karte2); border: 1px solid var(--rand); border-radius: 8px;
  color: var(--text); padding: 10px 12px; min-height: 42px; width: 100%;
}
.feld textarea { min-height: 72px; resize: vertical; }
.feld.hoch textarea { min-height: 240px; }
.feld-hinweis { font-size: 11.5px; color: var(--text-leise); }
.feld-kopf { display: flex; justify-content: flex-end; margin-bottom: 4px; position: relative; }
.knopf.klein { min-height: 30px; padding: 0 10px; font-size: 12px; }
.vorlagen-menue {
  position: absolute; right: 0; top: 34px; z-index: 70; min-width: 240px; max-height: 300px;
  overflow: auto; background: var(--karte2); border: 1px solid var(--rand); border-radius: 10px;
  box-shadow: var(--schatten); padding: 6px;
}
.vorlagen-menue .vm-kopf {
  margin: 6px 8px 4px; font-size: 11px; text-transform: uppercase; letter-spacing: .6px;
  color: var(--text-leise);
}
.vorlagen-menue button {
  display: block; width: 100%; text-align: left; background: none; border: 0; color: var(--text);
  padding: 8px 10px; border-radius: 8px; cursor: pointer;
}
.vorlagen-menue button:hover { background: var(--gewaehlt); }
.schalter { display: flex; align-items: center; gap: 8px; min-height: 42px; }
.schalter input { width: 20px; height: 20px; accent-color: var(--primaer); }
.dialog-fuss { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }
.dialog-fehler { color: var(--rot); margin: 12px 0 0; }
.knopf.gefahr { background: #3b1a1a; color: var(--rot); border: 1px solid var(--rot); }
.knopf.klein { min-height: 34px; padding: 0 12px; font-size: 12px; margin-top: 14px; }
.dialog-blatt.schmal { max-width: 460px; border-radius: 16px; }

/* PDF-Fenster */
.pdf-blatt {
  background: var(--karte); border: 1px solid var(--rand); border-radius: 16px 16px 0 0;
  width: 100%; height: 92dvh; display: flex; flex-direction: column; overflow: hidden;
}
.pdf-kopf {
  display: flex; align-items: center; gap: 8px; padding: 10px 12px;
  border-bottom: 1px solid var(--rand); background: var(--sidebar);
}
.pdf-kopf strong { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pdf-kopf .knopf { min-height: 36px; padding: 0 12px; font-size: 12.5px; text-decoration: none; display: flex; align-items: center; }
.pdf-koerper { flex: 1; position: relative; background: #2b2f3a; }
.pdf-koerper iframe { width: 100%; height: 100%; border: 0; }
.pdf-laedt {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  color: var(--text-dim); margin: 0;
}

/* Feld mit Knopf links (Kundensuche) + Vorschlagsliste darunter */
.feld-mit-knopf { display: flex; gap: 8px; align-items: flex-start; }
.feld-eingabe { position: relative; flex: 1; min-width: 0; }
.feld-knopf { min-width: 46px; font-size: 16px; }
.vorschlaege {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 5;
  background: var(--karte); border: 1px solid var(--rand); border-radius: 10px;
  box-shadow: var(--schatten); max-height: 260px; overflow: auto; padding: 4px;
}
.vorschlag {
  display: block; width: 100%; text-align: left; background: none; border: 0; cursor: pointer;
  color: var(--text); padding: 9px 10px; border-radius: 8px;
}
.vorschlag span { display: block; color: var(--text-leise); font-size: 12px; }
.vorschlag:hover, .vorschlag.aktiv { background: var(--karte2); }
.suche.breit { width: 100%; margin-bottom: 10px; }
.suche.breit input { width: 100%; }
.ks-liste { display: grid; gap: 8px; max-height: 50dvh; overflow: auto; }

/* Kalenderauswahl in den Einstellungen */
.kalender-wahl { display: grid; gap: 4px; }
.kalender-wahl .schalter { gap: 10px; }
.kalender-wahl .punkt { width: 12px; height: 12px; flex: 0 0 auto; }
.karte .felder { margin-bottom: 4px; }

.pos-liste { display: grid; gap: 10px; }
.pos-zeile {
  display: grid; gap: 6px; background: var(--karte2); border: 1px solid var(--rand);
  border-radius: 10px; padding: 10px;
  grid-template-columns: 1fr 70px 90px 100px 84px 42px;
}
.pos-zeile .p-name { grid-column: 1 / -1; }
.pos-zeile .p-desc { grid-column: 1 / -1; min-height: 40px; }
.pos-zeile input, .pos-zeile select { background: var(--karte); }

/* ── Haken und Kurzmeldung ─────────────────────────────────────────────── */
.haken {
  width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--text-leise);
  background: transparent; cursor: pointer; padding: 0;
}
.haken:hover { border-color: var(--gruen); background: rgba(74, 222, 128, .15); }
.status-wahl {
  background: var(--karte2); border: 1px solid var(--rand); border-radius: 10px;
  color: var(--text); min-height: 40px; padding: 0 10px;
}
.toast {
  position: fixed; left: 50%; transform: translateX(-50%); z-index: 70;
  bottom: calc(76px + env(safe-area-inset-bottom));
  background: var(--karte); border: 1px solid var(--rand); border-left: 4px solid var(--gruen);
  border-radius: 10px; padding: 12px 16px; box-shadow: var(--schatten); max-width: 92vw;
}
.toast.fehler { border-left-color: var(--rot); }

/* ── Untere Tab-Leiste (mobil) ─────────────────────────────────────────── */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--sidebar); border-top: 1px solid var(--rand);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabs a {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 9px 2px; color: var(--text-leise); text-decoration: none; font-size: 11px; min-height: 56px;
}
.tabs a span { font-size: 17px; line-height: 1; }
.tabs a[aria-current="page"] { color: var(--text); }

/* ── Ab Tablet: Seitenleiste statt Tab-Leiste, Detail als Spalte ───────── */
@media (min-width: 900px) {
  .rahmen { grid-template-columns: 232px minmax(0, 1fr); }
  .tabs { display: none; }
  main { padding: 24px 28px 32px; }
  .seite {
    display: flex; flex-direction: column; gap: 2px; padding: 20px 12px;
    background: var(--sidebar); border-right: 1px solid var(--rand); position: sticky; top: 0; height: 100dvh;
  }
  .marke { display: block; padding: 6px 12px 20px; }
  .marke img { width: 100%; max-width: 168px; height: auto; display: block; }
  .seite a {
    display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px;
    color: var(--text-dim); text-decoration: none;
  }
  .seite a:hover { background: var(--karte); color: var(--text); }
  .seite a[aria-current="page"] { background: var(--gewaehlt); color: var(--text); }
  .seite .ic { width: 18px; text-align: center; opacity: .9; }
  .seite-gruppe {
    margin: 14px 12px 4px; font-size: 11px; text-transform: uppercase; letter-spacing: .8px;
    color: var(--text-leise);
  }
  .mehr { display: none; }
  .nur-mobil { display: none; }
  .seite-fuss { margin-top: auto; color: var(--text-leise); font-size: 11.5px; padding: 0 12px; }
  .kacheln { grid-template-columns: repeat(4, 1fr); gap: 12px; }
  .suche input { width: 220px; }
  /* Datum als eigene Spalte: die Augen finden es dann immer an derselben Stelle */
  .liste-mit-datum .zeile { grid-template-columns: 14px minmax(0, 1fr) 86px auto; gap: 18px; }
  .liste-mit-datum .zeile .datum { display: block; color: var(--text-dim); font-size: 13px; }
  .monat-kopf strong { flex: 0 0 auto; margin-right: auto; }
  .zelle { min-height: 104px; }
  .zelle .punkte { display: none; }
  .zelle .chips-tag { display: grid; gap: 2px; }
  .dialog { align-items: center; padding: 24px; }
  .dialog-blatt { max-width: 720px; border-radius: 16px; }
  .pdf-blatt { max-width: 1000px; height: 88dvh; border-radius: 16px; }
  .toast { bottom: 24px; }
}

/* Ab großem Fenster: Detail als eigene Spalte neben der Liste, sonst als Vollbild */
@media (min-width: 1180px) {
  .rahmen.mit-detail { grid-template-columns: 232px minmax(0, 1fr) minmax(380px, 460px); }
  .rahmen.mit-detail .detail { position: static; border-left: 1px solid var(--rand); height: 100dvh; }
  .rahmen.mit-detail .detail-kopf { background: transparent; }
  .rahmen.mit-detail #detail-zu { display: none; }
}
