/* ===========================================================================
   TOWER – gemeinsames Stylesheet
   Anzeigetafel (index.php) und Marketing-Statistik (stats.php)
   =========================================================================== */

:root {
  color-scheme: dark;

  /* Flächen */
  --plane:        #08090b;
  --surface:      #12151a;
  --surface-2:    #171b21;
  --surface-3:    #1e232b;

  /* Schrift */
  --ink:          #ffffff;
  --ink-2:        #b9c0cc;
  --ink-muted:    #7b8493;

  /* Linien */
  --hairline:     rgba(255, 255, 255, 0.09);
  --grid:         rgba(255, 255, 255, 0.06);
  --axis:         rgba(255, 255, 255, 0.16);

  /* Marke: Bernstein wie die Fallblattanzeige */
  --amber:        #f5b13c;
  --amber-dim:    #b9812a;
  --amber-glow:   rgba(245, 177, 60, 0.22);

  /* Status (fix, nie als Serienfarbe verwenden) */
  --good:         #0ca30c;
  --warning:      #fab219;
  --serious:      #ec835a;
  --critical:     #d03b3b;

  /* Kategoriale Serien – feste Reihenfolge, nie zyklisch weiterdrehen */
  --series-1:     #3987e5;
  --series-2:     #d95926;
  --series-3:     #199e70;
  --series-4:     #c98500;
  --series-5:     #d55181;
  --series-6:     #008300;
  --series-7:     #9085e9;
  --series-8:     #e66767;

  /* Sequenzielle Rampe (eine Hue) für die Heatmap */
  --seq-0:        #171b21;
  --seq-1:        #3a2c15;
  --seq-2:        #5c421a;
  --seq-3:        #85601f;
  --seq-4:        #b07d24;
  --seq-5:        #d99a2e;
  --seq-6:        #f5b13c;

  /* Fallblattanzeige */
  --flap-ink:     var(--amber);
  --flap-top:     linear-gradient(180deg, #26262c, #131316);
  --flap-bottom:  linear-gradient(180deg, #0d0d10, #17171b);
  --flap-body:    #000;
  --flap-seam:    #000;
  --flap-pin:     #2e2e34;
  --flap-shadow:  0 10px 26px rgba(0, 0, 0, 0.6);
  --flap-inset:   inset 0 1px 0 rgba(255, 255, 255, 0.08);

  /* Kopfzeile */
  --topbar-bg:    linear-gradient(180deg, #0f1216, #0a0c0f);
  --on-accent:    #0b0c0e;
  --tooltip-bg:   #0b0d10;

  --mono: 'Plex Mono', ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --sans: 'Plex Sans', 'Segoe UI', Roboto, "Helvetica Neue", Arial, sans-serif;

  --radius: 10px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--plane);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--amber); }

:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
  border-radius: 4px;
}

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

/* ===========================================================================
   Kopfzeile – wie eine Terminalanzeige
   =========================================================================== */

.topbar {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--hairline);
  background: var(--topbar-bg);
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-family: var(--mono);
  letter-spacing: 0.32em;
  font-size: 17px;
  font-weight: 700;
  color: var(--amber);
  text-transform: uppercase;
}

.brand .brand-sub {
  font-size: 10px;
  letter-spacing: 0.24em;
  color: var(--ink-muted);
  font-weight: 500;
}

.topbar nav {
  display: flex;
  gap: 4px;
  margin-left: auto;
  align-items: center;
}

.topbar nav a,
.topbar nav button,
.btn {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-2);
  text-decoration: none;
  padding: 8px 13px;
  border: 1px solid var(--hairline);
  border-radius: 6px;
  background: var(--surface);
  cursor: pointer;
  transition: color .15s, border-color .15s, background .15s;
  white-space: nowrap;
}

.topbar nav a:hover,
.btn:hover { color: var(--amber); border-color: var(--amber-dim); }

.topbar nav a.active {
  color: var(--on-accent);
  background: var(--amber);
  border-color: var(--amber);
  font-weight: 700;
}

.clock {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.06em;
}

