/* ===========================================================================
   Wartungsplaner – Layout und Komponenten
   =========================================================================== */

*, *::before, *::after { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--grund);
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--ho-nordic-dark); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #cfcfcf; border-radius: 99px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: #b4b4b4; background-clip: content-box; border: 3px solid transparent; }

/* ============================================================== Grundraster */

.app {
  display: grid;
  grid-template-columns: var(--sidebar) 1fr;
  min-height: 100vh;
  min-height: 100dvh;   /* dvh = sichtbare Höhe, ohne die Symbolleisten von Safari */
}

/* -------------------------------------------------------------- Seitenleiste */

.seitenleiste {
  background: var(--ho-nordic);
  color: var(--text-invers);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  align-self: start;   /* sonst dehnt das Grid die Spalte und Sticky greift nicht */
  height: 100vh;
  height: 100dvh;
}

.marke {
  padding: 22px 20px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, .16);
}
.marke img { width: 132px; display: block; }
.marke .modul {
  margin-top: 12px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .12em;
  font-size: 11px;
  color: rgba(255, 255, 255, .72);
}

.navi { padding: 14px 12px; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; flex: 1; }

.navi a {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 12px;
  border-radius: var(--radius-s);
  color: rgba(255, 255, 255, .84);
  text-decoration: none;
  font-weight: 600;
  font-size: 13.5px;
  transition: background .12s, color .12s;
}
.navi a:hover { background: rgba(255, 255, 255, .1); color: #fff; }
.navi a.aktiv { background: var(--ho-white); color: var(--ho-nordic-dark); box-shadow: var(--schatten-s); }
.navi a .icon { width: 18px; height: 18px; flex: none; opacity: .9; }
.navi a.aktiv .icon { opacity: 1; }
.navi .zaehler {
  margin-left: auto;
  font-size: 11px;
  font-weight: 900;
  padding: 1px 7px;
  border-radius: 99px;
  background: rgba(255, 255, 255, .18);
  min-width: 22px;
  text-align: center;
}
.navi a.aktiv .zaehler { background: var(--ho-horizon); color: var(--ho-nordic-dark); }
.navi .zaehler.alarm { background: var(--ho-rust); color: #fff; }
.navi .trenner { margin: 12px 12px 6px; font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: rgba(255, 255, 255, .5); font-weight: 700; }

.leisten-fuss {
  padding: 14px 20px 18px;
  font-size: 11px;
  color: rgba(255, 255, 255, .6);
  border-top: 1px solid rgba(255, 255, 255, .16);
}
.leisten-fuss strong { color: rgba(255, 255, 255, .85); font-weight: 700; }

/* ------------------------------------------------------------------- Kopf */

/* min-width: 0 an jeder Stelle, an der ein Grid- oder Flex-Element sonst auf
   seine Inhaltsbreite wachsen würde – sonst schiebt eine einzige lange Zeile
   die ganze Seite seitlich weg. */
.inhalt { min-width: 0; display: flex; flex-direction: column; }
.seite { min-width: 0; }
.raster > * { min-width: 0; }
.karte { min-width: 0; }

.kopf {
  height: var(--kopf-gesamt);
  padding-top: var(--rand-oben);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 28px;
  background: var(--flaeche);
  border-bottom: 1px solid var(--linie);
  position: sticky;
  top: 0;
  z-index: 30;
}
.kopf h1 { font-size: 19px; margin: 0; font-weight: 900; text-transform: uppercase; letter-spacing: .03em; }
.kopf .unterzeile { font-size: 12px; color: var(--text-leise); font-weight: 600; }

.suche { margin-left: auto; position: relative; }
.suche input {
  width: 280px;
  padding: 9px 12px 9px 34px;
  border: 1px solid var(--linie);
  border-radius: var(--radius-s);
  background: var(--ho-horizon-50);
  outline: none;
}
.suche input:focus { border-color: var(--ho-nordic-50); background: #fff; box-shadow: 0 0 0 3px var(--ho-nordic-10); }
.suche svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--text-leise); }

.seite { padding: 24px 28px 64px; flex: 1; }

/* ------------------------------------------------------------------ Karten */

.karte {
  background: var(--flaeche);
  border: 1px solid var(--linie);
  border-radius: var(--radius-l);
  box-shadow: var(--schatten-s);
}
.karte > header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--linie);
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;   /* Titel, Zusatz und Schaltfläche dürfen umbrechen */
}
.karte > header h2 { margin: 0; font-size: 14px; font-weight: 900; text-transform: uppercase; letter-spacing: .06em; min-width: 0; }
.karte > header .hinweis { font-size: 12px; color: var(--text-leise); font-weight: 600; }
.karte > .inhalt-block { padding: 18px 20px; }

.raster { display: grid; gap: 18px; }
.raster.k2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.raster.k3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.raster.k4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1280px) { .raster.k4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .raster.k3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 900px)  { .raster.k2, .raster.k3, .raster.k4 { grid-template-columns: 1fr; } }

