:root {
  --bg: #0a0a0a;
  --bg-card: #141414;
  --primary: #dc143c;
  --text: #f5f5f5;
  --text-muted: #888;
  --border: #2a2a2a;
  --font: 'Outfit', system-ui, sans-serif;
}

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

body { font-family: var(--font); background: var(--bg); color: var(--text); min-height: 100vh; }

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

.login-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 16px;
  padding: 2.5rem; width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 1rem;
}

.login-card h1 { font-size: 1.5rem; }
.login-card .accent { color: var(--primary); }
.login-card .subtitle { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 0.5rem; }

.login-card input {
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
  padding: 0.75rem 1rem; color: var(--text); font-family: inherit;
}

.login-card button, .inline-form button, .upload-form button, .live-controls button {
  background: var(--primary); color: white; border: none; border-radius: 8px;
  padding: 0.75rem 1.5rem; font-family: inherit; font-weight: 600; cursor: pointer;
}

.login-card .error { color: #ff6b6b; font-size: 0.9rem; min-height: 1.2em; display: none; }

.dashboard { display: flex; min-height: 100vh; }

.sidebar {
  width: 220px; background: var(--bg-card); border-right: 1px solid var(--border);
  padding: 1.5rem 1rem; display: flex; flex-direction: column;
}

.sidebar h2 { font-size: 1.1rem; margin-bottom: 2rem; color: var(--primary); }

.sidebar nav { display: flex; flex-direction: column; gap: 0.25rem; flex: 1; }

.sidebar nav button {
  background: none; border: none; color: var(--text-muted); text-align: left;
  padding: 0.6rem 0.75rem; border-radius: 8px; cursor: pointer; font-family: inherit;
}

.sidebar nav button.active, .sidebar nav button:hover { background: var(--bg); color: var(--text); }

.logout {
  background: none; border: 1px solid var(--border); color: var(--text-muted);
  padding: 0.5rem; border-radius: 8px; cursor: pointer; font-family: inherit;
}

.content { flex: 1; padding: 2rem; overflow-y: auto; }
.content h1 { font-size: 1.5rem; margin-bottom: 1.5rem; }

.tab { display: none; }
.tab.active { display: block; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1rem; }

.stat-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px;
  padding: 1.5rem; text-align: center;
}

.stat-card span { display: block; font-size: 2rem; font-weight: 700; }
.stat-card label { color: var(--text-muted); font-size: 0.8rem; }
.stat-card.live span { color: var(--primary); font-size: 1.2rem; }

table { width: 100%; border-collapse: collapse; margin-top: 1rem; }
th, td { padding: 0.75rem; text-align: left; border-bottom: 1px solid var(--border); }
th { color: var(--text-muted); font-size: 0.8rem; text-transform: uppercase; }

.inline-form, .upload-form, .live-controls {
  display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1rem;
}

.upload-form-stack {
  flex-direction: column;
  align-items: stretch;
}

.upload-pick-btn {
  width: 100%;
  padding: 1rem 1.25rem;
  border-radius: 10px;
  border: 2px dashed var(--border);
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.upload-pick-btn:hover {
  border-color: var(--primary);
  background: rgba(220, 20, 60, 0.08);
}

.upload-form-stack #uploadBtn {
  width: 100%;
  padding: 0.85rem;
  font-size: 1rem;
  font-weight: 600;
}

.upload-form-stack #uploadBtn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}


.upload-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.upload-progress-wrap {
  margin: 0.5rem 0 1rem;
}

.upload-progress-wrap progress {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  accent-color: var(--primary);
}

.upload-progress-wrap p {
  margin-top: 0.35rem;
}

.inline-form input, .upload-form input, .live-controls input, select {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px;
  padding: 0.6rem 0.75rem; color: var(--text); font-family: inherit;
}

.btn-live-stop { background: #333 !important; }
.hint { color: var(--text-muted); font-size: 0.85rem; margin-top: 1rem; }

.btn-delete {
  background: none; border: 1px solid var(--primary); color: var(--primary);
  padding: 0.3rem 0.6rem; border-radius: 6px; cursor: pointer; font-size: 0.8rem;
}

.visual-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.visual-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.visual-card.active {
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary);
}

.visual-card video {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  background: #000;
  display: block;
}

.visual-meta {
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.visual-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.btn-activate, .btn-secondary {
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  padding: 0.35rem 0.7rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.8rem;
}

.btn-activate:hover, .btn-secondary:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.btn-secondary {
  margin-bottom: 1rem;
}

.hint {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin: 0.5rem 0 1rem;
}

.track-search {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  margin-bottom: 0.75rem;
}

.track-edit-input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.35rem 0.5rem;
  color: var(--text);
  font-family: inherit;
  font-size: 0.85rem;
}

.track-actions { display: flex; gap: 0.35rem; white-space: nowrap; }

.btn-save-track {
  background: none;
  border: 1px solid var(--primary);
  color: var(--primary);
  padding: 0.3rem 0.5rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.75rem;
}

@media (max-width: 768px) {
  .dashboard { flex-direction: column; }
  .sidebar { width: 100%; }
}
