/* =========================================================================
   SOLID GOLF · Leitstand — CI-Theme (Website-Relaunch 2026: Schwarz / Gold / Sand)
   Schwarz #0B0C0C · Gold #C9AD5E · Sand #D9C48A · Panel #F4EFE3
   Montserrat (Headlines, Display-Zahlen) + DM Sans (Text)
   Standard = DUNKEL (wie die Website); hell = optional via <html data-theme="light">
   Semantik der Token-Namen bleibt (Code/JS unangetastet):
     --gold*  = AKTIV / belegt / Wert  -> jetzt GOLD
     --sand*   = SPITZE / Highlight     -> jetzt SAND (heller, waermer)
     --on-accent = Text auf Gold/Sand-Vollflaechen (immer Schwarz)
   ========================================================================= */
@font-face {
  font-family: "Montserrat";
  font-weight: 400 900;
  font-style: normal;
  font-display: swap;
  src: url("/static/fonts/Montserrat-var-latin.woff2") format("woff2");
  unicode-range:
    U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC,
    U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Montserrat";
  font-weight: 400 900;
  font-style: normal;
  font-display: swap;
  src: url("/static/fonts/Montserrat-var-latin-ext.woff2") format("woff2");
  unicode-range:
    U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F,
    U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "DM Sans";
  font-weight: 100 1000;
  font-style: normal;
  font-display: swap;
  src: url("/static/fonts/DMSans-var-latin.woff2") format("woff2");
  unicode-range:
    U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC,
    U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "DM Sans";
  font-weight: 100 1000;
  font-style: normal;
  font-display: swap;
  src: url("/static/fonts/DMSans-var-latin-ext.woff2") format("woff2");
  unicode-range:
    U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F,
    U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  /* ---- Marken-Konstanten (theme-unabhaengig) ---- */
  --brand-black: #0b0c0c;
  --brand-ink: #141515;
  --brand-ink-2: #1c1d1d;
  --brand-gold: #c9ad5e;
  --brand-gold-dark: #806a2b;
  --brand-sand: #d9c48a;
  --brand-panel: #f4efe3;
  --font-display: "Montserrat", "Arial Black", system-ui, sans-serif;
  --font-text: "DM Sans", "Helvetica Neue", Arial, system-ui, sans-serif;
  --on-accent: #0b0c0c; /* Schrift auf Gold/Sand-Vollflaechen */

  /* ---- DUNKEL (Standard, wie Website) ---- */
  --bg: #0b0c0c;
  --surface: #141515;
  --surface-2: #1c1d1d;
  --surface-occ: #1a1913; /* belegte Karte: Hauch Gold */
  --border: #2a2b2a;
  --border-2: #3a3b39;
  --tl-grid: rgba(255, 255, 255, 0.08);
  --ink: #ffffff;
  --text: #e6e2d6;
  --muted: #b8b3a6;
  --muted-2: #7a766c;
  --glow: #1a1813;

  /* AKTIV / belegt / Wert */
  --gold: #c9ad5e;
  --gold-strong: #c9ad5e;
  --gold-text: #d9c48a;
  --gold-tint: rgba(201, 173, 94, 0.14);
  --gold-tint2: rgba(201, 173, 94, 0.3);
  --gold-border: rgba(201, 173, 94, 0.4);

  /* SPITZE / Highlight */
  --sand: #d9c48a;
  --sand-strong: #e8d7a3;
  --sand-text: #e8d7a3;
  --sand-ink: #0b0c0c;
  --sand-tint: rgba(217, 196, 138, 0.14);
  --sand-border: rgba(217, 196, 138, 0.42);

  /* Status Rot */
  --danger: #e0574b;
  --danger-text: #e9756b;
  --danger-tint: rgba(224, 87, 75, 0.14);
  --danger-border: rgba(224, 87, 75, 0.45);

  /* Sidebar: immer Schwarz (in beiden Themes, wie der Website-Header) */
  --logo-plate: #0b0c0c;
  --nav: #0b0c0c;
  --nav-2: #0b0c0c;
  --nav-ink: #f2eee4;
  --nav-muted: #8e887a;
  --nav-line: #2a2b2a;
  --radius: 6px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow-inset: inset 0 1px 2px rgba(0, 0, 0, 0.45);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 14px 30px -16px rgba(0, 0, 0, 0.7);
  --shadow-pop: 0 2px 6px -2px rgba(0, 0, 0, 0.4), 0 24px 50px -22px rgba(0, 0, 0, 0.8);
  --t-fast: 120ms;
  --t: 180ms;
  --ease: cubic-bezier(0.2, 0.6, 0.2, 1);
  font-synthesis: none;
  color-scheme: dark;
}

/* ---- HELL (Panel-Ton der Website) ---- */
:root[data-theme="light"] {
  --bg: #f4efe3;
  --surface: #ffffff;
  --surface-2: #faf7ef;
  --surface-occ: #fbf6e8;
  --border: #e3dcc8;
  --border-2: #d2c9ae;
  --tl-grid: rgba(11, 12, 12, 0.1);
  --ink: #0b0c0c;
  --text: #2b2a26;
  --muted: #5b5750;
  --muted-2: #948e80;
  --glow: #f1e9d3;

  --gold: #c9ad5e;
  --gold-strong: #c9ad5e;
  --gold-text: #806a2b;
  --gold-tint: #f5edd3;
  --gold-tint2: #ebddae;
  --gold-border: #e0cf98;

  --sand: #d9c48a;
  --sand-strong: #cdb56f;
  --sand-text: #6e5a22;
  --sand-ink: #0b0c0c;
  --sand-tint: #f7f1de;
  --sand-border: #e6d6a6;

  --danger: #c0362c;
  --danger-text: #c0362c;
  --danger-tint: #f9eae8;
  --danger-border: #e6b6b1;

  --shadow-sm: 0 1px 2px rgba(11, 12, 12, 0.06);
  --shadow-inset: inset 0 1px 2px rgba(11, 12, 12, 0.08);
  --shadow: 0 1px 2px rgba(11, 12, 12, 0.06), 0 12px 28px -16px rgba(11, 12, 12, 0.3);
  --shadow-pop: 0 2px 6px -2px rgba(11, 12, 12, 0.1), 0 20px 44px -22px rgba(11, 12, 12, 0.34);
  color-scheme: light;
}

* {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}
html,
body {
  margin: 0;
}
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-text);
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
  transition:
    background-color 0.2s ease,
    color 0.2s ease;
}
h1,
h2,
h3,
.box-title {
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
h3 {
  font-size: 13px;
  font-weight: 800;
  line-height: 1.25;
  margin: 0;
} /* einheitliche Karten-/Sektions-Titel; Abstand über Eltern-gap/Utilities, nicht inline */
.tnum {
  font-variant-numeric: tabular-nums;
}

/* Browser-Flaechen aus der Palette gethemt (Selektion, Scrollbar, Caret, Fokus) */
::selection {
  background: var(--gold-tint2);
  color: var(--ink);
}
* {
  scrollbar-width: thin;
  scrollbar-color: var(--border-2) transparent;
}
::-webkit-scrollbar {
  width: 11px;
  height: 11px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border-2);
  border-radius: 999px;
  border: 3px solid var(--surface);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--muted-2);
}
input,
select,
textarea {
  caret-color: var(--gold);
}
/* Einheitlicher Fokus-Ring als Grundlinie (0-Spezifitaet -> element-eigene Regeln gewinnen). */
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}
.nav a:focus-visible {
  outline-color: var(--sand);
}

