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

:root {
  --bg: #0f0f0f;
  --surface: #1a1a1a;
  --surface2: #252525;
  --border: #333;
  --accent: #e63946;
  --accent-hover: #c1121f;
  --text: #e8e8e8;
  --text-muted: #888;
  --radius: 8px;
}

html.light {
  --bg: #f4f4f5;
  --surface: #ffffff;
  --surface2: #f0f0f1;
  --border: #d4d4d8;
  --text: #18181b;
  --text-muted: #71717a;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', system-ui, sans-serif;
  min-height: 100vh;
  transition: background 0.2s, color 0.2s;
}

/* THEME TOGGLE */
.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 5px 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  flex-shrink: 0;
}
.theme-toggle:hover { background: var(--surface2); color: var(--text); }
.theme-toggle .icon-moon { display: block; }
.theme-toggle .icon-sun  { display: none; }
html.light .theme-toggle .icon-moon { display: none; }
html.light .theme-toggle .icon-sun  { display: block; }

/* NAV */
nav {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 2rem;
  display: flex;
  align-items: center;
  gap: 2rem;
  height: 56px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
  font-weight: 700;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.nav-logo svg {
  color: var(--accent);
}

.nav-links {
  display: flex;
  gap: 0.25rem;
  align-items: center;
  flex: 1;
}

.nav-links a {
  color: var(--text-muted);
  text-decoration: none;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 0.9rem;
  transition: all 0.15s;
}

.nav-links a:hover, .nav-links a.active {
  color: var(--text);
  background: var(--surface2);
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-left: auto;
}

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

/* BUTTONS */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: all 0.15s;
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover { background: var(--accent-hover); }

.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-ghost:hover { background: var(--surface2); }

.btn-danger {
  background: transparent;
  color: #e63946;
  border: 1px solid #e63946;
}

.btn-danger:hover { background: #e6394620; }

.btn-sm { padding: 5px 10px; font-size: 0.8rem; }

/* MAIN LAYOUT */
main {
  max-width: 1300px;
  margin: 0 auto;
  padding: 2rem;
}

/* LOGIN PAGE */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1rem;
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2.5rem;
  width: 100%;
  max-width: 380px;
}

.login-card .logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 2rem;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text);
}

.login-card .logo svg { color: var(--accent); }

.login-card h2 {
  font-size: 1.25rem;
  margin-bottom: 0.4rem;
}

.login-card p {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin-bottom: 1.75rem;
}

/* FORMS */
.form-group {
  margin-bottom: 1.1rem;
}

label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--text-muted);
}

input[type="text"],
input[type="password"],
input[type="file"],
textarea,
select {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  color: var(--text);
  font-size: 0.9rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
}

input:focus, textarea:focus, select:focus {
  border-color: var(--accent);
}

textarea { resize: vertical; min-height: 80px; }

.error-msg {
  background: #e6394620;
  border: 1px solid #e6394650;
  color: #ff6b6b;
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 0.875rem;
  margin-top: 1rem;
  display: none;
}

.error-msg.show { display: block; }

/* PAGE HEADER */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2rem;
  gap: 1rem;
  flex-wrap: wrap;
}

.page-header h1 {
  font-size: 1.75rem;
  font-weight: 700;
}

/* VIDEO GRID */
.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.25rem;
}

.video-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  text-decoration: none;
  color: var(--text);
  transition: transform 0.15s, border-color 0.15s;
  display: block;
}

.video-card:hover {
  transform: translateY(-2px);
  border-color: #555;
}

.video-thumb {
  width: 100%;
  aspect-ratio: 16/9;
  background: var(--surface2);
  position: relative;
  overflow: hidden;
}

.video-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.video-thumb-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}

.play-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.3);
  opacity: 0;
  transition: opacity 0.15s;
}

.video-card:hover .play-overlay { opacity: 1; }

.video-card.pinned {
  border: 1.5px solid #f59e0b;
  box-shadow: 0 0 12px #f59e0b22, 0 2px 8px #f59e0b18;
}

.video-card.pinned .video-title { color: #fbbf24; }

.pin-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #1a0f00;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  gap: 4px;
  letter-spacing: 0.03em;
  box-shadow: 0 1px 4px rgba(0,0,0,0.4);
}

.play-overlay svg {
  width: 48px;
  height: 48px;
  color: #fff;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
}

.video-info {
  padding: 12px 14px;
}

.video-title {
  font-weight: 600;
  font-size: 0.95rem;
  line-height: 1.3;
  margin-bottom: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.video-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.video-meta .dot { color: var(--border); }

/* EMPTY STATE */
.empty-state {
  grid-column: 1/-1;
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-muted);
}