/* --------------------------------------------------------------- Kennzahl */

.kennzahl {
  position: relative;
  padding: 18px 20px 16px;
  border-radius: var(--radius-l);
  background: var(--flaeche);
  border: 1px solid var(--linie);
  box-shadow: var(--schatten-s);
  overflow: hidden;
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: transform .12s, box-shadow .12s;
}
.kennzahl:hover { transform: translateY(-2px); box-shadow: var(--schatten); }
.kennzahl::before {
  /* Designelement: abgerundetes Quadrat der Bildmarke */
  content: '';
  position: absolute;
  right: -26px; top: -26px;
  width: 86px; height: 86px;
  border-radius: 24px;
  background: var(--st-ecke, var(--st-weich, var(--ho-horizon-50)));
}
/* Kacheltext in Lato Regular – die Zahl trägt über die Größe, nicht über die Strichstärke */
.kennzahl .wert { position: relative; font-size: 34px; font-weight: 400; line-height: 1; color: var(--st-akzent, var(--text)); }
.kennzahl .titel { position: relative; margin-top: 8px; font-size: 12px; font-weight: 400; text-transform: uppercase; letter-spacing: .07em; }
.kennzahl .zusatz { position: relative; margin-top: 3px; font-size: 12px; font-weight: 400; color: var(--text-leise); }
.kennzahl[data-status="ueberfaellig"] { border-color: var(--ho-rust-50); }

/* ------------------------------------------------------------------ Chips */

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: var(--radius-xs);
  font-size: 11.5px;
  font-weight: 700;
  background: var(--st-bg, var(--ho-horizon));
  color: var(--st-fg, var(--text-leise));
  white-space: nowrap;
  line-height: 1.5;
}
.chip.rand { background: transparent; border: 1px solid var(--st-line, var(--linie-stark)); color: var(--st-fg, var(--text-leise)); }
.chip.neutral { background: var(--ho-horizon); color: var(--text-leise); }
.chip.blau { background: var(--ho-nordic-10); color: var(--ho-nordic-dark); }
.chip.punkt::before { content: ''; width: 7px; height: 7px; border-radius: 2px; background: currentColor; }