/* ===================== Shell ===================== */
.app {
  display: grid;
  grid-template-columns: 250px 1fr;
  min-height: 100dvh;
}

.sidebar {
  background: var(--nav);
  color: var(--nav-ink);
  border-right: 1px solid var(--nav-line);
  display: flex;
  flex-direction: column;
  padding: 18px 14px;
  position: sticky;
  top: 0;
  height: 100dvh;
}
.logo-wrap {
  padding: 6px 6px 16px;
}
.logo-wrap .logo-img {
  height: 20px;
  width: auto;
  max-width: 100%;
  display: block;
} /* Original-Logo direkt auf Gruen – ohne Plakette */
/* Sidebar-Logo: logo-dark.svg in beiden Themes (Sidebar ist immer dunkel) */
.logo-wrap .logo-dark {
  display: block;
}
.navlabel {
  font-family: var(--font-text);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--nav-muted);
  padding: 12px 10px 6px;
  font-weight: 700;
}
.nav {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.nav a {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 11px;
  border-radius: 6px;
  color: var(--nav-ink);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  position: relative;
}
.nav a svg {
  width: 18px;
  height: 18px;
  opacity: 0.9;
  flex: 0 0 auto;
}
.nav a:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}
.nav a.active {
  background: rgba(201, 173, 94, 0.12);
  color: var(--brand-gold);
}
.nav a.active::before {
  content: "";
  position: absolute;
  left: -14px;
  top: 8px;
  bottom: 8px;
  width: 4px;
  border-radius: 0 2px 2px 0;
  background: var(--sand);
}
.side-foot {
  margin-top: auto;
  padding: 12px 10px 2px;
}
.side-foot .conn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--nav-muted);
  font-size: 12px;
  padding-left: 2px;
}
.side-foot .conn i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--sand);
}
.side-foot .conn.off i {
  background: var(--danger);
}
.userbox {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.07);
  margin-bottom: 10px;
}
.uavatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--brand-gold);
  color: var(--on-accent);
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 13px;
  flex: 0 0 auto;
}
.uinfo {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.2;
}
.uinfo .uname {
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.uinfo .urole {
  font-size: 11px;
  color: var(--nav-muted);
}
.logout-btn {
  margin-left: auto;
  width: 32px;
  height: 32px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.04);
  color: var(--nav-ink);
  cursor: pointer;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}
.logout-btn:hover {
  background: rgba(255, 255, 255, 0.12);
}
.logout-btn svg {
  width: 16px;
  height: 16px;
}

.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px clamp(16px, 2.4vw, 28px);
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.page-head h1 {
  font-size: 18px;
  font-weight: 900;
  margin: 0;
  color: var(--ink);
}
.page-head .sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}
.status {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
}
.statusclock {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 15px;
}

.content {
  padding: clamp(16px, 2.4vw, 26px);
  display: flex;
  flex-direction: column;
  gap: 22px;
}
.view {
  display: flex;
  flex-direction: column;
  gap: 22px;
}
.stand {
  margin: 4px 2px 0;
  color: var(--muted-2);
  font-size: 12px;
}

/* KPI-Kacheln */
.kpis {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}
@media (min-width: 1080px) {
  .kpis {
    grid-template-columns: repeat(5, 1fr);
  }
}
.kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 18px 16px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.kpi .k-label {
  font-size: 11px;
  color: var(--muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.18em;
}
.kpi .k-val {
  font-size: clamp(27px, 2.3vw, 33px);
  font-weight: 800;
  color: var(--ink);
  margin-top: 7px;
  line-height: 1;
  font-family: var(--font-display);
  white-space: nowrap;
}
.kpi .k-val small {
  font-size: 16px;
  color: var(--muted);
  font-weight: 700;
}
.kpi .k-delta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: auto;
  align-self: flex-start;
  font-size: 12px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
}
/* Sparkline (echte by_day-Reihe) — recessed unter dem Wert; Delta sitzt via margin-top:auto unten */
.k-spark {
  display: block;
  height: 34px;
  margin: 14px -2px 0;
}
.k-spark svg {
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
}
.k-spark path.line {
  fill: none;
  stroke: var(--gold);
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}
.k-spark path.area {
  fill: var(--gold-tint);
  stroke: none;
}
.k-delta.up {
  color: var(--gold-text);
  background: var(--gold-tint);
}
.k-delta.down {
  color: var(--danger-text);
  background: var(--danger-tint);
}
.k-delta.flat {
  color: var(--sand-text);
  background: var(--sand-tint);
}

/* Chart-Karten */
.charts {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(2, 1fr);
}
@media (max-width: 1100px) {
  .charts {
    grid-template-columns: 1fr;
  }
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
}
.card .c-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 12px;
  gap: 12px;
}
/* Chart-Karte: nicht auf Nachbarhöhe (Tabelle) strecken -> kein Leerraum unter dem Diagramm */

/* Dashboard-Steuerleiste: Zeitraum-Filter (steuert alles) + Bericht-Download */
.dash-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px 18px;
  flex-wrap: wrap;
}
.dash-controls .filterbar {
  flex: 1 1 auto;
}
.dl-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}
.dl-label {
  font-size: 13px;
  color: var(--muted);
  font-weight: 600;
}
.dl-group .export-btn {
  margin-left: 0;
}
.export-btn.ghost {
  color: var(--gold-text);
  background: var(--surface);
  border-color: var(--gold-border);
}
.export-btn.ghost:hover {
  background: var(--gold-tint);
  filter: none;
}
@media (max-width: 620px) {
  .dl-group {
    width: 100%;
  }
  .dl-group .export-btn {
    flex: 1;
    justify-content: center;
  }
}
.card h3 {
  font-size: 13px;
  font-weight: 800;
  color: var(--ink);
  margin: 0;
}
.card .c-sub {
  font-size: 12px;
  color: var(--muted);
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 13px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
}
.pill .dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--muted-2);
  flex: 0 0 auto;
}
.pill.on {
  background: var(--sand-tint);
  border-color: var(--sand-border);
  color: var(--sand-text);
}
.pill.on .dot {
  background: var(--sand-strong);
  box-shadow: 0 0 0 4px rgba(201, 173, 94, 0.22);
}
.pill.warn {
  border-color: var(--sand-border);
  color: var(--sand-text);
  background: var(--sand-tint);
}
.pill.warn .dot {
  background: var(--sand-strong);
}
.pill.alarm {
  border-color: var(--danger-border);
  color: var(--danger-text);
  background: var(--danger-tint);
}
.pill.alarm .dot {
  background: var(--danger);
  box-shadow: 0 0 0 4px rgba(192, 54, 44, 0.15);
}
.pill .muted {
  color: var(--muted);
  font-weight: 500;
}
.pill.clickable {
  cursor: pointer;
  transition:
    border-color 0.15s,
    background 0.15s,
    box-shadow 0.15s;
}
.pill.clickable:hover {
  border-color: var(--border-2);
  box-shadow: var(--shadow-sm);
}
.pill.clickable:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}
.icon-pill {
  padding: 9px;
}
.icon-pill svg {
  width: 16px;
  height: 16px;
  color: var(--muted);
  display: block;
}

.occ {
  gap: 9px;
}
.occ-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}
.occ .bar {
  width: 74px;
  height: 8px;
  border-radius: 999px;
  background: var(--gold-tint);
  overflow: hidden;
  border: 1px solid var(--gold-border);
  box-shadow: var(--shadow-inset);
}
.occ .bar > i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--brand-gold-dark), var(--gold));
  transition: width 0.4s ease;
}

