:root {
  --bg: #111418; --panel: #1b2027; --line: #2a313b; --text: #e6e9ee; --muted: #8b95a3;
  --accent: #4aa3ff; --ok: #3ccf7a; --err: #ff6b6b; --radius: 10px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
main { padding: 16px; max-width: 1400px; margin: 0 auto; }
h1 { font-size: 1.3rem; margin: 0; }
h2 { font-size: 1.1rem; margin: 24px 0 8px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.inline { display: inline; }

.topbar { display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 10px 16px; background: var(--panel); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 10; }
.topbar nav { display: flex; gap: 16px; align-items: center; }
.brand { font-weight: 700; color: var(--text); }
.subnav { display: flex; gap: 16px; padding: 0 0 12px; border-bottom: 1px solid var(--line); margin-bottom: 16px; flex-wrap: wrap; }

button, .button { background: var(--accent); color: #fff; border: 0; border-radius: 8px;
  padding: 8px 14px; font: inherit; cursor: pointer; display: inline-block; }
button.link { background: none; color: var(--muted); padding: 0; }
button.danger { background: var(--err); }
input, select { background: var(--bg); color: var(--text); border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 10px; font: inherit; }
label { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
label.check { flex-direction: row; align-items: center; gap: 8px; }

.center { display: grid; place-items: center; min-height: 100vh; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.login { width: min(360px, 92vw); }
.login h1 { margin-bottom: 16px; }
.login button { width: 100%; }

.flash { padding: 8px 12px; border-radius: 8px; margin: 0 0 12px; }
.flash.ok { background: #183a28; color: var(--ok); }
.flash.err { background: #3d1c1c; color: var(--err); }

/* Live grid */
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr)); }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.tile-video, .player { display: block; background: #000; aspect-ratio: 16 / 9; }
.tile video, .player video { width: 100%; height: 100%; object-fit: contain; display: block; background: #000; }
.tile footer { display: flex; align-items: center; gap: 8px; padding: 8px 12px; }
.tile footer .small { margin-left: auto; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.dot.on { background: var(--ok); }
.dot.off { background: var(--err); }

.titlebar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.player { border-radius: var(--radius); overflow: hidden; }

/* Playback */
.daypicker { display: flex; gap: 8px; align-items: center; margin-bottom: 16px; }
.timeline { margin-bottom: 12px; }
.hours { display: grid; grid-template-columns: repeat(24, 1fr); font-size: .7rem; color: var(--muted); }
.bar { position: relative; height: 36px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 6px; cursor: pointer;
  background-image: repeating-linear-gradient(to right, transparent 0, transparent calc(100% / 24 - 1px), var(--line) calc(100% / 24 - 1px), var(--line) calc(100% / 24)); }
.bar .block { position: absolute; top: 4px; bottom: 4px; padding: 0; border-radius: 3px;
  background: #2e7dd1; min-width: 2px; }
.bar .block.active { background: var(--ok); }
.jump { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.jump label { flex-direction: row; align-items: center; margin: 0; gap: 8px; }
.clipinfo { display: flex; justify-content: space-between; align-items: center; gap: 12px; }

/* Admin */
table { width: 100%; border-collapse: collapse; background: var(--panel); border-radius: var(--radius); overflow: hidden; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-weight: 600; font-size: .85rem; }
.formrow { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.formrow label { margin-bottom: 0; }
.stack { max-width: 520px; }
.badge { font-size: .75rem; padding: 2px 8px; border-radius: 999px; background: var(--line); }
.badge.off { background: #3d1c1c; color: var(--err); }

@media (max-width: 600px) {
  main { padding: 10px; }
  .grid { gap: 8px; }
}

/* Privacy mode */
.privacy-box { display: flex; align-items: center; justify-content: center; text-align: center; background: #15181d; }
.privacy-notice { display: flex; flex-direction: column; gap: 6px; padding: 16px; align-items: center; }
.privacy-notice form { margin-top: 6px; }
.tile-actions { padding: 0 12px 10px; }
.privacy-off { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 8px 0; }
.privacy-off select { width: auto; }
button.secondary { background: transparent; color: var(--text); border: 1px solid var(--line); }