.empty-state svg { margin-bottom: 1rem; opacity: 0.3; }
.empty-state h3 { font-size: 1.1rem; margin-bottom: 0.5rem; color: var(--text); }
.empty-state p { font-size: 0.9rem; margin-bottom: 1.5rem; }

/* WATCH PAGE */
.watch-layout {
  max-width: 960px;
  margin: 0 auto;
}

.video-player-wrap {
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
  aspect-ratio: 16/9;
  margin-bottom: 1.25rem;
}

.video-player-wrap video {
  width: 100%;
  height: 100%;
}

.video-details h1 {
  font-size: 1.4rem;
  margin-bottom: 0.5rem;
}

.video-details-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1rem;
}

.video-details-meta .left { color: var(--text-muted); font-size: 0.875rem; }
.video-details-meta .right { display: flex; gap: 0.5rem; }

.video-description {
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.6;
}

.video-description p  { margin: 0 0 0.6em; }
.video-description p:last-child { margin-bottom: 0; }
.video-description h1, .video-description h2, .video-description h3 {
  color: var(--text);
  margin: 0.75em 0 0.25em;
  font-size: 1rem;
}
.video-description a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.video-description a:hover { opacity: 0.8; }
.video-description strong { color: var(--text); font-weight: 600; }
.video-description em { font-style: italic; }
.video-description code {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
  font-family: monospace;
  font-size: 0.85em;
}
.video-description ul {
  padding-left: 1.25em;
  margin: 0.4em 0;
}
.video-description li { margin: 0.2em 0; }

/* AVATARS */
.avatar-letter {
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.nav-profile-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  background: none;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px 12px 3px 4px;
  cursor: pointer;
  color: var(--text);
  font-size: 0.875rem;
  transition: background 0.15s;
}

.nav-profile-btn:hover { background: var(--surface2); }

/* COMMENTS */
.comments-section {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.video-details.no-desc .video-details-meta {
  border-bottom: none;
  padding-bottom: 0;
  margin-bottom: 0;
}

.comments-heading {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 1.25rem;
}

.comment-form {
  margin-bottom: 1.75rem;
}

.comment-form textarea {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
  padding: 10px 12px;
  resize: none;
  min-height: 72px;
  transition: border-color 0.15s;
  outline: none;
}

.comment-form textarea:focus { border-color: var(--accent); }

.comment-form-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 0.5rem;
}

.comment {
  display: flex;
  gap: 12px;
  padding: 0.875rem 0;
  border-bottom: 1px solid var(--border);
}

.comment:last-child { border-bottom: none; }

.comment-avatar {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
}

.comment-body { flex: 1; min-width: 0; }

.comment-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.comment-author {
  font-weight: 600;
  font-size: 0.875rem;
}

.comment-time {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.comment-delete {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1rem;
  padding: 0 4px;
  border-radius: 4px;
  line-height: 1;
  opacity: 0;
  transition: opacity 0.15s, color 0.15s;
}

.comment:hover .comment-delete { opacity: 1; }
.comment-delete:hover { color: var(--accent); }

.comment-text {
  font-size: 0.9rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.no-comments {
  color: var(--text-muted);
  font-size: 0.9rem;
  padding: 1rem 0;
}

/* UPLOAD PAGE */
.upload-card {
  max-width: 640px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2rem;
}

.upload-card h2 { margin-bottom: 1.5rem; }

.file-drop {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 2.5rem 1rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s;
  margin-bottom: 1.25rem;
  color: var(--text-muted);
}

.file-drop:hover, .file-drop.dragover {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  color: var(--text);
}

.file-drop svg { margin-bottom: 0.75rem; }
.file-drop p { font-size: 0.9rem; }
.file-drop strong { color: var(--text); }
.file-drop input[type="file"] { display: none; }

.file-selected {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 0.875rem;
  margin-bottom: 1.25rem;
  display: none;
  align-items: center;
  gap: 8px;
}

.file-selected.show { display: flex; }

.thumb-preview-img {
  width: 160px;
  aspect-ratio: 16/9;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--border);
}
.file-selected svg { color: var(--accent); flex-shrink: 0; }
.file-selected span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.progress-wrap {
  background: var(--surface2);
  border-radius: 999px;
  height: 6px;
  overflow: hidden;
  margin-bottom: 1rem;
  display: none;
}

.progress-wrap.show { display: block; }
.progress-bar {
  height: 100%;
  background: var(--accent);
  transition: width 0.2s;
  width: 0%;
}

/* ADMIN PAGE */
.admin-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.admin-section h2 {
  font-size: 1.1rem;
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.user-row {
  display: flex;
  align-items: center;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
  gap: 1rem;
}

.user-row:last-child { border-bottom: none; }
.user-name { font-weight: 500; flex: 1; }
.user-badge {
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.add-user-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-top: 1rem;
}

.add-user-form .btn { grid-column: 1/-1; }

.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem;
  color: var(--text-muted);
}

/* ── Modal ── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 1rem;
  animation: fadeIn 0.15s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* Custom confirm dialog */
.confirm-dialog {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  width: 100%;
  max-width: 360px;
  animation: slideUp 0.15s ease;
}

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

.confirm-dialog p {
  font-size: 0.95rem;
  line-height: 1.5;
  margin-bottom: 1.25rem;
  color: var(--text);
}

.confirm-dialog .confirm-title {
  font-weight: 600;
  font-size: 1rem;
  margin-bottom: 0.5rem;
}

.confirm-btns {
  display: flex;
  gap: 0.625rem;
  justify-content: flex-end;
}

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.75rem;
  width: 100%;
  max-width: 520px;
  position: relative;
}