/* ---------- Layout ---------- */
.grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(3, 1fr);
} /* 9 Boxen = 3 pro Reihe, 3 Reihen */
/* Tür-Statuskacheln (Leitstand, read-only) */
.doors-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 14px;
}
.door {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  min-width: 220px;
}
.door-ico {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 4px;
  color: var(--muted);
  background: var(--surface-2);
  flex: 0 0 auto;
}
.door-ico svg {
  width: 18px;
  height: 18px;
}
.door-info {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}
.door-name {
  font-weight: 700;
  color: var(--ink);
  font-size: 14px;
}
.door-status {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
}
.door.closed {
  border-color: var(--gold-border);
}
.door.closed .door-ico {
  color: var(--gold-text);
  background: var(--gold-tint);
}
.door.closed .door-status {
  color: var(--gold-text);
}
.door.open .door-ico,
.door.moving .door-ico {
  color: var(--sand-text);
  background: var(--sand-tint);
}
.door.open .door-status,
.door.moving .door-status {
  color: var(--sand-text);
}
.door.alarm {
  border-color: var(--danger-border);
  background: var(--danger-tint);
}
.door.alarm .door-ico {
  color: var(--danger);
  background: var(--surface);
}
.door.alarm .door-status {
  color: var(--danger);
}
.door.alarm {
  animation: doorpulse 1.6s ease-in-out infinite;
}
@keyframes doorpulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(192, 54, 44, 0);
  }
  50% {
    box-shadow: 0 0 0 4px rgba(192, 54, 44, 0.14);
  }
}
@media (prefers-reduced-motion: reduce) {
  .door.alarm {
    animation: none;
  }
}

/* ---------- Box-Karte ---------- */
.box {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 15px 15px 13px;
  box-shadow: var(--shadow-sm);
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    transform 0.2s ease;
}
.box:hover {
  box-shadow: var(--shadow-pop);
  transform: translateY(-1px);
}
/* Voller grüner Rahmen rundherum – folgt den runden Ecken (box-sizing: border-box, kein Layout-Shift) */
.box.occupied {
  background: var(--surface-occ);
  border-color: var(--gold);
  border-width: 2px;
}
.box.alarm {
  border-color: var(--danger);
  border-width: 2px;
}
.box-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.box-id {
  display: flex;
  align-items: center;
  gap: 10px;
}
.box-no {
  width: 34px;
  height: 34px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 15px;
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  color: var(--muted);
}
.box.occupied .box-no {
  color: var(--gold-text);
  background: var(--gold-tint);
  border-color: var(--gold-border);
}
.box-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
}
.box-title small {
  display: block;
  font-size: 11px;
  color: var(--muted);
  font-weight: 500;
  font-family: var(--font-text);
  text-transform: none;
  letter-spacing: 0;
}

.badge {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  padding: 5px 9px;
  border-radius: 4px;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.badge.free {
  color: var(--muted);
}
.badge.busy {
  color: var(--on-accent);
  background: var(--gold-strong);
  border-color: var(--gold-strong);
}
.badge.soon {
  color: var(--sand-ink);
  background: var(--sand);
  border-color: var(--sand-strong);
}
.badge.alarm {
  color: #fff;
  background: var(--danger);
  border-color: var(--danger);
}

.booking-line {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-height: 26px;
  margin-bottom: 12px;
}
.booking-line .time {
  font-size: 19px;
  font-weight: 800;
  color: var(--ink);
  font-family: var(--font-display);
}
.booking-line .rel {
  font-size: 12px;
  color: var(--gold-text);
  font-weight: 600;
}
.booking-line.empty .time {
  color: var(--muted-2);
  font-weight: 700;
  font-size: 15px;
}
.next-line {
  font-size: 12px;
  color: var(--muted);
  margin: -6px 0 12px;
  min-height: 16px;
}
.next-line b {
  color: var(--text);
  font-weight: 600;
}

.alarm-line {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: -6px 0 12px;
  font-size: 12px;
  color: var(--danger-text);
  font-weight: 600;
}
.alarm-line svg {
  width: 15px;
  height: 15px;
  color: var(--danger-text);
  flex: 0 0 auto;
}

.devices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.dev {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
}
.dev svg {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
  color: var(--muted);
}
.dev .meta {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  min-width: 0;
}
.dev .name {
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
}
.dev .state {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted-2);
  display: flex;
  align-items: center;
  gap: 6px;
}
.dev .state i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted-2);
  flex: 0 0 auto;
}
.dev.on {
  border-color: var(--gold-border);
  background: var(--gold-tint);
}
.dev.on svg {
  color: var(--gold-text);
}
.dev.on .state {
  color: var(--gold-text);
}
.dev.on .state i {
  background: var(--gold);
}

/* Fortschritt der laufenden Buchung – schlanker, abgerundeter Balken unter der Zeit (NICHT am Rahmen) */
.progress {
  height: 5px;
  border-radius: 999px;
  background: var(--gold-tint);
  overflow: hidden;
  margin: -2px 0 12px;
  box-shadow: var(--shadow-inset);
}
.progress > i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--brand-gold-dark), var(--gold));
  transition: width 1s linear;
}

.head-right {
  display: flex;
  align-items: center;
  gap: 8px;
}
.chip-manual {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--sand-text);
  background: var(--sand-tint);
  border: 1px solid var(--sand-border);
  padding: 3px 7px;
  border-radius: 6px;
}

/* ---------- Aktionsleiste ---------- */
.box-foot {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-top: 13px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.foot-row {
  display: flex;
  gap: 7px;
}
.rbtns {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
}
.btn {
  font-family: inherit;
  cursor: pointer;
  border-radius: 4px;
  border: 1px solid var(--border-2);
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  padding: 9px 12px;
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  flex: 1;
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    opacity 0.15s ease,
    filter 0.15s ease;
}
.btn svg {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
}
.btn:hover {
  background: var(--surface-2);
  border-color: var(--muted-2);
}
.btn:active {
  transform: translateY(1px);
}
.btn:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}
.btn:disabled {
  opacity: 0.5;
  cursor: progress;
}
.btn.power-on {
  color: var(--on-accent);
  background: var(--gold-strong);
  border-color: var(--gold-strong);
}
.btn.power-on:hover {
  filter: brightness(0.92);
  background: var(--gold-strong);
}
.btn.power-off {
  color: var(--danger-text);
  background: var(--surface);
  border-color: var(--danger-border);
}
.btn.power-off:hover {
  background: var(--danger-tint);
  border-color: var(--danger);
}
.btn.ack {
  flex: 0 0 auto;
  color: #fff;
  background: var(--danger);
  border-color: var(--danger);
}
.btn.ack:hover {
  filter: brightness(0.92);
  background: var(--danger);
}
.rbtns .btn {
  padding: 7px 6px;
  min-height: 32px;
  font-size: 12px;
  color: var(--muted);
}
.rbtns .btn svg {
  width: 13px;
  height: 13px;
}
/* Hart-Reset: destruktiv -> Gefahr-Hinweis beim Hover (Bestätigungs-Modal bleibt der eigentliche Schutz) */
.rbtns .btn.rb-hard:hover {
  border-color: var(--danger);
  color: var(--danger);
  background: var(--danger-tint);
}
.btn.primary {
  color: var(--on-accent);
  background: var(--gold-strong);
  border-color: var(--gold-strong);
}
.btn.primary:hover {
  filter: brightness(0.92);
  background: var(--gold-strong);
}
.btn.danger {
  color: #fff;
  background: var(--danger);
  border-color: var(--danger);
}
.btn.danger:hover {
  filter: brightness(0.92);
  background: var(--danger);
}

