/* BS-REMOTE - eine Oberfläche für Browser und Telefon.
   Handschrift der Familie: Kopf und Raster wie BS-KEYS (Petrol, türkiser Strich, Eyebrows mit
   "//" in Consolas, Karten mit türkiser Oberkante, Kennzahl-Kacheln), Bausteine wie BS-CHAT
   (runde Knöpfe, Felder, Blätter, Navigation unten am Telefon). Hell und dunkel nach System. */

[hidden] { display: none !important; }

:root {
  --tuerkis: #00898f;
  --tuerkis-dunkel: #00626a;
  --tuerkis-hell: #e3f0f1;
  --tuerkis-leuchtend: #1fb0b8;
  --petrol-tief: #0a2f35;
  --petrol: #0d4a52;
  --mint: #8fe3e8;
  --auf-dunkel: #e8f4f5;
  --auf-dunkel-leise: #a9cfd3;
  --karte: #ffffff;
  --flaeche: #f3f5f6;
  --linie: #dde3e5;
  --text: #1b2326;
  --leise: #66757a;
  --gruen: #1d9a4b;
  --rot: #c62828;
  --orange: #e08a00;
  --schatten: 0 1px 2px rgba(0,0,0,.08), 0 4px 14px rgba(0,0,0,.10);
  --mono: Consolas, "Cascadia Mono", "Segoe UI Mono", monospace;
  --sicher-unten: env(safe-area-inset-bottom, 0px);
  --sicher-oben: env(safe-area-inset-top, 0px);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --karte: #172225;
    --flaeche: #1e2b2e;
    --linie: #2a3a3f;
    --text: #e4ecee;
    --leise: #93a7ac;
    --tuerkis-hell: #11373a;
    --schatten: 0 1px 3px rgba(0,0,0,.5);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font: 16px/1.45 "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  color: var(--text); background: var(--petrol-tief);
  -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent;
}
button, input, select, textarea { font: inherit; color: inherit; }
input, select, textarea { font-size: 16px; } /* darunter zoomt Safari beim Antippen */
a { color: var(--tuerkis); }

.hintergrund { position: fixed; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: -1; pointer-events: none; }
#app.laedt { min-height: 100dvh; display: grid; place-items: center; }
.startbild { border-radius: 18px; opacity: .85; }

/* ------------------------------------------------------------ Bausteine -- */

.eyebrow { font-family: var(--mono); font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--tuerkis); }
.eyebrow::before { content: "// "; opacity: .6; }

.knopf {
  display: inline-flex; align-items: center; justify-content: center; gap: .45em;
  min-height: 42px; padding: 0 18px; border-radius: 21px; border: 0; cursor: pointer;
  background: var(--tuerkis); color: #fff; font-weight: 600; text-decoration: none; white-space: nowrap;
  touch-action: manipulation; transition: background .15s;
}
.knopf:hover { background: var(--tuerkis-dunkel); }
.knopf:disabled { opacity: .5; cursor: default; }
.knopf svg { width: 18px; height: 18px; flex: none; }
.knopf.zweit { background: var(--flaeche); color: var(--text); border: 1px solid var(--linie); }
.knopf.zweit:hover { border-color: var(--tuerkis); }
.knopf.gefahr { background: var(--rot); }
.knopf.breit { width: 100%; }
.knopf.klein { min-height: 34px; padding: 0 12px; font-size: 14px; }
.knopf.hell { background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.28); color: var(--auf-dunkel); }
.knopf.hell:hover { background: rgba(255,255,255,.2); }

.symbol {
  width: 40px; height: 40px; flex: none; border: 0; background: none; border-radius: 50%;
  display: inline-grid; place-items: center; cursor: pointer; color: var(--leise);
}
.symbol:hover { background: var(--flaeche); color: var(--text); }
.symbol svg { width: 22px; height: 22px; }

