:root {
  --bg: #0b0b0f;
  --bg-2: #111118;
  --panel: #16161f;
  --panel-2: #1c1c27;
  --line: #262633;
  --text: #ececf1;
  --muted: #8b8b9c;
  --red: #e5243b;
  --red-soft: rgba(229, 36, 59, .14);
  --green: #22c55e;
  --green-soft: rgba(34, 197, 94, .14);
  --amber: #f59e0b;
  --amber-soft: rgba(245, 158, 11, .14);
  --blue: #60a5fa;
  --pink: #fe2c55;
  --cyan: #25f4ee;
  --radius: 14px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-font-smoothing: antialiased; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -.01em; }
h1 { font-size: 22px; }
h2 { font-size: 17px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; word-break: break-all; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.stack { display: grid; gap: 14px; }

/* Layout */
.shell { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.side { background: var(--bg-2); border-right: 1px solid var(--line); padding: 20px 12px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; font-weight: 800; letter-spacing: .08em; font-size: 13px; }
.brand img { width: 34px; height: 34px; border-radius: 9px; border: 1px solid rgba(229,36,59,.6); object-fit: cover; }
.nav a { display: flex; gap: 10px; align-items: center; padding: 9px 12px; border-radius: 10px; text-decoration: none; color: var(--muted); margin-bottom: 2px; }
.nav a:hover { background: var(--panel); color: var(--text); }
.nav a.active { background: var(--red-soft); color: var(--text); box-shadow: inset 3px 0 0 var(--red); }
.nav .ico { width: 22px; text-align: center; }
.side-foot { margin-top: 18px; padding: 12px; border-top: 1px solid var(--line); font-size: 13px; }
.main { padding: 26px 30px 60px; max-width: 1280px; width: 100%; min-width: 0; }
.topbar { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; flex-wrap: wrap; }
.btn.menu-btn { display: none; }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; z-index: 30; left: 0; top: 0; width: 270px; transform: translateX(-100%); transition: transform .2s; padding-top: max(20px, env(safe-area-inset-top)); }
  .side.open { transform: none; box-shadow: 0 0 0 100vmax rgba(0,0,0,.55); }
  .main { padding: max(16px, env(safe-area-inset-top)) 16px 60px; }
  .btn.menu-btn { display: inline-flex; }
}

/* Components */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.stat .label { color: var(--muted); font-size: 13px; }
.stat .value { font-size: 28px; font-weight: 700; margin-top: 6px; font-variant-numeric: tabular-nums; }
.stat.accent .value { color: var(--red); }
.btn { text-decoration: none; justify-content: center; border: 1px solid var(--line); background: var(--panel-2); padding: 8px 14px; border-radius: 10px; cursor: pointer; display: inline-flex; gap: 6px; align-items: center; white-space: nowrap; }
.btn:hover { border-color: #3a3a4a; }
.btn.primary { background: var(--red); border-color: var(--red); color: #fff; font-weight: 600; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: #ff6b7d; border-color: rgba(229,36,59,.4); }
.btn.sm { padding: 5px 10px; font-size: 13px; border-radius: 8px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--red); white-space: normal; }
.btn.ghost:hover { text-decoration: underline; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 99px; font-size: 12px; font-weight: 600; background: var(--panel-2); color: var(--muted); white-space: nowrap; }
.pill.green { background: var(--green-soft); color: var(--green); }
.pill.red { background: var(--red-soft); color: #ff6b7d; }
.pill.amber { background: var(--amber-soft); color: var(--amber); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; display: inline-block; }
.live-dot { background: var(--red); animation: pulse 1.4s infinite; }
@keyframes pulse { 50% { opacity: .35; } }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-weight: 500; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; background: var(--bg-2); }
tr:last-child td { border-bottom: 0; }
td.actions { text-align: right; white-space: nowrap; }
td.actions .btn { margin-left: 4px; }
.empty { padding: 30px; text-align: center; color: var(--muted); }

label.field { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
input, select, textarea { background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; width: 100%; outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--red); }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--red); padding: 0; }
.check { display: flex; gap: 8px; align-items: center; color: var(--text); font-size: 14px; cursor: pointer; }
.err { color: #ff6b7d; font-size: 12px; }
.form-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }

