/* Mobile-first. Große Trefferflächen, weil das im Auto mit einer Hand und
   bei Regen bedient wird. Desktop bekommt nur eine breitere Spalte. */

:root {
  --bg: #12181d;
  --bg-card: #1c252c;
  --bg-card-muted: #182026;
  --fg: #eef3f7;
  --fg-dim: #9fb0bd;
  --line: #2c3945;
  --accent: #2f9e6a;
  --accent-strong: #35b77b;
  --danger: #c8503f;
  --warn: #b8862b;
  --radius: 14px;
}

* { box-sizing: border-box; }

/* Muss sein: eigene display-Regeln (etwa `.btn { display: inline-flex }`)
   überstimmen die display:none des Browsers für [hidden] -- Autorenregeln
   schlagen die UA-Regel. Ohne das hier bleibt jedes per hidden versteckte
   Element sichtbar, und genau daran hängen der Installations-Knopf und der
   "Kamera starten"-Knopf. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
}

.shell {
  max-width: 34rem;
  margin: 0 auto;
  padding: max(1rem, env(safe-area-inset-top)) 1rem 1rem;
}

body.wide .shell { max-width: 68rem; }

h1 { font-size: 1.6rem; margin: 0 0 .25rem; letter-spacing: -.01em; }
h2 { font-size: 1.05rem; margin: 0 0 .6rem; color: var(--fg); }
p { margin: 0 0 .8rem; }
a { color: var(--accent-strong); }

.hero { padding: 1.4rem 0 1rem; }
.hero-compact { padding: 1rem 0 .6rem; }
.lead { color: var(--fg-dim); margin: 0; }

.card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem;
  margin: 0 0 1rem;
}
.card-muted { background: var(--bg-card-muted); color: var(--fg-dim); }
.card-muted h2 { color: var(--fg); }
.hint { color: var(--fg-dim); font-size: .85rem; }

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  min-height: 3rem;
  padding: .75rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #253038;
  color: var(--fg);
  font-size: 1rem;
  font-family: inherit;
  text-decoration: none;
  cursor: pointer;
  touch-action: manipulation;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-quiet { background: transparent; color: var(--fg-dim); }
.btn-small { min-height: 2.25rem; padding: .35rem .7rem; font-size: .85rem; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

/* Die beiden Torknöpfe: bewusst groß und nicht nebeneinander, damit man
   nicht im Vorbeigehen den falschen Kanal trifft. */
.actions { display: grid; gap: .9rem; margin: 0 0 1rem; }
.btn-action {
  flex-direction: column;
  align-items: flex-start;
  gap: .15rem;
  min-height: 5.5rem;
  padding: 1rem 1.2rem;
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  text-align: left;
  width: 100%;
}
.btn-action .btn-icon { font-size: 1.5rem; line-height: 1; opacity: .85; }
.btn-action .btn-label { font-size: 1.25rem; font-weight: 650; }
.btn-action .btn-hint { font-size: .85rem; opacity: .85; font-weight: 400; }
.btn-action.is-busy { background: #24707d; border-color: #24707d; }

/* --- Statusanzeige ----------------------------------------------------- */

.pill {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .4rem .8rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: .9rem;
  background: var(--bg-card);
}
.pill .dot { width: .6rem; height: .6rem; border-radius: 50%; background: var(--fg-dim); }
.pill-online .dot { background: #3ec27f; box-shadow: 0 0 0 3px rgba(62,194,127,.18); }
.pill-offline .dot { background: var(--danger); box-shadow: 0 0 0 3px rgba(200,80,63,.18); }
.pill-unbekannt .dot { background: var(--warn); box-shadow: 0 0 0 3px rgba(184,134,43,.18); }
.status-detail { color: var(--fg-dim); font-size: .82rem; margin: .5rem 0 1rem; }

.alert {
  padding: .8rem 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  margin: 0 0 1rem;
  font-size: .92rem;
}
.alert-ok { background: rgba(47,158,106,.14); border-color: rgba(47,158,106,.5); }
.alert-error { background: rgba(200,80,63,.14); border-color: rgba(200,80,63,.5); }
.alert-warn { background: rgba(184,134,43,.14); border-color: rgba(184,134,43,.5); }

/* --- Formulare und Tabellen ------------------------------------------- */

.stack { display: grid; gap: .5rem; }
.stack label { font-size: .85rem; color: var(--fg-dim); }
input[type="text"], input[type="password"] {
  width: 100%;
  min-height: 2.9rem;
  padding: .6rem .8rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #131a20;
  color: var(--fg);
  font: inherit;
}
input:focus-visible, .btn:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent-strong);
  outline-offset: 2px;
}