.pill {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 4px 9px;
  border-radius: 999px;
  border: 1px solid var(--hairline);
  color: var(--ink-muted);
}
.pill.demo { color: var(--warning); border-color: rgba(250, 178, 25, 0.35); }
.pill.live { color: var(--good); border-color: rgba(12, 163, 12, 0.4); }

/* ===========================================================================
   ANZEIGETAFEL – Startseite
   Nur die Zahl, der Balken und sonst Ruhe.
   =========================================================================== */

.board {
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  background: var(--plane);
  overflow: hidden;
}

/* Hintergrundgrafik: Radarbild des Towers, sehr zurückhaltend */
#backdrop {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

.board > * { position: relative; z-index: 1; }

/* --- Kopfzeile der Tafel: nur das Nötigste ------------------------------- */

.board-top {
  display: flex;
  align-items: center;
  gap: clamp(14px, 2.5vw, 34px);
  padding: clamp(18px, 2.4vw, 30px) clamp(20px, 4vw, 60px);
  font-family: var(--mono);
}

.board-top .mark {
  font-size: clamp(13px, 1.3vw, 16px);
  font-weight: 700;
  letter-spacing: 0.42em;
  color: var(--amber);
}

.board-top .production {
  font-size: clamp(10px, 1.05vw, 13px);
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--ink-2);
  border-left: 1px solid var(--hairline);
  padding-left: clamp(14px, 2.5vw, 34px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.board-top .spacer { margin-left: auto; }

.board-top .clock {
  font-size: clamp(10px, 1.05vw, 13px);
  letter-spacing: 0.16em;
  color: var(--ink-muted);
}

.board-top .to-stats {
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-muted);
  text-decoration: none;
  padding: 8px 14px;
  border: 1px solid var(--hairline);
  border-radius: 6px;
  transition: color .15s, border-color .15s;
  white-space: nowrap;
}
.board-top .to-stats:hover { color: var(--amber); border-color: var(--amber-dim); }

/* --- Bühne: die Zahl ------------------------------------------------------ */

.board-stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(18px, 3vh, 40px);
  padding: 10px clamp(16px, 4vw, 60px) 0;
}

.stage-label {
  font-family: var(--mono);
  font-size: clamp(9px, 1vw, 12px);
  letter-spacing: 0.44em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

/* --- Fortschritt unten ---------------------------------------------------- */

.board-progress {
  padding: 0 clamp(20px, 4vw, 60px) clamp(26px, 4vh, 48px);
  display: flex;
  flex-direction: column;
  gap: clamp(12px, 1.6vh, 20px);
}

.progress-track {
  position: relative;
  height: clamp(10px, 1.1vh, 14px);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.055);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: var(--gauge-color, var(--amber));
  transition: width 1.6s cubic-bezier(.22, .61, .36, 1), background .5s;
}

.progress-meta {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  font-family: var(--mono);
}

.progress-meta .counts {
  font-size: clamp(11px, 1.1vw, 14px);
  letter-spacing: 0.18em;
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
  padding-bottom: 4px;
}

.progress-pct {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}
.progress-pct .unit {
  font-family: var(--mono);
  font-size: clamp(13px, 1.5vw, 20px);
  color: var(--ink-2);
  padding-bottom: clamp(4px, 0.8vw, 9px);
}


/* --- Vollbild: nur noch die Tafel ---------------------------------------- */

body.is-fullscreen .board-top { display: none; }
body.is-fullscreen .board-stage { padding-top: clamp(20px, 4vh, 60px); }
body.is-fullscreen .board-progress { padding-bottom: clamp(30px, 5vh, 60px); }

/* Ein Hinweis, der beim Betreten kurz aufblendet und dann verschwindet */
body.is-fullscreen::after {
  content: "Esc beendet den Vollbildmodus";
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-muted);
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 999px;
  padding: 7px 14px;
  pointer-events: none;
  animation: hint-fade 4s ease forwards;
}

@keyframes hint-fade {
  0%   { opacity: 0; }
  12%  { opacity: 1; }
  70%  { opacity: 1; }
  100% { opacity: 0; }
}

