/* Theme tokens. Dark first; light follows the system unless Account sets html[data-theme]. */
:root {
  --bg: #0b0d0e; --panel: #141719; --panel2: #1b1f22; --field: #101315; --line: #262b2f; --line2: #333a3f;
  --text: #eceff0; --muted: #8a9499; --accent: #5dcaa5; --accent-ink: #04140f; --accent-soft: rgba(93,202,165,.14);
  --danger: #ef5b5b; --ok: #3fcf8e; --warn: #f2a93b; --chip-red: #ef5b5b; --chip-amber: #f2a93b; --chip-green: #3fcf8e;
  --shadow: 0 10px 30px rgba(0,0,0,.45); --pill: rgba(8,10,11,.62); --radius: 12px;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #f5f6f6; --panel: #ffffff; --panel2: #eef1f1; --field: #ffffff; --line: #e1e5e6; --line2: #cfd5d7;
  --text: #111516; --muted: #5d686c; --accent: #0f6e56; --accent-ink: #ffffff; --accent-soft: rgba(15,110,86,.1);
  --danger: #c93636; --ok: #1f8f5a; --warn: #b8740f; --chip-red: #d64545; --chip-amber: #c98314; --chip-green: #23935e;
  --shadow: 0 10px 30px rgba(17,21,22,.12);
  color-scheme: light;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f5f6f6; --panel: #ffffff; --panel2: #eef1f1; --field: #ffffff; --line: #e1e5e6; --line2: #cfd5d7;
    --text: #111516; --muted: #5d686c; --accent: #0f6e56; --accent-ink: #ffffff; --accent-soft: rgba(15,110,86,.1);
    --danger: #c93636; --ok: #1f8f5a; --warn: #b8740f; --chip-red: #d64545; --chip-amber: #c98314; --chip-green: #23935e;
    --shadow: 0 10px 30px rgba(17,21,22,.12);
    color-scheme: light;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: 14px/1.45 "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; font-variant-numeric: tabular-nums; letter-spacing: -.003em; -webkit-font-smoothing: antialiased; }
h1, h2, h3, b, strong { letter-spacing: -.012em; }
a { color: var(--accent); text-decoration: none; }
button, input, select { font: inherit; color: inherit; }
button, .btn { background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 7px 12px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; color: var(--text); transition: border-color .15s, background .15s; }
button:hover, .btn:hover { border-color: var(--line2); }
button:focus-visible, .btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
button.primary:hover { filter: brightness(1.06); }
button.danger { border-color: var(--danger); color: var(--danger); }
button:disabled { opacity: .5; cursor: default; }
input, select, textarea { background: var(--field); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; width: 100%; }
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
label { display: block; color: var(--muted); font-size: 12px; margin: 10px 0 4px; }
code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
pre { background: var(--field); border: 1px solid var(--line); border-radius: 8px; padding: 10px; white-space: pre-wrap; word-break: break-all; }
.muted { color: var(--muted); }
.hidden { display: none !important; }
.ico { width: 16px; height: 16px; flex: none; display: block; }

/* top bar */
header.top { display: flex; align-items: center; gap: 16px; padding: 10px 16px; background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
header.top .brand { font-weight: 700; letter-spacing: .3px; display: flex; align-items: center; gap: 8px; color: var(--text); }
header.top nav { display: flex; gap: 4px; flex: 1; overflow-x: auto; }
header.top nav a { color: var(--muted); padding: 6px 10px; border-radius: 8px; white-space: nowrap; }
header.top nav a.active, header.top nav a:hover { color: var(--text); background: var(--panel2); }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); display: inline-block; }
.status-dot.ok { background: var(--ok); } .status-dot.bad { background: var(--danger); }
#bell { position: relative; }
#bell .count { position: absolute; top: -6px; right: -6px; background: var(--accent); color: var(--accent-ink); font-size: 11px; font-weight: 600; border-radius: 9px; padding: 0 5px; min-width: 18px; text-align: center; }

main { padding: 16px; }
.page-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 14px; flex-wrap: wrap; }
.page-title h1 { font-size: 18px; margin: 0; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }

