:root {
  --bg: #0d0f12;
  --panel: #161a20;
  --panel-2: #1e242c;
  --line: #2a323c;
  --text: #e8ecf1;
  --muted: #8d99a8;
  --accent: #4c9aff;
  --radius: 14px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
}

.pad { padding: 16px; }
.muted { color: var(--muted); }
.hidden { display: none !important; }

/* ---------- login ---------- */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  padding: 24px;
}

.login {
  width: 100%;
  max-width: 340px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px 22px;
  text-align: center;
}

.login .logo { font-size: 40px; }
.login h1 { font-size: 20px; margin: 8px 0 20px; font-weight: 600; }

.login input {
  width: 100%;
  padding: 13px 14px;
  margin-bottom: 12px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  font-size: 16px;
}
.login input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

.login button {
  width: 100%;
  padding: 13px;
  background: var(--accent);
  color: #fff;
  border: 0;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
}

.err { color: #ff6b6b; font-size: 14px; margin: 14px 0 0; }

/* ---------- chrome ---------- */
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: rgba(13, 15, 18, .92);
  backdrop-filter: blur(8px);
  z-index: 5;
}
.top h1 { font-size: 18px; margin: 0; font-weight: 600; }
.logout { color: var(--muted); text-decoration: none; font-size: 14px; }

.cams {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  overflow-x: auto;
}
.cams button {
  flex: 0 0 auto;
  padding: 9px 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  font-size: 15px;
  cursor: pointer;
}
.cams button.on { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }

/* video / photo switch */
.modes {
  display: flex;
  margin: 0 16px 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 4px;
  gap: 4px;
}
.modes button {
  flex: 1;
  padding: 10px 8px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}
.modes button.on { background: var(--panel-2); color: var(--text); }

/* ---------- stage ---------- */
.stage {
  padding: 0 16px 4px;
}
.stage video {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: 12px;
  display: block;
}

.stage-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 2px 0;
}
.stage-meta #stage-title { font-size: 16px; font-weight: 600; }
.stage-meta .muted { font-size: 13px; }
.stage-actions { display: flex; align-items: center; gap: 8px; }

.stage-note {
  margin: 8px 0 0;
  font-size: 14px;
  color: #f3d99b;
}

.quality { display: flex; gap: 6px; }
.quality button {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.quality button.on { background: var(--panel-2); color: var(--text); border-color: var(--accent); }

.btn {
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 7px 13px;
  border-radius: 9px;
  font-size: 14px;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}

/* ---------- days ---------- */
.days {
  display: flex;
  gap: 8px;
  padding: 14px 16px;
  overflow-x: auto;
  border-bottom: 1px solid var(--line);
}
.days button {
  flex: 0 0 auto;
  padding: 8px 13px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
  white-space: nowrap;
}
.days button.on { background: var(--panel-2); color: var(--text); border-color: var(--accent); }

/* ---------- lists ---------- */
.section-title {
  padding: 16px 16px 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}

.warn {
  margin: 14px 16px 0;
  padding: 11px 13px;
  border-radius: 10px;
  border: 1px solid #4a3b1c;
  background: #251d0d;
  color: #f3d99b;
  font-size: 14px;
}
.warn b { color: #ffd980; }

/* clip rows, Reolink style */
.rows { padding: 0 16px 28px; display: flex; flex-direction: column; gap: 8px; }

.row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 8px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.row.on { border-color: var(--accent); background: var(--panel-2); }
.row:active { transform: scale(.99); }

.row-thumb {
  position: relative;
  flex: 0 0 96px;
  width: 96px;
  aspect-ratio: 16 / 9;
  border-radius: 8px;
  overflow: hidden;
  background: #0a0c0f;
}
.row-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.row-play {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: rgba(255, 255, 255, .92);
  text-shadow: 0 2px 8px rgba(0, 0, 0, .7);
}

.row-meta { flex: 1; min-width: 0; }
.row-time { font-size: 17px; font-weight: 600; }
.row-sub { font-size: 12px; color: var(--muted); }

.row-badge {
  flex: 0 0 auto;
  background: rgba(220, 60, 60, .92);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
}

/* snapshot grid */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
  padding: 0 16px 28px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  text-align: left;
  padding: 0;
  color: inherit;
  font: inherit;
}
.card:active { transform: scale(.985); }

.thumb-wrap { position: relative; }
.thumb {
  aspect-ratio: 16 / 9;
  background: #0a0c0f;
  display: block;
  width: 100%;
  object-fit: cover;
}

.meta { padding: 8px 11px 10px; }
.meta .t { font-size: 15px; font-weight: 600; }

@media (min-width: 720px) {
  .stage, .rows, .grid, .days, .cams, .modes { max-width: 900px; margin-inline: auto; }
  .modes { margin-bottom: 14px; }
}