.modal h3 {
  font-size: 1.1rem;
  margin-bottom: 1.25rem;
}

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.25rem;
  cursor: pointer;
  line-height: 1;
  padding: 4px;
  border-radius: 4px;
}

.modal-close:hover { background: var(--surface2); color: var(--text); }

.copy-row {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.copy-row input {
  flex: 1;
  font-size: 0.8rem;
  color: var(--text-muted);
  cursor: text;
}

.modal-section-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
}

.modal-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1.25rem 0;
}

.share-status {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.75rem;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.duration-badge {
  position: absolute;
  bottom: 6px;
  right: 6px;
  background: rgba(0,0,0,0.82);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 5px;
  border-radius: 4px;
  letter-spacing: 0.02em;
  pointer-events: none;
  font-variant-numeric: tabular-nums;
}

.processing-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(0,0,0,0.75);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  gap: 5px;
  letter-spacing: 0.03em;
}

.processing-badge::before {
  content: '';
  width: 8px;
  height: 8px;
  border: 1.5px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}

/* ── Search ── */
.search-wrap {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0 10px;
  gap: 8px;
  transition: border-color 0.15s;
  width: 220px;
}
.search-wrap:focus-within { border-color: var(--accent); }
.search-wrap svg { color: var(--text-muted); flex-shrink: 0; }
.search-wrap input {
  background: none;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 0.875rem;
  padding: 7px 0;
  width: 100%;
}
.search-wrap input::placeholder { color: var(--text-muted); }
.search-wrap button {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px;
  display: flex;
  align-items: center;
  border-radius: 4px;
  flex-shrink: 0;
}
.search-wrap button:hover { color: var(--text); }

@media (max-width: 640px) {
  .search-wrap { width: 100%; }
}

/* ── Transcode Jobs ── */
.job-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 0.875rem 0;
  border-bottom: 1px solid var(--border);
}
.job-row:last-child { border-bottom: none; }
.job-row-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.job-title {
  font-size: 0.9rem;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.job-meta {
  font-size: 0.78rem;
  color: var(--text-muted);
  flex-shrink: 0;
}
.job-progress-track {
  height: 6px;
  background: var(--surface2);
  border-radius: 4px;
  overflow: hidden;
}
.job-progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 4px;
  transition: width 1s linear;
}
.job-progress-fill.indeterminate {
  width: 40% !important;
  animation: indeterminate 1.4s ease-in-out infinite;
}
@keyframes indeterminate {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(350%); }
}
.job-error {
  font-size: 0.8rem;
  color: #f87171;
  background: #f8717115;
  border: 1px solid #f8717130;
  border-radius: 6px;
  padding: 6px 10px;
  word-break: break-all;
}

/* ── Admin Stats ── */
.stat-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.75rem;
}
.stat-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
}
.stat-card-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-weight: 600;
  margin-bottom: 0.5rem;
}
.stat-card-value {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
}
.stat-card-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
}
.stat-charts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}
.stat-chart-box {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}
.stat-chart-title {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 1rem;
}
.hbar-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 7px;
}
.hbar-label {
  font-size: 0.78rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 110px;
  flex-shrink: 0;
}
.hbar-track {
  flex: 1;
  height: 7px;
  background: var(--surface2);
  border-radius: 4px;
  overflow: hidden;
}
.hbar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 4px;
}
.hbar-count {
  font-size: 0.72rem;
  color: var(--text-muted);
  width: 28px;
  text-align: right;
  flex-shrink: 0;
}
.vbar-chart {
  display: flex;
  flex-direction: column;
}
.vbar-bars {
  height: 130px;
  display: flex;
  align-items: flex-end;
  gap: 3px;
}
.vbar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
}
.vbar-bar {
  width: 100%;
  background: var(--accent);
  border-radius: 3px 3px 0 0;
  min-height: 2px;
}
.vbar-labels {
  display: flex;
  gap: 3px;
  margin-top: 6px;
  border-top: 1px solid var(--border);
  padding-top: 5px;
}
.vbar-label {
  flex: 1;
  text-align: center;
  font-size: 0.6rem;
  color: var(--text-muted);
  overflow: hidden;
  white-space: nowrap;
}
.stat-empty {
  color: var(--text-muted);
  font-size: 0.85rem;
  padding: 1.5rem 0;
  text-align: center;
}