/* Auth */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(900px 500px at 50% -10%, rgba(229,36,59,.18), transparent 70%), var(--bg); }
.auth .card { width: 100%; max-width: 400px; padding: 28px; }
.auth .logo { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-bottom: 22px; }
.auth .logo img { width: 84px; height: 84px; border-radius: 20px; border: 1px solid rgba(229,36,59,.6); object-fit: cover; }
.auth .logo h1 { letter-spacing: .12em; font-size: 18px; }

/* Modal */
.modal-back { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; width: 100%; max-width: 620px; max-height: 90vh; overflow-y: auto; padding: 22px; }
.modal h2 { margin-bottom: 16px; }
.modal .foot { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; flex-wrap: wrap; }
.secret { background: var(--bg); border: 1px dashed var(--red); border-radius: 10px; padding: 12px; }

#toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 60; display: grid; gap: 8px; }
#toast .t { background: var(--panel-2); border: 1px solid var(--line); padding: 10px 16px; border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,.4); }
#toast .t.error { border-color: var(--red); }

.tabs { display: flex; gap: 6px; }
.tabs button { background: none; border: 1px solid var(--line); border-radius: 99px; padding: 6px 14px; cursor: pointer; color: var(--muted); }
.tabs button.on { background: var(--red-soft); color: var(--text); border-color: var(--red); }
.bar { height: 8px; background: var(--bg-2); border-radius: 99px; overflow: hidden; }
.bar > div { height: 100%; background: var(--red); }
.feed { max-height: 360px; overflow-y: auto; display: grid; gap: 6px; }
.feed .it { display: flex; gap: 10px; font-size: 13px; padding: 6px 0; border-bottom: 1px solid var(--line); }

/* ---------- Web-Version (wie die App) ---------- */
body { overflow-x: hidden; }
.grow { flex: 1; min-width: 0; }
.cyan { color: var(--cyan); }
.pink { color: var(--pink); }
.green { color: var(--green); }
.btn.pink { background: var(--pink); border-color: var(--pink); color: #fff; font-weight: 600; border-radius: 99px; }
.btn.pink:hover { filter: brightness(1.08); }
.icon-btn { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 18px; padding: 6px; border-radius: 8px; }
.icon-btn:hover { background: var(--panel-2); color: var(--text); }
.new-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--red); margin-left: auto; }

.addrow { display: flex; gap: 10px; }
.addrow input { flex: 1; min-width: 0; }

.avatar { position: relative; flex: none; border-radius: 50%; display: grid; place-items: center; overflow: hidden;
  background: color-mix(in srgb, var(--c) 25%, transparent); color: var(--c); font-weight: 700; border: 1px solid var(--line); }
.avatar.live { border: 3px solid var(--pink); }
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.avatar.live img { inset: 3px; width: calc(100% - 6px); height: calc(100% - 6px); }