.table-scroll { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.table th, .table td {
  text-align: left;
  padding: .55rem .5rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.table th { color: var(--fg-dim); font-weight: 600; font-size: .8rem; white-space: nowrap; }
.row-revoked { opacity: .55; }
.actions-cell { display: flex; flex-wrap: wrap; gap: .35rem; }
.actions-cell form { margin: 0; }

.tag { padding: .15rem .5rem; border-radius: 999px; font-size: .75rem; white-space: nowrap; }
.tag-ok { background: rgba(47,158,106,.2); color: #7fdcae; }
.tag-off { background: rgba(200,80,63,.18); color: #eda398; }

.kv { display: grid; grid-template-columns: auto 1fr; gap: .3rem .8rem; margin: .5rem 0 0;
      font-size: .85rem; }
.kv dt { color: var(--fg-dim); }
.kv dd { margin: 0; word-break: break-all; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .85em; }
.filters { display: flex; flex-wrap: wrap; gap: .8rem; font-size: .88rem; }

.footer {
  max-width: 34rem;
  margin: 0 auto;
  padding: 1rem 1rem max(1.5rem, env(safe-area-inset-bottom));
  color: var(--fg-dim);
  font-size: .78rem;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

/* --- Scanner ----------------------------------------------------------- */

.scanner { position: relative; border-radius: var(--radius); overflow: hidden; background: #000;
           aspect-ratio: 3 / 4; }
.scanner video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scanner-frame {
  position: absolute;
  inset: 18%;
  border: 3px solid rgba(255,255,255,.85);
  border-radius: 12px;
  box-shadow: 0 0 0 100vmax rgba(0,0,0,.35);
}
.scan-status { margin: .8rem 0 0; color: var(--fg-dim); font-size: .9rem; text-align: center; }

/* --- "Als App installieren" -------------------------------------------- */

.install-card { position: relative; padding-right: 2.8rem; }
.install-close {
  position: absolute;
  top: .35rem;
  right: .35rem;
  width: 2.2rem;
  height: 2.2rem;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--fg-dim);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}
.install-close:hover { color: var(--fg); }
.install-steps {
  margin: .8rem 0 0;
  padding-left: 1.3rem;
  color: var(--fg-dim);
  font-size: .92rem;
  line-height: 1.6;
}
.install-steps strong { color: var(--fg); }

/* --- Zettel zum Ausdrucken -------------------------------------------- */

.printable {
  background: #fff;
  color: #111;
  border-radius: var(--radius);
  padding: 1.5rem;
  text-align: center;
}
.printable h1 { font-size: 1.4rem; }
.sheet-for { font-size: 1.05rem; }
.qr { width: min(78%, 17rem); height: auto; margin: 1rem auto; display: block; }
.sheet-steps { text-align: left; margin: 1rem auto; max-width: 22rem; font-size: .92rem;
               line-height: 1.55; }
.sheet-url { font-size: .7rem; word-break: break-all; color: #555; }
.sheet-note { font-size: .8rem; color: #444; margin-top: 1rem; }
.sheet-actions { display: flex; gap: .6rem; flex-wrap: wrap; margin-top: 1rem; }

@media print {
  :root { --bg: #fff; }
  body { background: #fff; color: #000; }
  .no-print, .footer { display: none !important; }
  .shell { max-width: none; padding: 0; }
  .printable { border: none; padding: 0; }
  .qr { width: 9cm; }
}

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