:root {
  --bg: #0b0d12; --panel: #151922; --panel2: #1d2330; --line: #2a3142; --text: #e9ecf2; --muted: #8b94a8;
  --gold: #d6b052; --red: #e5484d; --green: #30c46c; --blue: #4c8dff; --orange: #f0a030;
  --r: 14px; --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
body { min-height: 100vh; overscroll-behavior-y: contain; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }

/* Kopf */
header { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px; padding: calc(10px + var(--safe-t)) 16px 10px;
  background: rgba(11, 13, 18, .92); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
header img { width: 30px; height: 30px; border-radius: 8px; }
header h1 { margin: 0; font-size: 17px; letter-spacing: .5px; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hbtn { min-width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); display: grid; place-items: center; padding: 0 10px; cursor: pointer; font-size: 15px; }
.hbtn.open { border-color: var(--gold); color: var(--gold); }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; background: var(--muted); flex: none; }
.dot.ok { background: var(--green); } .dot.bad { background: var(--red); box-shadow: 0 0 0 4px rgba(229, 72, 77, .2); }

main { padding: 14px 16px calc(96px + var(--safe-b)); max-width: 920px; margin: 0 auto; }

/* Navigation: unten am Handy, links am PC */
nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; background: rgba(17, 20, 28, .96); backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px); border-top: 1px solid var(--line); padding-bottom: var(--safe-b); }
nav a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 2px 7px; color: var(--muted); text-decoration: none; font-size: 11px; position: relative; }
nav a .i { font-size: 21px; line-height: 1; }
nav a.on { color: var(--gold); }
nav a .badge { position: absolute; top: 4px; left: 50%; margin-left: 6px; }
@media (min-width: 900px) {
  nav { top: 62px; right: auto; width: 190px; flex-direction: column; border-top: 0; border-right: 1px solid var(--line); padding: 10px 8px; gap: 4px; background: var(--bg); }
  nav a { flex: none; flex-direction: row; gap: 12px; font-size: 15px; padding: 11px 12px; border-radius: 10px; }
  nav a.on { background: var(--panel); }
  nav a .badge { position: static; margin: 0 0 0 auto; }
  main { margin-left: 200px; margin-right: auto; padding-bottom: 40px; }
}