/* --- Fallblatt-Anzeige ---------------------------------------------------- */

.flapline {
  display: flex;
  gap: clamp(4px, 0.7vw, 10px);
  align-items: stretch;
}

/* Die grosse Zahl auf der Bühne und die kleine beim Fortschrittsbalken */
.board-stage .flapline { --flap-size: clamp(64px, 13.5vw, 190px); }
.progress-pct .flapline { --flap-size: clamp(26px, 3.2vw, 44px); }

.flap {
  --flap-h: calc(var(--flap-size, 96px) * 1.3);
  position: relative;
  height: var(--flap-h);
  font-family: var(--mono);
  font-size: var(--flap-size, 96px);
  line-height: 1;
  font-weight: 700;
  color: var(--flap-ink);
  background: var(--flap-body);
  border-radius: calc(var(--flap-size, 96px) * 0.06);
  box-shadow: var(--flap-inset), var(--flap-shadow);
  overflow: hidden;
  perspective: 420px;
  text-align: center;
  min-width: calc(var(--flap-size, 96px) * 0.8);
  user-select: none;
}

.flap.sep {
  background: transparent;
  box-shadow: none;
  border-radius: 0;
  overflow: visible;
  min-width: calc(var(--flap-size, 96px) * 0.3);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: calc(var(--flap-size, 96px) * 0.26);
  color: var(--flap-ink);
}

.flap .half {
  position: absolute;
  left: 0;
  right: 0;
  height: 50%;
  overflow: hidden;
  display: flex;
  justify-content: center;
  background: var(--flap-bottom);
}

.flap .half.top {
  top: 0;
  align-items: flex-start;
  border-bottom: 2px solid var(--flap-seam);
  background: var(--flap-top);
}

/* Achszapfen links und rechts – wie bei einer echten Fallblattwalze */
.flap::before,
.flap::after {
  content: "";
  position: absolute;
  top: 50%;
  width: calc(var(--flap-size, 96px) * 0.055);
  height: calc(var(--flap-size, 96px) * 0.075);
  background: var(--flap-pin);
  border-radius: 2px;
  transform: translateY(-50%);
  z-index: 4;
}
.flap::before { left: 0; }
.flap::after { right: 0; }
.flap.sep::before, .flap.sep::after { display: none; }

.flap .half.bottom {
  bottom: 0;
  align-items: flex-end;
  background: var(--flap-bottom);
}

.flap .half span {
  display: block;
  height: var(--flap-h);
  line-height: var(--flap-h);
}

.flap .half.bottom span { margin-top: calc(var(--flap-h) * -0.5); }

.flap .half.flip-top {
  transform-origin: bottom center;
  animation: flip-top 82ms ease-in forwards;
  z-index: 3;
}

.flap .half.flip-bottom {
  transform-origin: top center;
  transform: rotateX(90deg);
  animation: flip-bottom 82ms 80ms ease-out forwards;
  z-index: 2;
}

@keyframes flip-top {
  from { transform: rotateX(0deg);   filter: brightness(1); }
  to   { transform: rotateX(-90deg); filter: brightness(0.45); }
}

@keyframes flip-bottom {
  from { transform: rotateX(90deg); filter: brightness(0.45); }
  to   { transform: rotateX(0deg);  filter: brightness(1); }
}

.flap.sep .half { background: none; border: 0; }

@media (prefers-reduced-motion: reduce) {
  .flap .half.flip-top,
  .flap .half.flip-bottom { animation-duration: 1ms; }
}

/* --- Abflugbrett ---------------------------------------------------------- */

.departures {
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
}

.departures-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--hairline);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

table.dep {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}

table.dep th {
  text-align: left;
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-muted);
  font-weight: 500;
  padding: 10px 14px;
  border-bottom: 1px solid var(--hairline);
  white-space: nowrap;
}

table.dep td {
  padding: 11px 14px;
  font-size: clamp(13px, 1.35vw, 17px);
  border-bottom: 1px solid var(--grid);
  color: var(--amber);
  white-space: nowrap;
}

