:root {
  --bg: #0b0f17;
  --bg-elevated: #121826;
  --bg-card: #161d2e;
  --bg-hover: #1c2538;
  --border: rgba(255,255,255,0.08);
  --border-strong: rgba(255,255,255,0.14);
  --text: #e8edf7;
  --text-secondary: #9aa6bf;
  --muted: #6b7794;
  --primary: #5b8cff;
  --primary-hover: #7aa3ff;
  --primary-dim: rgba(91,140,255,0.15);
  --success: #34d399;
  --success-dim: rgba(52,211,153,0.15);
  --danger: #f87171;
  --danger-dim: rgba(248,113,113,0.15);
  --warning: #fbbf24;
  --warning-dim: rgba(251,191,36,0.15);
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 8px 32px rgba(0,0,0,0.4);
  --sidebar-w: 260px;
  --font: 'Inter', system-ui, -apple-system, sans-serif;
}

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

html, body {
  height: 100%;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--primary); }

.hidden { display: none !important; }

/* ---------- Screens ---------- */
.screen { min-height: 100vh; }

/* ---------- Auth ---------- */
#auth-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 1.5rem;
  overflow: hidden;
}

.auth-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 20% 10%, rgba(91,140,255,0.18), transparent),
    radial-gradient(ellipse 60% 50% at 80% 90%, rgba(52,211,153,0.1), transparent),
    var(--bg);
  z-index: 0;
}

.auth-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 2rem;
  box-shadow: var(--shadow);
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.75rem;
}

.logo-mark {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--primary), #8b5cf6);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: -0.02em;
  flex-shrink: 0;
}
.logo-mark.sm { width: 36px; height: 36px; font-size: 0.85rem; border-radius: 10px; }

.auth-brand h1 { font-size: 1.5rem; font-weight: 700; letter-spacing: -0.03em; }
.tagline { color: var(--muted); font-size: 0.85rem; margin-top: 0.15rem; }

.tabs {
  display: flex;
  gap: 0.25rem;
  background: var(--bg);
  padding: 4px;
  border-radius: var(--radius-sm);
  margin-bottom: 1.5rem;
}
.tab {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  padding: 0.55rem;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  font-size: 0.9rem;
  transition: all 0.15s;
}
.tab.active {
  background: var(--bg-card);
  color: var(--text);
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.auth-form label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 0.35rem;
  margin-top: 0.85rem;
}
.auth-form label:first-of-type { margin-top: 0; }

.auth-form input,
.auth-form select,
.content input,
.content select,
.content textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.85rem;
  outline: none;
  transition: border-color 0.15s;
}
.auth-form input:focus,
.content input:focus,
.content select:focus,
.content textarea:focus {
  border-color: var(--primary);
}

.hint { font-size: 0.8rem; color: var(--muted); margin-top: 1rem; text-align: center; }

.msg {
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  text-align: center;
}
.msg.error { background: var(--danger-dim); color: var(--danger); }
.msg.success { background: var(--success-dim); color: var(--success); }

/* ---------- Layout ---------- */
#main-screen {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-elevated);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 40;
  transition: transform 0.2s ease;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1.25rem 1.25rem 1rem;
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: -0.02em;
}

