*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: system-ui, -apple-system, sans-serif;
  background: #0f0f0f;
  color: #e0e0e0;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }

/* ── Nav ──────────────────────────────────────── */
.nav {
  background: #111;
  border-bottom: 1px solid #1e1e1e;
  padding: 0 16px;
}

.nav-inner {
  max-width: 860px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 48px;
}

.nav-brand {
  font-size: 0.95rem;
  font-weight: 600;
  color: #e0e0e0;
  letter-spacing: 0.02em;
}

.nav-links {
  display: flex;
  gap: 4px;
}

.nav-links a {
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.84rem;
  color: #888;
  transition: color 0.15s, background 0.15s;
}

.nav-links a:hover  { color: #ddd; background: #1a1a1a; }
.nav-links a.active { color: #e0e0e0; background: #1e1e1e; }

/* ── Container ────────────────────────────────── */
.container {
  max-width: 860px;
  margin: 0 auto;
  padding: 28px 16px;
}

h1 { font-size: 1.3rem; font-weight: 600; margin-bottom: 28px; letter-spacing: 0.01em; }
h2 { font-size: 0.8rem; font-weight: 500; color: #555; text-transform: uppercase;
     letter-spacing: 0.08em; margin-bottom: 14px; }

/* ── Flash messages ───────────────────────────── */
.flash {
  padding: 10px 14px;
  border-radius: 7px;
  font-size: 0.87rem;
  margin-bottom: 20px;
}

.flash-error { background: #2a1111; border: 1px solid #4a1c1c; color: #f87171; }
.flash-info  { background: #0f1e2a; border: 1px solid #1a3a4a; color: #60a5fa; }

/* ── Stream ───────────────────────────────────── */
.stream-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
}

.pill {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: #555;
}

.dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #333;
  transition: background 0.3s, box-shadow 0.3s;
}

.dot.live {
  background: #22c55e;
  box-shadow: 0 0 7px #22c55e88;
}

button {
  background: #1c1c1c;
  color: #d0d0d0;
  border: 1px solid #2e2e2e;
  padding: 8px 18px;
  border-radius: 7px;
  cursor: pointer;
  font-size: 0.88rem;
  transition: background 0.15s, border-color 0.15s;
  white-space: nowrap;
}

button:hover  { background: #252525; }
button:disabled { opacity: 0.45; cursor: default; }
button.active { border-color: #22c55e88; color: #22c55e; }

#video {
  width: 100%;
  aspect-ratio: 4/3;
  border-radius: 10px;
  background: #000;
  display: none;
  margin-bottom: 36px;
}

#video.visible { display: block; }

/* ── Mini events (dashboard) ──────────────────── */
.events-mini { margin-top: 32px; }

.event-mini-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: #161616;
  border: 1px solid #222;
  border-radius: 8px;
  padding: 11px 14px;
  margin-bottom: 7px;
  font-size: 0.87rem;
}

.event-mini-item .event-time { color: #999; font-variant-numeric: tabular-nums; }

/* ── Events table ─────────────────────────────── */
.events-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.87rem;
}

.events-table th {
  text-align: left;
  font-size: 0.75rem;
  font-weight: 500;
  color: #555;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  padding: 0 12px 10px 0;
  border-bottom: 1px solid #1e1e1e;
}

.events-table td {
  padding: 11px 12px 11px 0;
  border-bottom: 1px solid #181818;
  vertical-align: middle;
  font-variant-numeric: tabular-nums;
}

.events-table tr:last-child td { border-bottom: none; }

/* ── Badge ────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 500;
}

.badge-pir    { background: #1a2a1a; color: #4ade80; border: 1px solid #2a4a2a; }
.badge-manual { background: #1a1a2a; color: #818cf8; border: 1px solid #2a2a4a; }

/* ── Recordings list ──────────────────────────── */
.rec-list { display: flex; flex-direction: column; gap: 8px; }

.rec-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: #161616;
  border: 1px solid #222;
  border-radius: 8px;
  padding: 13px 16px;
}

.rec-time {
  font-size: 0.88rem;
  font-variant-numeric: tabular-nums;
}

.rec-meta { font-size: 0.78rem; color: var(--text-dim); margin-left: auto; white-space: nowrap; }
.rec-actions { display: flex; gap: 8px; flex-shrink: 0; }

.rec-actions a {
  background: #1c1c1c;
  color: #c0c0c0;
  border: 1px solid #2e2e2e;
  padding: 6px 13px;
  border-radius: 6px;
  font-size: 0.82rem;
  transition: background 0.15s;
  cursor: pointer;
}

.rec-actions a:hover { background: #252525; }

/* Inline video player */
.rec-video-wrap {
  display: none;
  margin-top: 10px;
}

.rec-video-wrap.open { display: block; }

.rec-video-wrap video {
  width: 100%;
  border-radius: 7px;
  background: #000;
  max-height: 360px;
}

.rec-item-inner {
  width: 100%;
}

/* ── Pagination ───────────────────────────────── */
.pagination {
  display: flex;
  gap: 8px;
  margin-top: 24px;
  align-items: center;
}

.pagination a {
  background: #1c1c1c;
  border: 1px solid #2e2e2e;
  padding: 7px 16px;
  border-radius: 7px;
  font-size: 0.85rem;
  color: #c0c0c0;
  transition: background 0.15s;
}

.pagination a:hover { background: #252525; }
.pagination .page-info { font-size: 0.82rem; color: #555; }

/* ── Login ────────────────────────────────────── */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: #0f0f0f;
}

.login-card {
  background: #161616;
  border: 1px solid #222;
  border-radius: 12px;
  padding: 36px 32px;
  width: 100%;
  max-width: 360px;
}

.login-card h1 {
  font-size: 1.2rem;
  margin-bottom: 28px;
  text-align: center;
}

.form-group { margin-bottom: 16px; }

.form-group label {
  display: block;
  font-size: 0.82rem;
  color: #888;
  margin-bottom: 6px;
}

.form-group input {
  width: 100%;
  background: #1c1c1c;
  border: 1px solid #2e2e2e;
  border-radius: 7px;
  padding: 10px 12px;
  color: #e0e0e0;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.15s;
}

.form-group input:focus { border-color: #444; }

.btn-primary {
  width: 100%;
  background: #1e3a1e;
  border: 1px solid #2d5a2d;
  color: #4ade80;
  padding: 10px;
  border-radius: 7px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  margin-top: 8px;
  transition: background 0.15s;
}

.btn-primary:hover { background: #254a25; }

/* ── Misc ─────────────────────────────────────── */
.empty { color: #444; font-size: 0.88rem; padding: 12px 0; }

/* ── Mobile ───────────────────────────────────── */
@media (max-width: 480px) {
  .rec-item    { flex-direction: column; align-items: flex-start; }
  .rec-actions { width: 100%; }
  .rec-actions a { flex: 1; text-align: center; }

  .events-table th:nth-child(3),
  .events-table td:nth-child(3) { display: none; }

  .nav-links a { padding: 6px 8px; font-size: 0.8rem; }
}
