/* ---------------------------------------------------------------------------
   NaturSalzOase - Oberfläche
   Handgeschrieben, absichtlich ohne Build-Schritt: die Anwendung wird per FTP
   kopiert, ein npm-Lauf auf dem Server ist nicht möglich.

   Farben aus dem Raum selbst: warmes Salzstein-Amber auf kühlem Mineralgrund.
   Die Terminfarben (#83d5e1 türkis, gelb, grün) sind die des alten
   Planungsassistenten - das Büro soll den Kalender wiedererkennen.
--------------------------------------------------------------------------- */

:root {
  --ground:      #eff3f4;
  --surface:     #ffffff;
  --surface-2:   #f7fafa;
  --ink:         #151a1c;
  --ink-2:       #4c575b;
  --ink-3:       #78868a;
  --line:        #d7e0e2;
  --line-soft:   #e6eced;

  --amber:       #a9510a;
  --amber-soft:  #f6e7d7;
  --brine:       #12626e;
  --brine-soft:  #ddeeef;

  --ok:          #2c6e42;
  --ok-soft:     #dcefe2;
  --warn:        #94660a;
  --warn-soft:   #faeed4;
  --crit:        #a6342a;
  --crit-soft:   #f7e2df;

  --slot-general:  #83d5e1;
  --slot-children: #ffe600;
  --slot-private:  #90ee90;

  --radius: 3px;
  --shadow: 0 1px 2px rgba(21, 26, 28, .08);

  --font: "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: "Cascadia Mono", ui-monospace, Consolas, monospace;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
}

a { color: var(--brine); }
a:focus-visible, button:focus-visible, input:focus-visible,
select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
}

h1, h2, h3 { margin: 0; line-height: 1.2; font-weight: 600; }
h1 { font-size: 1.5rem; letter-spacing: -.01em; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p  { margin: 0; }

/* --- Kopfzeile ---------------------------------------------------------- */
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar-inner {
  max-width: 76rem;
  margin: 0 auto;
  padding: .6rem 1rem;
  display: flex;
  align-items: center;
  gap: 1.2rem;
}
.brand {
  font-weight: 700;
  letter-spacing: -.02em;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}
.brand span { color: var(--amber); }
.topnav { display: flex; gap: .3rem; flex: 1; flex-wrap: wrap; }
.topnav a {
  padding: .4rem .7rem;
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--ink-2);
  font-weight: 500;
  font-size: .93rem;
}
.topnav a:hover { background: var(--surface-2); color: var(--ink); }
.topnav a[aria-current="page"] { background: var(--amber-soft); color: var(--amber); }
.topbar form { margin: 0; }

