/* Technik-Ruf – Techniker-App
   Dunkel, damit sie backstage nicht blendet. Bernstein = offener Ruf (wie eine Call-Lampe), Grün = erledigt. */
:root {
  --bg: #12161C;
  --panel: #1A2029;
  --panel-2: #222935;
  --line: #2C3441;
  --ink: #EEF1F5;
  --muted: #8F99A7;
  --key: #F2A900;
  --key-ink: #1B1300;
  --ok: #2BB673;
  --err: #EF5B50;
  --focus: #9CC3FF;
  --r-s: 8px;
  --r-m: 14px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --top-h: 56px;
  --tab-h: 64px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  min-height: 100svh;
}
[hidden] { display: none !important; }
a { color: var(--ink); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }
h1, h2, h3 { line-height: 1.2; margin: 0; }
h2 { font-size: 20px; font-weight: 700; }
h3 { font-size: 16px; font-weight: 650; }

/* ---------- Buttons & Formulare ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px;
  border-radius: var(--r-s);
  border: 1px solid var(--line);
  background: var(--panel-2);
  font-weight: 600; cursor: pointer; text-decoration: none;
  transition: background .15s ease, transform .08s ease;
  white-space: nowrap;
}
.btn:hover { background: #2A3240; }
.btn:active { transform: scale(.98); }
.btn[disabled] { opacity: .5; cursor: default; }
.btn-primary { background: var(--key); border-color: var(--key); color: var(--key-ink); }
.btn-primary:hover { background: #FFB914; }
.btn-ok { background: var(--ok); border-color: var(--ok); color: #04130B; }
.btn-ok:hover { background: #34C77F; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); padding: 0 10px; }
.btn-ghost:hover { background: var(--panel-2); color: var(--ink); }
.btn-danger { color: var(--err); }
.btn-block { width: 100%; }
.btn-small { min-height: 36px; padding: 0 12px; font-size: 14px; }

label { display: block; font-size: 14px; font-weight: 600; color: var(--muted); margin-bottom: 14px; }
label small { display: block; font-weight: 400; margin-top: 4px; }
input, select, textarea {
  display: block; width: 100%; margin-top: 6px;
  min-height: 46px; padding: 10px 12px;
  border-radius: var(--r-s);
  border: 1px solid var(--line);
  background: #0E1217;
  color: var(--ink);
  font-size: 16px;
}
textarea { min-height: 80px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--focus); }
.form-error { color: var(--err); font-size: 14px; min-height: 1.4em; margin: 4px 0 10px; }
.row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.row > label { flex: 1 1 160px; margin-bottom: 0; }

/* ---------- Boot & Anmeldung ---------- */
.boot { min-height: 100svh; display: grid; place-items: center; }
.boot::after { content: ""; width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--key); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.auth { min-height: 100svh; display: grid; place-items: center; padding: 24px; }
.auth-box { width: 100%; max-width: 360px; }
.auth-box h1 { font-size: 26px; margin: 18px 0 6px; }
.auth-box > p.muted { margin: 0 0 22px; }
.auth-mark { width: 52px; height: 52px; border-radius: 50%; background: var(--key); box-shadow: 0 0 0 7px #2A2212, 0 0 30px rgba(242,169,0,.35); }

/* ---------- Grundgerüst ---------- */
.shell { min-height: 100svh; }
.top {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 20px;
  height: calc(var(--top-h) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left));
  background: rgba(18, 22, 28, .92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.top-title { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; margin-right: auto; min-width: 0; }
.top-title span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lamp { flex: none; width: 12px; height: 12px; border-radius: 50%; background: #39424F; transition: background .3s ease, box-shadow .3s ease; }
.lamp.on { background: var(--key); box-shadow: 0 0 0 4px rgba(242,169,0,.18), 0 0 14px rgba(242,169,0,.7); animation: blink 1.6s ease-in-out infinite; }
@keyframes blink { 50% { opacity: .45; } }

.tabs { display: flex; gap: 4px; }
.tabs a {
  position: relative;
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; border-radius: var(--r-s);
  text-decoration: none; color: var(--muted); font-weight: 600; font-size: 15px;
}
.tabs a svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.tabs a:hover { color: var(--ink); }
.tabs a[aria-current="page"] { color: var(--ink); background: var(--panel-2); }
.tab-count { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--key); color: var(--key-ink); font-size: 12px; font-weight: 800; display: inline-grid; place-items: center; }

.views { max-width: 860px; margin: 0 auto; padding: 22px max(16px, env(safe-area-inset-right)) 40px max(16px, env(safe-area-inset-left)); }
.view-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.section { margin-top: 34px; }
.section:first-child { margin-top: 0; }

@media (max-width: 720px) {
  /* backdrop-filter würde die fixierte Tab-Leiste an den Header binden */
  .top { backdrop-filter: none; background: var(--bg); }
  .tabs {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
    height: calc(var(--tab-h) + env(safe-area-inset-bottom));
    padding: 6px 6px env(safe-area-inset-bottom);
    background: rgba(18, 22, 28, .96);
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--line);
    justify-content: space-around;
  }
  .tabs a { flex: 1; flex-direction: column; gap: 3px; font-size: 11px; padding: 6px 2px; }
  .tabs a[aria-current="page"] { background: transparent; color: var(--key); }
  .tab-count { position: absolute; top: 2px; left: calc(50% + 6px); }
  .views { padding-bottom: calc(var(--tab-h) + env(safe-area-inset-bottom) + 30px); }
}

/* ---------- Hinweis-Leiste ---------- */
.notice {
  display: flex; gap: 14px; align-items: center; justify-content: space-between; flex-wrap: wrap;
  padding: 14px 16px; margin-bottom: 20px;
  border: 1px solid #4A3D1A; background: #241E10;
  border-radius: var(--r-m);
}
.notice p { margin: 0; flex: 1 1 240px; }
.notice.info { border-color: var(--line); background: var(--panel); }

/* ---------- Offene Anfragen ---------- */
.calls { display: grid; gap: 10px; }
.call {
  display: grid; grid-template-columns: 1fr auto; gap: 14px; align-items: center;
  padding: 16px 16px 16px 20px;
  background: var(--panel);
  border-radius: var(--r-m);
  border-left: 6px solid var(--key);
  cursor: pointer;
}
.call:first-child { background: #221E14; }
.call-room { font-size: 22px; font-weight: 750; letter-spacing: -0.01em; overflow-wrap: anywhere; }
.call-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 4px; color: var(--muted); font-size: 15px; }
.call-age { color: var(--key); font-weight: 650; }
.call-repeat { color: var(--key-ink); background: var(--key); border-radius: 6px; padding: 0 7px; font-weight: 700; font-size: 13px; line-height: 22px; }
.call .btn-ok { min-height: 52px; padding: 0 20px; font-size: 16px; }
.call.leaving { animation: leave .35s ease forwards; }
@keyframes leave { to { opacity: 0; transform: translateX(30px); } }
.call.fresh { animation: arrive 1.2s ease; }
@keyframes arrive { 0% { box-shadow: 0 0 0 0 rgba(242,169,0,.0); } 25% { box-shadow: 0 0 0 4px rgba(242,169,0,.55); } 100% { box-shadow: 0 0 0 0 rgba(242,169,0,0); } }

.empty {
  padding: 34px 20px; text-align: center;
  border: 1px dashed var(--line); border-radius: var(--r-m);
  color: var(--muted);
}
.empty strong { display: block; color: var(--ink); font-size: 18px; margin-bottom: 4px; }

.stats { display: flex; gap: 26px; flex-wrap: wrap; margin: 18px 2px 0; color: var(--muted); font-size: 15px; }
.stats b { color: var(--ink); font-size: 17px; font-weight: 700; margin-right: 4px; }

/* ---------- Listen (erledigt, Räume, Team) ---------- */
.list { border-top: 1px solid var(--line); }
.item {
  display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center;
  padding: 12px 2px;
  border-bottom: 1px solid var(--line);
}
.item-title { font-weight: 650; overflow-wrap: anywhere; }
.item-sub { color: var(--muted); font-size: 14px; }
.item-actions { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.item.off .item-title { color: var(--muted); text-decoration: line-through; text-decoration-thickness: 1px; }
.tick { color: var(--ok); font-weight: 700; }
.pill { display: inline-block; font-size: 12px; font-weight: 700; padding: 1px 8px; border-radius: 10px; background: var(--panel-2); color: var(--muted); margin-left: 6px; vertical-align: 1px; }
.pill.key { background: var(--key); color: var(--key-ink); }
.group-title { font-size: 14px; color: var(--muted); font-weight: 650; margin: 22px 2px 6px; }
.group-title:first-child { margin-top: 6px; }

.panel { background: var(--panel); border-radius: var(--r-m); padding: 18px; }
.panel + .panel { margin-top: 14px; }
.panel h3 { margin-bottom: 12px; }
.panel p { margin: 0 0 12px; }
.panel .muted { font-size: 15px; }
.kv { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; font-weight: 600; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); flex: none; }
.dot.ok { background: var(--ok); }
.dot.off { background: var(--err); }
.steps { margin: 0 0 12px; padding-left: 22px; }
.steps li { margin-bottom: 6px; }
.share-icon { display: inline-block; width: 18px; height: 18px; vertical-align: -3px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Fokus-Ansicht (eine Anfrage) ---------- */
.focus {
  position: fixed; inset: 0; z-index: 30;
  background: var(--bg);
  display: flex; flex-direction: column;
  padding: calc(16px + env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) calc(20px + env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
}
.focus-back { align-self: flex-start; }
.focus-body { flex: 1; display: flex; flex-direction: column; justify-content: center; max-width: 520px; width: 100%; margin: 0 auto; }
.focus-label { color: var(--key); font-weight: 700; font-size: 16px; display: flex; align-items: center; gap: 10px; }
.focus-room { font-size: clamp(40px, 12vw, 64px); font-weight: 800; letter-spacing: -0.025em; line-height: 1.02; margin: 10px 0 8px; overflow-wrap: anywhere; }
.focus-loc { font-size: 20px; color: var(--muted); }
.focus-time { font-size: 18px; margin-top: 22px; }
.focus-time .call-age { font-size: 22px; }
.focus-done {
  width: 100%; max-width: 520px; margin: 0 auto;
  min-height: 92px; border-radius: 20px; border: 0;
  background: var(--ok); color: #04130B;
  font-size: 26px; font-weight: 800; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 12px;
  transition: transform .08s ease, background .2s ease;
}
.focus-done:active { transform: scale(.98); }
.focus-done svg { width: 34px; height: 34px; fill: none; stroke: currentColor; stroke-width: 3.2; stroke-linecap: round; stroke-linejoin: round; }
.focus-done svg path { stroke-dasharray: 40; stroke-dashoffset: 0; }
.focus-done.sent svg path { animation: draw .45s ease; }
@keyframes draw { from { stroke-dashoffset: 40; } }
.focus.is-done .focus-label { color: var(--ok); }
.focus-note { text-align: center; color: var(--muted); margin: 14px 0 0; min-height: 1.4em; }

/* ---------- Modal & Toast ---------- */
.modal {
  width: min(460px, calc(100vw - 32px)); max-height: calc(100svh - 40px);
  padding: 22px; border: 1px solid var(--line); border-radius: 18px;
  background: var(--panel); color: var(--ink);
}
.modal::backdrop { background: rgba(5, 7, 10, .7); }
.modal h2 { margin-bottom: 14px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; }
.qr-box { background: #fff; border-radius: 12px; padding: 18px; width: min(300px, 100%); margin: 0 auto 14px; }
.qr-box svg { display: block; width: 100%; height: auto; }
.url-line { display: flex; gap: 8px; align-items: center; }
.url-line code { flex: 1; min-width: 0; font-size: 13px; padding: 10px; background: #0E1217; border-radius: var(--r-s); overflow-wrap: anywhere; }
.choice { display: grid; gap: 10px; margin-bottom: 6px; }
.choice label { display: flex; gap: 12px; align-items: flex-start; padding: 12px; border: 1px solid var(--line); border-radius: var(--r-s); color: var(--ink); cursor: pointer; margin: 0; }
.choice input { width: auto; min-height: 0; margin: 3px 0 0; accent-color: var(--key); }
.choice small { color: var(--muted); font-weight: 400; }

.toast {
  position: fixed; z-index: 40; left: 50%; transform: translateX(-50%);
  bottom: calc(24px + env(safe-area-inset-bottom));
  display: flex; gap: 14px; align-items: center;
  width: max-content; max-width: calc(100vw - 32px);
  padding: 10px 10px 10px 18px; border-radius: 12px;
  background: #EEF1F5; color: #12161C; font-weight: 600;
  box-shadow: 0 10px 30px rgba(0,0,0,.4);
}
.toast button { background: none; border: 0; color: #0B5FD6; font-weight: 700; padding: 8px 10px; cursor: pointer; border-radius: 8px; }
@media (max-width: 720px) { .toast { bottom: calc(var(--tab-h) + 16px + env(safe-area-inset-bottom)); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ---------- Version 2: Veranstaltungen ---------- */
.context { margin: 0 0 16px; font-size: 15px; }
.context b { color: var(--ink); font-weight: 650; }
.call-event { font-size: 13px; font-weight: 700; color: var(--key); margin-bottom: 2px; }

.back { display: inline-block; color: var(--muted); text-decoration: none; font-weight: 600; padding: 6px 0; margin-bottom: 8px; }
.back:hover { color: var(--ink); }

.evs { display: grid; gap: 8px; }
.ev {
  display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
  padding: 14px 16px; border-radius: var(--r-m);
  background: var(--panel); text-decoration: none; color: var(--ink);
  border: 1px solid transparent;
}
a.ev:hover { border-color: var(--line); background: #1D242E; }
.ev-main { min-width: 0; flex: 1 1 220px; }
.ev-name { font-size: 18px; font-weight: 700; overflow-wrap: anywhere; }
.ev-meta { color: var(--muted); font-size: 14px; margin-top: 2px; display: flex; flex-wrap: wrap; align-items: center; gap: 2px 0; }
.ev-meta .sep { display: inline-block; width: 4px; height: 4px; border-radius: 50%; background: #4A5361; margin: 0 9px; }
.ev-side { display: flex; gap: 6px; flex-wrap: wrap; }
.ev-side .pill { margin-left: 0; }
.ev-ended { opacity: .7; }

.pill.st-live { background: #123A26; color: #6FE0A4; }
.pill.st-upcoming { background: #1E2A3D; color: #9CC3FF; }
.pill.st-ended { background: var(--panel-2); color: var(--muted); }
.pill.lead { background: #2A2212; color: var(--key); }

.ev-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 18px; }
.ev-title { font-size: 28px; font-weight: 800; letter-spacing: -0.015em; overflow-wrap: anywhere; }
.ev-dates { color: var(--muted); margin-top: 6px; font-size: 16px; }
.ev-dates .pill { margin-left: 8px; }
.sec-title { font-size: 18px; }
.sec-title .muted { font-weight: 500; margin-left: 4px; }
.head-actions { display: flex; gap: 6px; flex-wrap: wrap; }

.seg { display: flex; gap: 4px; padding: 4px; background: #0E1217; border-radius: 10px; margin-bottom: 16px; }
.seg button { flex: 1; min-height: 38px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); font-weight: 600; cursor: pointer; padding: 0 8px; }
.seg button.on { background: var(--panel-2); color: var(--ink); }