/* ---------- Dialog / Modal (zentriert, gestyltes confirm/alert) ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.48);
  backdrop-filter: blur(3px);
  opacity: 0;
  transition: opacity 0.18s ease;
}
.modal-overlay.show {
  opacity: 1;
}
.modal {
  width: min(420px, 100%);
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 24px 60px -16px rgba(0, 0, 0, 0.45);
  padding: 22px 22px 18px;
  transform: translateY(10px) scale(0.98);
  transition: transform 0.18s ease;
}
.modal-overlay.show .modal {
  transform: none;
}
.modal h3 {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 800;
  color: var(--ink);
}
.modal p {
  margin: 0 0 20px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}
.modal-actions .btn {
  flex: 0 0 auto;
  min-width: 104px;
  padding: 10px 18px;
}
@media (prefers-reduced-motion: reduce) {
  .modal-overlay,
  .modal {
    transition: none;
  }
}

/* ---------- Seitenspalte ---------- */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.panel h2 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--muted);
  margin: 0;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-text);
  text-transform: none;
  letter-spacing: 0;
  font-weight: 700;
}
.panel h2 svg {
  width: 16px;
  height: 16px;
  color: var(--gold);
}
.up-list {
  list-style: none;
  margin: 0;
  padding: 6px;
  max-height: 46vh;
  overflow: auto;
}
.up {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 10px;
  border-radius: 6px;
}
.up + .up {
  border-top: 1px solid var(--border);
}
.up .tag {
  width: 30px;
  height: 30px;
  border-radius: 4px;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 13px;
  background: var(--gold-tint);
  border: 1px solid var(--gold-border);
  color: var(--gold-text);
  flex: 0 0 auto;
}
.up .info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.up .info .t {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
}
.up .info .s {
  font-size: 12px;
  color: var(--muted);
}
.up .when {
  margin-left: auto;
  font-size: 12px;
  font-weight: 700;
  color: var(--sand-text);
  white-space: nowrap;
}
.empty-state {
  padding: 38px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.5;
}
.empty-state::before {
  content: "";
  display: block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin: 0 auto 14px;
  background: var(--gold);
  box-shadow: 0 0 0 6px var(--gold-tint);
}

/* Volle-Breite-Sektion unter den Boxen: Buchungen als Karten-Raster */
.bookings-section {
  margin-top: 22px;
}
.bookings-section .up-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px;
  padding: 14px 16px 16px;
  max-height: none;
  overflow: visible;
}
.bookings-section .up {
  border: 1px solid var(--border);
  background: var(--surface);
}
.bookings-section .up + .up {
  border-top: 1px solid var(--border);
}
.bookings-section .empty-state {
  grid-column: 1 / -1;
}

/* ---------- Wegbeleuchtung ---------- */
.segments {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 14px 16px;
}

/* ---------- Footer ---------- */
footer {
  margin-top: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted-2);
  font-size: 12px;
}
.conn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.conn i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gold);
}
.conn.off i {
  background: var(--danger);
}

/* ---------- Buchungen ---------- */
.filterbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}
.filterbar select,
.filterbar input {
  font-family: inherit;
  font-size: 13px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: 6px;
  padding: 9px 11px;
  min-height: 38px;
}
.filterbar input {
  min-width: 200px;
  flex: 1;
}
.filterbar select:focus,
.filterbar input:focus {
  outline: 2px solid var(--gold);
  outline-offset: 1px;
}
.f-count {
  margin-left: auto;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}
.table-wrap {
  padding: 0;
  overflow-x: auto;
}
.table-wrap > .c-head {
  padding: 14px 16px 0;
  margin-bottom: 8px;
}
.btable {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.btable th {
  text-align: left;
  font-weight: 700;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--surface);
}
.btable td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
.btable tr:last-child td {
  border-bottom: none;
}
.btable tbody tr:hover {
  background: var(--surface-2);
}
.ta-r {
  text-align: right;
}
.btable th.ta-r {
  text-align: right;
}
/* Rechtsbündige (numerische) Zellen wie in der kn-Liste: fett, ink, Tabellenziffern */
.btable td.ta-r {
  font-weight: 700;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.btable .mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  color: var(--muted);
}
.tag-st {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
}
.tag-st.ok {
  color: var(--gold-text);
  background: var(--gold-tint);
}
.tag-st.off {
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
}

/* Box-Liste (Dashboard) im Top-10-Design: eigene Spaltenbreiten (Auslastung braucht Platz für den Balken) */
.kn-block.kn-box .kn-blk-head,
.kn-block.kn-box .kn-blk-row {
  grid-template-columns: 1fr 72px 86px 138px;
}
.util-cell {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  justify-content: flex-end;
  width: 100%;
}
.util-bar {
  width: 80px;
  height: 6px;
  border-radius: 999px;
  background: var(--gold-tint);
  border: 1px solid var(--gold-border);
  box-shadow: var(--shadow-inset);
  overflow: hidden;
  flex: 0 0 auto;
}
.util-bar > i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--brand-gold-dark), var(--gold));
  transition: width 0.5s var(--ease);
}
.util-bar.top > i {
  background: linear-gradient(90deg, var(--sand-strong), var(--sand));
}
.util-val {
  min-width: 34px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.filterbar .dash {
  color: var(--muted);
}
.filterbar input[type="date"] {
  flex: 0 0 auto;
  min-width: 0;
}
.export-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-left: auto;
  padding: 9px 13px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  color: var(--on-accent);
  background: var(--gold-strong);
  border: 1px solid var(--gold-strong);
}
.export-btn:hover {
  filter: brightness(0.94);
}
.export-btn svg {
  width: 15px;
  height: 15px;
}

