:root {
  --bg: #0f1115;
  --card: #171a21;
  --card-2: #1e222b;
  --line: #2a2f3a;
  --text: #e7e9ee;
  --muted: #8b93a7;
  --accent: #9146ff;
  --accent-dim: #7a35e0;
  --danger: #ff5c5c;
  --live: #ff4d4d;
  --ok: #48c78e;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 -apple-system, "Segoe UI", Roboto, Ubuntu, sans-serif;
}

.hidden { display: none !important; }
.muted { color: var(--muted); font-weight: 400; font-size: 12px; }
.error { color: var(--danger); min-height: 18px; font-size: 13px; }
.hint { color: var(--muted); font-size: 13px; min-height: 18px; }

.screen { min-height: 100vh; }
.center { display: flex; align-items: center; justify-content: center; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
}
.card.narrow { width: 340px; }
.card h1 { margin: 0 0 4px; font-size: 22px; }
.card h2 { margin: 0 0 4px; font-size: 17px; }
.card h3 { margin: 22px 0 8px; font-size: 14px; color: var(--muted); font-weight: 600; }

input, button, select, a.button {
  font: inherit;
  border-radius: 8px;
  border: 1px solid var(--line);
  padding: 8px 12px;
}
input {
  background: var(--card-2);
  color: var(--text);
  width: 100%;
  margin: 8px 0;
}
input:focus { outline: none; border-color: var(--accent); }
input[type="checkbox"] { width: auto; margin: 0 6px 0 0; }
input[type="date"] { width: auto; margin: 0 0 0 4px; }

button, a.button {
  background: var(--accent);
  color: #fff;
  border-color: transparent;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
button:hover, a.button:hover { background: var(--accent-dim); }
button.link {
  background: none;
  color: var(--muted);
  border: none;
  padding: 4px 6px;
}
button.link:hover { background: none; color: var(--text); text-decoration: underline; }
button.danger { background: none; color: var(--danger); border-color: var(--line); }
button.danger:hover { background: var(--danger); color: #fff; }

#login-form button[type="submit"] { width: 100%; margin-top: 8px; }

.topbar {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 12px 24px;
  border-bottom: 1px solid var(--line);
  background: var(--card);
  position: sticky;
  top: 0;
  z-index: 5;
  flex-wrap: wrap;
}
.brand { font-weight: 700; }
.tabs { display: flex; gap: 6px; }
.tab { background: none; color: var(--muted); border-color: transparent; }
.tab:hover { background: var(--card-2); color: var(--text); }
.tab.active { background: var(--card-2); color: var(--text); border-color: var(--line); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }

.badge {
  color: var(--live);
  border: 1px solid var(--live);
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 12px;
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse { 50% { opacity: .5; } }

main { padding: 24px; max-width: 1400px; margin: 0 auto; }

.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.row-inline { display: flex; align-items: center; gap: 8px; }
.row-inline.wrap { flex-wrap: wrap; }
.row-inline input { margin: 0; width: auto; min-width: 200px; }

.grid {
  width: 100%;
  border-collapse: collapse;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}
.grid th, .grid td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}
.grid th { background: var(--card-2); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.grid tr:last-child td { border-bottom: none; }
.grid tr.live td { background: rgba(255, 77, 77, .07); }

.mono { font-variant-numeric: tabular-nums; font-family: ui-monospace, "SF Mono", Menlo, monospace; }
.offset { font-weight: 600; }

.shots { display: flex; gap: 6px; }
.shot {
  width: 92px;
  height: 52px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--line);
  cursor: zoom-in;
  background: var(--card-2);
}
.shot.dup { opacity: .55; }
.shot-missing {
  width: 92px;
  height: 52px;
  border: 1px dashed var(--line);
  border-radius: 6px;
  color: var(--muted);
  font-size: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2px;
}
.shot-label { font-size: 10px; color: var(--muted); text-align: center; }

.note-input { margin: 0; min-width: 180px; }
.tag {
  display: inline-block;
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
}
.tag.offline { color: #ffb454; border-color: #6b4d20; }
.tag.open { color: var(--live); border-color: var(--live); }

.steps { margin: 8px 0 16px; padding-left: 20px; color: var(--muted); }
.steps li { margin-bottom: 6px; }
.steps b, .steps code { color: var(--text); }
code { background: var(--card-2); padding: 1px 6px; border-radius: 4px; font-size: 13px; }

.empty { padding: 40px; text-align: center; color: var(--muted); }

.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
  cursor: zoom-out;
}
.lightbox img { max-width: 92vw; max-height: 92vh; border-radius: 8px; }

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--card-2);
  border: 1px solid var(--line);
  padding: 10px 18px;
  border-radius: 8px;
  z-index: 30;
}
.toast.bad { border-color: var(--danger); color: var(--danger); }