.sidebar-nav {
  flex: 1;
  padding: 0.5rem 0.75rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-nav button {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 500;
  font-size: 0.9rem;
  transition: all 0.12s;
}
.sidebar-nav button:hover { background: var(--bg-hover); color: var(--text); }
.sidebar-nav button.active {
  background: var(--primary-dim);
  color: var(--primary);
}

.nav-icon { font-size: 1.1rem; width: 1.4rem; text-align: center; opacity: 0.9; }

.sidebar-footer {
  padding: 1rem;
  border-top: 1px solid var(--border);
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, #5b8cff, #a78bfa);
  display: grid;
  place-items: center;
  font-weight: 600;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.user-meta { min-width: 0; }
.user-meta strong {
  display: block;
  font-size: 0.85rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.role-pill {
  display: inline-block;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  font-weight: 600;
}

.main-wrap {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-width: 0;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: rgba(11,15,23,0.8);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar h2 {
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  flex: 1;
}

#sidebar-toggle { display: none; }

.content {
  padding: 1.5rem;
  flex: 1;
  max-width: 1280px;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.55rem 1rem;
  font-weight: 500;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); }
.btn-success { background: var(--success); color: #0b0f17; }
.btn-success:hover:not(:disabled) { filter: brightness(1.08); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { filter: brightness(1.08); }
.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-ghost:hover:not(:disabled) { background: var(--bg-hover); color: var(--text); }
.btn-sm { padding: 0.35rem 0.7rem; font-size: 0.8rem; }
.btn-block { width: 100%; }
.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  font-size: 1.2rem;
}

/* ---------- Cards & stats ---------- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.15rem 1.25rem;
  transition: border-color 0.15s;
}
.stat-card:hover { border-color: var(--border-strong); }
.stat-card .value {
  font-size: 1.65rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.2;
}
.stat-card .label {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 0.25rem;
  font-weight: 500;
}
.stat-card.accent-primary .value { color: var(--primary); }
.stat-card.accent-success .value { color: var(--success); }
.stat-card.accent-danger .value { color: var(--danger); }
.stat-card.accent-warning .value { color: var(--warning); }

.panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.5rem;
}
.panel h3 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 1rem;
  letter-spacing: -0.01em;
}

.progress-wrap {
  margin-top: 0.75rem;
}
.progress-bar {
  height: 8px;
  background: var(--bg);
  border-radius: 99px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), #8b5cf6);
  border-radius: 99px;
  transition: width 0.4s ease;
}
.progress-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 0.4rem;
}

/* ---------- Tables ---------- */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
th, td {
  padding: 0.85rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
th {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  font-weight: 600;
  background: var(--bg-elevated);
  white-space: nowrap;
}
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--bg-hover); }

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  border-radius: 99px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: capitalize;
}
.badge-pending { background: var(--warning-dim); color: var(--warning); }
.badge-approved { background: var(--success-dim); color: var(--success); }
.badge-rejected { background: var(--danger-dim); color: var(--danger); }

.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--muted);
}
.empty-state .icon { font-size: 2.5rem; margin-bottom: 0.75rem; opacity: 0.5; }
.empty-state p { margin-top: 0.35rem; font-size: 0.9rem; }

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 1rem;
}
.toolbar input,
.toolbar select {
  max-width: 220px;
  background: var(--bg-card);
}

/* ---------- Upload zone ---------- */
.upload-zone {
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius);
  padding: 2.5rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: var(--bg-card);
  position: relative;
}
.upload-zone:hover,
.upload-zone.dragover {
  border-color: var(--primary);
  background: var(--primary-dim);
}
.upload-zone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}
.upload-zone .icon { font-size: 2.25rem; margin-bottom: 0.75rem; }
.upload-zone p { color: var(--text-secondary); }
.upload-zone .hint-sm { font-size: 0.8rem; color: var(--muted); margin-top: 0.4rem; }

.preview-box {
  margin-top: 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}
.preview-box video {
  width: 100%;
  max-height: 280px;
  border-radius: var(--radius-sm);
  background: #000;
  margin-bottom: 1rem;
}

.upload-progress {
  margin-top: 1rem;
}
.upload-progress .bar {
  height: 6px;
  background: var(--bg);
  border-radius: 99px;
  overflow: hidden;
}
.upload-progress .fill {
  height: 100%;
  width: 0%;
  background: var(--primary);
  transition: width 0.2s;
}

/* ---------- Modal ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal.hidden { display: none; }
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(4px);
}
.modal-panel {
  position: relative;
  width: 100%;
  max-width: 720px;
  max-height: 90vh;
  overflow: auto;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg-elevated);
  z-index: 1;
}
.modal-header h3 {
  font-size: 1rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-right: 1rem;
}
.modal-body { padding: 1.25rem; }
.modal-body video {
  width: 100%;
  max-height: 360px;
  border-radius: var(--radius-sm);
  background: #000;
  margin-bottom: 1rem;
}
.review-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1rem;
}
.review-actions textarea {
  min-height: 80px;
  resize: vertical;
}
.review-btns {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

/* ---------- Form rows ---------- */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}
.form-group label {
  display: block;
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 0.35rem;
  font-weight: 500;
}

.actions-cell {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.section-title {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 1rem;
  letter-spacing: -0.02em;
}

.muted { color: var(--muted); font-size: 0.85rem; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 200;
  padding: 0.85rem 1.25rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  box-shadow: var(--shadow);
  animation: slideIn 0.25s ease;
  max-width: 360px;
}
.toast.success { background: #064e3b; color: var(--success); border: 1px solid rgba(52,211,153,0.3); }
.toast.error { background: #450a0a; color: var(--danger); border: 1px solid rgba(248,113,113,0.3); }
.toast.info { background: #1e3a5f; color: var(--primary); border: 1px solid rgba(91,140,255,0.3); }

@keyframes slideIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- Loading ---------- */
.spinner {
  width: 28px;
  height: 28px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: 2rem auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 3rem;
  color: var(--muted);
  gap: 0.75rem;
}

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open { transform: translateX(0); }
  .main-wrap { margin-left: 0; }
  #sidebar-toggle { display: inline-flex; }
  .form-row { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .content { padding: 1rem; }
  .auth-card { padding: 1.5rem; }
}