/* ---------- Einstellungen ---------- */
/* Systemstatus (Health) */
.health-pill {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  padding: 4px 11px;
  border-radius: 999px;
}
.health-pill.h-ok,
.h-dot.h-ok {
  color: var(--gold-text);
  background: var(--gold-tint);
  border: 1px solid var(--gold-border);
}
.health-pill.h-info,
.h-dot.h-info {
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.health-pill.h-warn,
.h-dot.h-warn {
  color: var(--sand-text);
  background: var(--sand-tint);
  border: 1px solid var(--sand-border);
}
.health-pill.h-down,
.h-dot.h-down {
  color: var(--danger);
  background: var(--danger-tint);
  border: 1px solid var(--danger-border);
}
.health-list {
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.h-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.h-group-title {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2px;
}
.health-row {
  display: grid;
  grid-template-columns: 12px 190px 1fr;
  align-items: center;
  gap: 12px;
  font-size: 13px;
}
.h-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}
.h-label {
  font-weight: 700;
  color: var(--ink);
}
.h-detail {
  color: var(--muted);
}
@media (max-width: 560px) {
  .health-row {
    grid-template-columns: 12px 1fr;
  }
  .h-detail {
    grid-column: 2;
  }
}
.dl-mini {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 700;
  color: var(--gold-text);
  text-decoration: none;
  padding: 3px 9px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface-2);
}
.dl-mini:hover {
  border-color: var(--gold-border);
  background: var(--gold-tint);
}
.dl-mini svg {
  width: 14px;
  height: 14px;
}
.h-jobs {
  grid-column: 1 / -1;
  margin: 2px 0 2px 22px;
}
.h-jobs > summary {
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  color: var(--gold-text);
  list-style: none;
  width: fit-content;
}
.h-jobs > summary::-webkit-details-marker {
  display: none;
}
.h-jobs > summary::before {
  content: "▸ ";
  color: var(--muted);
}
.h-jobs[open] > summary::before {
  content: "▾ ";
}
.h-jobs-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 8px;
  padding-left: 14px;
  border-left: 1px solid var(--border);
}
.h-job {
  display: grid;
  grid-template-columns: 1fr max-content 62px;
  align-items: center;
  gap: 8px 14px;
  font-size: 12.5px;
}
.h-job-label {
  color: var(--ink);
  font-weight: 600;
}
.h-job-int {
  justify-self: end;
  text-align: center;
  min-width: 104px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
}
.h-job-next {
  justify-self: end;
  text-align: right;
  color: var(--ink);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
/* Aufgabenplaner-Reiter: Liste ohne Einrückung + Kopfzeile */
#tasks-list {
  padding-left: 0;
  border-left: none;
  gap: 7px;
}
#tasks-list .h-job {
  padding: 4px 0;
  border-bottom: 1px solid var(--border);
}
.h-job-head {
  border-bottom: 2px solid var(--border);
  padding-bottom: 6px;
  margin-bottom: 2px;
}
.h-job-head .h-job-label,
.h-job-head .h-job-next {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.h-job-head .h-job-int {
  border: none;
  background: none;
  color: var(--muted);
  text-transform: uppercase;
  font-size: 11px;
  padding: 0;
  min-width: 104px;
}
.tasks-group-title {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gold);
  margin: 14px 0 6px;
}
.tasks-group-title:first-child {
  margin-top: 4px;
}
.tasks-once {
  margin-top: 14px;
}
.tasks-once > summary.tasks-group-title {
  margin: 0 0 6px;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 6px;
  user-select: none;
}
.tasks-once > summary.tasks-group-title::-webkit-details-marker {
  display: none;
}
.tasks-once > summary.tasks-group-title::before {
  content: "▸";
  font-size: 10px;
  transition: transform 0.12s ease;
}
.tasks-once[open] > summary.tasks-group-title::before {
  transform: rotate(90deg);
}
.tasks-once > summary.tasks-group-title:hover {
  color: var(--gold-text);
}

/* Rollen-Editor */
.roles-edit {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 10px;
  max-width: 780px;
}
.role-block {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 14px 16px;
  background: var(--surface-2);
}
.role-head {
  display: flex;
  align-items: center;
  gap: 10px;
}
.role-head b {
  font-family: var(--font-display);
  font-size: 15px;
  color: var(--ink);
}
.u-prot {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--sand-text);
  background: var(--sand-tint);
  border: 1px solid var(--sand-border);
  padding: 2px 7px;
  border-radius: 999px;
  margin-left: 6px;
  vertical-align: middle;
}
.role-name-edit {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: 4px;
  padding: 6px 10px;
  max-width: 260px;
}
.role-name-edit:focus {
  outline: 2px solid var(--gold);
  outline-offset: 1px;
}
.role-lock {
  font-size: 11px;
  font-weight: 700;
  color: var(--sand-text);
  background: var(--sand-tint);
  border: 1px solid var(--sand-border);
  padding: 3px 8px;
  border-radius: 999px;
}
.rp-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--muted);
  margin: 12px 0 6px;
}
.rp-group {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 7px;
}
.rp-check {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
  padding: 6px 9px;
  border: 1px solid var(--border-2);
  border-radius: 4px;
  background: var(--surface);
  cursor: pointer;
}
.rp-check:has(input:checked) {
  background: var(--gold-tint);
  border-color: var(--gold-border);
  color: var(--gold-text);
}
.rp-check input {
  margin: 0;
  accent-color: var(--gold);
}
.role-actions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}
.role-actions .btn {
  flex: 0 0 auto;
  padding: 9px 18px;
}

/* Rechte-Gating: fehlt eine Aktion, wird die zugehörige Steuerung ausgeblendet */
body.no-control_boxes .box-foot {
  display: none;
}
body.no-control_lights #segments .lsw {
  display: none;
}
body.no-control_lights #general-pill,
body.no-control_lights #light-master {
  display: none;
}
body.no-config_system #light-add,
body.no-config_system #door-add,
body.no-config_system #view-einstellungen .btn-del {
  display: none;
}
/* Betrieb (Öffnung/Saison/Licht/Schaltzeiten) -> config_operation */
body.no-config_operation #view-betrieb .set-actions {
  display: none;
}
/* Einstellungen (Anlage) + System>Sicherheit (Secrets/Backup/Dry-Run) -> config_system */
body.no-config_system #view-einstellungen .set-actions,
body.no-config_system #view-systemlog .set-actions,
body.no-config_system #view-systemlog #drymode-toggle {
  display: none;
}
/* Backup-Download enthaelt Hashes+DB -> nur mit config_system (analog Backend-Guard). */
body.no-config_system #view-systemlog .dl-mini {
  display: none;
}
body.no-manage_users #view-benutzer .filterbar,
body.no-manage_users #view-benutzer .u-actions,
body.no-manage_users .role-actions {
  display: none;
}

/* Untermenü (Einstellungen, Betrieb, Benutzer) */
.subtabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 18px;
}
.subtabs button {
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: 6px;
  padding: 9px 16px;
  cursor: pointer;
  transition:
    background 0.15s ease,
    color 0.15s ease,
    border-color 0.15s ease;
}
.subtabs button:hover {
  background: var(--surface-2);
  color: var(--ink);
}
.subtabs button.active {
  color: var(--on-accent);
  background: var(--gold-strong);
  border-color: var(--gold-strong);
}
.subtabs button:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.settings-card {
  padding: 20px 22px;
}
.settings-card h3 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
  margin: 0 0 12px;
}
.setgrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}
.setgrid label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}
.setgrid input {
  font-family: inherit;
  font-size: 14px;
  color: var(--ink);
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  border-radius: 6px;
  padding: 10px 12px;
}
.setgrid input:focus {
  outline: 2px solid var(--gold);
  outline-offset: 1px;
}
.set-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}
.set-actions .btn {
  flex: 0 0 auto;
  padding: 10px 22px;
}
.set-msg {
  font-size: 13px;
  font-weight: 600;
}
.set-msg.ok {
  color: var(--gold-text);
}
.set-msg.err {
  color: var(--danger);
}
.set-note {
  margin-top: 18px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}
.set-note.err {
  color: var(--danger);
}
.set-note code,
.auth-warn code,
.set-note .mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  background: var(--surface-2);
  padding: 1px 5px;
  border-radius: 5px;
}
/* Betriebsmodus (Dry-Run) + Secrets */
.drymode-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
}
.drymode-state {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 800;
}
.drymode-state.is-dry {
  color: var(--sand-text);
}
.drymode-state.is-live {
  color: var(--danger);
}
#drymode-toggle {
  flex: 0 0 auto;
  padding: 9px 18px;
}
.secret-status {
  display: block;
  margin-top: 4px;
  font-size: 11px;
  color: var(--muted);
}
.secret-status.on {
  color: var(--gold-text);
}
/* Geheimnisse untereinander: Label links, Eingabe rechts (mit Breitenlimit) */
.secrets-list {
  display: flex;
  flex-direction: column;
  gap: 28px;
  max-width: 720px;
  margin-top: 18px;
}
.sec-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.secrets-list label {
  display: grid;
  grid-template-columns: 240px 1fr;
  align-items: center;
  gap: 6px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}
