:root {
  --bg: #0a0e16;
  --bg2: #0f1420;
  --panel: #131a28;
  --panel2: #182134;
  --line: rgba(255, 255, 255, .07);
  --line2: rgba(255, 255, 255, .12);
  --text: #e7ecf5;
  --muted: #8a96ad;
  --accent: #5b8cff;
  --accent2: #8b6cff;
  --ok: #2fd5a6;
  --warn: #ffb547;
  --bad: #ff5470;
  --event: #ff7a59;
  --radius: 14px;
  --font: "Inter", "SF Pro Text", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 14px/1.45 var(--font); }
body { background: radial-gradient(1200px 600px at 80% -10%, rgba(91,140,255,.10), transparent 60%),
                   radial-gradient(900px 500px at -10% 110%, rgba(139,108,255,.08), transparent 60%), var(--bg); }
.hidden { display: none !important; }
.muted { color: var(--muted); }
button { font: inherit; color: inherit; cursor: pointer; }
input, select, textarea {
  font: inherit; color: var(--text); background: var(--bg2); border: 1px solid var(--line2);
  border-radius: 10px; padding: 8px 10px; width: 100%; outline: none; transition: border .15s;
}
input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(91,140,255,.18); }
input[type=checkbox] { width: auto; accent-color: var(--accent); }
input[type=range] { padding: 0; accent-color: var(--accent); background: none; border: 0; }
label { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--muted); font-weight: 500; }
label.check { flex-direction: row; align-items: center; gap: 8px; color: var(--text); font-size: 13px; }
svg.i { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,.12); border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; gap: 7px; padding: 8px 14px; border-radius: 10px;
  border: 1px solid var(--line2); background: var(--panel2); font-weight: 500; transition: all .15s; white-space: nowrap; }
