/* Bestattersoftware – ruhiges, gut lesbares Design. Keine externen Schriften/CDNs. */
:root {
  --grund: #f5f4f1;
  --karte: #ffffff;
  --text: #22262b;
  --gedimmt: #6b7178;
  --linie: #dedbd4;
  --akzent: #3d4f5c;
  --akzent-hell: #e6ecf0;
  --gruen: #2f7a4b;
  --gruen-hell: #e3f2e8;
  --gelb: #9a6b00;
  --gelb-hell: #fff3d1;
  --rot: #b3261e;
  --rot-hell: #fde4e1;
  --grau-hell: #eceae6;
  --radius: 8px;
  font-family: "DejaVu Sans", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  font-size: 16px;
  color: var(--text);
  background: var(--grund);
}
* { box-sizing: border-box; }
body { margin: 0; line-height: 1.45; }
a { color: var(--akzent); }
h1 { font-size: 1.5rem; margin: 0; }
h2 { font-size: 1.15rem; margin: 0 0 .75rem; }
h3 { font-size: 1rem; margin: 0 0 .5rem; }

/* Kopfzeile */
.kopf { background: var(--akzent); color: #fff; display: flex; align-items: center; flex-wrap: wrap; padding: 0 1rem; position: sticky; top: 0; z-index: 10; }
.marke { color: #fff; font-weight: bold; text-decoration: none; padding: .8rem 1rem .8rem 0; }
.navi { display: flex; align-items: center; gap: .1rem; flex: 1; flex-wrap: wrap; }
.navi > a, .untermenue > summary { color: #fff; text-decoration: none; padding: .8rem .7rem; display: block; cursor: pointer; border-radius: 4px; }
.navi > a.aktiv, .navi > a:hover, .untermenue > summary:hover { background: rgba(255,255,255,.14); }
.navi-trenner { flex: 1; }
.untermenue { position: relative; }
.untermenue > summary { list-style: none; }
.untermenue > summary::after { content: " ▾"; }
.untermenue > div { position: absolute; right: 0; background: var(--karte); border: 1px solid var(--linie); border-radius: var(--radius); min-width: 220px; box-shadow: 0 4px 16px rgba(0,0,0,.12); padding: .3rem 0; }
.untermenue > div a, .untermenue > div button.link { display: block; padding: .55rem 1rem; color: var(--text); text-decoration: none; width: 100%; text-align: left; }
.untermenue > div a:hover, .untermenue > div button.link:hover { background: var(--akzent-hell); }
.menue-schalter, .menue-knopf { display: none; }

.inhalt { max-width: 1200px; margin: 0 auto; padding: 1.2rem 1rem 4rem; }

/* Bausteine */
.seitenkopf { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .75rem; margin-bottom: 1rem; }
.seitenkopf .untertitel { color: var(--gedimmt); font-size: .95rem; }
.karte { background: var(--karte); border: 1px solid var(--linie); border-radius: var(--radius); padding: 1rem 1.2rem; margin-bottom: 1rem; }
.raster { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1rem; }
.raster > .karte { margin-bottom: 0; }
.zwei-spalten { display: grid; grid-template-columns: 2fr 1fr; gap: 1rem; align-items: start; }
.gedimmt { color: var(--gedimmt); }
.klein { font-size: .85rem; }
.rechts { text-align: right; }
.nowrap { white-space: nowrap; }
dl.daten { display: grid; grid-template-columns: max-content 1fr; gap: .3rem 1rem; margin: 0; }
dl.daten dt { color: var(--gedimmt); }
dl.daten dd { margin: 0; }

/* Knöpfe */
.knopf, button { font: inherit; display: inline-flex; align-items: center; justify-content: center; gap: .3rem; padding: .55rem 1rem; border-radius: 6px; border: 1px solid var(--linie); background: var(--karte); color: var(--text); text-decoration: none; cursor: pointer; min-height: 42px; }
.knopf:hover, button:hover { border-color: var(--akzent); }
.knopf.primaer, button.primaer { background: var(--akzent); color: #fff; border-color: var(--akzent); }
.knopf.gefahr, button.gefahr { background: var(--rot); color: #fff; border-color: var(--rot); }
.knopf.klein, button.klein { padding: .25rem .6rem; min-height: 32px; font-size: .9rem; }
.knopf.breit, button.breit { width: 100%; }
button.link { background: none; border: none; padding: 0; color: var(--akzent); min-height: 0; }
.knopfleiste { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: 1rem; }
form.inline { display: inline; }

/* Formulare */
.feldraster { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: .8rem 1rem; }
.feld { display: flex; flex-direction: column; gap: .25rem; margin-bottom: .2rem; }
.feld-breit { grid-column: 1 / -1; }
.feld label { font-size: .9rem; color: var(--gedimmt); }
.feld-check label { color: var(--text); display: flex; gap: .5rem; align-items: center; padding-top: 1.4rem; }
.feld small { color: var(--gedimmt); font-size: .8rem; }
.feld.fehler input, .feld.fehler select, .feld.fehler textarea { border-color: var(--rot); }
.fehlertext { color: var(--rot) !important; }
input, select, textarea { font: inherit; padding: .55rem .65rem; border: 1px solid var(--linie); border-radius: 6px; background: #fff; color: var(--text); width: 100%; min-height: 42px; }
input[type=checkbox], input[type=radio] { width: 1.2rem; height: 1.2rem; min-height: 0; }
textarea { min-height: 6rem; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--akzent-hell); border-color: var(--akzent); }
fieldset { border: 1px solid var(--linie); border-radius: var(--radius); margin: 0 0 1rem; padding: .8rem 1rem; }
legend { font-weight: bold; padding: 0 .4rem; }
.suchzeile { display: flex; gap: .5rem; }
.suchzeile input { min-width: 220px; }

/* Tabellen */
.tabelle-wrap { overflow-x: auto; padding: 0; }
.tabelle { width: 100%; border-collapse: collapse; }
.tabelle th, .tabelle td { padding: .6rem .8rem; border-bottom: 1px solid var(--linie); text-align: left; vertical-align: top; }
.tabelle th { font-size: .85rem; color: var(--gedimmt); font-weight: normal; background: #faf9f7; }
.tabelle tr:last-child td { border-bottom: none; }
.tabelle td.betrag, .tabelle th.betrag { text-align: right; white-space: nowrap; }
.tabelle tfoot td { font-weight: bold; }

/* Meldungen und Ampel */
.meldungen { margin-bottom: 1rem; }
.meldung { padding: .7rem 1rem; border-radius: 6px; margin-bottom: .5rem; background: var(--akzent-hell); }
.meldung.success { background: var(--gruen-hell); color: var(--gruen); }
.meldung.warning { background: var(--gelb-hell); color: var(--gelb); }
.meldung.error { background: var(--rot-hell); color: var(--rot); }
.marke-status { display: inline-block; padding: .1rem .55rem; border-radius: 99px; font-size: .8rem; background: var(--grau-hell); white-space: nowrap; }
.ampel-gruen { background: var(--gruen-hell); color: var(--gruen); }
.ampel-gelb { background: var(--gelb-hell); color: var(--gelb); }
.ampel-rot { background: var(--rot-hell); color: var(--rot); }
.ampel-grau { background: var(--grau-hell); color: var(--gedimmt); }
.status-neu { background: var(--akzent-hell); }
.status-in_bearbeitung { background: var(--gelb-hell); color: var(--gelb); }
.status-abgerechnet { background: var(--gruen-hell); color: var(--gruen); }
.status-archiviert { background: var(--grau-hell); color: var(--gedimmt); }

/* Anmeldung */
.anmeldung { max-width: 380px; margin: 10vh auto; }
.anmeldung h1 { margin-bottom: 1rem; }
.anmeldung .feld { margin-bottom: .8rem; }

.blaettern { display: flex; gap: 1rem; align-items: center; justify-content: center; }

/* Handy */
@media (max-width: 800px) {
  .menue-knopf { display: block; margin-left: auto; font-size: 1.6rem; padding: .4rem .6rem; cursor: pointer; }
  .navi { display: none; flex-basis: 100%; flex-direction: column; align-items: stretch; padding-bottom: .5rem; }
  .menue-schalter:checked ~ .navi { display: flex; }
  .navi-trenner { display: none; }
  .untermenue > div { position: static; box-shadow: none; }
  .inhalt { padding: .8rem .6rem 4rem; }
  .karte { padding: .8rem; }
  .zwei-spalten { grid-template-columns: 1fr; }
  .feldraster { grid-template-columns: 1fr; }
  .feld-check label { padding-top: 0; }
  .suchzeile { width: 100%; }
  .suchzeile input { min-width: 0; flex: 1; }
  /* Tabellen am Handy als Karten */
  .tabelle thead { display: none; }
  .tabelle, .tabelle tbody, .tabelle tr, .tabelle td { display: block; width: 100%; }
  .tabelle tr { border-bottom: 1px solid var(--linie); padding: .4rem 0; }
  .tabelle td { border: none; padding: .2rem .8rem; }
  .tabelle td[data-label]::before { content: attr(data-label) ": "; color: var(--gedimmt); font-size: .85rem; }
  .tabelle td.betrag { text-align: left; }
  .tabelle tfoot tr { display: block; }
  input, select, textarea { font-size: 16px; } /* verhindert Zoom auf iOS */
}

@media print {
  .kopf, .knopfleiste, .knopf { display: none !important; }
  body { background: #fff; }
  .karte { border: none; }
}

/* Fallakte */
.kontakt { padding: .6rem 0; border-bottom: 1px solid var(--linie); }
.kontakt:last-child { border-bottom: none; }
.checkliste { list-style: none; margin: 0; padding: 0; }
.checkliste li { display: flex; align-items: flex-start; gap: .6rem; padding: .35rem 0; border-bottom: 1px solid var(--grau-hell); }
.checkliste li > span { flex: 1; }
.checkliste li.erledigt > span { color: var(--gedimmt); text-decoration: line-through; }
.checkliste .haken { width: 34px; height: 34px; min-height: 34px; padding: 0; border-radius: 6px; font-weight: bold; color: var(--gruen); }
.checkliste li.erledigt .haken { background: var(--gruen-hell); border-color: var(--gruen); }
.checkliste .entfernen button { color: var(--gedimmt); }
.schnell { max-width: 640px; }

/* Kalender */
.kalender-leiste { display: flex; gap: .8rem; flex-wrap: wrap; align-items: center; justify-content: space-between; }
.knopfgruppe { display: flex; gap: .3rem; align-items: center; }
.woche { display: grid; grid-template-columns: repeat(7, 1fr); gap: .5rem; }
.woche .tag { padding: .5rem; min-height: 8rem; margin: 0; }
.tag-kopf { display: flex; justify-content: space-between; margin-bottom: .4rem; font-size: .9rem; }
.tag.heute, .monat-tag.heute { outline: 2px solid var(--akzent); }
.termin { display: block; text-decoration: none; color: var(--text); background: var(--akzent-hell); border-left: 4px solid var(--akzent); border-radius: 4px; padding: .3rem .4rem; margin-bottom: .35rem; font-size: .85rem; }
.termin .zeit { font-weight: bold; display: block; }
.typ-trauerfeier { border-left-color: #6a4c93; background: #efe9f6; }
.typ-beisetzung { border-left-color: #2f7a4b; background: var(--gruen-hell); }
.typ-ueberfuehrung { border-left-color: #9a6b00; background: var(--gelb-hell); }
.typ-einaescherung { border-left-color: #b3261e; background: var(--rot-hell); }
.monat { padding: 0; overflow: hidden; }
.monat-kopf, .monat-woche { display: grid; grid-template-columns: repeat(7, 1fr); }
.monat-kopf div { padding: .4rem; font-size: .85rem; color: var(--gedimmt); text-align: center; background: #faf9f7; }
.monat-tag { min-height: 6rem; border-top: 1px solid var(--linie); border-left: 1px solid var(--linie); padding: .25rem; overflow: hidden; }
.monat-tag.fremd { background: #faf9f7; color: var(--gedimmt); }
.tagnummer { font-size: .85rem; text-decoration: none; color: inherit; }
.monat-termin { display: block; font-size: .75rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-decoration: none; color: var(--text); border-left: 3px solid var(--akzent); padding-left: .25rem; margin-top: .15rem; }
.frist { padding: .5rem 0 .5rem .6rem; border-left: 4px solid var(--linie); margin-bottom: .4rem; }
.ampel-rand-rot { border-left-color: var(--rot); }
.ampel-rand-gelb { border-left-color: #e0a800; }
.ampel-rand-gruen { border-left-color: var(--gruen); }
.ampel-rand-grau { border-left-color: var(--linie); }
ul.checkbox-liste, .feld ul { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: .3rem 1rem; }
.feld ul label { display: flex; gap: .4rem; align-items: center; color: var(--text); }
@media (max-width: 800px) {
  .woche { grid-template-columns: 1fr; }
  .woche .tag { min-height: 0; }
  .monat-tag { min-height: 3.5rem; }
  .monat-termin { font-size: 0; border-left-width: 6px; height: 6px; }
}

/* Angebote / Rechnungen */
.position-zeile { display: grid; grid-template-columns: 4.5rem 1.6fr 2.4fr 5.5rem 5.5rem 7.5rem 6rem 7rem; gap: .4rem .6rem; padding: .6rem 0; border-bottom: 1px solid var(--linie); align-items: end; }
.position-zeile .feld { margin: 0; }
.position-zeile .feld-check label { padding-top: 0; font-size: .85rem; }
.position-zeile .pos-beschr { grid-column: 2 / 7; }
.position-zeile .pos-del { grid-column: 7 / 9; }
.position-zeile.fehler { background: var(--rot-hell); }
table.summen { margin: 0 0 0 auto; border-collapse: collapse; min-width: min(420px, 100%); }
table.summen td { padding: .25rem .5rem; }
table.summen td.betrag { text-align: right; white-space: nowrap; }
table.summen tr.gesamt td { font-weight: bold; border-top: 2px solid var(--text); font-size: 1.05rem; }
h3.abschnitt { margin: 1rem .8rem .3rem; font-size: .95rem; }
@media (max-width: 800px) {
  .position-zeile { grid-template-columns: 1fr 1fr; }
  .position-zeile .pos-artikel, .position-zeile .pos-bez, .position-zeile .pos-beschr { grid-column: 1 / -1; }
  .position-zeile .pos-del { grid-column: auto; }
}

/* Übersicht */
.kennzahlen { display: grid; grid-template-columns: repeat(4, 1fr); gap: .8rem; margin-bottom: 1rem; }
.kennzahl { background: var(--karte); border: 1px solid var(--linie); border-radius: var(--radius); padding: .8rem 1rem; text-decoration: none; color: var(--text); display: flex; flex-direction: column; }
.kennzahl b { font-size: 1.5rem; }
.kennzahl span { color: var(--gedimmt); font-size: .85rem; }
.kennzahl.rot { border-color: var(--rot); background: var(--rot-hell); }
.kennzahl.rot b { color: var(--rot); }
.dashboard { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.zeile-link { display: block; text-decoration: none; color: var(--text); padding: .5rem .4rem; border-bottom: 1px solid var(--grau-hell); border-radius: 4px; }
.zeile-link:hover { background: #faf9f7; }
.zeile-link .rechts { float: right; }
.offene-schritte { margin: .2rem 0 0; padding-left: 1.1rem; color: var(--gedimmt); }
.tagtrenner { font-size: .85rem; color: var(--gedimmt); margin: .6rem 0 .3rem; }
@media (max-width: 800px) {
  .kennzahlen { grid-template-columns: 1fr 1fr; }
  .kennzahl b { font-size: 1.2rem; }
  .dashboard { grid-template-columns: 1fr; }
}

.code { font-family: monospace; font-size: .85rem; }
.platzhalter-hilfe { max-height: 80vh; overflow-y: auto; }

.kopf-suche { margin: 0 .4rem; }
.kopf-suche input { min-height: 34px; padding: .3rem .6rem; width: 11rem; border: none; background: rgba(255,255,255,.15); color: #fff; }
.kopf-suche input::placeholder { color: rgba(255,255,255,.75); }
.kopf-suche input:focus { background: #fff; color: var(--text); }
@media (max-width: 800px) { .kopf-suche { margin: .4rem 0; } .kopf-suche input { width: 100%; } }

/* Sprungleiste der Fallakte – nur am Handy */
.sprungleiste { display: none; }
@media (max-width: 800px) {
  .sprungleiste { display: flex; gap: .4rem; overflow-x: auto; margin: 0 0 .8rem; padding-bottom: .2rem; }
  .sprungleiste a { flex: none; padding: .35rem .7rem; border-radius: 99px; background: var(--akzent-hell); text-decoration: none; font-size: .9rem; }
  section[id] { scroll-margin-top: 4rem; }
}

/* Nachbesserungen nach Bedienungstest */
button:disabled, .knopf[aria-disabled=true] { opacity: .45; cursor: not-allowed; }
.feld ul label { min-height: 40px; }
.checkliste .entfernen button, .tag-kopf a { min-width: 40px; min-height: 40px; display: inline-flex; align-items: center; justify-content: center; }
.kalender-leiste .knopf.klein { min-width: 40px; min-height: 40px; }
.monat-tag { position: relative; }
.monat-tag .tag-link { position: absolute; inset: 0; }
.monat-tag .monat-termin, .monat-tag .tagnummer { position: relative; z-index: 1; }
@media (max-width: 800px) {
  .suchzeile { flex-wrap: wrap; }
  .suchzeile input { flex: 1 1 100%; }
  .suchzeile select { max-width: none !important; flex: 1 1 auto; }
  .monat-tag { min-height: 3.2rem; }
  /* Fallakte: Fristen und Checkliste am Handy zuerst */
  .zwei-spalten.fallakte > aside { order: -1; }
}