.acc-list { gap: 10px; }
.acc-card { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border-radius: 18px; background: var(--panel); border: 1px solid var(--line); text-decoration: none; color: inherit; }
.acc-card:hover { border-color: #3a3a4a; }
.acc-main { flex: 1; min-width: 0; }
.acc-handle { font-weight: 700; font-size: 18px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acc-sub { color: var(--muted); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acc-sub.cyan { color: var(--cyan); }
.acc-live { color: var(--pink); font-weight: 600; font-size: 14px; margin-top: 4px; display: flex; align-items: center; gap: 6px; white-space: nowrap; overflow: hidden; }
.badge { flex: none; padding: 6px 12px; border-radius: 10px; font-weight: 700; font-size: 13px; letter-spacing: 1px; background: var(--panel-2); color: var(--muted); }
.badge.live { background: var(--pink); color: #fff; }

.detail { max-width: 860px; }
.player { position: relative; width: 100%; aspect-ratio: 9 / 16; max-height: 72vh; background: #000; border: 1px solid rgba(254,44,85,.6); border-radius: 16px; overflow: hidden; margin: 0 auto; }
@media (min-width: 700px) { .player { aspect-ratio: auto; height: 560px; } }
.player video { width: 100%; height: 100%; object-fit: contain; background: #000; display: block; }
.player.fill video { object-fit: cover; }
.player:fullscreen { border-radius: 0; max-height: none; height: 100%; }
.ov-tiles { position: absolute; top: 10px; left: 10px; right: 10px; display: flex; gap: 8px; flex-wrap: wrap; pointer-events: none; }
.ov-tile { background: rgba(0,0,0,.55); color: #fff; font-weight: 700; font-size: 16px; padding: 6px 12px; border-radius: 12px; }
.ov-tile.pink { color: var(--pink); }
.ov-sound { position: absolute; right: 10px; bottom: 10px; background: rgba(0,0,0,.6); color: #fff; border: 1px solid rgba(255,255,255,.25); border-radius: 99px; padding: 8px 14px; font-weight: 600; cursor: pointer; }
.ov-sound.on { padding: 8px 12px; }
.offline-stage { height: 200px; border-radius: 16px; background: #000; border: 1px solid var(--line); display: grid; place-content: center; justify-items: center; gap: 8px; }

.chips { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.chip { background: none; border: 1px solid var(--line); border-radius: 99px; padding: 6px 14px; cursor: pointer; color: var(--muted); }
.chip.on { background: var(--red-soft); color: var(--text); border-color: var(--pink); }

.tiles { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; }
.tile .label { color: var(--muted); font-size: 13px; }
.tile .value { font-size: 20px; font-weight: 700; margin-top: 2px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.tile.accent .value { color: var(--pink); }

.dtabs { display: flex; gap: 4px; overflow-x: auto; border-bottom: 1px solid var(--line); scrollbar-width: none; }
.dtabs button { background: none; border: 0; border-bottom: 3px solid transparent; color: rgba(37,244,238,.55); font-weight: 600; font-size: 16px; padding: 10px 12px; cursor: pointer; white-space: nowrap; }
.dtabs button.on { color: var(--cyan); border-bottom-color: var(--pink); }

.chat { display: grid; gap: 10px; max-height: 560px; overflow-y: auto; }
.chat-row { display: flex; gap: 10px; font-size: 14px; }
.chat-row .time { color: var(--muted); font-size: 12px; width: 62px; flex: none; padding-top: 2px; }
.list { display: grid; padding: 4px 16px; }
.list-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); text-decoration: none; color: inherit; }
.list-row:last-child { border-bottom: 0; }
a.list-row.card, .list-row.link { padding: 14px 16px; border-bottom: 1px solid var(--line); }
.list-row.plain { background: none; border: 0; border-bottom: 1px solid var(--line); width: 100%; cursor: pointer; color: inherit; font: inherit; }
.list.users { max-height: 520px; overflow-y: auto; }
.kv { display: grid; gap: 6px; }
.kv-row { display: flex; gap: 12px; justify-content: space-between; font-size: 14px; }
.kv-row > span { flex: 0 0 45%; }
.kv-row > b { text-align: right; overflow-wrap: anywhere; font-weight: 600; }
.kv-row > b.mono { font-weight: 500; }
.lamp { width: 16px; height: 16px; border-radius: 50%; flex: none; }
details.expand { border-top: 1px solid var(--line); padding-top: 10px; }
details.expand summary { cursor: pointer; font-weight: 600; font-size: 16px; list-style: none; display: flex; align-items: center; gap: 6px; }
details.expand summary::-webkit-details-marker { display: none; }
details.expand summary::after { content: '▼'; margin-left: auto; color: var(--muted); font-size: 12px; }
details.expand[open] summary::after { content: '▲'; }
.chatlog-grid { align-items: start; }

.update-banner { position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top));
  background: linear-gradient(90deg, rgba(229,36,59,.95), rgba(254,44,85,.9)); color: #fff; }
.update-banner .btn { background: rgba(0,0,0,.25); border-color: rgba(255,255,255,.35); color: #fff; }
.update-banner .btn.primary { background: #fff; color: #b3122a; border-color: #fff; }
.update.newest { border-color: rgba(229,36,59,.6); }
.upd-list { margin: 0; padding-left: 20px; display: grid; gap: 6px; }
.install .steps { margin: 0; padding-left: 20px; display: grid; gap: 6px; }

@media (max-width: 860px) {
  .acc-card { gap: 10px; padding: 10px 12px; }
  .acc-handle { font-size: 16px; }
  .badge { padding: 5px 9px; font-size: 12px; }
  .topbar h1 { font-size: 19px; }
  .main { padding-bottom: max(60px, env(safe-area-inset-bottom)); }
}
.detail > div:empty { display: none; }
@media (max-width: 600px) { .update-banner .grow { flex-basis: 100%; } }
.card.warn, .small.warn, div.warn { border-color: var(--amber); background: var(--amber-soft); color: #fcd34d; white-space: pre-line; }
.card.warn { display: grid; gap: 6px; }

/* ================= Optik-Auffrischung (Monitoring-Look) ================= */
:root {
  --bg: #08080b;
  --bg-2: #0d0d12;
  --panel: #14141b;
  --panel-2: #1b1b24;
  --line: #24242f;
  --muted: #8e8ea0;
  --shadow: 0 6px 24px rgba(0, 0, 0, .35);
}
body { background: radial-gradient(1200px 600px at 100% -10%, rgba(229,36,59,.07), transparent 60%), var(--bg); }

/* Seitenleiste */
.side { background: linear-gradient(180deg, #0e0e14, #0a0a0e); border-right: 1px solid var(--line); }
.brand { font-size: 14px; color: #fff; letter-spacing: .06em; padding-bottom: 22px; }
.brand img { width: 36px; height: 36px; }
.nav a { padding: 10px 12px; border-radius: 10px; font-weight: 500; transition: background .15s, color .15s; }
.nav a:hover { background: var(--panel-2); color: var(--text); }
.nav a.active { background: var(--red); color: #fff; box-shadow: 0 4px 14px rgba(229,36,59,.35); }
.nav a.active .ico { filter: grayscale(1) brightness(3); }
.side-foot { border-top: 1px solid var(--line); }

/* Kopfzeile */
.topbar { padding-bottom: 14px; border-bottom: 1px solid var(--line); margin-bottom: 22px; }
.topbar h1 { font-size: 22px; font-weight: 700; }
.user-chip { display: inline-flex; align-items: center; gap: 8px; padding: 5px 12px 5px 5px; border-radius: 99px; background: var(--panel); border: 1px solid var(--line); text-decoration: none; transition: border-color .15s; }
.user-chip:hover { border-color: var(--red); }
.user-ava { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--red); color: #fff; font-weight: 700; font-size: 13px; }
.user-name { font-weight: 600; font-size: 14px; }
.user-role { font-size: 11px; color: var(--muted); border: 1px solid var(--line); border-radius: 99px; padding: 1px 7px; }

/* Karten und Kacheln */
.card, .tile, .acc-card, .table-wrap { box-shadow: var(--shadow); }
.card { border-radius: 16px; }
.acc-card { transition: transform .12s, border-color .15s; }
.acc-card:hover { transform: translateY(-1px); border-color: rgba(229,36,59,.5); }
.stat { display: flex; align-items: center; gap: 14px; }
.stat-ico { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; font-size: 22px; background: var(--red-soft); flex: none; }
.stat .value { font-size: 28px; margin-top: 0; line-height: 1.1; }
.stat .label { margin-top: 2px; }
.stat.accent .stat-ico { background: rgba(34,197,94,.15); }
.stat.accent .value { color: var(--green); }
.tile { border-radius: 14px; transition: border-color .15s; }
.tile:hover { border-color: #34344a; }

/* Status-Plaketten: LIVE grün */
.badge.live { background: var(--green); color: #04130a; box-shadow: 0 0 0 3px rgba(34,197,94,.15); }
.pill.red { background: var(--red-soft); color: #ff6b7d; }
.live-dot { background: var(--green); }

/* Tabellen */
.table-wrap { border-radius: 16px; }
th { background: #101017; }
tbody tr { transition: background .12s; }
tbody tr:hover { background: rgba(255,255,255,.025); }

/* Knöpfe */
.btn { transition: border-color .15s, filter .15s, transform .08s; }
.btn:active { transform: translateY(1px); }
.btn.primary, .btn.pink { box-shadow: 0 4px 14px rgba(229,36,59,.3); }
.btn.pink { background: var(--red); border-color: var(--red); }

/* Reiter im Account */
.dtabs button { color: var(--muted); }
.dtabs button.on { color: #fff; border-bottom-color: var(--red); }
.chip.on { border-color: var(--red); }

/* Anmeldung */
.auth .card { box-shadow: 0 20px 60px rgba(0,0,0,.5); }

@media (max-width: 860px) {
  .user-name, .user-role { display: none; }
  .user-chip { padding: 4px; }
  .stat .value { font-size: 24px; }
}
/* Grid-Inhalte nie breiter als der Bildschirm (Handy) */
.stack { grid-template-columns: minmax(0, 1fr); }
.topbar > * { min-width: 0; }

/* ---- TikTok-Monitor: Status-Plaketten ---- */
.badge.amber { background: rgba(245,158,11,.18); color: #fbbf24; }
.badge.red { background: rgba(239,68,68,.2); color: #ff6b7d; }
.badge.off { background: #0b0d12; color: #6b7280; border: 1px solid rgba(255,255,255,.08); }
.small.muted .warn, .warn { color: #fbbf24; }
.badge { white-space: nowrap; }

/* ---- ⭐ Highlights & 🧠 Zusammenfassung ---- */
.highlight-btn { background: rgba(251,191,36,.14); color: #fbbf24; border-color: rgba(251,191,36,.35); font-weight: 700; }
.highlight-btn:hover { background: rgba(251,191,36,.24); }
.summary { border-color: rgba(37,244,238,.25); background: linear-gradient(180deg, rgba(37,244,238,.06), transparent 60%), var(--panel); }
.sum-list { margin: 0; padding-left: 20px; display: grid; gap: 4px; }

/* ---- 👤 Profil, 🔔 Alerts, ⚖️ Vergleich ---- */
.act-row { align-items: flex-start; }
.act-ico { font-size: 18px; width: 26px; text-align: center; flex: none; }
.act-row.unseen { box-shadow: inset 3px 0 0 var(--red); background: rgba(229,36,59,.05); }
table.compare th:first-child { color: var(--muted); font-weight: 500; text-align: left; }
table.compare td.best { color: var(--green); font-weight: 700; }
.dtabs { overflow-x: auto; flex-wrap: nowrap; }
.dtabs button { white-space: nowrap; }

/* ---- 💬 Kontakt per WhatsApp ---- */
.wa-contact { display: flex; flex-direction: column; align-items: center; gap: 6px; text-decoration: none; color: var(--muted); font-size: 13px; padding: 10px; border-radius: 12px; transition: background .15s; }
.wa-contact:hover { background: rgba(37,211,102,.08); }
.wa-badge { display: inline-flex; align-items: center; gap: 8px; padding: 7px 14px 7px 8px; border-radius: 99px; background: rgba(37,211,102,.14); border: 1px solid rgba(37,211,102,.4); color: #e9fff1; }
.wa-ico { width: 24px; height: 24px; border-radius: 50%; background: #25d366; display: grid; place-items: center; font-size: 13px; }
.wa-contact.compact { align-items: flex-start; padding: 6px 0; font-size: 12px; }
.wa-contact.compact .wa-badge { padding: 5px 12px 5px 6px; font-size: 13px; }

/* 🗓 Sende-Zeiten-Heatmap */
.hm { overflow-x: auto; }
.hm-row { display: grid; grid-template-columns: 28px repeat(24, 1fr); gap: 2px; align-items: center; min-width: 360px; margin-bottom: 2px; }
.hm-day { font-size: 11px; color: #8b93a7; text-align: right; padding-right: 4px; }
.hm-h { font-size: 9px; color: #8b93a7; text-align: center; }
.hm-cell { height: 14px; border-radius: 2px; background: rgba(255,255,255,.05); }

/* 💬 Chat neben dem Player */
.player-wrap { display: flex; gap: 10px; align-items: flex-start; }
.player-wrap > .player { flex: 1 1 auto; min-width: 0; }
.player-wrap .chat-side { display: none; flex: 0 0 300px; max-height: 70vh; overflow-y: auto; }
.player-wrap.with-chat .chat-side { display: block; }
@media (max-width: 820px) {
  .player-wrap.with-chat { flex-direction: column; }
  .player-wrap .chat-side { flex: none; width: 100%; max-height: 260px; }
}