.feld { display: block; margin: 0 0 14px; }
.feld > span { display: block; font-size: 13px; color: var(--leise); margin-bottom: 4px; }
.feld input, .feld select, .feld textarea {
  width: 100%; min-height: 44px; padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--linie); background: var(--karte);
}
.feld input:focus, .feld select:focus, .feld textarea:focus { outline: 2px solid var(--tuerkis); outline-offset: -1px; border-color: transparent; }
.feld small { display: block; color: var(--leise); font-size: 12px; margin-top: 4px; }
.zeile { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.zeile > .feld { flex: 1 1 180px; }
.leise { color: var(--leise); font-size: 14px; }
.fehler { color: var(--rot); font-size: 14px; min-height: 1.2em; }
.mono { font-family: var(--mono); }

.marke { display: inline-flex; align-items: center; gap: 5px; padding: 1px 9px; border-radius: 10px; font-size: 12px; font-weight: 600; background: var(--flaeche); color: var(--leise); white-space: nowrap; }
.marke.an { background: #e1f5e8; color: #17703a; }
.marke.an::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--gruen); }
.marke.tuerkis { background: var(--tuerkis-hell); color: var(--tuerkis-dunkel); }
@media (prefers-color-scheme: dark) { .marke.an { background: #12351f; color: #7ad69a; } .marke.tuerkis { color: var(--mint); } }

.karte {
  background: var(--karte); border: 1px solid var(--linie); border-top: 3px solid var(--tuerkis);
  border-radius: 8px; padding: 16px 18px; margin: 0 0 16px; box-shadow: var(--schatten);
}
.karte h3 { margin: 0 0 6px; font-size: 17px; }

/* ----------------------------------------------------------- Anmeldung -- */

.anmelden {
  margin: auto; width: min(420px, calc(100% - 24px)); background: var(--karte); border-radius: 18px;
  padding: 28px 24px calc(24px + var(--sicher-unten)); box-shadow: 0 10px 40px rgba(0,0,0,.35);
}
.anmelden .kopf { text-align: center; margin-bottom: 22px; }
.anmelden .kopf img { width: 72px; height: 72px; border-radius: 18px; }
.anmelden h1 { font-size: 24px; margin: 12px 0 2px; letter-spacing: .02em; }
.anmelden .hinweis { background: var(--tuerkis-hell); border-radius: 12px; padding: 12px 14px; font-size: 14px; margin-bottom: 16px; }
.anmelde-rahmen { min-height: 100dvh; display: flex; padding: 16px 0; }
.anmelden form { margin: 0; }
.geraet-zeile { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--leise); background: var(--flaeche); border-radius: 10px; padding: 8px 12px; margin-bottom: 14px; }
.geraet-zeile svg { width: 18px; height: 18px; color: var(--tuerkis); flex: none; }
.pin { letter-spacing: .5em; text-align: center; font-size: 26px !important; font-variant-numeric: tabular-nums; }

/* Freigabe am Telefon: die Zahl groß, darunter laufende Punkte - wie BS-PUSHTAN */
.freigabe { text-align: center; margin-bottom: 18px; }
.freigabe p { margin: 8px 0; }
.freigabe .zahl { font-size: 64px; font-weight: 700; line-height: 1.1; color: var(--tuerkis); font-variant-numeric: tabular-nums; letter-spacing: .04em; margin: 8px 0 4px; }
.warte-punkte { display: flex; justify-content: center; gap: 8px; margin: 10px 0; }
.warte-punkte i { width: 9px; height: 9px; border-radius: 50%; background: var(--tuerkis); opacity: .25; animation: punkt 1.2s infinite; }
.warte-punkte i:nth-child(2) { animation-delay: .2s; } .warte-punkte i:nth-child(3) { animation-delay: .4s; }
@keyframes punkt { 40% { opacity: 1; transform: translateY(-3px); } }
@media (prefers-reduced-motion: reduce) { .warte-punkte i { animation: none; opacity: .6; } }

/* Einladung: Link und PIN zum Weitergeben */
.einladung-box { background: var(--tuerkis-hell); border-radius: 12px; padding: 12px 14px; margin: 6px 0 14px; }
.einladung-box .wert { display: flex; gap: 8px; align-items: center; margin: 4px 0 10px; }
.einladung-box .wert code { flex: 1; min-width: 0; overflow-wrap: anywhere; font-family: var(--mono); font-size: 13px; background: var(--karte); border-radius: 8px; padding: 8px 10px; }
.einladung-box .wert code.gross { font-size: 26px; letter-spacing: .3em; text-align: center; }
.einladung-box .qr { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.einladung-box .qr img { width: 200px; height: 200px; background: #fff; border-radius: 10px; padding: 8px; image-rendering: pixelated; flex: none; }
.einladung-box .qr .leise { flex: 1 1 160px; }
.geraeteliste { list-style: none; padding: 0; margin: 4px 0 14px; }
.geraeteliste li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--linie); font-size: 14px; }
.geraeteliste li > div { flex: 1; min-width: 0; }
.geraeteliste li.gesperrt { opacity: .55; }
.geraeteliste li > svg { width: 20px; height: 20px; flex: none; color: var(--tuerkis); }
.geraeteliste li.gesperrt > svg { color: var(--rot); }

/* -------------------------------------------------------------- Rahmen -- */

.kopfleiste {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px;
  padding: calc(6px + var(--sicher-oben)) 16px 0; min-height: 56px;
  background: var(--petrol-tief); border-bottom: 3px solid var(--tuerkis); color: #fff;
}
.marke-kopf { display: flex; align-items: center; gap: 10px; text-decoration: none; color: #fff; padding-bottom: 6px; }
.marke-kopf img { width: 30px; height: 30px; border-radius: 8px; }
.marke-kopf b { font-weight: 650; letter-spacing: .03em; white-space: nowrap; }
.reiter-kopf button { white-space: nowrap; }
@media (max-width: 1100px) { .ebene { display: none; } .reiter-kopf { margin-left: 4px; } .reiter-kopf button { padding: 0 10px; } }
.ebene { font-family: var(--mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--mint);
         padding-left: 10px; border-left: 1px solid rgba(255,255,255,.25); }
.ebene::before { content: "// "; opacity: .6; }
.reiter-kopf { display: flex; gap: 2px; margin-left: 12px; align-self: stretch; }
.reiter-kopf button {
  border: 0; background: none; color: var(--auf-dunkel-leise); font-weight: 500; padding: 0 14px;
  border-bottom: 3px solid transparent; margin-bottom: -3px; cursor: pointer; display: flex; align-items: center; gap: 7px;
}
.reiter-kopf button svg { width: 18px; height: 18px; }
.reiter-kopf button:hover { color: var(--mint); background: rgba(255,255,255,.05); }
.reiter-kopf button.an { color: #fff; font-weight: 700; border-bottom-color: var(--tuerkis-leuchtend); }
.kopf-rechts { margin-left: auto; display: flex; align-items: center; gap: 8px; padding-bottom: 6px; font-size: 14px; color: var(--auf-dunkel-leise); }
.kopf-rechts .wer { white-space: nowrap; }

.inhalt { max-width: 1180px; margin: 0 auto; padding: 20px 16px calc(96px + var(--sicher-unten)); }
.seitenkopf { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 4px 0 16px; }
.seitenkopf h1 { margin: 2px 0 0; font-size: 28px; color: #fff; letter-spacing: -.01em; }
.seitenkopf .eyebrow { color: var(--mint); }

.navigation { display: none; }

@media (max-width: 820px) {
  .reiter-kopf, .kopf-rechts .wer, .ebene { display: none; }
  .navigation {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
    background: var(--karte); border-top: 1px solid var(--linie); padding-bottom: var(--sicher-unten);
  }
  .navigation button {
    flex: 1; border: 0; background: none; min-height: 58px; display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 2px; font-size: 12px; color: var(--leise); cursor: pointer;
  }
  .navigation button svg { width: 24px; height: 24px; }
  .navigation button.an { color: var(--tuerkis); font-weight: 600; }
  .seitenkopf h1 { font-size: 24px; }
}

.vorschau-band {
  display: flex; gap: 10px; align-items: center; background: rgba(224,138,0,.16); color: #ffe2b0;
  border: 1px solid rgba(224,138,0,.45); border-radius: 10px; padding: 10px 14px; margin-bottom: 16px; font-size: 14px;
}
.vorschau-band svg { width: 20px; height: 20px; flex: none; }

/* ---------------------------------------------------------- Kennzahlen -- */

.kennzahlen { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; margin-bottom: 18px; }
.kennzahl {
  background: var(--karte); border: 1px solid var(--linie); border-left: 4px solid var(--tuerkis);
  border-radius: 8px; padding: 12px 14px; box-shadow: var(--schatten); text-align: left; cursor: pointer;
}
.kennzahl b { display: block; font-size: 28px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kennzahl span { font-family: var(--mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--leise); }
.kennzahl.gruen { border-left-color: var(--gruen); }
.kennzahl.an { outline: 2px solid var(--tuerkis-leuchtend); }

.werkzeuge { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.suche {
  flex: 1 1 240px; min-height: 42px; border-radius: 21px; border: 0; padding: 0 16px 0 40px; background: var(--karte)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' fill='none' stroke='%2366757a' stroke-width='2'%3E%3Ccircle cx='8' cy='8' r='6'/%3E%3Cpath d='M13 13l4 4'/%3E%3C/svg%3E") 14px center no-repeat;
  box-shadow: var(--schatten);
}
.suche:focus { outline: 2px solid var(--tuerkis-leuchtend); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chips button { min-height: 36px; padding: 0 14px; border-radius: 18px; border: 1px solid rgba(255,255,255,.3); background: rgba(10,47,53,.35); color: #fff; cursor: pointer; font-size: 14px; }
.chips button.an { background: #fff; color: var(--petrol); border-color: #fff; font-weight: 600; }

/* ------------------------------------------------------------- Geräte -- */

.gruppentitel { display: flex; align-items: baseline; gap: 10px; margin: 22px 0 8px; color: var(--mint); }
.gruppentitel .eyebrow { color: var(--mint); font-size: 13px; }
.gruppentitel small { color: var(--auf-dunkel-leise); font-size: 13px; }

.geraete { background: var(--karte); border: 1px solid var(--linie); border-top: 3px solid var(--tuerkis); border-radius: 8px; box-shadow: var(--schatten); overflow: hidden; }
.geraet { display: flex; align-items: center; gap: 14px; padding: 10px 14px; border-top: 1px solid var(--linie); cursor: pointer; }
.geraet:first-child { border-top: 0; }
.geraet:hover { background: var(--flaeche); }
.geraet .bild { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--tuerkis-hell); color: var(--tuerkis-dunkel); flex: none; position: relative; }
.geraet .bild svg { width: 24px; height: 24px; }
.geraet .bild .punkt { position: absolute; right: -3px; bottom: -3px; width: 13px; height: 13px; border-radius: 50%; background: #9aa7ab; border: 2px solid var(--karte); }
.geraet.online .bild .punkt { background: var(--gruen); }
.geraet:not(.online) .bild { filter: grayscale(1); opacity: .7; }
.geraet .mitte { flex: 1; min-width: 0; }
.geraet .name { font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.geraet .unter { color: var(--leise); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.geraet .rechts { display: flex; align-items: center; gap: 8px; flex: none; }
@media (max-width: 560px) { .geraet .rechts .marke, .geraet .rechts .knopf span { display: none; } .geraet .rechts .knopf { padding: 0 11px; } }

.leer { text-align: center; color: var(--auf-dunkel-leise); padding: 36px 12px; }
.karte .leer, .geraete .leer { color: var(--leise); }

/* ------------------------------------------------------ Fernsteuerung -- */

.fernsteuerung { position: fixed; inset: 0; z-index: 40; display: flex; flex-direction: column; background: #050d0f; }
.fernsteuerung .leiste {
  display: flex; align-items: center; gap: 8px; padding: calc(6px + var(--sicher-oben)) 10px 6px; min-height: 52px;
  background: var(--petrol-tief); border-bottom: 3px solid var(--tuerkis); color: #fff; flex: none;
}
.fernsteuerung .leiste .titel { min-width: 0; flex: 1; }
.fernsteuerung .leiste .titel b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fernsteuerung .leiste .titel small { color: var(--auf-dunkel-leise); font-size: 12px; }
.fernsteuerung .leiste .symbol { color: var(--auf-dunkel-leise); }
.fernsteuerung .leiste .symbol:hover { background: rgba(255,255,255,.1); color: #fff; }
.ansichten { display: flex; background: rgba(255,255,255,.08); border-radius: 10px; padding: 3px; }
.ansichten button { border: 0; background: none; color: var(--auf-dunkel-leise); border-radius: 8px; padding: 6px 12px; cursor: pointer; display: flex; gap: 6px; align-items: center; font-size: 14px; }
.ansichten button svg { width: 17px; height: 17px; }
.ansichten button.an { background: #fff; color: var(--petrol); font-weight: 600; }
@media (max-width: 640px) { .ansichten button span { display: none; } }
.fernsteuerung iframe { flex: 1; width: 100%; border: 0; background: #000; }
.fernsteuerung .platzhalter { flex: 1; display: grid; place-items: center; padding: 20px; }
.fernsteuerung .platzhalter .karte { max-width: 520px; }

/* -------------------------------------------------------- Fahrer-Support -- */

.fahrer-raster { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.fahrer { margin: 0; display: flex; flex-direction: column; gap: 8px; }
.fahrer .oben { display: flex; gap: 12px; align-items: center; }
.fahrer .bild { width: 44px; height: 44px; border-radius: 50%; background: var(--tuerkis); color: #fff; display: grid; place-items: center; font-weight: 700; flex: none; }
.fahrer .id { font-family: var(--mono); font-size: 18px; letter-spacing: .06em; }
.fahrer .knoepfe { display: flex; gap: 6px; margin-top: 4px; }
.fahrer .knoepfe .knopf:first-child { flex: 1; }
.schritte { counter-reset: s; list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 8px; }
.schritte li { counter-increment: s; display: flex; gap: 10px; align-items: flex-start; font-size: 14px; }
.schritte li::before { content: counter(s); width: 24px; height: 24px; border-radius: 50%; background: var(--tuerkis); color: #fff; display: grid; place-items: center; font-size: 13px; font-weight: 700; flex: none; }

/* -------------------------------------------------- Tabellen, Protokoll -- */

.tabelle-rahmen { overflow-x: auto; }
table.tabelle { border-collapse: collapse; width: 100%; font-size: 14px; }
.tabelle th { text-align: left; font-family: var(--mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--leise); padding: 8px 10px; border-bottom: 2px solid var(--linie); white-space: nowrap; }
.tabelle td { padding: 8px 10px; border-bottom: 1px solid var(--linie); vertical-align: top; }
.tabelle tr:hover td { background: var(--flaeche); }
.tabelle .zeit { white-space: nowrap; color: var(--leise); font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------- Blatt, Hinweis -- */

.blatt-grund { position: fixed; inset: 0; z-index: 50; background: rgba(5,20,23,.55); display: flex; align-items: center; justify-content: center; padding: 16px; animation: ein .15s; }
.blatt { background: var(--karte); border-radius: 16px; width: min(520px, 100%); max-height: calc(100dvh - 32px); overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,.4); border-top: 4px solid var(--tuerkis); }
.blatt .blatt-kopf { display: flex; align-items: center; gap: 8px; padding: 14px 14px 4px 20px; }
.blatt .blatt-kopf h2 { flex: 1; margin: 0; font-size: 19px; }
.blatt .blatt-inhalt { padding: 6px 20px 20px; }
.blatt dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 4px 0 18px; font-size: 14px; }
.blatt dt { color: var(--leise); }
.blatt dd { margin: 0; overflow-wrap: anywhere; }
.aktionen { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.aktionen .knopf { flex-direction: column; min-height: 76px; border-radius: 14px; gap: 4px; }
.aktionen .knopf svg { width: 24px; height: 24px; }
@media (max-width: 560px) {
  .blatt-grund { align-items: flex-end; padding: 0; }
  .blatt { border-radius: 18px 18px 0 0; width: 100%; padding-bottom: var(--sicher-unten); }
}
@keyframes ein { from { opacity: 0 } }

#hinweise { position: fixed; left: 50%; bottom: calc(80px + var(--sicher-unten)); transform: translateX(-50%); z-index: 60; display: grid; gap: 8px; pointer-events: none; }
.hinweis-zettel { background: #1b2326; color: #fff; padding: 10px 16px; border-radius: 12px; box-shadow: 0 6px 20px rgba(0,0,0,.3); font-size: 14px; animation: ein .2s; max-width: 90vw; }
.hinweis-zettel.fehler { background: var(--rot); }