.secrets-list label input {
  grid-column: 2;
  font-family: inherit;
  font-size: 14px;
  color: var(--ink);
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  border-radius: 6px;
  padding: 10px 12px;
}
.secrets-list label input:focus {
  outline: 2px solid var(--gold);
  outline-offset: 1px;
}
.secrets-list .secret-status {
  grid-column: 2;
  margin-top: 0;
}
.secrets-list .secret-hint {
  grid-column: 2;
  font-size: 11px;
  color: var(--muted-2);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.secrets-list label + label {
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
@media (max-width: 620px) {
  .secrets-list label {
    grid-template-columns: 1fr;
  }
  .secrets-list label input,
  .secrets-list .secret-status {
    grid-column: 1;
  }
}
.setgrid select {
  font-family: inherit;
  font-size: 14px;
  color: var(--ink);
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  border-radius: 6px;
  padding: 10px 12px;
}
.setgrid select:focus {
  outline: 2px solid var(--gold);
  outline-offset: 1px;
}

/* Betrieb: Lichtsteuerung – Modus je Licht */
.light-modes {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 22px;
  max-width: 580px;
}
.lm-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-2);
}
.lm-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
}
.lm-mode {
  margin-left: auto;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: 4px;
  padding: 7px 9px;
}
.lm-mode:focus {
  outline: 2px solid var(--gold);
  outline-offset: 1px;
}

/* Betrieb: Öffnungszeiten je Wochentag */
.staff-hours {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 22px;
  max-width: 580px;
}
.sh-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-2);
}
.sh-row.closed {
  opacity: 0.55;
}
.sh-day {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 13px;
  width: 26px;
  color: var(--ink);
  flex: 0 0 auto;
}
.sh-cl {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
  cursor: pointer;
}
.sh-times {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.sh-row.closed .sh-times {
  visibility: hidden;
}
.sh-times input {
  width: 58px;
  font-family: inherit;
  font-size: 13px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: 4px;
  padding: 6px 8px;
  text-align: center;
}
.sh-times input:focus {
  outline: 2px solid var(--gold);
  outline-offset: 1px;
}
.sh-times .dash {
  color: var(--muted);
}
.sh-u {
  font-size: 12px;
  color: var(--muted);
}

/* Box-Hardware: eine Karte je Box, Felder im 2-Spalten-Raster */
.box-cfg-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}
.box-cfg {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 14px;
  background: var(--surface-2);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  align-content: start;
}
.box-cfg-head {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 9px;
}
.box-cfg-head .box-no {
  width: 26px;
  height: 26px;
  border-radius: 4px;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 13px;
  background: var(--gold-tint);
  color: var(--gold-text);
  border: 1px solid var(--gold-border);
}
.box-cfg-head b {
  font-size: 14px;
  color: var(--ink);
}
.box-cfg label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
  min-width: 0;
}
.box-cfg input,
.box-cfg select {
  font-family: inherit;
  font-size: 13px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: 4px;
  padding: 7px 9px;
  min-width: 0;
}
.box-cfg input:focus,
.box-cfg select:focus {
  outline: 2px solid var(--gold);
  outline-offset: 1px;
}
.box-seg-label {
  grid-column: 1 / -1;
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
  margin-top: 4px;
}
.box-seg {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 7px;
}
/* .seg-check ist ein <label> in .box-cfg -> Reihen-Layout erzwingen (überschreibt column) */
.box-seg .seg-check {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border: 1px solid var(--border-2);
  border-radius: 4px;
  background: var(--surface);
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
}
.box-seg .seg-check:has(input:checked) {
  background: var(--gold-tint);
  border-color: var(--gold-border);
  color: var(--gold-text);
}
.box-seg .seg-check input {
  margin: 0;
  flex: 0 0 auto;
  width: 15px;
  height: 15px;
  accent-color: var(--gold);
}
.box-seg-empty {
  font-size: 12px;
  color: var(--muted);
}

/* Wegbeleuchtung-Editor (Lichter umbenennen / GA) */
.lights-edit {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
  max-width: 760px;
}
.lge-row {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-2);
}
.lge-key {
  align-self: center;
  flex: 0 0 auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: 6px;
  padding: 5px 8px;
}
.lge-row label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
  min-width: 0;
}
.lge-row label:nth-of-type(1) {
  flex: 1 1 auto;
}
.lge-row label:nth-of-type(2) {
  flex: 0 0 160px;
}
.lge-row input {
  font-family: inherit;
  font-size: 13px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: 4px;
  padding: 7px 9px;
  min-width: 0;
}
.lge-row input:focus {
  outline: 2px solid var(--gold);
  outline-offset: 1px;
}
.lge-row .btn-del {
  align-self: center;
  flex: 0 0 auto;
}
/* Gira-X1-Zuordnung: Zweck statt Namensfeld */
.lge-row .map-purpose {
  font-size: 13px;
  color: var(--ink);
  font-weight: 500;
  padding: 7px 0;
}
@media (max-width: 560px) {
  .lge-row {
    flex-wrap: wrap;
  }
  .lge-row label:nth-of-type(2) {
    flex: 1 1 auto;
  }
}

/* ---------- Benutzer ---------- */
.auth-warn {
  background: var(--sand-tint);
  border: 1px solid var(--sand-border);
  color: var(--sand-text);
  padding: 10px 13px;
  border-radius: 6px;
  font-size: 13px;
  margin-bottom: 14px;
}
.btn-del {
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  color: var(--danger);
  background: var(--danger-tint);
  border: 1px solid var(--danger-border);
  border-radius: 4px;
  padding: 6px 11px;
  cursor: pointer;
}
.btn-del:hover {
  filter: brightness(0.96);
}
/* Tür-Editor (Einstellungen → Türen) */
.doors-edit {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 6px;
}
.door-cfg {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 14px 16px;
  background: var(--surface-2);
}
.door-cfg-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.door-cfg-head b {
  font-size: 14px;
  color: var(--ink);
}
.door-inv {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin-top: 12px;
}
.inv-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--muted);
  font-weight: 600;
}
.inv-check input {
  width: 15px;
  height: 15px;
  accent-color: var(--gold);
}
.btn-edit {
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  border-radius: 4px;
  padding: 6px 11px;
  cursor: pointer;
  margin-right: 6px;
}
.btn-edit:hover {
  background: var(--surface);
  border-color: var(--muted-2);
}
.u-actions {
  white-space: nowrap;
}
.btable .editing input,
.btable .editing select {
  font-family: inherit;
  font-size: 13px;
  color: var(--ink);
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  border-radius: 4px;
  padding: 6px 9px;
}
.btable .u-e-name {
  width: 140px;
}
.btable .u-e-pass {
  width: 170px;
  margin-right: 6px;
}