table.dep tr:last-child td { border-bottom: 0; }
table.dep tr.past td { color: var(--ink-muted); }
table.dep td.num { text-align: right; }
table.dep td.title { color: var(--ink); letter-spacing: 0.06em; }

/* Erklärung der Statusstufen unter der Vorstellungsliste */
.dep-legend {
  margin: 0;
  padding: 12px 18px 14px;
  border-top: 1px solid var(--hairline);
  background: var(--surface-2);
  font-size: 12.5px;
  line-height: 2.1;
  color: var(--ink-muted);
}
.dep-legend .status-tag { margin: 0 2px 0 5px; text-transform: uppercase; }

.status-tag {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 4px;
  font-size: 0.8em;
  letter-spacing: 0.14em;
  background: rgba(255, 255, 255, 0.06);
  color: var(--ink-2);
}
.status-tag.sold   { background: rgba(208, 59, 59, 0.16); color: #f08a8a; }
.status-tag.hot    { background: rgba(236, 131, 90, 0.16); color: var(--serious); }
.status-tag.good   { background: rgba(12, 163, 12, 0.16); color: #4dd44d; }
.status-tag.open   { background: rgba(245, 177, 60, 0.14); color: var(--amber); }
/* Unter 20 % – früh im Vorverkauf völlig normal, deshalb neutral und
   nicht alarmierend eingefärbt. */
.status-tag.low    { background: rgba(255, 255, 255, 0.06); color: var(--ink-2); }
.status-tag.past   { background: rgba(255, 255, 255, 0.05); color: var(--ink-muted); }

/* Mini-Auslastungsbalken in der Tabelle */
.minibar {
  display: inline-block;
  width: 86px;
  height: 8px;
  border-radius: 4px;
  background: var(--surface-3);
  overflow: hidden;
  vertical-align: middle;
}
.minibar > i { display: block; height: 100%; border-radius: 4px; }

/* ===========================================================================
   STATISTIK
   =========================================================================== */

.page {
  max-width: 1360px;
  margin: 0 auto;
  padding: 28px clamp(16px, 3vw, 40px) 72px;
}

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 26px;
}

.page-head h1 {
  margin: 0;
  font-size: clamp(22px, 3vw, 34px);
  letter-spacing: -0.01em;
}
.page-head p { margin: 6px 0 0; color: var(--ink-muted); font-size: 14px; }

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-left: auto;
}

select, input[type="password"], input[type="text"], input[type="date"], input[type="number"] {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 6px;
  padding: 9px 12px;
}
select:focus, input:focus { outline: 2px solid var(--amber-dim); outline-offset: 1px; }

/* Kennzahlen-Kacheln */
.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
  margin-bottom: 22px;
}

.tile {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 16px 18px;
}
.tile .label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-muted);
}
.tile .value {
  margin-top: 8px;
  font-size: 30px;
  font-weight: 650;
  line-height: 1.1;
  letter-spacing: -0.02em;
}
.tile .value small { font-size: 15px; color: var(--ink-muted); font-weight: 500; margin-left: 3px; }
.tile .sub { margin-top: 6px; font-size: 12px; color: var(--ink-muted); }
.tile .sub.up   { color: #4dd44d; }
.tile .sub.down { color: #f08a8a; }

/* Panels */
.grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 14px;
}
.panel {
  grid-column: span 12;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 18px 20px 20px;
  min-width: 0;
}
.panel.half { grid-column: span 6; }
.panel.third { grid-column: span 4; }
.panel.twothirds { grid-column: span 8; }

@media (max-width: 1000px) {
  .panel.half, .panel.third, .panel.twothirds { grid-column: span 12; }
}

.panel h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.005em;
}
.panel .hint {
  margin: 4px 0 16px;
  font-size: 12.5px;
  color: var(--ink-muted);
  line-height: 1.45;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
}
.panel-head .legend { margin-left: auto; }