/* badges (all pages) */
.badge { font-size: 11px; padding: 2px 8px; border-radius: 99px; background: var(--panel2); border: 1px solid var(--line); white-space: nowrap; }
.badge.ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 45%, transparent); } .badge.bad { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, transparent); }
.badge.alert { color: #fff; background: var(--chip-red); border-color: transparent; }

/* Live */
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
.live-bar { display: flex; align-items: center; gap: 10px; margin: 0 0 12px; flex-wrap: wrap; }
.live-bar h1 { font-size: 18px; margin: 0; }
.live-bar .spacer { flex: 1; }
.seg-btns { display: inline-flex; padding: 2px; gap: 2px; background: var(--panel2); border: 1px solid var(--line); border-radius: 9px; }
.seg-btns button { border: 0; background: transparent; padding: 5px 10px; border-radius: 7px; color: var(--muted); font-size: 13px; }
.seg-btns button:hover { color: var(--text); }
.seg-btns button.on { background: var(--panel); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.25); font-weight: 600; }
.seg-btns button:disabled { opacity: .4; }
.pager { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; color: var(--muted); }
.pager button { padding: 5px 8px; }
.live-grid { --cols: 2; display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); gap: 0; background: #000; border-radius: var(--radius); overflow: hidden; width: 100%; max-width: calc((100vh - 150px) * 16 / 9); }
.live-grid.n1 { --cols: 1; } .live-grid.n9 { --cols: 3; }
.tile { position: relative; background: #000; aspect-ratio: 16/9; overflow: hidden; cursor: pointer; outline: none; }
.tile video { width: 100%; height: 100%; object-fit: contain; background: #000; display: block; }
.tile::after { content: ""; position: absolute; inset: 0; pointer-events: none; box-shadow: inset 0 0 0 0 transparent; transition: box-shadow .15s; }
.tile.sel::after { box-shadow: inset 0 0 0 1.5px var(--accent); }
.tile:focus-visible::after { box-shadow: inset 0 0 0 2px var(--accent); }
.tile.empty-slot { cursor: default; background: #050607; display: grid; place-items: center; }
.tile.empty-slot a { color: rgba(255,255,255,.45); font-size: 13px; }
.tile .ov { position: absolute; inset: 8px; pointer-events: none; display: flex; flex-direction: column; justify-content: space-between; }
.tile .row { display: flex; justify-content: space-between; align-items: flex-start; gap: 6px; min-width: 0; }
.pill { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; min-width: 0; padding: 3px 9px; border-radius: 99px; background: var(--pill); color: #f1f4f4; font-size: 12px; line-height: 16px; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); white-space: nowrap; }
.pill .nm { overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.n9 .pill { font-size: 11px; padding: 2px 7px; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: #7d878b; flex: none; }
.dot.live { background: #5dcaa5; box-shadow: 0 0 0 3px rgba(93,202,165,.22); }
.dot.red { background: var(--chip-red); } .dot.amber { background: var(--chip-amber); } .dot.green { background: var(--chip-green); }
.tile .fav { pointer-events: auto; border: 0; padding: 4px; border-radius: 99px; background: var(--pill); color: #f1f4f4; opacity: 0; transition: opacity .15s; }
.tile:hover .fav, .tile .fav.on { opacity: 1; }
.tile .fav.on { color: #5dcaa5; }
.tile .open { pointer-events: auto; border: 0; padding: 4px; border-radius: 99px; background: var(--pill); color: #f1f4f4; opacity: 0; transition: opacity .15s; }
.tile:hover .open, .tile.sel .open { opacity: 1; }
.tile .acts { display: flex; gap: 4px; flex: none; }
.tile .msg { position: absolute; inset: 0; display: grid; place-items: center; color: rgba(255,255,255,.6); font-size: 13px; text-align: center; padding: 20px; }
.tile.flash { animation: flash 1.2s ease-out 2; }
@keyframes flash { 0% { box-shadow: inset 0 0 0 3px var(--accent); } 100% { box-shadow: inset 0 0 0 0 transparent; } }

.alerts { position: sticky; top: 70px; max-height: calc(100vh - 90px); display: flex; flex-direction: column; padding: 0; }
.alerts .head { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.alerts .list { overflow-y: auto; flex: 1; }
.alert-item { display: grid; grid-template-columns: 96px 1fr; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); cursor: pointer; }
.alert-item:hover { background: var(--panel2); }
.alert-item.unread { border-left: 3px solid var(--accent); padding-left: 11px; }
.alert-item img, .alert-item .noimg { width: 96px; height: 54px; object-fit: cover; border-radius: 6px; background: #000; display: grid; place-items: center; color: var(--muted); font-size: 18px; }
.alert-item .t { font-weight: 600; } .alert-item .s { color: var(--muted); font-size: 12px; }
.empty { padding: 30px 14px; text-align: center; color: var(--muted); }

/* toasts */
#toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 100; max-width: calc(100vw - 32px); }
.toast { background: var(--panel2); border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: 10px; padding: 10px 12px; min-width: 260px; box-shadow: var(--shadow); display: flex; gap: 10px; align-items: center; animation: slidein .2s ease-out; cursor: pointer; }
.toast img { width: 64px; height: 36px; object-fit: cover; border-radius: 4px; }
.toast.info { border-left-color: var(--accent); }
@keyframes slidein { from { transform: translateY(10px); opacity: 0; } }
.banner { background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; margin-bottom: 14px; display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }

/* tables / history */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-weight: 500; font-size: 12px; }
td img.thumb { width: 120px; height: 68px; object-fit: cover; border-radius: 6px; cursor: zoom-in; background: #000; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; margin-bottom: 14px; }
.filters > div { min-width: 160px; }
.filters label { margin-top: 0; }

.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.88); display: grid; place-items: center; z-index: 200; padding: 20px; cursor: zoom-out; }
.lightbox img { max-width: 100%; max-height: 85vh; border-radius: 8px; }
.lightbox > div { max-width: min(1100px, 100%); }
.enrol { display: flex; gap: 12px; align-items: flex-start; flex-wrap: wrap; margin-top: 12px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; cursor: default; }
.enrol img { width: 96px; height: 96px; object-fit: cover; border-radius: 8px; max-height: none; }
.counts-table td, .counts-table th { text-align: right; } .counts-table td:first-child, .counts-table th:first-child { text-align: left; }
.bars { display: flex; align-items: flex-end; gap: 2px; height: 90px; margin-top: 10px; }
.bars .h { flex: 1; display: flex; flex-direction: column-reverse; gap: 1px; min-width: 0; position: relative; height: 100%; justify-content: flex-start; }
.bars .h i { display: block; border-radius: 2px 2px 0 0; }
.bars .h i.in { background: var(--accent); } .bars .h i.out { background: var(--warn); }
.bars-axis { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-top: 4px; }
.legend { display: flex; gap: 12px; font-size: 12px; color: var(--muted); } .legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 4px; vertical-align: -1px; }
.people { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.photos { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0; }
.photos figure { margin: 0; position: relative; }
.photos img { width: 64px; height: 64px; object-fit: cover; border-radius: 6px; display: block; }
.photos button { position: absolute; top: -6px; right: -6px; padding: 0 5px; font-size: 11px; border-radius: 99px; line-height: 16px; }
.lightbox .cap { color: var(--muted); margin-top: 10px; text-align: center; }

/* forms */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.cam-list { display: grid; gap: 10px; }
.cam-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg label { margin: 0; padding: 7px 12px; cursor: pointer; color: var(--text); font-size: 14px; }
.seg input { display: none; }
.seg input:checked + span { color: var(--accent); font-weight: 600; }

/* zone editor */
.zone-wrap { position: relative; display: inline-block; max-width: 100%; user-select: none; }
.zone-wrap img { display: block; max-width: 100%; max-height: 70vh; border-radius: 8px; }
.zone-wrap svg { position: absolute; inset: 0; width: 100%; height: 100%; cursor: crosshair; }
.zone-layout { display: grid; grid-template-columns: 1fr 360px; gap: 16px; align-items: start; }
.zone-item { display: flex; gap: 6px; align-items: center; padding: 6px 0; }
.zone-item input, .zone-item select { min-width: 0; padding: 6px 8px; }
.zone-item button { padding: 6px 9px; flex: none; }
.zone-item .sw { width: 14px; height: 14px; border-radius: 3px; flex: none; }

/* login */
.login { min-height: 100%; display: grid; place-items: center; padding: 20px; }
.login form { width: 100%; max-width: 360px; }
.login h1 { margin: 0 0 4px; font-size: 22px; display: flex; gap: 10px; align-items: center; }
.error { color: var(--danger); margin-top: 10px; }

@media (max-width: 900px) {
  .layout, .zone-layout { grid-template-columns: 1fr; }
  .alerts { position: static; max-height: 60vh; }
  .grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  main { padding: 10px; }
  .hide-sm { display: none; }
  td img.thumb { width: 84px; height: 48px; }
}
@media (max-width: 600px) {
  header.top { flex-wrap: wrap; gap: 8px 10px; padding: 8px 10px; }
  header.top .brand { flex: 1; }
  header.top nav { order: 3; flex-basis: 100%; }
  header.top nav a { flex: 1; text-align: center; }
}
.bar { height: 6px; background: var(--panel2); border-radius: 99px; overflow: hidden; margin-bottom: 4px; }
.bar i { display: block; height: 100%; background: var(--accent); transition: width .5s; }

.role-viewer .owner-only { display: none !important; }
.viewer { position: fixed; inset: 0; background: rgba(0,0,0,.88); z-index: 200; display: grid; place-items: center; padding: 16px; }
.viewer .panel { width: min(1100px, 100%); max-height: 100%; overflow: auto; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.viewer .vhead { display: flex; gap: 6px; align-items: center; margin-bottom: 8px; }
.viewer .vimg { background: #000; border-radius: 8px; display: grid; place-items: center; min-height: 200px; }
.viewer .vimg img { max-width: 100%; max-height: 68vh; display: block; }
.viewer .vmeta { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; margin-top: 10px; }
.viewer .vtitle { font-weight: 600; font-size: 16px; }
.viewer .enrol { margin-top: 12px; }
.who-row { display: flex; gap: 6px; align-items: center; margin: -2px 0 4px 20px; font-size: 12px; }
.who-row select { width: auto; padding: 4px 6px; font-size: 12px; }
.who-people { display: flex; flex-wrap: wrap; gap: 4px 10px; margin: 0 0 6px 20px; font-size: 12px; }
.who-people label, .who-unseen { display: inline-flex; gap: 4px; align-items: center; color: var(--text); margin: 0; font-size: 12px; }
.who-unseen { margin: 0 0 6px 20px; }
.who-people input, .who-unseen input { width: auto; }
.x-box { margin: 0 0 8px 20px; font-size: 12px; }
.x-box summary { cursor: pointer; color: var(--muted); }
.x-row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin: 4px 0; }
.x-row label { display: inline-flex; gap: 4px; align-items: center; color: var(--text); margin: 0; font-size: 12px; }
.x-row input[type=time], .x-row input[type=number] { width: auto; max-width: 92px; padding: 3px 6px; font-size: 12px; }
.x-row input[type=checkbox] { width: auto; }
.x-row.days label { gap: 2px; }
.chk { display: flex; gap: 8px; align-items: center; color: var(--text); margin: 4px 0; flex-wrap: wrap; }
.chk input[type=checkbox] { width: auto; }
.chk input[type=time] { width: auto; padding: 3px 6px; }
.quick { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; margin-top: 4px; font-size: 12px; }
.quick button { padding: 2px 8px; font-size: 12px; border-radius: 99px; }

/* event chips: the only place red, amber and green appear */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; font-size: 12px; border-radius: 99px; }
.chip.on { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.tone { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 600; padding: 1px 8px 1px 6px; border-radius: 99px; }
.tone.red { color: var(--chip-red); background: color-mix(in srgb, var(--chip-red) 14%, transparent); }
.tone.amber { color: var(--chip-amber); background: color-mix(in srgb, var(--chip-amber) 14%, transparent); }
.tone.green { color: var(--chip-green); background: color-mix(in srgb, var(--chip-green) 14%, transparent); }
.tone::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* Camera page */
.cam-head { display: flex; align-items: center; gap: 10px; margin: 0 0 12px; flex-wrap: wrap; }
.cam-head h1 { font-size: 18px; margin: 0; }
.cam-head .back { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 8px; color: var(--muted); border: 1px solid var(--line); background: var(--panel); }
.cam-head .back:hover { color: var(--text); }
.cam-head .spacer { flex: 1; }
.cam-head select { width: auto; }
.state { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.cam-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.player { position: relative; background: #000; border-radius: var(--radius); overflow: hidden; aspect-ratio: 16/9; user-select: none; -webkit-user-select: none; touch-action: none; }
.player .stage { position: absolute; inset: 0; transform-origin: 0 0; will-change: transform; }
.player video { width: 100%; height: 100%; object-fit: contain; display: block; background: #000; }
.player.zoomed { cursor: grab; } .player.panning { cursor: grabbing; }
.player .msg { position: absolute; inset: 0; display: grid; place-items: center; color: rgba(255,255,255,.75); text-align: center; padding: 20px; background: rgba(0,0,0,.45); }
.player:fullscreen { border-radius: 0; aspect-ratio: auto; }
.player .float { position: absolute; display: flex; gap: 6px; align-items: center; transition: opacity .25s; z-index: 3; }
.player .tl { top: 12px; left: 12px; } .player .tr { top: 12px; right: 12px; }
.player .bc { bottom: 14px; left: 50%; transform: translateX(-50%); }
.player.idle .float.hide-idle { opacity: 0; pointer-events: none; }
.player.idle { cursor: none; }
.glass { display: inline-flex; align-items: center; gap: 2px; padding: 3px; border-radius: 12px; background: var(--pill); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); color: #f1f4f4; }
.glass button, .glass a { border: 0; background: transparent; color: #f1f4f4; padding: 7px 10px; border-radius: 9px; font-size: 13px; display: inline-flex; align-items: center; gap: 6px; }
.glass button:hover, .glass a:hover { background: rgba(255,255,255,.12); }
.glass button.on { background: rgba(255,255,255,.16); color: #fff; font-weight: 600; }
.glass button.teal { color: #5dcaa5; }
.glass .sep { width: 1px; align-self: stretch; margin: 5px 2px; background: rgba(255,255,255,.18); }
.glass .lbl { padding: 0 8px; font-size: 12px; color: rgba(255,255,255,.8); }
.zoomlvl { font-size: 12px; min-width: 36px; }

.timeline { margin-top: 12px; padding: 12px 14px 10px; }
.tl-head { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.tl-head .daypick { display: inline-flex; align-items: center; gap: 4px; }
.tl-head .daypick button { padding: 6px 8px; }
.tl-head input[type=date] { width: auto; padding: 6px 8px; }
.tl-head .legend { margin-left: auto; align-items: center; }
.legend .sw { display: inline-block; width: 12px; height: 8px; border-radius: 2px; margin-right: 5px; vertical-align: 0; }
.track { position: relative; height: 46px; border-radius: 8px; background: var(--panel2); cursor: pointer; overflow: hidden; touch-action: none; }
.track .hr { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--line); }
.track .mo { position: absolute; top: 0; bottom: 0; min-width: 2px; background: color-mix(in srgb, var(--accent) 34%, transparent); }
.track .cl { position: absolute; bottom: 0; height: 3px; min-width: 2px; background: color-mix(in srgb, var(--accent) 70%, transparent); }
.track .tk { position: absolute; top: 9px; height: 20px; width: 2px; margin-left: -1px; border-radius: 1px; }
.track .tk.red { background: var(--chip-red); } .track .tk.amber { background: var(--chip-amber); } .track .tk.green { background: var(--chip-green); }
.track .tk.dim { opacity: .45; }
.track .now { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: var(--text); opacity: .55; }
.track .head { position: absolute; top: -2px; bottom: -2px; width: 2px; margin-left: -1px; background: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 25%, transparent); }
.track .cur { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--text); pointer-events: none; }
.tl-tip { position: absolute; top: -26px; transform: translateX(-50%); padding: 2px 7px; border-radius: 6px; background: var(--text); color: var(--bg); font-size: 11px; font-weight: 600; pointer-events: none; white-space: nowrap; }
.tl-wrap { position: relative; }
.tl-axis { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-top: 6px; }

.moments { padding: 0; display: flex; flex-direction: column; max-height: calc(100vh - 120px); position: sticky; top: 70px; }
.moments .head { display: flex; justify-content: space-between; align-items: baseline; padding: 14px 14px 8px; }
.moments .chips { display: flex; gap: 4px; flex-wrap: wrap; padding: 0 14px 10px; border-bottom: 1px solid var(--line); }
.moments .list { overflow-y: auto; }
.mom { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); cursor: pointer; align-items: center; }
.mom:hover { background: var(--panel2); }
.mom img, .mom .noimg { width: 112px; height: 63px; object-fit: cover; border-radius: 7px; background: #000; display: block; }
.mom .t { font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mom .s { color: var(--muted); font-size: 12px; display: flex; gap: 8px; align-items: center; margin-top: 3px; }
.mom.unread .t::after { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); margin-left: 6px; vertical-align: 2px; }
.mom.sel { background: var(--accent-soft); }

@media (max-width: 900px) {
  .cam-layout { grid-template-columns: 1fr; }
  .moments { max-height: none; position: static; }
  .live-grid { max-width: none; }
  .tl-head .legend { display: none; }
  .glass .txt { display: none; }
}