/* --- Grundraster --------------------------------------------------------- */
.wrap { max-width: 76rem; margin: 0 auto; padding: 1.2rem 1rem 4rem; }
.wrap-narrow { max-width: 34rem; margin: 0 auto; padding: 2.5rem 1rem 4rem; }
.stack { display: flex; flex-direction: column; gap: 1rem; }
.stack-tight { display: flex; flex-direction: column; gap: .5rem; }
.row { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.grow { flex: 1; }

/* --- Karten -------------------------------------------------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-head {
  padding: .75rem 1rem;
  border-bottom: 1px solid var(--line-soft);
  display: flex;
  align-items: center;
  gap: .75rem;
  flex-wrap: wrap;
}
.card-body { padding: 1rem; }

/* Terminkarte: der farbige Streifen links ist die Terminart. */
.slot-card { border-left: 5px solid var(--slot-general); }
.slot-card.is-children { border-left-color: var(--slot-children); }
.slot-card.is-private  { border-left-color: var(--slot-private); }

.slot-time {
  font-size: 1.35rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.02em;
}
.slot-meta { color: var(--ink-3); font-size: .85rem; }

/* --- Auslastungsampel ---------------------------------------------------- */
.gauge {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  padding: .15rem .5rem;
  border-radius: var(--radius);
  border: 1px solid currentColor;
  font-size: .9rem;
  white-space: nowrap;
}
/* Eigene Präfixe, keine blossen Zustandsnamen: gaugeLevel() liefert "empty",
   und .empty ist weiter unten der Leerzustand einer Karte mit 3rem Innenabstand.
   Ohne Präfix erbt die Ampel dessen Polsterung und wird zum Klotz. */
.gauge-empty   { color: var(--crit); background: var(--crit-soft); }
.gauge-filling { color: var(--warn); background: var(--warn-soft); }
.gauge-full    { color: var(--ok);   background: var(--ok-soft); }

/* --- Personenliste ------------------------------------------------------- */
.person-list { list-style: none; margin: 0; padding: 0; }
.person {
  display: flex;
  gap: .9rem;
  align-items: flex-start;
  padding: .8rem 1rem;
  border-bottom: 1px solid var(--line-soft);
}
.person:last-child { border-bottom: 0; }
.person.is-done   { background: var(--ok-soft); }
.person.is-absent { background: var(--crit-soft); }
.person-main { flex: 1; min-width: 0; }
.person-name { font-weight: 600; }
.person-sub  { color: var(--ink-3); font-size: .87rem; }

/* Die Anmerkung zur Person ist der wichtigste Text am Empfang -
   "keine Sole", "sitzt gern vorne rechts". Deshalb nicht kleingedruckt. */
.note {
  margin-top: .35rem;
  padding: .4rem .6rem;
  background: var(--brine-soft);
  border-left: 3px solid var(--brine);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: .92rem;
  color: var(--ink);
}
.note.wish { background: var(--amber-soft); border-left-color: var(--amber); }

.badges { display: flex; gap: .3rem; flex-wrap: wrap; margin-top: .3rem; }
.badge {
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .03em;
  text-transform: uppercase;
  padding: .12rem .4rem;
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--ink-2);
  border: 1px solid var(--line);
  white-space: nowrap;
}
.badge.vip     { background: var(--warn-soft); color: var(--warn); border-color: currentColor; }
.badge.lounger { background: var(--brine-soft); color: var(--brine); border-color: currentColor; }
.badge.birthday{ background: var(--amber-soft); color: var(--amber); border-color: currentColor; }
.badge.visits  { font-variant-numeric: tabular-nums; }
.badge.noshow  { background: var(--crit-soft); color: var(--crit); border-color: currentColor; }