/* Legende */
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 12px;
  color: var(--ink-2);
}
.legend i {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 3px;
  margin-right: 6px;
  vertical-align: -1px;
}
.legend .line i { height: 3px; border-radius: 2px; width: 14px; vertical-align: 3px; }

/* Charts */
.chart { width: 100%; display: block; overflow: visible; }
.chart text { font-family: var(--sans); fill: var(--ink-muted); font-size: 11px; }
.chart .axis-line { stroke: var(--axis); stroke-width: 1; }
.chart .grid-line { stroke: var(--grid); stroke-width: 1; }
.chart .tick { font-variant-numeric: tabular-nums; }
.chart .value-label { fill: var(--ink); font-size: 11.5px; font-variant-numeric: tabular-nums; }
.chart .marker-line { stroke: var(--ink-muted); stroke-width: 1; stroke-dasharray: 3 3; }
.chart .marker-label { fill: var(--ink-muted); font-size: 10px; letter-spacing: 0.04em; }

.chart-wrap { position: relative; }

.tooltip {
  position: absolute;
  z-index: 20;
  pointer-events: none;
  background: var(--tooltip-bg);
  border: 1px solid var(--hairline);
  border-radius: 8px;
  padding: 9px 11px;
  font-size: 12px;
  color: var(--ink);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.55);
  opacity: 0;
  transform: translate(-50%, -110%);
  transition: opacity .12s;
  white-space: nowrap;
}
.tooltip.on { opacity: 1; }
.tooltip .t-title { color: var(--ink-muted); font-size: 11px; margin-bottom: 4px; }
.tooltip .t-row { display: flex; gap: 10px; justify-content: space-between; font-variant-numeric: tabular-nums; }
.tooltip .t-row b { font-weight: 600; }

/* Heatmap */
.heat {
  display: grid;
  grid-template-columns: 34px repeat(24, minmax(0, 1fr));
  gap: 2px;
  align-items: center;
}
.heat .h-label {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--ink-muted);
  text-align: right;
  padding-right: 6px;
}
.heat .cell {
  aspect-ratio: 1 / 1;
  border-radius: 3px;
  background: var(--seq-0);
  cursor: default;
}
.heat .cell:hover { outline: 1.5px solid var(--ink); outline-offset: -1px; }
.heat .h-hour {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--ink-muted);
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.scale {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  font-size: 11px;
  color: var(--ink-muted);
}
.scale .swatches { display: flex; gap: 2px; }
.scale .swatches i { width: 20px; height: 10px; border-radius: 2px; display: block; }

/* Tabellen */
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
table.data th {
  text-align: left;
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-muted);
  font-weight: 500;
  padding: 8px 10px;
  border-bottom: 1px solid var(--hairline);
}
table.data td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--grid);
  color: var(--ink-2);
}
table.data td.n { text-align: right; color: var(--ink); }
table.data tr:last-child td { border-bottom: 0; }

.table-toggle {
  margin-top: 12px;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-muted);
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}
.table-toggle:hover { color: var(--amber); }

/* Erkenntnisse */
.insights { display: grid; gap: 10px; }
.insight {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 13px 15px;
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  border-left: 3px solid var(--amber);
  border-radius: 8px;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--ink-2);
}
.insight b { color: var(--ink); font-weight: 650; }
.insight .ic {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  color: var(--amber);
  padding-top: 2px;
  white-space: nowrap;
}

/* Login */
.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(900px 500px at 50% 0%, rgba(245, 177, 60, 0.08), transparent 60%),
    var(--plane);
}
.login-card {
  width: min(400px, 100%);
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 14px;
  padding: 32px 30px;
  text-align: center;
}
.login-card .brand { justify-content: center; margin-bottom: 6px; }
.login-card p { color: var(--ink-muted); font-size: 13px; margin: 0 0 22px; }
.login-card input[type="password"],
.login-card input[type="text"] { width: 100%; text-align: center; font-size: 15px; padding: 13px; }
.login-card input[type="password"] { letter-spacing: 0.2em; }
.login-card button {
  width: 100%;
  margin-top: 12px;
  padding: 13px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--on-accent);
  background: var(--amber);
  border: 0;
  border-radius: 7px;
  cursor: pointer;
}
.login-card button:hover { background: var(--amber-dim); }
.login-card .err {
  margin: 0 0 16px;
  padding: 10px;
  border-radius: 7px;
  background: rgba(208, 59, 59, 0.14);
  color: #f0a0a0;
  font-size: 13px;
}
.login-card label.remember {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 14px;
  font-size: 12.5px;
  color: var(--ink-muted);
}