/* --------------------------------------------------------------- Buttons */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  border-radius: var(--radius-s);
  border: 1px solid var(--linie-stark);
  background: var(--flaeche);
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  transition: background .12s, border-color .12s, transform .05s;
  white-space: nowrap;
}
.btn:hover { background: var(--ho-horizon-50); border-color: var(--ho-nordic-50); }
.btn:active { transform: translateY(1px); }
.btn.primaer { background: var(--ho-nordic); border-color: var(--ho-nordic); color: #fff; }
.btn.primaer:hover { background: var(--ho-nordic-dark); border-color: var(--ho-nordic-dark); }
.btn.alarm { background: var(--ho-rust); border-color: var(--ho-rust); color: #fff; }
.btn.alarm:hover { background: var(--ho-rust-dark); border-color: var(--ho-rust-dark); }
.btn.leise { border-color: transparent; background: transparent; color: var(--text-leise); }
.btn.leise:hover { background: var(--ho-horizon); color: var(--text); }
.btn.klein { padding: 5px 10px; font-size: 12px; border-radius: var(--radius-xs); }
.btn .icon { width: 15px; height: 15px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
/* Schaltflaechen, die in Wahrheit Links sind (Download, Datei ansehen, tel:).
   Ohne das kaemen sie unterstrichen und in Linkfarbe daher. */
a.btn { text-decoration: none; color: inherit; }

/* ------------------------------------------------- Vertragsliste */

/* Eine Tabelle für alle Gewerke, damit die Spalten durchgehend fluchten.
   Die Breite ist gedeckelt: Auf einem 2000-px-Bildschirm zögen sich fünf
   kurze Angaben sonst quer über die ganze Fläche. */
.v-tabelle { table-layout: fixed; max-width: 1080px; }
.v-tabelle td { vertical-align: top; }
.v-tabelle .v-aktion { text-align: right; white-space: nowrap; }

/* Zwischenzeile: das Gewerk samt Firma. Keine eigene Tabelle, sondern eine
   Zeile in derselben – nur so bleiben die Spalten über alle Gruppen gleich. */
.v-tabelle tr.gruppe td {
  background: var(--ho-horizon-50, #f3f5f7);
  border-top: 1px solid var(--linie);
  padding: 13px 14px 11px;
}
.v-tabelle tr.gruppe:first-child td { border-top: 0; }
.v-tabelle .g-nr { font-variant-numeric: tabular-nums; font-weight: 800; color: var(--text-leise); margin-right: 8px; }
.v-tabelle .g-name { font-weight: 800; }
.v-tabelle .g-firma { margin-left: 10px; color: var(--ho-nordic-dark); font-weight: 700; }
.v-tabelle .g-firma::before { content: '· '; color: var(--text-leise); font-weight: 400; }
.v-tabelle .g-zahl { margin-left: 10px; font-size: 12px; color: var(--text-leise); }

/* --------------------------------------------------------------- Filter */

.filterleiste {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 16px;
}
.filterleiste select, .filterleiste input[type="search"], .filterleiste input[type="text"] {
  min-width: 0;
  padding: 7px 10px;
  border: 1px solid var(--linie);
  border-radius: var(--radius-s);
  background: var(--flaeche);
  outline: none;
  max-width: 260px;
}
.filterleiste select:focus, .filterleiste input:focus { border-color: var(--ho-nordic-50); box-shadow: 0 0 0 3px var(--ho-nordic-10); }
.filterleiste .abstand { margin-left: auto; }

.segment { display: inline-flex; background: var(--ho-horizon); border-radius: var(--radius-s); padding: 3px; gap: 2px; }
.segment button {
  border: 0; background: transparent; padding: 5px 12px; border-radius: var(--radius-xs);
  font-weight: 700; font-size: 12.5px; cursor: pointer; color: var(--text-leise);
}
.segment button.aktiv { background: var(--flaeche); color: var(--text); box-shadow: var(--schatten-s); }

/* -------------------------------------------------------------- Tabellen */

.tabelle { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tabelle th {
  text-align: left;
  font-size: 10.5px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text-leise);
  font-weight: 800;
  padding: 10px 14px;
  border-bottom: 1px solid var(--linie);
  background: var(--ho-horizon-25);
  position: sticky;
  top: var(--kopf-gesamt);
  z-index: 5;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.tabelle th:hover { color: var(--text); }
.tabelle th .pfeil { opacity: .5; font-size: 9px; }
.tabelle td { padding: 11px 14px; border-bottom: 1px solid var(--ho-horizon); vertical-align: top; }
.tabelle tbody tr { cursor: pointer; }
.tabelle tbody tr:hover { background: var(--ho-nordic-10); }
.tabelle tbody tr:last-child td { border-bottom: 0; }
.tabelle .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tabelle .haupt { font-weight: 700; }
.tabelle .leise { color: var(--text-leise); font-size: 12.5px; }
/* Kein Scroll-Container auf großen Schirmen – sonst würde er die
   seitenweite Sticky-Kopfzeile der Tabelle kapern. */
.tabelle-huelle { border-radius: var(--radius-l); }
.tabelle thead tr th:first-child { border-top-left-radius: var(--radius-l); }
.tabelle thead tr th:last-child { border-top-right-radius: var(--radius-l); }
@media (max-width: 1180px) {
  .tabelle-huelle { overflow-x: auto; }
  .tabelle th { position: static; }
}

.balken-links { box-shadow: inset 3px 0 0 var(--st-line, transparent); }

/* -------------------------------------------------------------- Zeitstrahl */

.monatsblock { margin-bottom: 22px; }
.monatskopf {
  display: flex; align-items: baseline; gap: 12px;
  padding: 0 4px 8px;
  border-bottom: 2px solid var(--ho-nordic-25);
  margin-bottom: 10px;
}
.monatskopf h3 { margin: 0; font-size: 13px; font-weight: 900; text-transform: uppercase; letter-spacing: .08em; }
.monatskopf .anzahl { font-size: 12px; color: var(--text-leise); font-weight: 700; }

.termin {
  display: grid;
  grid-template-columns: 56px 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 11px 14px;
  background: var(--flaeche);
  border: 1px solid var(--linie);
  border-left: 4px solid var(--st-line, var(--linie));
  border-radius: var(--radius-s);
  margin-bottom: 7px;
  cursor: pointer;
  transition: box-shadow .12s, transform .06s;
}
.termin:hover { box-shadow: var(--schatten); transform: translateX(2px); }
.termin .tag { text-align: center; }
.termin .tag .d { font-size: 20px; font-weight: 900; line-height: 1; }
.termin .tag .m { font-size: 10px; text-transform: uppercase; letter-spacing: .09em; color: var(--text-leise); font-weight: 700; }
.termin .titel { font-weight: 700; }
.termin .meta { font-size: 12px; color: var(--text-leise); margin-top: 2px; display: flex; gap: 10px; flex-wrap: wrap; }
.termin .rechts { display: flex; align-items: center; gap: 8px; }

/* ------------------------------------------------------------------ Panel */

.panel-huelle {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(29, 29, 27, .38);
  display: flex; justify-content: flex-end;
  opacity: 0; pointer-events: none; transition: opacity .18s;
}
.panel-huelle.offen { opacity: 1; pointer-events: auto; }
.panel {
  width: min(680px, 96vw);
  background: var(--flaeche);
  height: 100%;
  overflow-y: auto;
  box-shadow: var(--schatten-l);
  transform: translateX(24px);
  transition: transform .18s;
}
.panel-huelle.offen .panel { transform: none; }
.panel > header {
  position: sticky; top: 0; z-index: 2;
  background: var(--ho-nordic); color: #fff;
  padding: 20px 24px 18px;
}
.panel > header h2 { margin: 0 0 4px; font-size: 19px; font-weight: 900; line-height: 1.2; padding-right: 40px; }
.panel > header .meta { font-size: 12.5px; color: rgba(255, 255, 255, .8); font-weight: 600; }
.panel .schliessen {
  position: absolute; right: 16px; top: 16px;
  width: 30px; height: 30px; border-radius: var(--radius-xs);
  border: 0; background: rgba(255, 255, 255, .16); color: #fff; cursor: pointer; font-size: 17px; line-height: 1;
}
.panel .schliessen:hover { background: rgba(255, 255, 255, .3); }
.panel .rumpf { padding: 20px 24px 40px; }

.abschnitt { margin-bottom: 24px; }
.abschnitt > h3 {
  font-size: 11px; text-transform: uppercase; letter-spacing: .11em;
  color: var(--text-leise); font-weight: 800; margin: 0 0 10px;
  display: flex; align-items: center; gap: 8px;
}
.abschnitt > h3::after { content: ''; flex: 1; height: 1px; background: var(--linie); }

.feldliste { display: grid; grid-template-columns: 150px 1fr; gap: 7px 14px; font-size: 13.5px; }
.feldliste dt { color: var(--text-leise); font-weight: 600; }
.feldliste dd { margin: 0; font-weight: 600; }

/* ------------------------------------------------------------------ Modal */

.modal-huelle {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(29, 29, 27, .42);
  display: grid; place-items: center;
  padding: 24px;
  opacity: 0; pointer-events: none; transition: opacity .15s;
}
.modal-huelle.offen { opacity: 1; pointer-events: auto; }
.modal {
  width: min(520px, 100%);
  background: var(--flaeche);
  border-radius: var(--radius-l);
  box-shadow: var(--schatten-l);
  max-height: 88vh;
  max-height: 88dvh;      /* dvh berücksichtigt die eingeblendete Bildschirmtastatur */
  overflow-y: auto;
  scroll-padding: 76px 0 84px;
  transform: scale(.97); transition: transform .15s;
}
.modal-huelle.offen .modal { transform: none; }
/* Der Dialog ist sein eigener Scrollbereich – Kopf und Fuß bleiben stehen,
   damit Titel und Knöpfe nie hinter den Rand rutschen. */
.modal > header {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 18px 24px 12px;
  background: var(--flaeche);
  border-bottom: 1px solid var(--linie);
}
.modal > header h2 { margin: 0; font-size: 17px; font-weight: 900; }
.modal > header p { margin: 6px 0 0; font-size: 13px; color: var(--text-leise); }
.modal .rumpf { padding: 18px 24px; }
/* Der Dialog scrollt selbst – die Knöpfe bleiben trotzdem in Reichweite */
.modal > footer {
  position: sticky;
  bottom: 0;
  padding: 14px 24px 18px;
  display: flex;
  gap: 9px;
  justify-content: flex-end;
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0), var(--flaeche) 22%);
}

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

/* Ein fieldset ohne Rahmen – nur da, um eine Formularhälfte auf einen Schlag
   zu sperren (Team darf Ordner und Postausgang sehen, nicht ändern). */
fieldset.nackt { border: 0; padding: 0; margin: 0; min-width: 0; }
fieldset.nackt:disabled { opacity: .7; }
.feld { margin-bottom: 14px; }
.feld > label { display: block; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; color: var(--text-leise); margin-bottom: 5px; }
.feld input, .feld select, .feld textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--linie-stark);
  border-radius: var(--radius-s);
  background: var(--flaeche);
  outline: none;
}
.feld textarea { min-height: 84px; resize: vertical; }
/* Datums- und Zahlenfelder auf Inhaltsbreite begrenzen – über die volle
   Dialogbreite gezogen wirken sie wie ein Fehler. */
.feld input[type="date"] { max-width: 190px; }
.feld input[type="number"] { max-width: 150px; }
.feld input:focus, .feld select:focus, .feld textarea:focus { border-color: var(--ho-nordic); box-shadow: 0 0 0 3px var(--ho-nordic-10); }
/* Textfeld hinter "Andere – selbst eintippen" in einer Klappliste */
.feld input.frei-feld { margin-top: 6px; }
.feld input[hidden] { display: none; }
.feld .hilfe { font-size: 11.5px; color: var(--text-leise); margin-top: 4px; }
.feld.fehlerhaft > label { color: var(--ho-rust-dark); }
.feld.fehlerhaft input, .feld.fehlerhaft select, .feld.fehlerhaft textarea { border-color: var(--ho-rust); background: var(--ho-rust-10); }
.feld-fehler { font-size: 12px; font-weight: 700; color: var(--ho-rust-dark); margin-top: 5px; }
.feld-paar { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ---------------------------------------------------------------- Diverses */

.leer {
  text-align: center;
  padding: 54px 20px;
  color: var(--text-leise);
}
.leer .zeichen { width: 56px; height: 56px; margin: 0 auto 14px; border-radius: var(--radius-l); background: var(--ho-horizon); display: grid; place-items: center; }
.leer h3 { margin: 0 0 5px; font-size: 15px; color: var(--text); font-weight: 900; }

.balken { height: 8px; border-radius: 99px; background: var(--ho-horizon); overflow: hidden; display: flex; }
.balken span { display: block; height: 100%; }

.liste-strich { list-style: none; margin: 0; padding: 0; }
.liste-strich li { padding: 10px 0; border-bottom: 1px solid var(--ho-horizon); display: flex; gap: 12px; align-items: flex-start; }
.liste-strich li:last-child { border-bottom: 0; }

/* Zugangszeile: Text links, Knöpfe rechts – auf dem Handy rutschen die
   Knöpfe unter den Text, statt ihn auf Wortbreite zusammenzudrücken. */
.liste-strich li.zugang { flex-wrap: wrap; }
.zugang-text { flex: 1 1 180px; min-width: 0; overflow-wrap: anywhere; }
.zugang-knoepfe { display: flex; gap: 5px; flex-wrap: wrap; margin-left: auto; }
@media (max-width: 860px) {
  .zugang-knoepfe { flex-basis: 100%; margin-left: 0; padding-left: 0; }
}
/* Die drei Knöpfe unter der Liste: gleich breit, mit Luft, umbrechend –
   als lose Inline-Knöpfe klebten sie aneinander und waren jeder anders breit. */
.zugang-aktionen {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 8px; margin-top: 14px;
}
.zugang-aktionen .btn { justify-content: center; width: 100%; }

.toast-bereich { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 400; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  background: var(--ho-black); color: #fff;
  padding: 11px 18px; border-radius: var(--radius-s);
  font-weight: 700; font-size: 13px; box-shadow: var(--schatten-l);
  animation: hoch .2s ease-out;
}
.toast.alarm { background: var(--ho-rust); }
.toast.gut { background: var(--ho-mint-dark); }
@keyframes hoch { from { opacity: 0; transform: translateY(10px); } }

.hinweisbox {
  padding: 12px 16px;
  border-radius: var(--radius-s);
  background: var(--st-weich, var(--ho-nordic-10));
  border-left: 3px solid var(--st-line, var(--ho-nordic-50));
  font-size: 13px;
}

.trennung { height: 1px; background: var(--linie); margin: 20px 0; border: 0; }

.spalte-eng { max-width: 760px; }

.tag-liste { display: flex; flex-wrap: wrap; gap: 6px; }

.klick { cursor: pointer; }
.rechts { text-align: right; }
.nowrap { white-space: nowrap; }
.leise { color: var(--text-leise); }
.mini { font-size: 12px; }

/* ------------------------------------------------------------------ Druck */

@media print {
  .seitenleiste, .kopf .suche, .filterleiste, .btn, .panel-huelle, .modal-huelle { display: none !important; }
  .app { grid-template-columns: 1fr; }
  .kopf { position: static; border-bottom: 2px solid var(--ho-nordic); }
  .seite { padding: 0; }
  .karte { break-inside: avoid; box-shadow: none; }
  .termin { break-inside: avoid; }
  body { background: #fff; font-size: 11px; }
}

/* ======================================================= Handy und Tablet ===
   Unter 860 px wird aus der Seitenleiste eine Reiterleiste am unteren Rand
   (Daumenreichweite), Tabellen werden zu Karten und Dialoge zu Sheets.        */

.kopf-marke, .suche-schalter { display: none; }
.kopf-text { min-width: 0; }
.suche-treffer {
  position: absolute; top: 100%; right: 0; margin-top: 6px;
  width: min(460px, calc(100vw - 24px)); max-height: 60vh; overflow-y: auto;
  background: var(--flaeche); border: 1px solid var(--linie);
  border-radius: var(--radius); box-shadow: var(--schatten-l); z-index: 60; padding: 6px;
}
.suche-treffer button {
  display: flex; gap: 10px; align-items: center; width: 100%; text-align: left;
  border: 0; background: transparent; padding: 9px 10px; border-radius: var(--radius-s); cursor: pointer;
}
.suche-treffer button:hover, .suche-treffer button:focus-visible { background: var(--ho-nordic-10); }

.termin.frei { grid-template-columns: 1fr auto; }
.termin.eins { grid-template-columns: 1fr; gap: 6px; margin: 0; }
.rechts-stapel { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.rechts-stapel .knopfreihe { display: flex; gap: 5px; }

/* Kontaktschaltflächen – Nummer und Adresse stecken im Link, nicht im Text */
.kontakt-aktionen { display: flex; gap: 7px; flex-wrap: wrap; }
.kontakt-aktionen .btn { text-decoration: none; color: var(--text); }
.kontakt-aktionen .btn:hover { color: var(--ho-nordic-dark); }

/* Empfänger einer Meldung: Firma und/oder Kontakt im Centermanagement */
.empfaenger {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 12px 14px;
  border: 1px solid var(--linie);
  border-radius: var(--radius);
  background: var(--ho-horizon-25);
  margin-bottom: 8px;
}
.empfaenger > :first-child { flex: 1; min-width: 150px; }
.empfaenger .subline { margin-bottom: 2px; }

/* ------------------------------------------------------------------ Fotos */

.foto-galerie {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
}
.foto-galerie figure { margin: 0; border: 1px solid var(--linie); border-radius: var(--radius); overflow: hidden; background: var(--ho-horizon-50); }
.foto-galerie img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: var(--ho-horizon); }
.foto-galerie figcaption { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 4px 6px 4px 10px; }

.mangel-vorschau { width: 100%; max-height: 130px; object-fit: cover; border-radius: var(--radius-s); margin-top: 8px; }
.foto-auswahl { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.foto-auswahl img { width: 68px; height: 68px; object-fit: cover; border-radius: var(--radius-s); border: 1px solid var(--linie); }

.feld input[type="file"] {
  padding: 8px 10px;
  background: var(--ho-horizon-50);
  border-style: dashed;
  cursor: pointer;
}

/* Balkendiagramm der Terminlast */
.monatsbalken { display: flex; align-items: flex-end; gap: 6px; height: 132px; }
.monatsbalken > div { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.raster.dash { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); }

@media (max-width: 1100px) {
  .raster.dash { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
  /* Höhe der Reiterleiste ohne den Geräterand – der kommt über --rand-unten dazu. */
  :root { --kopf: 56px; --leiste-hoehe: 64px; }

  .app { grid-template-columns: 1fr; }

  /* Letzte Absicherung: kein seitliches Verschieben der ganzen Seite, falls
     doch einmal ein Inhalt breiter ist als das Display. "clip" erzeugt keinen
     Scroll-Container, die klebende Kopfzeile bleibt also funktionsfähig. */
  .inhalt { overflow-x: clip; }
  .karte > header .hinweis { flex-basis: 100%; }

  /* Zwölf Monate auf 375 px wären 20 px je Säule – lieber im Kasten schieben */
  .monatsbalken { overflow-x: auto; padding-bottom: 4px; }
  .monatsbalken > div { flex: 0 0 34px; }

  /* Reiterleiste unten */
  .seitenleiste {
    position: fixed; inset: auto 0 0 0; height: auto; z-index: 80;
    flex-direction: row; align-self: auto;
    padding-bottom: var(--rand-unten);
    box-shadow: 0 -2px 16px rgba(29, 29, 27, .22);
  }
  .marke, .leisten-fuss { display: none; }
  .navi { flex-direction: row; overflow-x: auto; padding: 6px; gap: 2px; scrollbar-width: none; }
  .navi::-webkit-scrollbar { display: none; }
  .navi .trenner { display: none; }
  /* Die Reiter teilen sich die Breite nach ihrer Beschriftung, damit alle sieben
     nebeneinander stehen und die Leiste nicht geschoben werden muss. */
  .navi a {
    position: relative; flex-direction: column; gap: 3px; min-width: 0; flex: 1 1 auto;
    padding: 7px 6px 6px; font-size: 10.5px; text-align: center; justify-content: center;
  }
  .navi a .icon { width: 21px; height: 21px; }
  .navi .zaehler {
    position: absolute; top: 2px; right: 6px; margin: 0;
    font-size: 9.5px; padding: 0 5px; min-width: 17px;
  }
  .inhalt { padding-bottom: calc(var(--leiste-hoehe) + var(--rand-unten)); }

  /* Kopfzeile kompakt */
  /* Kurzschreibweise darf das padding-top für die Statusleiste nicht platt machen */
  .kopf { padding: var(--rand-oben) 14px 0; gap: 10px; }
  .kopf-marke { display: block; width: 26px; height: 26px; flex: none; }
  .kopf h1 { font-size: 15px; }
  .kopf .unterzeile { display: none; }
  .suche-schalter { display: inline-flex; margin-left: auto; padding: 8px; }
  .suche { position: static; margin-left: 0; display: none; }
  .suche.offen {
    display: block; position: absolute; left: 0; right: 0; top: var(--kopf-gesamt);
    background: var(--flaeche); padding: 10px 14px; border-bottom: 1px solid var(--linie);
    box-shadow: var(--schatten);
  }
  .suche input { width: 100%; }
  .suche-treffer { left: 14px; right: 14px; width: auto; margin-top: 10px; }

  .seite { padding: 14px 14px 24px; }
  .btn { min-height: 38px; }
  .btn.klein { min-height: 32px; }

  /* Tabellen als Karten */
  .tabelle-huelle { overflow-x: visible; border: 0; background: transparent; box-shadow: none; border-radius: 0; }
  .tabelle, .tabelle tbody, .tabelle tr, .tabelle td { display: block; width: 100%; }
  .tabelle thead { display: none; }
  .tabelle tbody tr {
    border: 1px solid var(--linie); border-left: 4px solid var(--st-line, var(--linie));
    border-radius: var(--radius); margin-bottom: 10px; padding: 11px 14px;
    background: var(--flaeche); box-shadow: var(--schatten-s);
  }
  .tabelle td { border: 0; padding: 3px 0; display: flex; gap: 10px; align-items: baseline; text-align: left; }
  /* Als Karte ist jede Spalte eine eigene Zeile – ein Feld ohne Inhalt wäre
     dort nur eine Zeile mit einem Strich. In der Tabelle bleibt der Strich,
     weil er dort die Spaltenflucht hält. */
  .tabelle td.leer { display: none; }

  /* Die Gewerkszeile ist keine Karte, sondern eine Überschrift darüber. */
  .v-tabelle colgroup { display: none; }
  .v-tabelle tr.gruppe {
    border: 0; background: transparent; box-shadow: none;
    margin: 20px 0 8px; padding: 0;
  }
  .v-tabelle tr.gruppe td { background: none; border: 0; padding: 0; display: block; }
  .v-tabelle tr.gruppe td::before { content: none; }
  .v-tabelle .g-firma, .v-tabelle .g-zahl { display: block; margin-left: 0; margin-top: 2px; }
  .v-tabelle .g-firma::before { content: none; }
  .v-tabelle .v-aktion { text-align: left; }

  /* Jede Zeile wird hier schon zur Karte – die Karte drumherum ergäbe eine
     Karte in der Karte. Also nimmt die äußere ihre Ränder zurück. */
  .karte.v-huelle { border: 0; background: transparent; box-shadow: none; border-radius: 0; }
  /* Die Vertragsart trägt sich selbst, sie braucht kein Wort davor. */
  .v-tabelle td[data-spalte="Vertrag"] { display: block; margin-bottom: 4px; }
  .v-tabelle td[data-spalte="Vertrag"]::before { content: none; }
  .tabelle td::before {
    content: attr(data-spalte); flex: 0 0 92px;
    font-size: 10px; text-transform: uppercase; letter-spacing: .07em;
    color: var(--text-leise); font-weight: 800; line-height: 1.7;
  }
  .tabelle td[data-haupt] { display: block; font-size: 15px; margin-bottom: 7px; }
  .tabelle td[data-haupt]::before { display: none; }
  .tabelle td:empty { display: none; }
  .tabelle td.num { justify-content: flex-start; }

  /* Terminzeilen */
  .termin { grid-template-columns: 46px 1fr; }
  .termin.frei, .termin.eins { grid-template-columns: 1fr; }
  .termin .rechts {
    grid-column: 1 / -1; justify-content: flex-start; flex-wrap: wrap;
    margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--ho-horizon);
  }
  .termin.eins .rechts { border-top: 0; margin-top: 0; padding-top: 0; }
  .rechts-stapel { flex-direction: row; align-items: center; flex-wrap: wrap; gap: 8px; }
  .rechts-stapel .knopfreihe { margin-left: auto; }

  /* Filter */
  .filterleiste { gap: 7px; }
  .filterleiste select, .filterleiste input[type="search"], .filterleiste input[type="text"] {
    flex: 1 1 calc(50% - 4px); max-width: none; min-height: 40px;
  }
  .filterleiste .segment { flex: 1 1 100%; }
  .filterleiste .segment button { flex: 1; min-height: 34px; }
  .filterleiste .abstand { flex-basis: 100%; height: 0; margin: 0; }

  /* Detailfenster und Dialoge als Sheets */
  .panel { width: 100%; }
  .panel > header { padding: 16px 18px 14px; }
  .panel > header h2 { font-size: 17px; }
  .panel .rumpf { padding: 16px 18px calc(40px + env(safe-area-inset-bottom, 0px)); }
  .feldliste { grid-template-columns: 118px 1fr; }

  .modal-huelle { align-items: flex-end; padding: 0; }
  .modal {
    width: 100%;
    max-height: 92vh;
    max-height: 92dvh;   /* sonst schiebt die Tastatur den Dialogkopf über den Rand */
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    padding-bottom: var(--rand-unten);
  }
  .modal > header { padding: 15px 18px 11px; }
  .modal .rumpf { padding: 16px 18px; }
  .modal > footer { padding: 12px 18px 16px; }
  .modal-huelle.offen .modal { transform: none; }
  .feld-paar { grid-template-columns: 1fr; gap: 0; }
  .feld input, .feld select, .feld textarea { min-height: 42px; font-size: 16px; } /* 16 px verhindert Auto-Zoom in iOS */

  .toast-bereich { bottom: calc(var(--leiste-hoehe) + 16px + var(--rand-unten)); }
  .raster.k4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kennzahl { padding: 14px 16px 12px; }
  /* Auf zwei Kacheln nebeneinander wird es eng: das Eckquadrat muss über der
     Beschriftung enden, sonst läuft eine lange Zeile wie "Fällig in 30 Tagen"
     hinein. Sichtbar bleiben 46 statt 60 Pixel. */
  .kennzahl::before { width: 72px; height: 72px; border-radius: 20px; }
  .kennzahl .wert { font-size: 27px; }
  .kennzahl .titel { font-size: 10.5px; }
  .kennzahl .zusatz { display: none; }
}

@media (max-width: 420px) {
  .navi a { padding: 7px 3px 6px; font-size: 10px; }
  .navi .zaehler { right: 2px; }
  .tabelle td::before { flex-basis: 80px; }
}

/* ============================================================== Anmeldung */

.anmeldung-offen { overflow: hidden; }

.anmelde-huelle {
  position: fixed; inset: 0; z-index: 200;
  display: flex; align-items: center; justify-content: center;
  padding: 24px calc(16px + env(safe-area-inset-right, 0px)) 24px calc(16px + env(safe-area-inset-left, 0px));
  background: var(--ho-nordic);
  /* Das Designelement der Bildmarke als ruhiger Grund */
  background-image:
    radial-gradient(circle at 18% 22%, var(--ho-nordic-dark) 0 38%, transparent 38%),
    radial-gradient(circle at 82% 78%, var(--ho-nordic-dark) 0 30%, transparent 30%);
  overflow: auto;
}

.anmelde-karte {
  width: 100%; max-width: 380px;
  background: var(--flaeche);
  border-radius: var(--radius-l);
  box-shadow: var(--schatten-l);
  padding: 30px 28px 24px;
}
.anmelde-marke { display: block; height: 34px; margin-bottom: 14px; }
.anmelde-modul {
  font-size: 10.5px; letter-spacing: .16em; text-transform: uppercase;
  font-weight: 800; color: var(--text-leise); margin-bottom: 22px;
}
.anmelde-karte h1 {
  font-size: 21px; font-weight: 900; text-transform: uppercase;
  letter-spacing: .03em; margin: 0 0 18px;
}
.anmelde-karte .feld { margin-bottom: 14px; }
.anmelde-karte input {
  width: 100%; padding: 11px 12px; font-size: 16px;   /* 16px: iOS zoomt sonst beim Tippen */
  border: 1px solid var(--linie-stark); border-radius: var(--radius-s); background: #fff;
}
.anmelde-karte input:focus {
  outline: none; border-color: var(--ho-nordic);
  box-shadow: 0 0 0 3px var(--ho-nordic-10);
}
.btn.gross { width: 100%; justify-content: center; min-height: 44px; font-size: 15px; }

.anmelde-fehler {
  background: var(--ho-rust-10); color: var(--ho-rust-dark);
  border-left: 3px solid var(--ho-rust);
  padding: 10px 12px; border-radius: 0 var(--radius-s) var(--radius-s) 0;
  font-size: 13px; font-weight: 700; margin-bottom: 14px;
}
.anmelde-hinweis {
  background: var(--ho-nordic-10); color: var(--ho-nordic-dark);
  border-left: 3px solid var(--ho-nordic);
  padding: 10px 12px; border-radius: 0 var(--radius-s) var(--radius-s) 0;
  font-size: 13px; margin-bottom: 14px;
}
.anmelde-fuss { margin-top: 16px; font-size: 12px; color: var(--text-leise); text-align: center; }
.anmelde-fuss a { color: var(--ho-nordic); font-weight: 700; text-decoration: none; }
.anmelde-fuss a:hover { text-decoration: underline; }

/* --- Benutzerknopf in der Kopfzeile --- */

.benutzer-knopf {
  display: inline-flex; align-items: center; gap: 8px;
  margin-left: auto; padding: 5px 10px 5px 5px;
  background: transparent; border: 1px solid var(--linie); border-radius: 99px;
  cursor: pointer; color: var(--text); font-weight: 700; font-size: 12.5px;
}
.benutzer-knopf:hover { background: var(--ho-horizon-50); border-color: var(--ho-nordic-50); }
.benutzer-knopf .kuerzel {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--ho-nordic); color: #fff; font-size: 11px; font-weight: 900;
}
.benutzer-knopf svg { width: 15px; height: 15px; opacity: .55; }

@media (max-width: 860px) {
  /* Auf dem Handy nur das Kürzel – der Name braucht dort zu viel Platz */
  .benutzer-knopf { margin-left: 0; padding: 3px; border: 0; }
  .benutzer-knopf .benutzer-name, .benutzer-knopf svg { display: none; }
  .suche-schalter { margin-left: auto; }
}

/* --- Farbmuster im Corporate Design --- */

.farbraster {
  display: grid;
  /* Zwei je Reihe: geht bei acht Farben immer ohne Lücke auf, und die Karte
     steht in der schmalen Spalte – bei vier Spalten wären es nur 96px und die
     Namen würden umbrechen. grid-auto-rows haelt alle Reihen gleich hoch. */
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: 1fr;
  gap: 10px;
}
.farbmuster {
  border: 1px solid var(--linie);
  border-radius: var(--radius);
  padding: 12px 12px 10px;
  min-height: 62px;                 /* alle Kacheln gleich hoch, egal wie lang der Name */
  display: flex; flex-direction: column; justify-content: space-between;
}
.farbmuster .name { font-weight: 900; font-size: 12px; line-height: 1.25; }
.farbmuster .wert { font-size: 11px; opacity: .85; margin-top: 6px; }