/* ── Mobile hamburger menu ── */
.nav-hamburger {
  display: none;
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  cursor: pointer;
  padding: 5px 7px;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-left: auto;
  transition: background 0.15s;
}
.nav-hamburger:hover { background: var(--surface2); }

.nav-mobile-menu {
  display: none;
  position: fixed;
  top: 56px;
  left: 0;
  right: 0;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  z-index: 99;
  padding: 0.5rem;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}
.nav-mobile-menu.open { display: block; }

.nav-mobile-link {
  display: block;
  padding: 10px 14px;
  color: var(--text);
  text-decoration: none;
  border-radius: 6px;
  font-size: 0.95rem;
  background: none;
  border: none;
  cursor: pointer;
  width: 100%;
  text-align: left;
  font-family: inherit;
  transition: background 0.15s;
}
.nav-mobile-link:hover { background: var(--surface2); }

.nav-mobile-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 0.25rem 0;
}

/* ── Modal overlay (generic) ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 1rem;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.modal-header h2 {
  font-size: 1.1rem;
  font-weight: 600;
}

.modal-body { display: flex; flex-direction: column; gap: 0; }
.form-label { display: block; font-size: 0.85rem; font-weight: 500; margin-bottom: 6px; color: var(--text-muted); }
.form-input { width: 100%; background: var(--surface2); border: 1px solid var(--border); border-radius: 6px; padding: 0.6rem 0.75rem; color: var(--text); font-size: 0.9rem; font-family: inherit; outline: none; transition: border-color 0.15s; }
.form-input:focus { border-color: var(--accent); }

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.625rem;
  margin-top: 1.25rem;
}

/* ── Events ── */
.event-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
}

.event-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  text-decoration: none;
  color: var(--text);
  transition: transform 0.15s, box-shadow 0.15s;
  display: flex;
  flex-direction: column;
}

.event-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.35);
}

.event-cover {
  aspect-ratio: 16/9;
  background: var(--surface2);
  overflow: hidden;
  flex-shrink: 0;
}

.event-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }

.event-cover-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}

.event-info {
  padding: 0.85rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.event-title {
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.3;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.event-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.event-meta {
  font-size: 0.78rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

/* Event hero banner */
.event-hero {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  background-size: cover;
  background-position: center;
  position: relative;
  overflow: hidden;
}

.event-hero.has-cover::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(2px);
}

.event-hero.has-cover .event-hero-info,
.event-hero.has-cover .event-hero-actions {
  position: relative;
  z-index: 1;
}

.event-hero.has-cover .event-hero-title,
.event-hero.has-cover .event-hero-desc,
.event-hero.has-cover .event-hero-meta { color: #fff; }
.event-hero.has-cover .event-hero-meta { opacity: 0.75; }
.event-hero.has-cover .back-link { color: rgba(255,255,255,0.8); }

.event-hero-info { display: flex; flex-direction: column; gap: 0.5rem; flex: 1; min-width: 0; }

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.82rem;
  color: var(--text-muted);
  text-decoration: none;
  margin-bottom: 0.25rem;
}
.back-link:hover { color: var(--text); }

.event-hero-title { font-size: 1.6rem; font-weight: 700; line-height: 1.2; }
.event-hero-desc { font-size: 0.9rem; color: var(--text-muted); max-width: 60ch; }
.event-hero-meta {
  font-size: 0.82rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.event-hero-actions { display: flex; gap: 0.5rem; flex-shrink: 0; }

/* form-select */
.form-select {
  width: 100%;
  padding: 0.6rem 0.75rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 0.9rem;
  outline: none;
  cursor: pointer;
}
.form-select:focus { border-color: var(--accent); }

@media (max-width: 640px) {
  nav { padding: 0 1rem; gap: 0.75rem; }
  main { padding: 1rem; }
  .add-user-form { grid-template-columns: 1fr; }
  .video-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
  .nav-hamburger { display: flex; }
  .nav-links { display: none; }
  .nav-right .btn-ghost { display: none; }
  .nav-profile-btn span { display: none; }
  .nav-right { margin-left: 0; }
  .stat-cards { grid-template-columns: repeat(2, 1fr); }
  .stat-charts { grid-template-columns: 1fr; }
  .event-grid { grid-template-columns: 1fr; }
  .event-hero { flex-direction: column; padding: 1.25rem; }
}