/* Fussnote */
.footnote {
  margin-top: 28px;
  font-size: 12px;
  color: var(--ink-muted);
  text-align: center;
}

.error-box {
  margin: 20px 0;
  padding: 14px 16px;
  border: 1px solid rgba(208, 59, 59, 0.4);
  background: rgba(208, 59, 59, 0.1);
  border-radius: 8px;
  color: #f0a0a0;
  font-size: 13.5px;
}


/* ===========================================================================
   TAGMODUS
   ---------------------------------------------------------------------------
   Umgeschaltet wird über  <html data-theme="light">  – gesetzt aus den
   Einstellungen. Es werden ausschliesslich die Farbwerte getauscht, kein
   Layout: dadurch bleiben beide Modi automatisch in Form.

   Die Diagrammfarben sind gegen weissen Grund geprüft (Farbfehlsichtigkeit,
   Helligkeitsband, Mindestabstand der Nachbarfarben).
   =========================================================================== */

:root[data-theme="light"] {
  color-scheme: light;

  --plane:        #f4f5f7;
  --surface:      #ffffff;
  --surface-2:    #f7f8fa;
  --surface-3:    #e9ebef;

  --ink:          #14171c;
  --ink-2:        #4d5563;
  --ink-muted:    #6b7382;

  --hairline:     rgba(20, 23, 28, 0.13);
  --grid:         rgba(20, 23, 28, 0.07);
  --axis:         rgba(20, 23, 28, 0.22);

  --amber:        #8a5510;
  --amber-dim:    #b5771a;
  --amber-glow:   rgba(181, 119, 26, 0.18);

  /* Kategoriale Serien – helle Stufen derselben Farbtöne */
  --series-1:     #2a78d6;
  --series-2:     #eb6834;
  --series-3:     #1baf7a;
  --series-4:     #eda100;
  --series-5:     #e87ba4;
  --series-6:     #008300;
  --series-7:     #4a3aa7;
  --series-8:     #e34948;

  /* Sequenzielle Rampe für die Heatmap: hell -> dunkel */
  --seq-0:        #f4f5f7;
  --seq-1:        #fbe9cd;
  --seq-2:        #f6d59f;
  --seq-3:        #e9b463;
  --seq-4:        #cf9130;
  --seq-5:        #a86a12;
  --seq-6:        #7a4a06;

  /* Fallblatt bei Tag: helle Blätter, dunkle Ziffern */
  --flap-ink:     #14171c;
  --flap-body:    #dfe3e9;
  --flap-top:     linear-gradient(180deg, #ffffff, #eceff3);
  --flap-bottom:  linear-gradient(180deg, #e4e8ee, #f4f6f9);
  --flap-seam:    rgba(20, 23, 28, 0.22);
  --flap-pin:     #b9c0cb;
  --flap-shadow:  0 8px 20px rgba(20, 23, 28, 0.14);
  --flap-inset:   inset 0 1px 0 rgba(255, 255, 255, 0.9);

  --topbar-bg:    linear-gradient(180deg, #ffffff, #f2f4f7);
  --on-accent:    #ffffff;
  --tooltip-bg:   #ffffff;
}

/* Die Tafel bekommt bei Tag einen ruhigen, hellen Grund */
:root[data-theme="light"] .board {
  background: var(--plane);
}

/* Statuskennzeichen auf hellem Grund – die Farben bleiben, die Flächen
   werden heller, damit der Text lesbar bleibt. */
:root[data-theme="light"] .status-tag {
  background: rgba(20, 23, 28, 0.06);
  color: var(--ink-2);
}
:root[data-theme="light"] .status-tag.sold { background: rgba(208, 59, 59, 0.12); color: #a32626; }
:root[data-theme="light"] .status-tag.hot  { background: rgba(236, 131, 90, 0.16); color: #a2521f; }
:root[data-theme="light"] .status-tag.good { background: rgba(12, 163, 12, 0.12); color: #0a7a0a; }
:root[data-theme="light"] .status-tag.open { background: rgba(181, 119, 26, 0.14); color: #8a5510; }
:root[data-theme="light"] .status-tag.low  { background: rgba(20, 23, 28, 0.06); color: var(--ink-2); }
:root[data-theme="light"] .status-tag.past { background: rgba(20, 23, 28, 0.05); color: var(--ink-muted); }

:root[data-theme="light"] .tile .sub.up   { color: #0a7a0a; }
:root[data-theme="light"] .tile .sub.down { color: #b32b2b; }

:root[data-theme="light"] .msg.err,
:root[data-theme="light"] .error-box { background: rgba(208, 59, 59, 0.09); color: #a32626; }
:root[data-theme="light"] .msg.ok    { background: rgba(12, 163, 12, 0.10); color: #0a7a0a; }
:root[data-theme="light"] .msg.warn  { background: rgba(181, 119, 26, 0.12); color: #8a5510; }

:root[data-theme="light"] .pill.demo { color: #8a5510; border-color: rgba(181, 119, 26, 0.4); }
:root[data-theme="light"] .pill.live { color: #0a7a0a; border-color: rgba(12, 163, 12, 0.4); }

:root[data-theme="light"] .progress-track { background: rgba(20, 23, 28, 0.08); }

:root[data-theme="light"] .topbar nav a.active {
  color: #ffffff;
  background: var(--amber);
  border-color: var(--amber);
}

:root[data-theme="light"] .tooltip { box-shadow: 0 10px 30px rgba(20, 23, 28, 0.18); }

:root[data-theme="light"] .insight { background: var(--surface-2); }

/* ===========================================================================
   Schmale Bildschirme
   =========================================================================== */

@media (max-width: 760px) {
  /* --- Anzeigetafel --- */
  .board-top { padding: 16px 18px; gap: 12px; }
  .board-top .production {
    padding-left: 12px;
    letter-spacing: 0.16em;
    font-size: 10px;
    flex: 1 1 auto;
    min-width: 0;
  }
  .board-top .clock { display: none; }
  .board-stage .flapline { --flap-size: clamp(58px, 19vw, 100px); }
  .progress-pct .flapline { --flap-size: 26px; }
  .board-progress { padding: 0 18px 22px; }
  .progress-meta .counts { font-size: 11px; letter-spacing: 0.12em; }
  .stage-label { letter-spacing: 0.3em; }

  .topbar {
    flex-wrap: wrap;
    gap: 8px 14px;
    padding: 12px 16px;
  }
  .topbar nav { margin-left: 0; width: 100%; }
  .topbar nav a, .topbar nav button { flex: 1; text-align: center; padding: 9px 6px; }
  .clock { font-size: 11px; }
  #updated { display: none; }

  .board-main { padding: 22px 16px 32px; gap: 20px; }

  /* Produktionsspalte ist auf jeder Zeile gleich – auf dem Handy weglassen */
  table.dep th:nth-child(4),
  table.dep td:nth-child(4) { display: none; }
  table.dep th, table.dep td { padding: 9px 10px; }

  .departures-head span:last-child { display: none; }

  .page { padding: 20px 14px 56px; }
  .page-head { gap: 12px; }
  .filters { margin-left: 0; width: 100%; }
  .filters select { flex: 1 1 100%; }

  .tile .value { font-size: 25px; }
  .panel { padding: 15px 14px 16px; }

  .heat { grid-template-columns: 26px repeat(24, minmax(0, 1fr)); gap: 1px; }
  .heat .h-hour { font-size: 7px; }
  .heat .h-label { font-size: 9px; padding-right: 3px; }
}

@media print {
  body { background: #fff; color: #000; }
}