.btn:hover { border-color: rgba(255,255,255,.22); background: #1d2840; }
.btn.primary { background: linear-gradient(135deg, var(--accent), var(--accent2)); border-color: transparent; color: #fff; }
.btn.primary:hover { filter: brightness(1.1); }
.btn.danger { color: var(--bad); }
.btn.danger:hover { background: rgba(255,84,112,.12); border-color: rgba(255,84,112,.4); }
.btn.small { padding: 5px 10px; font-size: 12.5px; border-radius: 8px; }
.btn.wide { width: 100%; justify-content: center; padding: 11px; }
.btn.on { background: rgba(91,140,255,.18); border-color: rgba(91,140,255,.5); color: #cfdcff; }
.btn:disabled { opacity: .5; cursor: default; }
.icon-btn { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 10px;
  border: 1px solid var(--line); background: rgba(255,255,255,.03); color: var(--text); transition: all .15s; }
.icon-btn:hover { background: rgba(255,255,255,.09); border-color: var(--line2); }
.icon-btn.on { background: rgba(91,140,255,.2); border-color: rgba(91,140,255,.55); color: #cfdcff; }
.icon-btn.rec { color: var(--bad); }

/* ---------- login ---------- */
.login { position: fixed; inset: 0; display: grid; place-items: center; }
.login-card { width: min(360px, 92vw); background: var(--panel); border: 1px solid var(--line); border-radius: 20px;
  padding: 32px; display: flex; flex-direction: column; gap: 14px; box-shadow: 0 30px 80px rgba(0,0,0,.45); }
.login-err { color: var(--bad); min-height: 18px; font-size: 13px; }

/* ---------- topbar ---------- */
#app { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }
.topbar { height: 58px; flex: none; display: flex; align-items: center; gap: 22px; padding: 0 18px;
  border-bottom: 1px solid var(--line); background: rgba(10,14,22,.75); backdrop-filter: blur(14px); z-index: 5; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; letter-spacing: .5px; font-size: 16px; }
.brand.big { font-size: 24px; }
.brand-dot { width: 14px; height: 14px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #fff 0 18%, var(--accent) 22% 60%, var(--accent2));
  box-shadow: 0 0 18px rgba(91,140,255,.7); }
.tabs { display: flex; gap: 4px; background: rgba(255,255,255,.03); padding: 4px; border-radius: 12px; border: 1px solid var(--line); }
.tabs button { border: 0; background: none; padding: 6px 14px; border-radius: 9px; color: var(--muted); font-weight: 500; }
.tabs button.active { background: var(--panel2); color: var(--text); box-shadow: 0 1px 0 rgba(255,255,255,.06) inset; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.pill { font-size: 12px; padding: 5px 10px; border-radius: 99px; border: 1px solid var(--line); color: var(--muted); display: flex; gap: 6px; align-items: center; }
.clock { font-variant-numeric: tabular-nums; font-weight: 600; min-width: 74px; text-align: right; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
.dot.ok { background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.dot.bad { background: var(--bad); }
.dot.warn { background: var(--warn); }
main#view { flex: 1; min-height: 0; overflow: hidden; }

/* ---------- live view ---------- */
.live { height: 100%; display: grid; grid-template-columns: 1fr 270px; grid-template-rows: minmax(0, 1fr) auto;
  grid-template-areas: "stage list" "tl tl"; gap: 14px; padding: 14px; }
.live .stage-wrap { grid-area: stage; }
.live .cam-list { grid-area: list; }
.live .tl-host, .detail .tl-host { grid-area: tl; min-width: 0; }
.live.grid-mode { grid-template-columns: 1fr; grid-template-areas: "stage" "tl"; }
.live.grid-mode .cam-list { display: none; }
.cam-list { overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding-right: 4px; }
.cam-list-head { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .8px; padding: 2px 2px 0; }
.tile { position: relative; aspect-ratio: 16/9; border-radius: 12px; overflow: hidden; background: #05070b; border: 2px solid transparent;
  cursor: pointer; transition: border-color .15s, transform .15s; flex: none; user-select: none; }
.tile:hover { border-color: var(--line2); }
.tile.active { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(91,140,255,.15); }
.tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile .tile-label { position: absolute; left: 0; right: 0; bottom: 0; padding: 18px 10px 7px; font-size: 12.5px; font-weight: 600;
  background: linear-gradient(transparent, rgba(0,0,0,.75)); display: flex; align-items: center; gap: 7px; }
.tile.motion { border-color: var(--event); }
.tile.motion::after, .stage.motion::after { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  box-shadow: inset 0 0 0 2px var(--event); animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { box-shadow: inset 0 0 0 2px transparent; } }
.offline-cover { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: 12px; text-align: center; padding: 10px;
  background: repeating-linear-gradient(45deg, #0a0d14 0 12px, #0c1019 12px 24px); }

.stage-wrap { min-height: 0; min-width: 0; display: flex; }
.stage { position: relative; flex: 1; border-radius: var(--radius); overflow: hidden; background: #000; border: 1px solid var(--line);
  display: grid; place-items: center; }
.stage .media { position: absolute; inset: 0; }
.stage img, .stage video { width: 100%; height: 100%; object-fit: contain; display: block; background: #000; }
.stage-top { position: absolute; top: 0; left: 0; right: 0; display: flex; align-items: center; gap: 10px; padding: 12px 14px;
  background: linear-gradient(rgba(0,0,0,.6), transparent); z-index: 2; }
.stage-title { font-weight: 650; font-size: 15px; display: flex; align-items: center; gap: 9px; text-shadow: 0 1px 3px rgba(0,0,0,.6); }
.stage-actions { position: absolute; top: 12px; right: 14px; z-index: 3; display: flex; gap: 6px; }
.stage:not(.ext) .ext-only { display: none; }
.stage-actions small { display: none; }
.stage-actions .icon-btn { background: rgba(0,0,0,.45); backdrop-filter: blur(6px); }
.badge { font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 6px; letter-spacing: .4px; text-transform: uppercase; }
.badge.live { background: rgba(255,84,112,.18); color: #ff8ca0; }
.badge.rec { background: var(--bad); color: #fff; animation: blink 1s infinite; }
.badge.play { background: rgba(91,140,255,.22); color: #cfdcff; }
.badge.off { background: rgba(255,255,255,.1); color: var(--muted); }
@keyframes blink { 50% { opacity: .55; } }
.stage-bottom { position: absolute; left: 14px; bottom: 12px; font-size: 12px; color: rgba(255,255,255,.75); z-index: 2; text-shadow: 0 1px 3px #000; font-variant-numeric: tabular-nums; }
.stage-hint { position: absolute; right: 14px; bottom: 12px; font-size: 11.5px; color: rgba(255,255,255,.45); z-index: 2; }

.cam-grid { flex: 1; display: grid; gap: 10px; min-height: 0; }
.cam-grid .tile { aspect-ratio: auto; height: 100%; min-height: 0; }
.cam-grid .tile img { object-fit: contain; background: #000; }

.empty { display: grid; place-items: center; text-align: center; gap: 12px; color: var(--muted); padding: 40px; height: 100%; }
.empty h2 { color: var(--text); margin: 0; }

/* ---------- player bar ---------- */
.playerbar { position: absolute; left: 0; right: 0; bottom: 0; z-index: 3; display: flex; align-items: center; gap: 6px; padding: 10px 12px;
  background: linear-gradient(transparent, rgba(0,0,0,.8)); }
.playerbar .sep { flex: 1; }
.playerbar .info { font-size: 12.5px; color: rgba(255,255,255,.85); font-variant-numeric: tabular-nums; margin-right: 6px; }
.speed { display: flex; background: rgba(0,0,0,.4); border-radius: 9px; padding: 2px; border: 1px solid var(--line); }
.speed button { border: 0; background: none; padding: 4px 8px; font-size: 12px; border-radius: 7px; color: var(--muted); }
.speed button.on { background: rgba(255,255,255,.14); color: #fff; }
.stage.playing .stage-bottom, .stage.playing .stage-hint { display: none; }
.stage video::-webkit-media-controls-panel { margin-bottom: 44px; }

/* ---------- timeline ---------- */
.tl { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px 12px; user-select: none; }
.tl-toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.tl-title { font-weight: 600; font-size: 13px; }
.tl-range { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.tl-tools { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.seg { display: flex; background: var(--bg2); border: 1px solid var(--line); border-radius: 9px; padding: 2px; }
.seg button { border: 0; background: none; color: var(--muted); padding: 3px 9px; border-radius: 7px; font-size: 12px; }
.seg button.on { background: var(--panel2); color: var(--text); }
.tl-body { display: flex; }
.tl-labels { width: 130px; flex: none; padding-top: 22px; }
.tl-label { height: 26px; margin-bottom: 4px; display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-right: 8px; cursor: pointer; }
.tl-label.active { color: var(--text); font-weight: 600; }
.tl-wrap { flex: 1; min-width: 0; position: relative; }
.tl-scroll { display: flex; overflow-x: auto; overflow-y: hidden; position: relative; cursor: grab; scrollbar-width: thin; }
.tl-scroll.dragging { cursor: grabbing; }
.tl-inner { position: relative; flex: none; overflow: hidden; }
.tl-pad { flex: none; }
.tl-axis { position: relative; height: 22px; }
.tl-tick { position: absolute; top: 0; height: 100%; border-left: 1px solid var(--line2); }
.tl-tick.minor { border-color: var(--line); top: 12px; height: 10px; }
.tl-tick span { position: absolute; left: 5px; top: 1px; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.tl-tick.day span { color: var(--accent); font-weight: 600; }
.tl-row { position: relative; height: 26px; margin-bottom: 4px; background: rgba(255,255,255,.025); border-radius: 7px; }
.tl-row.active { background: rgba(91,140,255,.07); box-shadow: inset 0 0 0 1px rgba(91,140,255,.18); }
.tl-grid { position: absolute; top: 22px; bottom: 0; border-left: 1px dashed rgba(255,255,255,.05); pointer-events: none; }
.tl-ev { position: absolute; top: 4px; bottom: 4px; min-width: 4px; border-radius: 4px; cursor: pointer;
  background: linear-gradient(180deg, #ff8f6b, #f0574b); box-shadow: 0 0 0 1px rgba(0,0,0,.25); transition: filter .1s, transform .1s; }
.tl-ev:hover { filter: brightness(1.25); transform: scaleY(1.12); z-index: 2; }
.tl-ev.sel { background: linear-gradient(180deg, #8fb0ff, var(--accent)); box-shadow: 0 0 0 2px #fff; z-index: 3; }
.tl-ev.live { background: repeating-linear-gradient(45deg, #ff5470 0 6px, #ff7a8e 6px 12px); animation: blink 1s infinite; }
.tl-ev.novideo { background: rgba(255,181,71,.55); }
.tl-now { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--ok); box-shadow: 0 0 8px var(--ok); pointer-events: none; }
.tl-now::before { content: "Jetzt"; position: absolute; top: 2px; right: 5px; font-size: 10px; color: var(--ok); font-weight: 700; }
.tl-cursor { position: absolute; top: 0; bottom: 0; width: 2px; background: #fff; pointer-events: none; z-index: 4; }
.tl-hover { position: absolute; top: 0; bottom: 0; width: 1px; background: rgba(255,255,255,.35); pointer-events: none; z-index: 5; }
.tl-hover span { position: absolute; top: 2px; left: 4px; font-size: 10.5px; background: #000; padding: 1px 5px; border-radius: 4px; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ---------- detail view ---------- */
.detail { height: 100%; display: grid; grid-template-columns: 1fr 340px; grid-template-rows: auto minmax(0, 1fr) auto; gap: 14px; padding: 14px;
  grid-template-areas: "head head" "stage side" "tl tl"; }
.detail .stage-wrap { grid-area: stage; }
.detail .side { grid-area: side; }
.detail-head { grid-area: head; display: flex; align-items: center; gap: 12px; min-width: 0; }
.rec-card { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.detail-head h1 { font-size: 19px; margin: 0; display: flex; align-items: center; gap: 10px; }
.detail-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.side { min-height: 0; display: flex; flex-direction: column; gap: 14px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.card h3 { margin: 0 0 10px; font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.card h3 .muted { font-weight: 400; margin-left: auto; font-size: 12px; }
.ev-list { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; margin: 0 -6px; padding: 0 6px; }
.ev-item { display: flex; gap: 10px; align-items: center; padding: 6px; border-radius: 10px; cursor: pointer; border: 1px solid transparent; }
.ev-item:hover { background: rgba(255,255,255,.04); }
.ev-item.sel { background: rgba(91,140,255,.12); border-color: rgba(91,140,255,.35); }
.ev-item img { width: 92px; aspect-ratio: 16/9; object-fit: cover; border-radius: 7px; background: #000; flex: none; }
.ev-meta { font-size: 12.5px; min-width: 0; }
.ev-meta b { display: block; font-size: 13px; font-variant-numeric: tabular-nums; }
.ev-day { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .7px; padding: 8px 6px 2px; }
.ptz { display: grid; grid-template-columns: repeat(3, 44px); grid-template-rows: repeat(3, 44px); gap: 6px; justify-content: center; }
.ptz button { border-radius: 12px; border: 1px solid var(--line2); background: var(--panel2); display: grid; place-items: center; }
.ptz button:active { background: var(--accent); }
.ptz-row { display: flex; gap: 14px; align-items: center; justify-content: center; }
.zoom { display: flex; flex-direction: column; gap: 6px; }
.zoom button { width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--line2); background: var(--panel2); font-size: 18px; }
.zoom button:active { background: var(--accent); }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; font-size: 12.5px; }
.stats div { background: var(--bg2); border-radius: 9px; padding: 7px 9px; }
.stats b { display: block; font-size: 14px; }

/* ---------- events view ---------- */
.page { height: 100%; overflow-y: auto; padding: 18px 22px 40px; }
.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { margin: 0; font-size: 20px; }
.page-head .filters { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.page-head select { width: auto; }
.ev-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.ev-card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; cursor: pointer; transition: transform .12s, border-color .12s; }
.ev-card:hover { transform: translateY(-2px); border-color: var(--line2); }
.ev-card .thumb { position: relative; aspect-ratio: 16/9; background: #000; }
.ev-card img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ev-card .dur { position: absolute; right: 7px; bottom: 7px; font-size: 11px; background: rgba(0,0,0,.7); padding: 2px 6px; border-radius: 5px; }
.ev-card .body { padding: 9px 11px; display: flex; justify-content: space-between; gap: 8px; font-size: 12.5px; }
.section-title { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .8px; margin: 22px 0 10px; }

/* ---------- settings ---------- */
.settings { max-width: 1100px; margin: 0 auto; }
.cam-table { display: flex; flex-direction: column; gap: 8px; }
.cam-row { display: grid; grid-template-columns: 22px 120px 1fr auto; gap: 14px; align-items: center; background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; padding: 10px 12px; }
.cam-row img, .cam-row .ph { width: 120px; aspect-ratio: 16/9; border-radius: 7px; object-fit: cover; background: #000; }
.cam-row .name { font-weight: 600; }
.cam-row .sub { color: var(--muted); font-size: 12px; word-break: break-all; }
.cam-row .row-actions { display: flex; gap: 6px; }
.drag-handle { cursor: grab; color: var(--muted); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.form-grid .full { grid-column: 1 / -1; }
.storage-bar { height: 10px; border-radius: 99px; background: var(--bg2); overflow: hidden; display: flex; margin: 8px 0; }
.storage-bar i { display: block; height: 100%; }
.legend { display: flex; gap: 16px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.legend span::before { content: ""; display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 6px; background: var(--c); }
.warn-box { border: 1px solid rgba(255,181,71,.4); background: rgba(255,181,71,.08); color: #ffd28a; border-radius: 12px; padding: 10px 14px; margin-bottom: 14px; font-size: 13px; }

/* ---------- modal ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(3,5,10,.7); backdrop-filter: blur(4px); display: grid; place-items: center; z-index: 50; padding: 20px; animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
.modal { width: min(900px, 100%); max-height: calc(100vh - 40px); display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line2);
  border-radius: 18px; box-shadow: 0 40px 100px rgba(0,0,0,.6); }
.modal-head { display: flex; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; font-size: 17px; }
.modal-head .icon-btn { margin-left: auto; }
.modal-body { padding: 18px 20px; overflow-y: auto; display: flex; flex-direction: column; gap: 18px; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; }
fieldset { border: 1px solid var(--line); border-radius: 14px; padding: 14px; margin: 0; display: flex; flex-direction: column; gap: 12px; }
legend { padding: 0 6px; font-weight: 600; font-size: 13px; }
.hint { font-size: 12px; color: var(--muted); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line2); background: var(--bg2); border-radius: 10px; padding: 7px 11px; font-size: 12.5px; cursor: pointer; text-align: left; }
.chip:hover { border-color: var(--accent); }
.chip small { display: block; color: var(--muted); }
table.profiles { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.profiles th { text-align: left; color: var(--muted); font-weight: 500; padding: 6px; border-bottom: 1px solid var(--line); }
table.profiles td { padding: 6px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.profiles td.uri { word-break: break-all; color: var(--muted); font-size: 11.5px; }
.mask-editor { position: relative; width: 100%; max-width: 640px; aspect-ratio: 16/9; border-radius: 10px; overflow: hidden; background: #000; user-select: none; }
.mask-editor img { width: 100%; height: 100%; object-fit: fill; display: block; }
.mask-grid { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(16, 1fr); grid-template-rows: repeat(12, 1fr); cursor: crosshair; }
.mask-grid div { border: 1px solid rgba(255,255,255,.08); }
.mask-grid div.off { background: rgba(255,84,112,.45); }
.spinner { width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.25); border-top-color: #fff; border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- toasts ---------- */
#toasts { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 100; }
.toast { background: var(--panel2); border: 1px solid var(--line2); border-left: 3px solid var(--accent); padding: 10px 14px; border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0,0,0,.4); max-width: 380px; font-size: 13px; animation: fade .2s; }
.toast.err { border-left-color: var(--bad); }
.toast.ok { border-left-color: var(--ok); }

.seg button { display: inline-flex; align-items: center; gap: 5px; }
.seg svg.i { width: 14px; height: 14px; }

/* ---------- Auflösung / Vollbild-Fallback ---------- */
.res { color: var(--accent); font-weight: 600; }
.ev-card .res-badge { position: absolute; left: 7px; bottom: 7px; font-size: 10.5px; font-weight: 700; background: rgba(91,140,255,.85); padding: 2px 6px; border-radius: 5px; }
.stage.fake-full { position: fixed; inset: 0; z-index: 80; border-radius: 0; border: 0; }
body.noscroll { overflow: hidden; }
.tabs button { display: inline-flex; align-items: center; gap: 6px; }
.tabs button svg.i { width: 16px; height: 16px; }
.mask-grid, .ptz button, .zoom button { touch-action: none; }
.tile, .stage { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }

/* ================= MOBILE ================= */
@media (max-width: 820px), (max-height: 500px) and (pointer: coarse) {
  body { font-size: 15px; }
  input, select, textarea { font-size: 16px; }           /* kein Auto-Zoom auf iOS */
  .topbar { height: calc(52px + env(safe-area-inset-top)); padding: env(safe-area-inset-top) 14px 0; gap: 10px; }
  .topbar { backdrop-filter: none; -webkit-backdrop-filter: none; background: var(--bg); } /* sonst hängt die fixe Navigation am Header */
  .seg button { white-space: nowrap; }
  .tl-now::before { display: none; }
  .pill#storage-pill, .clock { display: none; }
  /* Navigation unten wie eine App */
  .tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; border-radius: 0; border: 0; border-top: 1px solid var(--line);
    background: rgba(12,16,26,.94); backdrop-filter: blur(16px); padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); justify-content: space-around; }
  .tabs button { flex-direction: column; gap: 2px; font-size: 11px; padding: 6px 4px; flex: 1; border-radius: 10px; }
  .tabs button svg.i { width: 22px; height: 22px; }
  .tabs button.active { background: none; color: var(--accent); box-shadow: none; }
  main#view { overflow-y: auto; -webkit-overflow-scrolling: touch; padding-bottom: calc(68px + env(safe-area-inset-bottom)); }

  /* Live: Hauptbild oben, Zeitachse, darunter Kameras im 2er-Raster */
  .live { height: auto; display: flex; flex-direction: column; gap: 10px; padding: 10px; }
  .live .stage-wrap { order: 1; aspect-ratio: 16 / 9; flex: none; scroll-margin-top: 10px; }
  .live.grid-mode .stage-wrap { aspect-ratio: auto; }
  .live .tl-host { order: 2; }
  .live .cam-list { order: 3; display: grid; grid-template-columns: 1fr 1fr; overflow: visible; padding: 0; gap: 8px; }
  .live .cam-list-head { grid-column: 1 / -1; }
  .live.grid-mode .cam-list { display: none; }
  .cam-grid { grid-template-rows: none !important; grid-auto-rows: auto; }
  .cam-grid .tile { aspect-ratio: 16 / 9; height: auto; }
  .tile .tile-label { font-size: 12px; padding: 14px 8px 6px; }
  .stage { border-radius: 12px; }
  .stage-top { padding: 8px 8px; gap: 6px; }
  .stage-title { font-size: 13.5px; gap: 6px; }
  .stage-title .badge { font-size: 9.5px; padding: 2px 5px; }
  .stage-actions { gap: 4px; }
  .stage-actions .icon-btn { width: 30px; height: 30px; border-radius: 8px; }
  .stage-actions svg.i { width: 16px; height: 16px; }
  .stage-bottom { left: 8px; bottom: 6px; font-size: 10.5px; }
  .stage-hint { display: none; }
  .playerbar { flex-wrap: wrap; padding: 6px 8px; gap: 4px; }
  .playerbar .info { order: -1; width: 100%; font-size: 11px; }
  .playerbar .icon-btn { width: 30px; height: 30px; }
  .playerbar .btn.small { padding: 4px 8px; }
  .speed button { padding: 3px 6px; font-size: 11px; }
  .speed button[data-s="0.5"], .speed button[data-s="8"] { display: none; }
  .stage video::-webkit-media-controls-panel { margin-bottom: 64px; }

  /* Zeitachse */
  .tl { padding: 8px 8px 10px; border-radius: 12px; }
  .tl-toolbar { flex-wrap: wrap; gap: 6px; }
  .tl-title { font-size: 12.5px; width: 100%; }
  .tl-range { font-size: 11px; }
  .tl-tools { gap: 4px; }
  .tl-tools .btn.small { padding: 4px 8px; }
  .seg button { padding: 4px 7px; }
  .tl-labels { width: 74px; }
  .tl-label { font-size: 11px; gap: 5px; height: 30px; }
  .tl-row { height: 30px; }
  .tl-scroll { cursor: auto; }

  /* Detail */
  .detail { height: auto; display: flex; flex-direction: column; gap: 10px; padding: 10px; }
  .detail-head { gap: 8px; }
  .detail-head h1 { font-size: 16px; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .detail-head .btn { padding: 7px 9px; }
  .detail-head .actions { flex-wrap: nowrap; gap: 6px; }
  .detail-head .cam-switch { max-width: 120px; padding: 6px 8px; }
  .detail .stage-wrap { aspect-ratio: auto; flex: none; }
  .detail-head .cam-switch { display: none; }
  .ev-list { overflow: visible; }
  .ev-item img { width: 110px; }
  .hide-sm { display: none; }

  /* Seiten */
  .page { height: auto; overflow: visible; padding: 14px 12px; }
  .page-head h1 { font-size: 18px; }
  .page-head .filters { margin-left: 0; width: 100%; }
  .page-head .filters select, .page-head .filters .btn { flex: 1; }
  .ev-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .ev-card .body { flex-direction: column; gap: 0; padding: 7px 8px; font-size: 12px; }
  .cam-row { grid-template-columns: 1fr auto; grid-template-areas: "img img" "info act"; gap: 10px; }
  .cam-row > div:first-child { display: none; }
  .cam-row img, .cam-row .ph { grid-area: img; width: 100%; }
  .cam-row > div:nth-child(3) { grid-area: info; min-width: 0; }
  .cam-row .row-actions { grid-area: act; flex-direction: column; }

  /* Dialog im Vollbild */
  .modal-bg { padding: 0; place-items: stretch; }
  .modal { width: 100%; max-height: none; height: 100dvh; border-radius: 0; border: 0; }
  .modal-head { padding: calc(12px + env(safe-area-inset-top)) 14px 12px; }
  .modal-body { padding: 14px; }
  .modal-foot { padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); }
  .modal-foot .btn { flex: 1; justify-content: center; }
  table.profiles { display: block; overflow-x: auto; }
  #toasts { left: 12px; right: 12px; bottom: calc(76px + env(safe-area-inset-bottom)); }
  .toast { max-width: none; }
}
/* Handy quer: Hauptbild füllt den Bildschirm */
@media (max-width: 950px) and (max-height: 500px) and (orientation: landscape) {
  .live .stage-wrap { aspect-ratio: auto; height: calc(100dvh - 70px); }
  .stage.ext .media { aspect-ratio: auto; height: calc(100dvh - 120px); }
  .topbar { height: 44px; }
}

/* ================= Handy: Kamera-Übersicht ================= */
.mlive { padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.mlive-head { display: flex; justify-content: space-between; align-items: baseline; font-weight: 650; font-size: 17px; padding: 2px 2px 0; }
.mlive-head .muted { font-size: 12px; font-weight: 400; }
.mgrid { display: grid; gap: 8px; justify-content: center; }
.mgrid .tile { aspect-ratio: 16 / 9; border-radius: 12px; }
.mgrid .tile:active { transform: scale(.98); }
.mgrid .tile-label .badge.rec { margin-left: auto; font-size: 9.5px; padding: 2px 5px; }

/* ================= Handy: Kameraansicht – keine Knöpfe im Bild ================= */
.stage.ext { display: flex; flex-direction: column; gap: 8px; background: none; border: 0; border-radius: 0; overflow: visible; place-items: initial; }
.stage.ext .media { position: relative; inset: auto; aspect-ratio: 16 / 9; border-radius: 12px; overflow: hidden; background: #000; touch-action: pan-y pinch-zoom; }
.stage.ext .stage-top { position: static; background: none; padding: 0 2px; }
.stage.ext .stage-title { text-shadow: none; font-size: 15px; }
.stage.ext .stage-actions { position: static; display: flex; justify-content: space-around; gap: 4px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 4px; }
.stage.ext .stage-actions .icon-btn { width: auto; height: auto; flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 7px 0; background: none; border: 0; backdrop-filter: none; border-radius: 9px; }
.stage.ext .stage-actions .icon-btn svg.i { width: 20px; height: 20px; }
.stage.ext .stage-actions small { display: block; font-size: 10.5px; color: var(--muted); }
.stage.ext .stage-actions .icon-btn.on { background: rgba(91,140,255,.12); }
.stage.ext .stage-actions .icon-btn.on small { color: #cfdcff; }
.stage.ext .stage-bottom { position: static; text-shadow: none; color: var(--muted); padding: 0 2px; font-size: 11px; }
.stage.ext .playerbar { position: static; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; flex-wrap: wrap; gap: 6px; }
.stage.ext .playerbar .info { order: -2; width: 100%; margin: 0; color: var(--text); }
.stage.ext .playerbar .seek { order: -1; width: 100%; height: 22px; }
.stage.ext .playerbar .icon-btn { width: 36px; height: 36px; }
.stage.ext.playing .stage-actions { display: none; }
.stage.ext.motion::after { display: none; }
.stage.ext.motion .media { box-shadow: 0 0 0 2px var(--event); }
.stage.ext.fake-full, .stage.ext:fullscreen { position: fixed; inset: 0; z-index: 80; background: #000; gap: 0; padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom); }
.stage.ext.fake-full .media, .stage.ext:fullscreen .media { flex: 1; height: auto; aspect-ratio: auto; border-radius: 0; }
.stage.ext.fake-full .stage-top, .stage.ext:fullscreen .stage-top { padding: 8px 10px; }
.stage.ext.fake-full .stage-actions, .stage.ext:fullscreen .stage-actions, .stage.ext.fake-full .playerbar, .stage.ext:fullscreen .playerbar { border-radius: 0; border: 0; background: #0b0f17; }
.media.slide-l { animation: slideL .25s ease-out; }
.media.slide-r { animation: slideR .25s ease-out; }
@keyframes slideL { from { transform: translateX(35%); opacity: .2; } }
@keyframes slideR { from { transform: translateX(-35%); opacity: .2; } }
.cam-dots { display: flex; justify-content: center; align-items: center; gap: 7px; flex-wrap: wrap; padding: 2px 0; }
.cam-dots button { width: 8px; height: 8px; border-radius: 99px; border: 0; padding: 0; background: rgba(255,255,255,.25); transition: all .2s; }
.cam-dots button.on { width: 22px; background: var(--accent); }
.cam-dots .swipe-hint { width: 100%; text-align: center; font-size: 11px; color: var(--muted); }
.stage.ext .stage-actions a.icon-btn { text-decoration: none; color: var(--text); }
.stage.ext .stage-title .dot, .stage.ext .stage-title .nm { display: none; }   /* Name steht schon in der Kopfzeile */
.stage.ext .playerbar .sep { display: none; }
.stage.ext .playerbar { justify-content: space-between; }
.stage.ext .playerbar .lbl { display: none; }
.stage.ext .speed button[data-s="4"] { display: none; }

/* ---------- Zeitachse: Abspielmarke & Daueraufnahme ---------- */
.tl-cov { position: absolute; top: 9px; bottom: 9px; border-radius: 3px; background: rgba(91,140,255,.30); pointer-events: none; }
.tl-row .tl-ev { z-index: 1; }
.tl-playhead { position: absolute; top: 0; bottom: 0; left: 50%; width: 2px; margin-left: -1px; background: #fff; pointer-events: none; z-index: 6;
  box-shadow: 0 0 6px rgba(0,0,0,.6); }
.tl-playhead span { position: absolute; top: -3px; left: 50%; transform: translateX(-50%); white-space: nowrap; font-size: 11px; font-weight: 700;
  background: #fff; color: #0a0e16; padding: 1px 7px; border-radius: 6px; font-variant-numeric: tabular-nums; }
.tl-playhead.is-live { background: var(--ok); }
.tl-playhead.is-live span { background: var(--ok); }
.tl-legend { display: flex; gap: 12px; font-size: 11px; color: var(--muted); }
.tl-legend i { display: inline-block; width: 12px; height: 8px; border-radius: 2px; margin-right: 5px; vertical-align: middle; }
.tl-legend { margin-left: 8px; }
@media (max-width: 820px), (max-height: 500px) and (pointer: coarse) { .tl-legend { order: 5; width: 100%; margin: 0; } .tl-playhead span { font-size: 10px; } }

/* ---------- Handy: kompakter ---------- */
@media (max-width: 820px), (max-height: 500px) and (pointer: coarse) {
  .stage.ext .stage-actions { padding: 3px; border-radius: 10px; }
  .stage.ext .stage-actions .icon-btn { padding: 4px 0; gap: 1px; border-radius: 8px; }
  .stage.ext .stage-actions .icon-btn svg.i { width: 16px; height: 16px; }
  .stage.ext .stage-actions small { font-size: 9.5px; }
  .stage.ext .playerbar { padding: 6px 8px; gap: 4px; border-radius: 10px; }
  .stage.ext .playerbar .icon-btn { width: 30px; height: 30px; border-radius: 8px; }
  .stage.ext .playerbar .icon-btn svg.i { width: 15px; height: 15px; }
  .stage.ext .playerbar .btn.small { padding: 4px 7px; }
  .stage.ext .playerbar .seek { height: 16px; }
  .stage.ext .stage-bottom { font-size: 10px; }
  .stage.ext .stage-top .badge { font-size: 9px; padding: 2px 5px; }
  .tl-toolbar .seg button { padding: 2px 6px; font-size: 11px; }
  .tl-toolbar .btn.small { padding: 3px 7px; font-size: 11px; gap: 4px; }
  .tl-toolbar .btn.small svg.i { width: 13px; height: 13px; }
  .tl-legend { font-size: 10px; }
  .tl-playhead span { font-size: 9px; padding: 0 4px; border-radius: 4px; top: -1px; }
  .tl-scroll { scrollbar-width: none; }
  .tl-scroll::-webkit-scrollbar { display: none; }
  .cam-dots { padding: 0; }
  .cam-dots button { width: 6px; height: 6px; }
  .cam-dots button.on { width: 16px; }
  .detail-head .btn { padding: 5px 7px; }
  .detail-head h1 { font-size: 15px; }
}
@media (max-width: 820px), (max-height: 500px) and (pointer: coarse) {
  .ptz { grid-template-columns: repeat(3, 36px); grid-template-rows: repeat(3, 36px); gap: 5px; }
  .ptz button, .zoom button { border-radius: 9px; }
  .zoom button { width: 36px; height: 36px; font-size: 16px; }
  .detail .card { padding: 10px 12px; }
  .detail .card h3 { margin-bottom: 8px; font-size: 12.5px; }
}

/* ---------- Marke „Luchs“ ---------- */
.brand-logo { width: 26px; height: 26px; filter: drop-shadow(0 0 10px rgba(110,160,255,.35)); }
.brand.big .brand-logo { width: 56px; height: 56px; }
.brand.big { flex-direction: column; gap: 8px; font-size: 26px; letter-spacing: 1px; margin-bottom: 6px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.brand-name { white-space: nowrap; }
.brand-by { font-size: 9px; font-weight: 500; letter-spacing: .6px; color: var(--muted); margin-top: 2px; white-space: nowrap; }
.brand.big .brand-text { align-items: center; }
.brand.big .brand-by { font-size: 11px; margin-top: 6px; letter-spacing: 1px; }
.login-card .brand { align-self: center; }

/* ---------- Erkennungsarten ---------- */
.kind { display: inline-flex; align-items: center; gap: 3px; font-size: 10.5px; font-weight: 650; padding: 1px 6px 1px 4px; border-radius: 6px;
  color: #0a0e16; background: var(--kc); vertical-align: middle; white-space: nowrap; line-height: 16px; }
.kind svg.i { width: 12px; height: 12px; stroke-width: 2.2; }
.k-person { --kc: #ff6b6b; } .k-vehicle { --kc: #ffc145; } .k-animal { --kc: #3ddc97; } .k-motion { --kc: #b08cff; } .k-manual { --kc: #9aa6bd; }
.tl-ev.k-person, .tl-ev.k-vehicle, .tl-ev.k-animal, .tl-ev.k-motion, .tl-ev.k-manual { background: var(--kc); }
.tl-ev.novideo { opacity: .55; }
.tl-legend { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.tl-legend .lg-cov i { display: inline-block; width: 12px; height: 8px; border-radius: 2px; margin-right: 5px; vertical-align: middle; background: rgba(91,140,255,.45); }
.tl-legend .lg { display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--line); background: none; color: var(--text); border-radius: 7px;
  padding: 1px 7px 1px 5px; font-size: 11px; }
.tl-legend .lg svg.i { width: 12px; height: 12px; color: var(--kc); stroke-width: 2.2; }
.tl-legend .lg.off { opacity: .35; text-decoration: line-through; }
.ev-meta b .kind { margin-left: 4px; }
.ev-card .kinds { position: absolute; left: 7px; top: 7px; display: flex; gap: 4px; flex-wrap: wrap; }
.stage-title .det { display: inline-flex; gap: 4px; }
.tile .det { display: inline-flex; gap: 3px; margin-left: 2px; }
.tile .det .kind { padding: 1px 3px; }
.tile .tile-label .badge.rec { margin-left: auto; font-size: 9.5px; padding: 2px 5px; }
.src-status { color: var(--text); background: var(--bg2); border-radius: 9px; padding: 8px 10px; }

/* ---------- Kacheln anordnen / ausblenden ---------- */
.cam-tiles { display: flex; flex-direction: column; gap: 10px; }
.cam-list-head .btn.small { padding: 3px 8px; font-size: 11.5px; text-transform: none; letter-spacing: 0; }
.mlive-head { align-items: center; gap: 8px; }
.mlive-head .mlive-count { margin-left: auto; }
.mlive-edit { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.tile-eye, .tile-grip { display: none; }
.editing .tile { touch-action: none; cursor: grab; animation: wiggle .35s ease-in-out infinite alternate; }
.editing .tile:nth-child(even) { animation-delay: .17s; }
@keyframes wiggle { from { transform: rotate(-.6deg); } to { transform: rotate(.6deg); } }
.editing .tile .tile-eye { display: grid; place-items: center; position: absolute; top: 6px; right: 6px; width: 34px; height: 34px; border-radius: 10px;
  border: 0; background: rgba(0,0,0,.65); color: #fff; z-index: 3; }
.editing .tile .tile-grip { display: grid; place-items: center; position: absolute; top: 6px; left: 6px; width: 28px; height: 28px; border-radius: 8px;
  background: rgba(0,0,0,.55); color: #fff; z-index: 3; pointer-events: none; }
.editing .tile.is-hidden img { opacity: .25; filter: grayscale(1); }
.editing .tile.is-hidden .tile-label { opacity: .5; text-decoration: line-through; }
.editing .tile.dragging { animation: none; transform: scale(1.04); box-shadow: 0 12px 30px rgba(0,0,0,.6); border-color: var(--accent); z-index: 5; opacity: .9; }
.cam-tiles.editing .tile.active { border-color: transparent; box-shadow: none; }

/* Live: Marke am rechten Rand, Schild links daneben */
.tl-playhead.is-live span { transform: translateX(calc(-100% + 2px)); border-radius: 6px 0 6px 6px; }

/* ================= Kameraansicht: frei anordnbare Kacheln ================= */
.detail { display: flex; flex-direction: column; grid-template-areas: none; }
.detail .stage-wrap, .detail .tl-host { grid-area: auto; }
.dlayout { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 14px; }
.dlayout.one-col { grid-template-columns: minmax(0, 1fr); }
.dlayout.one-col .dside { display: none; }
.dcol { display: flex; flex-direction: column; gap: 14px; min-height: 0; min-width: 0; overflow-y: auto; }
.panel { min-width: 0; display: flex; flex-direction: column; flex: none; }
.panel.is-off { display: none; }
.panel[data-panel=stage] { flex: 1 1 auto; min-height: 280px; }
.panel[data-panel=stage] .stage-wrap { flex: 1; min-height: 0; display: flex; }
.dside .panel[data-panel=stage] { flex: none; min-height: 0; }
.dside .panel[data-panel=stage] .stage-wrap { flex: none; aspect-ratio: 16 / 9; }
.dside .panel[data-panel=recordings] { flex: 1 1 0; min-height: 240px; }
.dmain .panel[data-panel=recordings] { flex: 0 0 auto; }
.dmain .panel[data-panel=recordings] .ev-list { max-height: 320px; }
.panel .rec-card { flex: 1; min-height: 0; }
.panel-bar, .dcol-empty { display: none; }
.layout-bar { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; background: rgba(91,140,255,.1);
  border: 1px solid rgba(91,140,255,.35); border-radius: 12px; padding: 8px 12px; }
.editing-panels .panel-bar { display: flex; align-items: center; gap: 8px; padding: 7px 10px; background: var(--panel2); border: 1px dashed var(--accent);
  border-bottom: 0; border-radius: 10px 10px 0 0; cursor: grab; touch-action: none; font-size: 12.5px; user-select: none; }
.editing-panels .panel-bar .grip { color: var(--accent); display: grid; }
.editing-panels .panel-bar .muted { margin-left: auto; font-size: 11px; }
.panel-eye { margin-left: auto; display: grid; place-items: center; width: 30px; height: 26px; border-radius: 7px; border: 1px solid var(--line2); background: var(--bg2); color: var(--text); }
.editing-panels .panel > :not(.panel-bar) { pointer-events: none; outline: 1px dashed rgba(91,140,255,.45); outline-offset: -1px; }
.editing-panels .panel.is-off { display: flex; opacity: .4; }
.editing-panels .panel.is-off .panel-bar b { text-decoration: line-through; }
.editing-panels .panel.dragging { opacity: .75; box-shadow: 0 14px 34px rgba(0,0,0,.55); }
.editing-panels .panel[data-panel=stage] { flex: 0 0 auto; }
.editing-panels .panel[data-panel=stage] .stage-wrap { flex: none; height: 220px; }
.editing-panels .dcol-empty { display: block; order: 99; border: 2px dashed var(--line2); border-radius: 12px; padding: 22px; text-align: center; color: var(--muted); font-size: 12.5px; }
@media (max-width: 820px), (max-height: 500px) and (pointer: coarse) {
  .dlayout { display: flex; flex-direction: column; gap: 10px; }
  .dcol { overflow: visible; gap: 10px; }
  .panel[data-panel=stage] { min-height: 0; flex: none; }
  .panel[data-panel=stage] .stage-wrap { flex: none; }
  .editing-panels .panel[data-panel=stage] .stage-wrap { height: auto; }
  .editing-panels .panel[data-panel=stage] .media { max-height: 140px; }
  .dmain .panel[data-panel=recordings] .ev-list { max-height: none; }
  .layout-bar { padding: 6px 10px; }
  .layout-bar .hint { font-size: 11px; }
}

/* Sprung-Tasten in der Zeitachse */
.tl-jump { display: inline-flex; margin-left: 4px; border: 1px solid var(--line2); border-radius: 8px; overflow: hidden; }
.tl-jump button { display: inline-flex; align-items: center; gap: 4px; border: 0; background: var(--panel2); color: var(--text); font-size: 11.5px; padding: 3px 9px; }
.tl-jump button + button { border-left: 1px solid var(--line2); }
.tl-jump button:hover { background: #1d2840; }
.tl-jump button:active { background: var(--accent); }
.tl-jump svg.i { width: 13px; height: 13px; }
@media (max-width: 820px), (max-height: 500px) and (pointer: coarse) {
  .tl-jump { margin-left: auto; }
  .tl-jump button { padding: 4px 10px; font-size: 11px; }
}

/* Versionsnummer rechts neben dem Schriftzug */
.brand-ver { font-size: 9.5px; font-weight: 600; color: var(--muted); margin-left: 5px; letter-spacing: .3px; vertical-align: super; }
.brand.big .brand-ver { font-size: 12px; margin-left: 6px; }

/* ================= Handy: Kamerafunktionen als Symbole in der Kopfzeile ================= */
@media (max-width: 820px), (max-height: 500px) and (pointer: coarse) {
  .detail-head { gap: 6px; }
  .detail-head h1 { flex: 1; min-width: 0; }
  .detail-head .actions { gap: 4px; margin-left: 0; flex: none; }
  .detail-head .actions .btn { width: 32px; height: 32px; padding: 0; justify-content: center; border-radius: 9px; }
  .detail-head .stage-actions.head-actions { position: static; display: flex; gap: 4px; }
  .head-actions .icon-btn { width: 32px; height: 32px; border-radius: 9px; background: var(--panel2); border: 1px solid var(--line2);
    backdrop-filter: none; color: var(--text); text-decoration: none; }
  .head-actions .icon-btn svg.i { width: 16px; height: 16px; }
  .head-actions .icon-btn small { display: none; }
  .head-actions .icon-btn.rec { color: var(--bad); }
  .head-actions .icon-btn.on { background: rgba(91,140,255,.18); border-color: rgba(91,140,255,.5); color: #cfdcff; }
  .detail-head [data-back] { width: 32px; height: 32px; padding: 0; justify-content: center; border-radius: 9px; }
}

/* ================= Handy: Ereignisse als Liste ================= */
.ev-rows { display: flex; flex-direction: column; gap: 6px; }
.ev-row { display: grid; grid-template-columns: 62px 104px minmax(0, 1fr) minmax(0, auto); gap: 10px; align-items: center;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 6px 10px 6px 8px; cursor: pointer; }
.ev-row:active { background: var(--panel2); }
.ev-when { display: flex; flex-direction: column; font-variant-numeric: tabular-nums; line-height: 1.2; }
.ev-when span { font-size: 11px; color: var(--muted); }
.ev-when b { font-size: 13px; }
.ev-thumb { position: relative; width: 104px; aspect-ratio: 16 / 9; border-radius: 7px; overflow: hidden; background: #000; }
.ev-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ev-thumb .dur { position: absolute; right: 3px; bottom: 3px; font-size: 9.5px; background: rgba(0,0,0,.7); padding: 0 4px; border-radius: 4px; }
.ev-kinds { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; min-width: 0; }
.ev-cam { font-size: 12.5px; font-weight: 600; text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 96px; }
@media (max-width: 820px), (max-height: 500px) and (pointer: coarse) {
  .page-head .filters:has([data-f]) { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  .page-head .filters [data-f] { min-width: 0; padding: 8px 6px; text-overflow: ellipsis; }
}

/* Ereignisliste am PC: großzügiger */
@media (min-width: 821px) {
  .ev-rows { max-width: 1100px; gap: 8px; }
  .ev-row { grid-template-columns: 110px 192px minmax(0, 1fr) minmax(140px, 260px); gap: 18px; padding: 8px 18px 8px 12px; }
  .ev-row:hover { border-color: var(--line2); background: var(--panel2); }
  .ev-when span { font-size: 12.5px; }
  .ev-when b { font-size: 16px; }
  .ev-thumb { width: 192px; border-radius: 9px; }
  .ev-thumb .dur { font-size: 11px; padding: 1px 5px; }
  .ev-kinds { flex-direction: row; flex-wrap: wrap; gap: 6px; }
  .ev-kinds .kind { font-size: 12px; padding: 3px 9px 3px 6px; }
  .ev-kinds .kind svg.i { width: 14px; height: 14px; }
  .ev-cam { font-size: 14px; max-width: none; }
}
@media (min-width: 821px) {
  .ev-row { grid-template-columns: 110px 150px minmax(0, 1fr) minmax(140px, 260px); padding: 6px 18px 6px 10px; }
  .ev-thumb { width: 150px; }
  .page:has(.ev-rows) .page-head { max-width: 1100px; }
}

/* ---------- Ereignisliste kompakt ---------- */
.ev-rows { gap: 3px; }
.ev-row { grid-template-columns: 56px 72px minmax(0, 1fr) minmax(0, auto); gap: 8px; padding: 3px 10px 3px 6px; border-radius: 8px; }
.ev-thumb { width: 72px; border-radius: 5px; }
.ev-thumb .dur { font-size: 8.5px; right: 2px; bottom: 2px; padding: 0 3px; }
.ev-when span { font-size: 10px; }
.ev-when b { font-size: 12px; }
.ev-kinds { gap: 2px; }
.ev-kinds .kind { font-size: 10px; padding: 0 5px 0 3px; line-height: 15px; }
.ev-kinds .kind svg.i { width: 11px; height: 11px; }
.ev-cam { font-size: 12px; }
@media (min-width: 821px) {
  .ev-rows { gap: 3px; }
  .ev-row { grid-template-columns: 150px 80px minmax(0, 1fr) minmax(120px, 240px); gap: 14px; padding: 3px 14px 3px 10px; }
  .ev-thumb { width: 80px; }
  .ev-when { flex-direction: row; align-items: baseline; gap: 8px; }
  .ev-when span { font-size: 12px; min-width: 60px; }
  .ev-when b { font-size: 13.5px; }
  .ev-kinds { flex-direction: row; gap: 5px; }
  .ev-kinds .kind { font-size: 11px; padding: 1px 7px 1px 5px; }
  .ev-kinds .kind svg.i { width: 12px; height: 12px; }
  .ev-cam { font-size: 13px; }
}