/* --- Schaltflächen ------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  /* 44 px Mindesthöhe: die Empfangsansicht wird am Tablet mit dem Finger
     bedient, nicht mit der Maus. */
  min-height: 44px;
  padding: .5rem .9rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-weight: 500;
  font-size: .93rem;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn-primary { background: var(--amber); border-color: var(--amber); color: #fff; }
.btn-primary:hover { background: #8d430a; }
.btn-ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn-ok:hover { background: #245b36; }
.btn-danger { color: var(--crit); border-color: var(--crit); }
.btn-danger:hover { background: var(--crit-soft); }
.btn-quiet { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn-quiet:hover { background: var(--surface-2); }
.btn-sm { min-height: 34px; padding: .25rem .6rem; font-size: .85rem; }
.btn[disabled] { opacity: .5; cursor: default; }
.btn-group { display: flex; gap: .4rem; flex-wrap: wrap; }

/* --- Formulare ----------------------------------------------------------- */
.field { display: flex; flex-direction: column; gap: .3rem; }
.field label { font-size: .87rem; font-weight: 600; color: var(--ink-2); }
/* Kontrollkaestchen erben sonst die volle Feldbreite und stehen als
   handtellergrosses Quadrat neben ihrer Beschriftung. */
.field input[type="checkbox"], .field input[type="radio"] {
  width: auto;
  min-height: 0;
  padding: 0;
}

.field input, .field select, .field textarea {
  font: inherit;
  padding: .55rem .7rem;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  width: 100%;
}
.field textarea { min-height: 5rem; resize: vertical; }
.field .hint { font-size: .82rem; color: var(--ink-3); }
.field .error { font-size: .85rem; color: var(--crit); font-weight: 500; }
.field input[aria-invalid="true"] { border-color: var(--crit); }
.code-input {
  font-family: var(--mono);
  font-size: 1.6rem !important;
  letter-spacing: .5rem;
  text-align: center;
}

/* --- Meldungen ----------------------------------------------------------- */
.alert {
  padding: .8rem 1rem;
  border-radius: var(--radius);
  border: 1px solid;
  font-size: .95rem;
}
.alert-ok   { background: var(--ok-soft);   border-color: var(--ok);   color: #1d4a2c; }
.alert-warn { background: var(--warn-soft); border-color: var(--warn); color: #6b4a07; }
.alert-bad  { background: var(--crit-soft); border-color: var(--crit); color: #7d2720; }
.alert-info { background: var(--brine-soft);border-color: var(--brine);color: #0d4a53; }

.empty {
  padding: 3rem 1rem;
  text-align: center;
  color: var(--ink-3);
}

/* --- Datumsleiste -------------------------------------------------------- */
.datebar {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
}
.datebar .today-label { font-weight: 600; font-size: 1.1rem; }
.datebar .weekday { color: var(--ink-3); font-weight: 400; }

/* --- Öffentliche Seiten -------------------------------------------------- */
.public-head {
  text-align: center;
  padding: 2rem 1rem 1rem;
}
.public-head .brand { font-size: 1.3rem; }
.summary {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: .4rem 1rem;
  font-size: .95rem;
}
.summary dt { color: var(--ink-3); }
.summary dd { margin: 0; font-weight: 600; }

@media (max-width: 40rem) {
  .wrap { padding: .8rem .7rem 4rem; }
  .person { padding: .8rem .7rem; }
  .card-head { padding: .7rem .8rem; }
  h1 { font-size: 1.3rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ---------------------------------------------------------------------------
   Planer: Wochenkalender als Zeitraster

   Termine liegen nach Uhrzeit positioniert, nicht in Tabellenzellen - anders
   wären 09:45 und 11:15 nicht darstellbar, und die gibt es im Bestand.
   Eine Minute ist ein Pixel, eine 90-Minuten-Zeile also 90 Pixel hoch.

   Farbgebung wie im Altsystem, damit das Büro den Kalender wiedererkennt:
   Hintergrund sagt die Terminart, der linke Balken die Auslastung.
--------------------------------------------------------------------------- */

/* Drei Bereiche: Seitenspalte, Wochenraster, Detail. Schmal untereinander,
   mittelbreit rutscht die Seitenspalte unter den Kalender, breit steht sie
   links - wie im Altsystem. */
.planner {
  display: grid; gap: 1rem; align-items: start;
  grid-template-areas: 'cal' 'panel' 'side';
}
@media (min-width: 78rem) {
  .planner { grid-template-columns: minmax(0, 1fr) 22rem;
             grid-template-areas: 'cal panel' 'side panel'; }
}
@media (min-width: 100rem) {
  .planner { grid-template-columns: 15.5rem minmax(0, 1fr) 22rem;
             grid-template-areas: 'side cal panel'; }
}
.planner-side { grid-area: side; display: flex; flex-direction: column; gap: 1rem; }
.planner-cal { grid-area: cal; }
.planner-panel { grid-area: panel; }

.cal { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.cal-scroll { overflow-x: auto; }
.cal-inner { min-width: 54rem; }

.cal-head { display: grid; grid-template-columns: 3.6rem repeat(7, 1fr); border-bottom: 1px solid var(--line); background: var(--surface-2); }
.cal-head > div { padding: .4rem .3rem .5rem; text-align: center; border-left: 1px solid var(--line-soft); }
.cal-head > div:first-child { border-left: 0; }
.cal-day-name { font-weight: 600; font-size: .88rem; }
.cal-day-date { color: var(--ink-3); font-size: .78rem; }
.cal-head .is-today { background: var(--amber-soft); }
.cal-head .is-today .cal-day-name { color: var(--amber); }
.cal-holiday { display: block; font-size: .7rem; color: var(--warn); font-weight: 600; line-height: 1.2; }
.cal-daytools { display: flex; gap: .15rem; justify-content: center; margin-top: .2rem; }
.cal-daytools button {
  border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius);
  font: inherit; font-size: .68rem; padding: 0 .3rem; min-height: 20px; cursor: pointer; color: var(--ink-2);
}
.cal-daytools button:hover { background: var(--warn-soft); color: var(--warn); }

.cal-body { display: grid; grid-template-columns: 3.6rem repeat(7, 1fr); }
.cal-axis { position: relative; border-right: 1px solid var(--line); }
.cal-axis span {
  position: absolute; right: .35rem; transform: translateY(-.6em);
  font-size: .76rem; color: var(--ink-3); font-variant-numeric: tabular-nums;
}

.cal-col { position: relative; border-left: 1px solid var(--line-soft); }
.cal-col.is-weekend { background: var(--surface-2); }
/* Feiertag und Betriebsurlaub: schraffiert wie im Altsystem. */
.cal-col.is-closed { background-image: repeating-linear-gradient(45deg,
  transparent 0 7px, var(--warn-soft) 7px 14px); }
.cal-lines { position: absolute; inset: 0; pointer-events: none; }
.cal-hint {
  position: absolute; inset: 0; display: flex; align-items: flex-start; justify-content: center;
  padding-top: .4rem; font-size: .72rem; color: var(--ink-3); opacity: 0; pointer-events: none;
}
.cal-col:hover .cal-hint { opacity: 1; }

/* --- Termin im Raster ---------------------------------------------------- */
.ev {
  position: absolute; left: 2px; right: 2px; min-height: 22px;
  border: 1px solid rgba(21, 26, 28, .28); border-left-width: 5px;
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 1px 3px; overflow: hidden;
  font-size: .74rem; line-height: 1.2; text-decoration: none; color: #10171a;
  background: var(--slot-general);
}
.ev:hover { filter: brightness(1.06); }
.ev.ev-children { background: var(--slot-children); }
.ev.ev-private  { background: var(--slot-private); }
.ev.level-empty   { border-left-color: var(--crit); }
.ev.level-filling { border-left-color: var(--warn); }
.ev.level-full    { border-left-color: var(--ok); }
.ev.is-selected { outline: 2px solid var(--ink); outline-offset: -2px; }
.ev .t { font-variant-numeric: tabular-nums; opacity: .75; }
.ev .c { font-weight: 700; font-variant-numeric: tabular-nums; display: block; }
.ev .k { font-weight: 600; text-transform: uppercase; font-size: .64rem; letter-spacing: .03em; }
.ev .lock { position: absolute; right: 2px; bottom: 1px; width: 11px; height: 11px; opacity: .75; }
/* Gesperrte Termine bekommen zusätzlich ein Muster - Farbe allein reicht
   nicht, wenn jemand sie nicht unterscheiden kann. */
.ev.is-locked { background-image: repeating-linear-gradient(45deg,
  transparent 0 4px, rgba(21,26,28,.10) 4px 8px); }

.legend { display: flex; gap: .9rem; flex-wrap: wrap; font-size: .8rem; color: var(--ink-3); align-items: center; }
.legend i { display: inline-block; width: .8rem; height: .8rem; vertical-align: -1px; margin-right: .3rem;
            border: 1px solid rgba(21,26,28,.28); }
.legend b { display: inline-block; width: .35rem; height: .8rem; vertical-align: -1px; margin-right: .3rem; }

/* --- Detailspalte -------------------------------------------------------- */
.panel { position: sticky; top: 4rem; }
@media (max-width: 78rem) { .panel { position: static; } }

.search-results { border: 1px solid var(--line); border-radius: var(--radius); max-height: 15rem; overflow-y: auto; }
.search-results:empty { display: none; }
.search-hit {
  display: block; width: 100%; text-align: left; border: 0;
  border-bottom: 1px solid var(--line-soft); background: var(--surface);
  padding: .5rem .6rem; font: inherit; font-size: .9rem; cursor: pointer;
}
.search-hit:last-child { border-bottom: 0; }
.search-hit:hover, .search-hit:focus { background: var(--brine-soft); }
.search-hit .meta { color: var(--ink-3); font-size: .82rem; }

/* --- Monatsauswahl auf der Buchungsseite --------------------------------- */
.month { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.month-head {
  text-align: center; font-size: .72rem; font-weight: 600; color: var(--ink-3);
  text-transform: uppercase; letter-spacing: .04em; padding-bottom: .2rem;
}
.day {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 2.9rem; border-radius: var(--radius); border: 1px solid var(--line);
  text-decoration: none; font-size: .9rem; font-variant-numeric: tabular-nums;
  background: var(--surface); color: var(--ink-3);
}
.day small { font-size: .62rem; line-height: 1; margin-top: .1rem; }
.day.is-empty { background: var(--surface-2); color: var(--ink-3); border-style: dashed; }
.day.is-free  { background: var(--ok-soft);   color: var(--ok);   border-color: var(--ok);   font-weight: 700; }
.day.is-few   { background: var(--warn-soft); color: var(--warn); border-color: var(--warn); font-weight: 700; }
.day.is-full  { background: var(--crit-soft); color: var(--crit); border-color: var(--crit); }
.day.is-today { outline: 2px solid var(--ink); outline-offset: -2px; }
.day.is-outside { opacity: .35; }

/* Der Wochenkalender braucht mehr Breite als eine Textseite - sonst rutschen
   Samstag und Sonntag aus dem Bild. */
.wrap-wide { max-width: 96rem; }

/* Tagesknöpfe im Kalenderkopf: nur Symbol, Bedeutung im title und in
   aria-label. Sieben Tage mal zwei Beschriftungen wären sonst breiter als
   der Kalender selbst. */
.cal-daytools button { min-width: 22px; padding: 0 .2rem; line-height: 1; }
.cal-daytools svg { width: 11px; height: 11px; vertical-align: -1px; }

/* Der gerade gewählte Tag im Monatskalender - stärker als die Heute-Markierung,
   damit beide nebeneinander unterscheidbar bleiben. */
.day.is-current { outline: 3px solid var(--amber); outline-offset: -3px; }

/* Warnzeichen, wenn slots.seats_taken nicht zu den Buchungen passt.
   Im Normalbetrieb kommt das nicht vor - der Buchungsdienst schreibt beide in
   derselben Transaktion. Tritt es doch auf, hat jemand an der Anwendung vorbei
   gearbeitet, und das soll man sehen statt es wegzurechnen. */
.ev .drift { color: var(--crit); font-weight: 700; }

/* --- Kontaktfenster im Planer -------------------------------------------- */
.kontakt-dialog {
  width: min(34rem, calc(100vw - 2rem));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  padding: 1.1rem 1.2rem 1.2rem;
  box-shadow: 0 8px 30px rgba(21, 26, 28, .22);
}
.kontakt-dialog::backdrop { background: rgba(21, 26, 28, .45); }
.kontakt-dialog h2 { font-size: 1.05rem; }

/* ---------------------------------------------------------------------------
   Auswertungen

   Diagrammfarben: Emphasis statt kategorial. Der gewählte Zeitraum trägt den
   Markenakzent, das Vergleichsjahr ein Grau - so ist ablesbar, welche Reihe
   gemeint ist, auch ohne Farbunterscheidung. Beide Werte sind gegen den weissen
   Grund und gegeneinander geprüft (Kontrast 5,4:1 und 4,6:1, Abstand ΔE 17,3).
--------------------------------------------------------------------------- */

:root {
  --viz-accent:  #b85a0b;
  --viz-context: #5c6468;
  --viz-grid:    #e8eded;
  --viz-axis:    #c3cbcd;
}

.filterbar { display: flex; gap: .7rem; flex-wrap: wrap; align-items: flex-end; }
.filterbar .field { min-width: 8rem; }
.filterbar .btn { margin-left: auto; }

/* --- Kennzahlen ---------------------------------------------------------- */
/* Eigene Rahmen statt Rasterluecken als Trennlinien: bei 12 Kacheln bleibt
   sonst in der letzten Zeile eine graue Flaeche stehen, wo keine Kachel ist. */
.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(10.5rem, 1fr));
  gap: .55rem;
}
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
       padding: .7rem .85rem .8rem; display: flex; flex-direction: column; gap: .1rem; }
.kpi-label { font-size: .78rem; color: var(--ink-3); }
.kpi-value { font-size: 1.5rem; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpi-delta { font-size: .78rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.kpi-delta small { font-weight: 400; color: var(--ink-3); margin-left: .25rem; }
.kpi-delta.is-up   { color: var(--ok); }
.kpi-delta.is-down { color: var(--crit); }
.kpi-delta.is-flat { color: var(--ink-3); }

/* --- Diagramme ----------------------------------------------------------- */
.chart-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr)); gap: 1rem; }
.chart { margin: 0; }
.chart figcaption { font-weight: 600; font-size: .95rem; margin-bottom: .5rem; }
.chart svg { width: 100%; height: auto; display: block; }
.chart-axis  { fill: var(--ink-3); font-size: 9px; font-family: var(--font); }
.chart-value { fill: var(--ink-2); font-size: 9px; font-weight: 600; font-family: var(--font);
               font-variant-numeric: tabular-nums; }
.chart-empty { color: var(--ink-3); font-size: .9rem; padding: 1.5rem 0; text-align: center; }
.chart-note  { color: var(--ink-3); font-size: .82rem; margin-top: .5rem; }

.chart-legend { display: flex; gap: 1rem; flex-wrap: wrap; font-size: .82rem;
                color: var(--ink-2); margin-top: .5rem; }
.chart-legend i { display: inline-block; width: .75rem; height: .75rem; border-radius: 2px;
                  vertical-align: -1px; margin-right: .35rem; }

/* --- Liegende Balken ----------------------------------------------------- */
.barlist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .35rem; }
.barlist li { display: grid; grid-template-columns: minmax(6rem, 11rem) 1fr auto; gap: .6rem; align-items: center; }
.barlist-label { font-size: .87rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.barlist-track { background: var(--surface-2); border-radius: 3px; height: 1.1rem; overflow: hidden; }
.barlist-bar { display: block; height: 100%; background: var(--viz-accent); border-radius: 3px; min-width: 2px; }
.barlist-value { font-size: .87rem; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.barlist-value small { display: block; font-weight: 400; color: var(--ink-3); font-size: .74rem; }

/* --- Anteil Wiederkehrer ------------------------------------------------- */
.split { display: flex; flex-direction: column; gap: .5rem; }
.split-bar { display: flex; height: 1.6rem; border-radius: 3px; overflow: hidden; gap: 2px; }
.split-bar span { display: block; }
.split-a { background: var(--viz-accent); }
.split-b { background: var(--viz-context); }

.table-toggle summary { cursor: pointer; font-size: .88rem; color: var(--ink-2); margin-top: .6rem; }

@media print {
  .topbar, .filterbar .btn, .table-toggle { display: none; }
  .card { break-inside: avoid; box-shadow: none; }
}

/* Monatsübersicht in der schmalen Seitenspalte: nur die Zahl, die Farbe trägt
   die Auslastung, der Rest steht im title. */
.month.is-compact .day { min-height: 2rem; font-size: .78rem; border-radius: 2px; }
.month.is-compact .day small { display: none; }
.month.is-compact { gap: 1px; }

/* Offene Anfragen in der Seitenspalte */
.reqlist { list-style: none; margin: 0; padding: 0; }
.reqlist li { border-bottom: 1px solid var(--line-soft); }
.reqlist li:last-child { border-bottom: 0; }
.reqbtn {
  display: block; width: 100%; text-align: left; border: 0; background: var(--surface);
  padding: .55rem .8rem; font: inherit; cursor: pointer; border-left: 3px solid transparent;
}
.reqbtn:hover, .reqbtn:focus { background: var(--brine-soft); }
.reqbtn.is-tight { border-left-color: var(--crit); }
.reqbtn strong { display: block; font-size: .88rem; }
.reqbtn span { color: var(--ink-3); font-size: .8rem; }
.reqbtn .warn { color: var(--crit); font-weight: 600; }

.req-dialog {
  width: min(38rem, calc(100vw - 2rem));
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); color: var(--ink);
  padding: 1.1rem 1.2rem 1.2rem;
  box-shadow: 0 8px 30px rgba(21, 26, 28, .22);
}
.req-dialog::backdrop { background: rgba(21, 26, 28, .45); }
.req-dialog h2 { font-size: 1.05rem; }

/* ---------------------------------------------------------------------------
   Kundenakte: Stammdaten zwei Drittel, Termine und Historie ein Drittel.

   Eigene Klasse, nicht .planner mitbenutzen - die trägt inzwischen das
   Dreispalten-Raster des Planers, und dessen Seitenspalte ist für ein
   Formular viel zu schmal.
--------------------------------------------------------------------------- */
.detail-split { display: grid; grid-template-columns: 1fr; gap: 1rem; align-items: start; }
@media (min-width: 62rem) {
  .detail-split { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
}

/* --- Aenderungsprotokoll -------------------------------------------------- */
/* Zwei Ebenen: die Kopfzeile beantwortet wann/was/wer, die Liste darunter
   welche Felder. Wer nur blaettert, liest die Kopfzeilen; wer etwas sucht,
   liest die Felder. Deshalb sind die Felder kleiner und eingerueckt, nicht
   hinter einem Aufklapper - Aufklappen ist eine Huerde beim Suchen. */
.protokoll { padding: .6rem 1rem; }
.protokoll-kopf {
  display: flex;
  gap: .75rem;
  align-items: baseline;
  flex-wrap: wrap;
}
.protokoll-zeit {
  font-variant-numeric: tabular-nums;
  color: var(--ink-3);
  font-size: .85rem;
  min-width: 8.5rem;
}
.protokoll-was { flex: 1 1 12rem; }
.protokoll-nr { color: var(--ink-3); font-size: .85rem; }
.protokoll-wer { color: var(--ink-2); font-size: .85rem; }

.protokoll-felder {
  list-style: none;
  margin: .35rem 0 0 8.5rem;
  padding: 0;
  font-size: .85rem;
}
.protokoll-felder li {
  border: 0;
  display: flex;
  gap: .4rem;
  align-items: baseline;
  flex-wrap: wrap;
  padding: .1rem 0;
}
.protokoll-feld { color: var(--ink-2); font-weight: 600; min-width: 9rem; }
.protokoll-alt { color: var(--ink-3); text-decoration: line-through; }
.protokoll-pfeil { color: var(--ink-3); }
.protokoll-neu { color: var(--ink); font-weight: 600; }

@media (max-width: 40rem) {
  .protokoll-felder { margin-left: 0; }
  .protokoll-feld { min-width: 0; }
}

/* --- Benutzermenue ------------------------------------------------------- */
/* Ein <details> statt eines nachgebauten Dropdowns: es klappt ohne
   JavaScript, ist ueber die Tastatur bedienbar und braucht keine
   Bibliothek. Das Dreieck der Voreinstellung wird ausgeblendet, weil es
   links vom Text sitzt und dort niemand danach sucht. */
.dropdown { position: relative; }
.dropdown > summary {
  display: flex;
  align-items: center;
  gap: .45rem;
  padding: .4rem .7rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink-2);
  font-size: .93rem;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  list-style: none;
  min-height: 34px;
}
.dropdown > summary::-webkit-details-marker { display: none; }
.dropdown > summary::marker { content: ""; }
.dropdown > summary:hover,
.dropdown[open] > summary { background: var(--surface-2); color: var(--ink); }
.usermenu-pfeil { font-size: .7rem; color: var(--ink-3); }

.dropdown-panel {
  position: absolute;
  top: calc(100% + .35rem);
  right: 0;
  min-width: 14rem;
  padding: .3rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 4px 14px rgba(21, 26, 28, .13);
  z-index: 30;
}
.dropdown-kopf {
  display: flex;
  flex-direction: column;
  gap: .05rem;
  padding: .45rem .6rem .55rem;
  border-bottom: 1px solid var(--line-soft);
  margin-bottom: .3rem;
}
.dropdown-kopf strong { color: var(--ink); font-size: .93rem; }
.dropdown-kopf span { font-size: .8rem; color: var(--ink-3); }

.dropdown-panel a,
.dropdown-panel button {
  display: block;
  width: 100%;
  padding: .45rem .6rem;
  border: 0;
  border-radius: var(--radius);
  background: none;
  color: var(--ink-2);
  font: inherit;
  font-size: .9rem;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.dropdown-panel a:hover,
.dropdown-panel button:hover { background: var(--surface-2); color: var(--ink); }
.dropdown-panel a[aria-current="page"] { background: var(--amber-soft); color: var(--amber); }
.dropdown-trenner { height: 1px; background: var(--line-soft); margin: .3rem 0; }

/* Schmale Geraete: Marke und Benutzermenue in die erste Zeile, die Navigation
   darunter ueber die volle Breite. Ohne das schiebt die umbrechende Navigation
   das Menue aus dem Bild - auf einem Telefon kam man dann nicht mehr an
   "Abmelden". */
@media (max-width: 52rem) {
  .topbar-inner { flex-wrap: wrap; gap: .5rem .8rem; }
  .brand { order: 1; }
  .usermenu { order: 2; margin-left: auto; }
  .topnav { order: 3; flex-basis: 100%; flex: 1 0 100%; }
  .dropdown-panel { min-width: 12rem; }
}

/* --- Gaesteliste im Planer ----------------------------------------------- */
/* Zwei Zeilen je Gast: oben Name, Kennzeichen und das Aktionsmenue, darunter
   die Anmerkungen ueber die volle Breite. Neben den Knoepfen wurden sie sonst
   zu einem schmalen Streifen - und genau die liest man am Empfang.
   Die abwechselnde Hinterlegung trennt die Gaeste voneinander, ohne dafuer
   Hoehe zu verbrauchen. */
.gastliste { list-style: none; margin: 0; padding: 0; }
.gast {
  padding: .55rem 1rem .65rem;
  border-top: 1px solid var(--line);
}
.gast:first-child { border-top: 0; }
.gast:nth-child(even) { background: var(--surface-2); }
.gast-zeile { display: flex; gap: .6rem; align-items: flex-start; }
.gast .note { margin-top: .45rem; }
.gast .badges { margin-top: .25rem; }

/* Das Aktionsmenue ist ein kleiner Knopf, nicht das breite Namensfeld der
   Kopfzeile - deshalb eigene Masse auf demselben Grundgeruest. */
.aktionen { flex: none; }
.aktionen > summary {
  padding: .28rem .55rem;
  font-size: .84rem;
  min-height: 0;
}
.aktionen .dropdown-panel { min-width: 10.5rem; }
.dropdown-panel .ist-gefahr { color: var(--crit); }
.dropdown-panel .ist-gefahr:hover { background: var(--crit-soft); color: var(--crit); }

/* Abstand zwischen den Bloecken unter "Termin bearbeiten". */
.termin-block { margin-top: .8rem; }

/* --- Verschiebbare Fenster ----------------------------------------------- */
/* Die Kopfzeile eines Dialogs ist sein Griff. touch-action: none, damit auf
   dem Tablet gezogen und nicht gescrollt wird; user-select: none, damit beim
   Ziehen nicht die Ueberschrift markiert wird. */
.dialog-griff {
  cursor: move;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.dialog-griff button,
.dialog-griff a { cursor: pointer; }

/* --- Einstellungen -------------------------------------------------------- */
/* Beschriftung und Erklaerung links, Eingabefeld rechts in fester Breite.
   Die Erklaerungen sind laenger als die Werte - stuende das Feld darunter,
   muesste man fuer 23 Einstellungen dreimal so weit scrollen. */
.einstellung {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  padding: .7rem 0;
  border-top: 1px solid var(--line-soft);
}
.einstellung:first-of-type { border-top: 0; padding-top: 0; }
.einstellung-text { flex: 1; min-width: 0; }
.einstellung-text label { font-weight: 600; font-size: .93rem; color: var(--ink); }
.einstellung-hilfe {
  margin: .15rem 0 .2rem;
  font-size: .87rem;
  color: var(--ink-2);
}
.einstellung-schluessel { font-size: .75rem; color: var(--ink-3); }
.einstellung-feld { width: 13rem; flex: none; }
.einstellung-feld input,
.einstellung-feld textarea { width: 100%; }

@media (max-width: 40rem) {
  .einstellung { flex-direction: column; gap: .4rem; }
  .einstellung-feld { width: 100%; }
}