/* Bausteine */
h2 { font-size: 20px; margin: 4px 0 12px; }
h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); margin: 22px 0 8px; font-weight: 600; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; margin-bottom: 10px; }
.card.tap { cursor: pointer; transition: background .15s; } .card.tap:active { background: var(--panel2); }
.row { display: flex; align-items: center; gap: 10px; }
.row .grow { flex: 1; min-width: 0; }
.muted { color: var(--muted); } .small { font-size: 13px; } .gold { color: var(--gold); } .red { color: var(--red); } .green { color: var(--green); }
.ell { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 7px; }
.stat { background: var(--panel2); border-radius: 12px; padding: 9px 10px; min-width: 0; }
.stat b { display: block; font-size: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .stat span { font-size: 12px; color: var(--muted); }
.stat.warn b { color: var(--orange); } .stat.bad b { color: var(--red); }
.tag { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 999px; background: var(--panel2); color: var(--muted); margin: 2px 4px 2px 0; }
.tag.red { background: rgba(229, 72, 77, .15); color: #ff8f93; } .tag.gold { background: rgba(214, 176, 82, .15); color: var(--gold); }
.tag.green { background: rgba(48, 196, 108, .15); color: var(--green); }
.badge { min-width: 18px; height: 18px; border-radius: 9px; background: var(--red); color: #fff; font-size: 11px; font-weight: 700; display: inline-grid; place-items: center; padding: 0 5px; }
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 6px 10px; font-size: 15px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; word-break: break-word; }
.empty { text-align: center; color: var(--muted); padding: 30px 10px; }

.btn { border: 0; border-radius: 12px; padding: 13px 16px; min-height: 48px; background: var(--panel2); color: var(--text); font-weight: 600; cursor: pointer; width: 100%; }
.btn:active { transform: scale(.98); } .btn:disabled { opacity: .5; }
.btn.gold { background: var(--gold); color: #1a1406; } .btn.red { background: var(--red); color: #fff; } .btn.ghost { background: transparent; border: 1px solid var(--line); }
.btns { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; margin-top: 10px; }
.seg { display: flex; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 3px; gap: 3px; margin-bottom: 12px; }
.seg button { flex: 1; border: 0; background: transparent; border-radius: 9px; padding: 9px 6px; color: var(--muted); font-weight: 600; cursor: pointer; }
.seg button.on { background: var(--panel2); color: var(--text); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1px solid var(--line); background: var(--panel2); border-radius: 999px; padding: 9px 14px; cursor: pointer; font-size: 15px; }
.chip.on { border-color: var(--gold); color: var(--gold); background: rgba(214, 176, 82, .12); }
input.f, textarea.f, select.f { width: 100%; background: var(--panel2); border: 1px solid var(--line); border-radius: 12px; padding: 13px 14px; font-size: 16px; outline: none; }
input.f:focus, textarea.f:focus { border-color: var(--gold); }
input.code { letter-spacing: 8px; text-align: center; font-size: 26px; font-variant-numeric: tabular-nums; }
label.lbl { display: block; font-size: 13px; color: var(--muted); margin: 14px 0 6px; }
.check { display: flex; gap: 10px; align-items: center; margin-top: 14px; cursor: pointer; }
.check input { width: 22px; height: 22px; accent-color: var(--gold); }
.search { position: relative; margin-bottom: 12px; } .search input { padding-left: 40px; } .search::before { content: "🔍"; position: absolute; left: 13px; top: 13px; opacity: .6; }

/* Chat-Umfeld einer Meldung */
.chat { display: flex; flex-direction: column; gap: 6px; }
.msg { background: var(--panel2); border-radius: 12px; padding: 8px 11px; font-size: 15px; }
.msg.hit { background: rgba(229, 72, 77, .16); border: 1px solid rgba(229, 72, 77, .5); }
.msg .who { font-size: 12px; color: var(--muted); }

/* Ereignisse */
.ev { display: flex; gap: 12px; align-items: flex-start; padding: 11px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.ev:last-child { border-bottom: 0; }
.ev .ic { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--panel2); flex: none; font-size: 17px; }

/* Blatt (Bottom-Sheet) */
.shade { position: fixed; inset: 0; background: rgba(0, 0, 0, .55); z-index: 40; animation: fade .15s; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 41; background: var(--panel); border-radius: 20px 20px 0 0; border-top: 1px solid var(--line);
  max-height: 88vh; overflow-y: auto; padding: 8px 18px calc(18px + var(--safe-b)); animation: up .2s ease-out; }
.sheet .grab { width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 4px auto 12px; }
.sheet h2 { margin-top: 0; }
@media (min-width: 700px) { .sheet { left: 50%; right: auto; bottom: auto; top: 50%; width: 520px; transform: translate(-50%, -50%); border-radius: 20px; animation: fade .15s; border: 1px solid var(--line); } }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }

/* Meldung oben */
.toasts { position: fixed; left: 0; right: 0; top: calc(64px + var(--safe-t)); z-index: 50; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 12px; }
.toast { pointer-events: auto; max-width: 520px; width: 100%; background: #232a3a; border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; box-shadow: 0 8px 30px rgba(0, 0, 0, .4); animation: fade .2s; cursor: pointer; }
.toast.err { border-color: rgba(229, 72, 77, .6); } .toast.ok { border-color: rgba(48, 196, 108, .6); }

/* Anmeldung */
.login { max-width: 400px; margin: 0 auto; padding: calc(40px + var(--safe-t)) 20px 40px; }
.login .logo { display: block; width: 84px; height: 84px; margin: 0 auto 14px; border-radius: 20px; }
.login h1 { text-align: center; font-size: 22px; margin: 0 0 4px; } .login p.sub { text-align: center; color: var(--muted); margin: 0 0 24px; }
.qr { background: #fff; border-radius: 14px; padding: 10px; width: 220px; margin: 10px auto; } .qr svg { width: 100%; height: auto; display: block; }
.secret { font-family: ui-monospace, Menlo, monospace; font-size: 17px; letter-spacing: 1px; word-break: break-all; text-align: center; background: var(--panel2); padding: 12px; border-radius: 12px; user-select: all; }
.spin { display: inline-block; width: 18px; height: 18px; border: 2px solid var(--line); border-top-color: var(--gold); border-radius: 50%; animation: rot .8s linear infinite; vertical-align: middle; }
@keyframes rot { to { transform: rotate(360deg); } }
.loading { text-align: center; padding: 40px; }
a { color: var(--gold); }