/* ---------- Beleuchtung ---------- */
.light-card {
  padding: 18px 20px;
}
.light-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.light-head h3 {
  font-size: 15px;
  color: var(--ink);
  margin: 0 0 3px;
}
.light-head .c-sub {
  max-width: 460px;
}
.light-head .btn {
  flex: 0 0 auto;
  padding: 10px 16px;
}
/* Beleuchtung als vertikale Schalterliste (Icon · Name · Modus · Status · Toggle) */
.light-card .segments {
  padding: 0;
  gap: 8px;
  flex-direction: column;
}
.lseg {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  transition:
    background 0.18s ease,
    border-color 0.18s ease;
}
.lseg.on {
  background: var(--gold-tint);
  border-color: var(--gold-border);
}
.lseg-ico {
  width: 34px;
  height: 34px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted);
  flex: 0 0 auto;
}
.lseg.on .lseg-ico {
  color: var(--gold-text);
  border-color: var(--gold-border);
}
.lseg-ico svg {
  width: 18px;
  height: 18px;
}
.lseg-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lseg-badge {
  margin-left: auto;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 999px;
  flex: 0 0 auto;
}
.lseg-badge.auto {
  color: var(--gold-text);
  background: var(--gold-tint);
  border: 1px solid var(--gold-border);
}
.lseg-badge.manual {
  color: var(--sand-text);
  background: var(--sand-tint);
  border: 1px solid var(--sand-border);
}
.lseg-pill {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--border);
  min-width: 38px;
  text-align: center;
  flex: 0 0 auto;
}
.lseg.on .lseg-pill {
  color: var(--gold-text);
  background: var(--surface);
  border-color: var(--gold-border);
}
.lsw {
  position: relative;
  width: 46px;
  height: 26px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: var(--border-2);
  border: none;
  padding: 0;
  cursor: pointer;
  transition: background 0.18s ease;
}
.lsw::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  transition: transform 0.18s ease;
}
.lsw.on {
  background: var(--gold);
}
.lsw.on::after {
  transform: translateX(20px);
}
.lsw:focus-visible {
  outline: 2px solid var(--gold-strong);
  outline-offset: 2px;
}
@media (max-width: 560px) {
  .lseg {
    flex-wrap: wrap;
  }
  .lseg-badge {
    margin-left: auto;
  }
  .lseg-name {
    flex: 1 1 100%;
    order: -1;
  }
}

/* ---------- Chart-Tooltip ---------- */
.chart-tip {
  position: fixed;
  z-index: 60;
  pointer-events: none;
  background: var(--ink);
  color: var(--bg);
  font-family: var(--font-text);
  font-size: 12px;
  font-weight: 600;
  padding: 6px 9px;
  border-radius: 4px;
  box-shadow: 0 8px 20px -8px rgba(0, 0, 0, 0.45);
  white-space: nowrap;
}
svg [data-tip] {
  cursor: pointer;
}
svg rect[data-tip]:hover {
  filter: brightness(1.06);
}

/* ---------- Buchungen: Heute-Timeline je Box ---------- */
.today-card {
  padding: 0;
}
.today-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px 28px;
  flex-wrap: wrap;
  padding: 15px 18px;
  border-bottom: 1px solid var(--border);
}
.today-title h3 {
  font-size: 15px;
  font-weight: 800;
  font-family: var(--font-display);
  color: var(--ink);
  margin: 0 0 1px;
}
.today-title .c-sub {
  font-size: 12.5px;
  color: var(--muted);
}
.today-kpis {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
}
.today-stat {
  padding: 2px 20px;
  border-left: 1px solid var(--border);
}
.today-stat:first-child {
  padding-left: 0;
  border-left: none;
}
.today-stat .k-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.today-stat .k-val {
  font-size: 21px;
  font-weight: 800;
  color: var(--ink);
  line-height: 1.15;
  font-family: var(--font-display);
  margin-top: 3px;
}
.today-axis,
.tl-row {
  display: grid;
  grid-template-columns: 66px 1fr;
  align-items: center;
  gap: 12px;
}
.today-axis {
  padding: 12px 18px 2px;
}
.tl-row {
  padding: 8px 18px;
}
.tl-row:last-child {
  padding-bottom: 14px;
}
.tl-row + .tl-row {
  border-top: 1px solid var(--border);
}
.tl-box {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
}
.tl-track {
  position: relative;
  height: 26px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
  box-shadow: var(--shadow-inset);
}
.axis-track {
  height: 14px;
  background: transparent;
  border: none;
  overflow: visible;
}
.tk {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  font-size: 11px;
  color: var(--muted);
  font-family: var(--font-text);
  text-transform: none;
  letter-spacing: 0;
}
.tk::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 14px;
  width: 1px;
  height: 6px;
  background: var(--border-2);
}
.tl-now {
  position: absolute;
  top: -2px;
  bottom: -2px;
  width: 2px;
  background: var(--sand-strong);
  z-index: 3;
}
.tl-block {
  position: absolute;
  top: 3px;
  bottom: 3px;
  background: var(--gold);
  border-radius: 5px;
  display: flex;
  align-items: center;
  padding: 0 6px;
  overflow: hidden;
}
.tl-block {
  cursor: default;
}
.tl-lbl {
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.tl-block.running {
  background: var(--gold-strong);
  box-shadow: inset 0 0 0 2px var(--sand);
}
.tl-tip {
  position: fixed;
  z-index: 60;
  display: none;
  transform: translate(-50%, -100%);
  padding: 5px 9px;
  border-radius: 4px;
  background: var(--ink);
  color: var(--surface);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.22);
  pointer-events: none;
}
@media (max-width: 640px) {
  .today-axis,
  .tl-row {
    grid-template-columns: 50px 1fr;
  }
}

/* Umsatz-/Preis-Elemente ausblenden, wenn die Rolle 'view_revenue' nicht hat. */
body.no-view_revenue .rev-only {
  display: none !important;
}

/* ---------- Gastname (Kachel/Rail) + Kundenstatistik (personenbezogen) ---------- */
.guest {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
  color: var(--sand-text);
  min-width: 0;
}
.guest svg {
  width: 13px;
  height: 13px;
  flex: 0 0 auto;
  opacity: 0.85;
}
.guest span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.booking-line .guest {
  margin-left: auto;
}
body.no-view_guest .guest-only {
  display: none !important;
}

.mem-badge {
  display: inline-block;
  margin-left: 8px;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  padding: 2px 7px;
  border-radius: 999px;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  vertical-align: middle;
}
.mem-badge.gold {
  color: var(--sand-ink);
  background: var(--sand);
  border-color: var(--sand-strong);
}
.kn-table .kn-rank {
  color: var(--muted);
  font-weight: 700;
  width: 46px;
}
.kn-table .kn-name {
  font-weight: 700;
  color: var(--ink);
}
.kn-table th.sortable {
  cursor: pointer;
  user-select: none;
}
.kn-table th.sortable:hover {
  color: var(--ink);
}
.kn-table th.sort-asc::after {
  content: " ▲";
  font-size: 9px;
}
.kn-table th.sort-desc::after {
  content: " ▼";
  font-size: 9px;
}
#kn-search {
  min-width: 180px;
  flex: 1;
}
/* Top 10 */
.kn-top-card {
  padding: 14px 16px 8px;
}
/* Boxen-Tabelle + Top 10 nebeneinander (wie die Chart-Karten); 1 Spalte wenn Top10 aus/eng */
.dash-split {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 18px;
  align-items: start;
}
.kn-top {
  margin: 0;
  padding: 4px 0 2px;
}
.kn-top-rank {
  width: 22px;
  height: 22px;
  border-radius: 4px;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 12px;
  background: var(--gold-tint);
  color: var(--gold-text);
  border: 1px solid var(--gold-border);
  flex: 0 0 auto;
}
.kn-blk-head,
.kn-blk-row {
  display: grid;
  grid-template-columns: 1fr 52px 56px 72px;
  align-items: center;
  gap: 10px;
}
.kn-blk-head {
  padding: 0 2px 10px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0;
}
.kn-blk-head span {
  text-align: right;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--muted);
  font-weight: 700;
}
.kn-blk-row {
  padding: 11px 2px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.kn-blk-row:hover {
  background: var(--surface-2);
} /* Hover wie .btable-Zeilen */
.kn-blk-row > span:not(.kn-blk-name) {
  text-align: right;
  font-weight: 700;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.kn-blk-name {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  font-weight: 700;
  color: var(--ink);
}
.kn-blk-name .kn-nm {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1 1 auto;
  min-width: 0;
}
.kn-blk-name .mem-badge {
  flex: 0 0 auto;
}

/* ---------- Politur: Micro-Interactions + Typo-Rhythmus ---------- */
/* Weiche Uebergaenge auf allen sekundaeren Bedienelementen (Nav, kleine Buttons, Selects). */
.nav a,
.btn-del,
.btn-edit,
.export-btn,
.dl-mini,
.logout-btn,
.hamburger,
.seg-check,
.rp-check,
.lm-mode,
.role-name-edit {
  transition:
    background var(--t-fast) var(--ease),
    border-color var(--t-fast) var(--ease),
    color var(--t-fast) var(--ease),
    box-shadow var(--t-fast) var(--ease),
    transform var(--t-fast) var(--ease);
}
/* Grosse DM-Sans-Zahlen: leichtes negatives Tracking + Tabellenziffern (kein Springen). */
.kpi .k-val,
.today-stat .k-val,
.booking-line .time,
.statusclock,
.drymode-state {
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

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

/* ===================== Utilities (Styling gehört in CSS, nie inline) =====================
   Statische Werte hier; nur aus Daten berechnete Werte (Balkenbreite, Position) dürfen
   im JS als style gesetzt werden. */
.charts svg {
  width: 100%;
  height: 200px;
}
#chart-bybox {
  height: 220px;
}
#occ-bar {
  width: 0;
}
.btn-add {
  flex: 0 0 auto;
  padding: 8px 14px;
}
.card-head-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.card-head-row.spread {
  justify-content: space-between;
}
.table-wrap.boxed {
  border: 1px solid var(--border);
  border-radius: 6px;
}
.set-note.tight {
  margin: 2px 0 0;
}
.mt-6 {
  margin-top: 6px;
}
.mt-8 {
  margin-top: 8px;
}
.mt-0 {
  margin-top: 0;
}
.mb-12 {
  margin-bottom: 12px;
}
.mb-14 {
  margin-bottom: 14px;
}
.mb-22 {
  margin-bottom: 22px;
}
.ml-0 {
  margin-left: 0;
}
.ml-auto {
  margin-left: auto;
}
.w-130 {
  width: 130px;
}
.w-150 {
  width: 150px;
}

/* ===================== Mobiles Menü + Responsive ===================== */
/* Hamburger + Backdrop: standardmäßig aus (Desktop) */
.hamburger {
  display: none;
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  margin-left: -4px;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  border: 1px solid var(--border-2);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
}
.hamburger:hover {
  background: var(--surface-2);
}
.hamburger svg {
  width: 20px;
  height: 20px;
}
.nav-backdrop {
  display: none;
}

@media (max-width: 860px) {
  .app {
    grid-template-columns: 1fr;
  }
  .hamburger {
    display: inline-flex;
  }

  /* Sidebar als Off-Canvas-Drawer */
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 60;
    width: 264px;
    max-width: 84vw;
    height: 100dvh;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    box-shadow: 0 0 44px rgba(0, 0, 0, 0.38);
  }
  .app.nav-open .sidebar {
    transform: none;
  }
  .nav-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 55;
    background: rgba(0, 0, 0, 0.45);
  }
  .nav-backdrop[hidden] {
    display: none;
  }

  /* Topbar darf umbrechen; Status rutscht in zweite Zeile */
  .topbar {
    flex-wrap: wrap;
    row-gap: 8px;
    gap: 12px;
  }
  .page-head h1 {
    font-size: 17px;
  }
  .status {
    width: 100%;
    margin-left: 0;
    justify-content: flex-start;
  }

  /* Boxen & Buchungen einspaltig-freundlich */
  .grid {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  }
  .bookings-section .up-list {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .grid,
  .kpis {
    grid-template-columns: 1fr;
  }
  .content {
    padding: 14px;
  }
  .modal-actions {
    flex-direction: column-reverse;
  }
  .modal-actions .btn {
    width: 100%;
  }
  .filterbar .export-btn,
  .f-count {
    margin-left: 0;
  }
}

/* =========================================================================
   Login-Seite (standalone /login). Gescopet unter body.login-page, damit es
   die App-Regeln nicht beruehrt. Feste helle Palette (theme-unabhaengig).
   ========================================================================= */
body.login-page {
  margin: 0;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: radial-gradient(900px 520px at 50% -15%, rgba(201, 173, 94, 0.18), transparent 62%), var(--brand-black);
  color: var(--ink);
  font-family: var(--font-text);
}
.login-page .card {
  width: min(372px, 100%);
  background: var(--surface);
  text-align: center;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 32px 30px;
  box-shadow:
    0 30px 70px -24px rgba(0, 0, 0, 0.55),
    0 2px 8px rgba(0, 0, 0, 0.18);
}
.login-page .brand-logo {
  height: 30px;
  width: auto;
  display: block;
  margin: 0 auto 20px;
}
.login-page h1 {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 18px;
  letter-spacing: 0.04em;
  margin: 0 0 2px;
}
.login-page p.sub {
  color: var(--muted);
  font-size: 13px;
  margin: 0 0 20px;
}
.login-page label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin: 14px 0 6px;
  font-weight: 600;
}
.login-page input {
  width: 100%;
  padding: 11px 12px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--ink);
  font-size: 14px;
  font-family: inherit;
}
.login-page input:focus {
  outline: 2px solid var(--gold);
  outline-offset: 1px;
}
.login-page button {
  width: 100%;
  margin-top: 20px;
  padding: 13px;
  border: none;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-family: var(--font-text);
  background: var(--gold-strong);
  color: var(--on-accent);
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
}
.login-page button:disabled {
  opacity: 0.6;
  cursor: progress;
}
.login-page .err {
  color: var(--danger);
  font-size: 13px;
  min-height: 18px;
  margin-top: 12px;
  text-align: center;
}

/* ---------- Bonus / Cashback ---------- */
.cb-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 22px 40px;
  padding: 16px 20px;
  margin-bottom: 14px;
}
.cb-sum-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.cb-sum-label {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.cb-sum-val {
  font-size: 22px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.cb-table td.cb-cashback {
  color: var(--sand-strong);
  font-weight: 600;
}
.cb-tiers {
  margin-top: 14px;
  padding: 18px 20px;
}
.cb-tier-rows {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 14px 0 16px;
}
.cb-tier-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  font-size: 13px;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-2);
  width: fit-content;
}
.cb-tier-row input {
  width: 62px;
  font-family: inherit;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: 4px;
  padding: 6px 8px;
  text-align: center;
  -moz-appearance: textfield;
}
.cb-tier-row input::-webkit-outer-spin-button,
.cb-tier-row input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.cb-tier-del {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  min-height: 0;
  padding: 0;
  margin-left: 4px;
  display: grid;
  place-items: center;
  font-size: 15px;
  line-height: 1;
  color: var(--muted);
  border: 1px solid var(--border-2);
  border-radius: 4px;
  background: var(--surface);
}
.cb-tier-del:hover {
  color: var(--danger-text);
  border-color: var(--danger-border);
  background: var(--danger-tint);
}
.cb-tier-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 2px;
}
.cb-tier-actions .btn {
  flex: 0 0 auto;
}
/* Staffel-Editor nur mit config_operation (analog Betrieb) */
body.no-config_operation #cb-tier-card {
  display: none;
}
