:root {
  --bg: #0a0b0f;
  --bg-elevated: #0d0f15;
  --surface: #14161d;
  --surface-2: #1b1e27;
  --surface-3: #232733;
  --border: #262a36;
  --border-soft: #1d202a;
  --text: #f0f1f5;
  --text-dim: #9096a8;
  --text-faint: #5c6274;
  --accent: #7c3aed;
  --accent-hover: #8b5cf6;
  --accent-bright: #a78bfa;
  --accent-deep: #4c1d95;
  --accent-soft: rgba(124, 58, 237, 0.18);
  --accent-text: #ddd6fe;
  --danger: #ff6b7f;
  --danger-soft: rgba(255, 107, 127, 0.12);
  --success: #4ade80;
  --success-soft: rgba(74, 222, 128, 0.12);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.5);
  --font: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; }

/* Any element can be hidden via the `hidden` attribute regardless of what
   `display` its own class sets elsewhere — without `!important` here, a
   same-specificity class rule (e.g. `.alert { display: flex }`) silently
   wins over the browser's default `[hidden]{display:none}` and the element
   never actually hides. */
[hidden] { display: none !important; }

html { color-scheme: dark; }

body {
  margin: 0;
  background: radial-gradient(1200px 600px at 15% -10%, rgba(124, 58, 237, 0.10), transparent), var(--bg);
  background-repeat: no-repeat;
  color: var(--text);
  font: 14px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--accent-soft); color: var(--text); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 10px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--border); }

.icon { display: inline-block; vertical-align: -3px; flex-shrink: 0; }

body[data-role='MODERATOR'] [data-admin-only] { display: none !important; }

h1, h2, h3 { font-family: var(--font); letter-spacing: -0.01em; }

/* ---------------------------------------------------------------------
   Buttons
--------------------------------------------------------------------- */
button {
  cursor: pointer;
  font: inherit;
  color: inherit;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
}
button:active { transform: translateY(1px); }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border-radius: var(--radius-sm);
  padding: 9px 15px;
  font-weight: 600;
  font-size: 13px;
  border: 1px solid transparent;
  white-space: nowrap;
}
.btn-primary {
  background: linear-gradient(180deg, var(--accent-hover), var(--accent));
  color: #fff;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.12) inset, var(--shadow-sm);
}
.btn-primary:hover:not(:disabled) { background: linear-gradient(180deg, var(--accent-bright), var(--accent-hover)); box-shadow: 0 4px 14px rgba(124, 58, 237, 0.4); }
.btn-primary:disabled { opacity: 0.55; cursor: not-allowed; box-shadow: none; }
.btn-secondary { background: var(--surface-2); border-color: var(--border); color: var(--text); }
.btn-secondary:hover:not(:disabled) { background: var(--surface-3); border-color: #333849; }
.btn-ghost { background: transparent; color: var(--text-dim); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #ff8291; box-shadow: 0 4px 14px rgba(255, 107, 127, 0.35); }
.btn-block { width: 100%; justify-content: center; }
.spin { animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------------------
   Login
--------------------------------------------------------------------- */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background:
    radial-gradient(900px 500px at 50% 0%, rgba(124, 58, 237, 0.16), transparent 60%),
    var(--bg);
  background-repeat: no-repeat;
}
.login-card {
  background: linear-gradient(180deg, var(--surface), var(--bg-elevated));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 36px 32px;
  width: 340px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: var(--shadow-lg);
}
.login-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.login-brand .brand-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--accent-hover), var(--accent-deep));
  color: #fff;
  box-shadow: var(--shadow-sm);
}
.login-card h1 { margin: 0; font-size: 16px; font-weight: 700; }
.login-card .subtitle { margin: -8px 0 4px; color: var(--text-faint); font-size: 12.5px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12.5px; color: var(--text-dim); font-weight: 500; }

/* Not display:none/visibility:hidden — those bar an element from constraint
   validation and (worse) make the browser unable to focus it to anchor a
   validation bubble. This stays focusable while taking no visual space, for
   fields whose real value lives in a custom widget (e.g. the genres tag
   picker) but still needs to participate in native form validation. */
.visually-hidden-input { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
.input-wrap { position: relative; display: flex; align-items: center; }
.input-wrap .icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--text-faint); pointer-events: none; }
.input-wrap input, .input-wrap select { padding-left: 34px; }
input, select, textarea {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  color: var(--text);
  font: inherit;
  width: 100%;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}
input::placeholder, textarea::placeholder { color: var(--text-faint); }
input:hover, select:hover, textarea:hover { border-color: #333849; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); background: var(--surface-3); }

.alert {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 12.5px;
  line-height: 1.4;
}
.alert-danger { background: var(--danger-soft); color: #ffb3bd; border: 1px solid rgba(255, 107, 127, 0.25); }
.alert-success { background: var(--success-soft); color: #a4f4c0; border: 1px solid rgba(74, 222, 128, 0.25); }
.alert-info { background: var(--surface-2); color: var(--text-dim); border: 1px solid var(--border); }
.alert .icon { margin-top: 1px; flex-shrink: 0; }

/* ---------------------------------------------------------------------
   Navbar / tabs
--------------------------------------------------------------------- */
.app-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(13, 15, 21, 0.85);
  backdrop-filter: blur(10px);
}
.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 28px;
  border-bottom: 1px solid var(--border-soft);
}
.navbar-brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: -0.01em; }
.navbar-brand .brand-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent-hover), var(--accent-deep));
  color: #fff;
}
.navbar-profile { position: relative; }
.profile-btn {
  display: flex;
  align-items: center;
  gap: 9px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 999px;
  padding: 5px 12px 5px 5px;
}
.profile-btn:hover { border-color: #333849; background: var(--surface-2); }
.avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-hover), var(--accent-deep));
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}
.profile-btn .role-chip {
  font-size: 10.5px;
  color: var(--text-faint);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.profile-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  min-width: 160px;
  box-shadow: var(--shadow-md);
  padding: 6px;
}
.profile-menu button {
  width: 100%;
  padding: 8px 10px;
  background: none;
  border: none;
  color: var(--text-dim);
  text-align: left;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}
.profile-menu button:hover { background: var(--surface-2); color: var(--text); }

.tabs { display: flex; gap: 2px; padding: 0 28px; border-bottom: 1px solid var(--border-soft); background: var(--bg-elevated); }
.tab-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  background: none;
  border: none;
  color: var(--text-faint);
  padding: 13px 16px;
  border-bottom: 2px solid transparent;
  font-weight: 600;
  font-size: 13px;
}
.tab-btn:hover { color: var(--text-dim); }
.tab-btn.active { color: var(--text); border-bottom-color: var(--accent); }
main { max-width: 1280px; margin: 0 auto; }
.tab-panel { display: none; padding: 24px 28px 60px; }
.tab-panel.active { display: block; animation: fade-in 0.2s ease; }
@keyframes fade-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.placeholder-panel { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 100px 20px; color: var(--text-faint); text-align: center; }
.placeholder-panel .icon { color: var(--text-faint); }
.placeholder-panel h3 { margin: 0; color: var(--text-dim); font-size: 15px; }
.placeholder-panel p { margin: 0; font-size: 13px; }

/* ---------------------------------------------------------------------
   Movie grid
--------------------------------------------------------------------- */
.panel-toolbar { display: flex; gap: 12px; margin-bottom: 20px; }
.search-wrap { position: relative; flex: 1; max-width: 420px; }
.search-wrap .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-faint); }
.search-wrap input { padding-left: 36px; }

.category-filter-bar {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  margin-bottom: 20px;
  overflow-x: auto;
  padding-bottom: 6px;
}
.category-filter-bar:empty { display: none; }
.category-chip {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}
.category-chip:hover { border-color: var(--accent-hover); color: var(--text); }
.category-chip.active { background: var(--accent-soft); border-color: rgba(124, 58, 237, 0.5); color: var(--accent-text); }

.movie-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 18px; }
.movie-card {
  position: relative;
  background: var(--surface);
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-soft);
  aspect-ratio: 2 / 3;
  cursor: pointer;
  animation: fade-in 0.25s ease;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.movie-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: #333849; }
.movie-card img { width: 100%; height: 100%; object-fit: cover; display: block; background: var(--surface-2); }

.movie-card-actions {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  gap: 6px;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.15s ease, transform 0.15s ease;
  z-index: 1;
}
.movie-card:hover .movie-card-actions { opacity: 1; transform: none; }
.card-action-btn {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: rgba(20, 22, 29, 0.85);
  backdrop-filter: blur(4px);
  border: 1px solid var(--border);
  color: var(--text);
}
.card-action-btn:hover { background: var(--accent); border-color: var(--accent); }
.card-action-btn.danger:hover { background: var(--danger); border-color: var(--danger); }
.movie-card .poster-fallback {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-2);
  color: var(--text-faint);
}
.movie-card .movie-title-overlay {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 22px 10px 10px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.3;
  color: #fff;
  background: linear-gradient(0deg, rgba(0, 0, 0, 0.85), rgba(0, 0, 0, 0.55) 55%, transparent);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.skeleton-card { border-radius: var(--radius-md); aspect-ratio: 2 / 3; background: linear-gradient(100deg, var(--surface) 30%, var(--surface-2) 50%, var(--surface) 70%); background-size: 200% 100%; animation: shimmer 1.4s ease-in-out infinite; border: 1px solid var(--border-soft); }

.error-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--danger-soft);
  border: 1px solid rgba(255, 107, 127, 0.4);
  color: var(--danger);
  z-index: 1;
}
@keyframes shimmer { 0% { background-position: 150% 0; } 100% { background-position: -50% 0; } }

.empty-state { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 70px 20px; color: var(--text-faint); grid-column: 1 / -1; text-align: center; }
.empty-state h3 { margin: 0; color: var(--text-dim); font-size: 14px; font-weight: 600; }
.empty-state p { margin: 0; font-size: 13px; }

.panel-footer { display: flex; justify-content: center; margin-top: 28px; }

/* ---------------------------------------------------------------------
   Modal
--------------------------------------------------------------------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(6, 7, 10, 0.72);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  animation: fade-in 0.15s ease;
  padding: 20px;
}
.modal {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 600px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}
.modal-header { flex-shrink: 0; display: flex; justify-content: space-between; align-items: center; padding: 18px 22px; border-bottom: 1px solid var(--border-soft); }
.modal-header .modal-title { display: flex; align-items: center; gap: 10px; }
.modal-header h2 { margin: 0; font-size: 15px; font-weight: 700; }
.modal-close { background: var(--surface-2); border: 1px solid var(--border); color: var(--text-dim); border-radius: 8px; width: 30px; height: 30px; display: flex; align-items: center; justify-content: center; padding: 0; }
.modal-close:hover { background: var(--surface-3); color: var(--text); }

/* Header + stepper + footer stay put; only .modal-body scrolls — the
   conventional ERP-style wizard modal the user asked for. */
.modal-form { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.modal-body { flex: 1; overflow-y: auto; }
.modal-footer { flex-shrink: 0; display: flex; align-items: center; gap: 10px; padding: 16px 24px; border-top: 1px solid var(--border-soft); }
.spacer { flex: 1; }

.stepper { flex-shrink: 0; display: flex; align-items: center; padding: 18px 24px 4px; gap: 0; }
.stepper .step { display: flex; flex-direction: column; align-items: center; gap: 7px; flex: 1; background: none; border: none; color: var(--text-faint); position: relative; }
.stepper .step-circle {
  width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text-faint); transition: all 0.15s ease; z-index: 1;
}
.stepper .step-label { font-size: 11px; font-weight: 600; }
.stepper .step::after {
  content: ''; position: absolute; top: 15px; left: 50%; width: 100%; height: 1px; background: var(--border); z-index: 0;
}
.stepper .step:last-child::after { display: none; }
.stepper .step.active .step-circle { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-text); }
.stepper .step.active .step-label { color: var(--text); }
.stepper .step.done .step-circle { background: var(--success-soft); border-color: var(--success); color: var(--success); }
.stepper .step.done::after { background: var(--success); opacity: 0.4; }

/* ---------------------------------------------------------------------
   Movie modal — Editar/Informações tabs
--------------------------------------------------------------------- */
.modal-tabbar { flex-shrink: 0; display: flex; padding: 0 22px; border-bottom: 1px solid var(--border-soft); }
.modal-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-faint);
  padding: 12px 4px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.12s ease, background 0.12s ease;
}
.modal-tab:hover { background: var(--surface-2); color: var(--text-dim); }
.modal-tab.active { color: var(--accent-text); border-bottom-color: var(--accent); }

/* The wizard (stepper + form) is wrapped so the Editar/Informações switch
   can hide/show it as one unit — display:contents keeps its children
   (stepper, form) as direct flex items of .modal so the existing
   header/stepper/footer-pinned, only-.modal-body-scrolls layout is
   untouched. [hidden]'s !important still wins when the tab is inactive. */
#movie-edit-view { display: contents; }

/* Outer view is a flex column: a scrollable body + a fixed footer, same
   split .modal-form uses for the wizard (.modal-body scrolls, .modal-footer
   doesn't) — so both tabs share one footer position/behavior. */
.hotcache-view { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.hotcache-view-body { flex: 1; min-height: 0; overflow-y: auto; padding: 22px 24px; display: flex; flex-direction: column; gap: 28px; }

.hotcache-empty { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 40px 20px; color: var(--text-faint); text-align: center; }
.hotcache-empty p { margin: 0; font-size: 13px; }

#hotcache-content { display: flex; flex-direction: column; gap: 28px; }
.hotcache-section { display: flex; flex-direction: column; gap: 12px; }
.hotcache-section-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-faint); }

.hotcache-status-row { display: flex; }
.hotcache-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 700;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-dim);
}
.hotcache-badge::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.hotcache-badge.cached { background: var(--success-soft); border-color: rgba(74, 222, 128, 0.4); color: var(--success); }
.hotcache-badge.cold { background: var(--surface-2); border-color: var(--border); color: var(--text-dim); }

.hotcache-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; }
.hotcache-stat {
  background: linear-gradient(160deg, var(--surface-2), var(--surface));
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.hotcache-stat-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; color: var(--text-faint); }
.hotcache-stat-value { font-size: 26px; font-weight: 700; color: var(--accent-bright); line-height: 1.2; }

.hotcache-paths { display: flex; flex-direction: column; gap: 12px; }
.hotcache-path-row {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  padding: 12px 16px;
}
.hotcache-path-icon {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-3);
  color: var(--text-dim);
}
.hotcache-path-icon.ssd { background: var(--accent-soft); color: var(--accent-bright); }
.hotcache-path-icon.nvme { background: var(--success-soft); color: var(--success); }
.hotcache-path-text { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1; }
.hotcache-path-label { font-size: 11px; color: var(--text-faint); }
.hotcache-path-value { color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hotcache-path-value.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 11.5px; }
.hotcache-copy-btn { flex-shrink: 0; }
.hotcache-copy-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.hotcache-copy-btn.copied { border-color: var(--success); color: var(--success); }

.hotcache-meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; }
.hotcache-meta-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  font-size: 12.5px;
}
.hotcache-key { font-size: 11px; color: var(--text-faint); }

.modal-step { display: none; flex-direction: column; gap: 14px; padding: 20px 24px 24px; }
.modal-step.active { display: flex; animation: fade-in 0.18s ease; }
.modal-step .field label { display: flex; align-items: center; gap: 6px; }

.tmdb-results { border: 1px solid var(--border); border-radius: var(--radius-sm); max-height: 220px; overflow-y: auto; background: var(--surface); }
.tmdb-result-item { padding: 8px 10px; cursor: pointer; display: flex; gap: 10px; align-items: center; border-bottom: 1px solid var(--border-soft); }
.tmdb-result-item:last-child { border-bottom: none; }
.tmdb-result-item:hover { background: var(--surface-2); }
.tmdb-result-item img { width: 34px; height: 50px; object-fit: cover; border-radius: 5px; background: var(--surface-2); flex-shrink: 0; }
.tmdb-result-item .result-title { font-size: 13px; font-weight: 500; }
.tmdb-result-item .result-year { color: var(--text-faint); font-size: 12px; }

.manual-entry-card {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  color: var(--text-dim);
  font-size: 12.5px;
  text-align: left;
}
.manual-entry-card:hover { border-color: var(--accent); color: var(--text); background: var(--surface-2); }

.selected-pill {
  display: none;
  align-items: center;
  gap: 10px;
  background: var(--accent-soft);
  border: 1px solid rgba(124, 58, 237, 0.35);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
}
.selected-pill.show { display: flex; }
.selected-pill img { width: 30px; height: 44px; object-fit: cover; border-radius: 4px; }
.selected-pill .selected-title { font-size: 12.5px; font-weight: 600; color: var(--text); }
.selected-pill .selected-sub { font-size: 11px; color: var(--text-dim); }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.upload-drop {
  border: 1.5px dashed var(--border);
  border-radius: var(--radius-md);
  padding: 28px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: var(--text-dim);
  text-align: center;
  cursor: pointer;
  position: relative;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}
.upload-drop:hover { border-color: var(--accent); background: var(--accent-soft); }
.upload-drop input[type='file'] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.upload-drop .icon { color: var(--text-faint); }
.upload-drop .drop-title { font-size: 13px; font-weight: 600; color: var(--text); }
.upload-drop .drop-hint { font-size: 11.5px; color: var(--text-faint); }
.upload-drop.has-file { border-style: solid; border-color: var(--success); background: var(--success-soft); }
.upload-drop.has-file .icon { color: var(--success); }
.upload-drop-note { margin: -6px 0 0; font-size: 11.5px; color: var(--text-faint); line-height: 1.4; }

.upload-progress { display: flex; flex-direction: column; gap: 6px; }
.upload-progress-track { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.upload-progress-fill { height: 100%; width: 0%; background: linear-gradient(90deg, var(--accent-hover), var(--accent-bright)); transition: width 0.15s ease; }
.upload-progress-meta { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--text-faint); }
.upload-progress-meta #upload-progress-percent { color: var(--text-dim); font-weight: 600; }

.btn-danger-ghost { color: var(--danger); }
.btn-danger-ghost:hover { background: var(--danger-soft); color: var(--danger); }

.source-link-list { display: flex; flex-direction: column; gap: 8px; }
.source-link-row { display: flex; gap: 8px; align-items: center; }
.source-link-row input { flex: 1; font-size: 12.5px; }
.source-link-row button { flex-shrink: 0; }

.tag-picker { position: relative; display: flex; flex-direction: column; gap: 8px; }
.tag-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-chips:empty { display: none; }
.tag-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--accent-soft);
  border: 1px solid rgba(124, 58, 237, 0.35);
  color: var(--accent-text);
  padding: 5px 6px 5px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.tag-chip button { background: none; border: none; color: inherit; display: flex; padding: 2px; border-radius: 50%; opacity: 0.8; }
.tag-chip button:hover { background: rgba(124, 58, 237, 0.3); opacity: 1; }
.tag-picker-trigger {
  align-self: flex-start;
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--surface-2);
  border: 1px dashed var(--border);
  color: var(--text-dim);
  border-radius: var(--radius-sm);
  padding: 7px 12px;
  font-size: 12.5px;
  font-weight: 600;
}
.tag-picker-trigger:hover { border-color: var(--accent); color: var(--text); background: var(--surface-3); }
.tag-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  max-height: 200px;
  overflow-y: auto;
  z-index: 20;
  box-shadow: var(--shadow-md);
}
.tag-dropdown-item { display: flex; align-items: center; gap: 8px; padding: 8px 12px; cursor: pointer; font-size: 13px; }
.tag-dropdown-item:hover { background: var(--surface-2); }
.tag-dropdown-item.selected { background: var(--accent-soft); color: var(--accent-text); }
.tag-dropdown-item.selected:hover { background: rgba(124, 58, 237, 0.24); }
.tag-dropdown-check { display: inline-flex; width: 14px; flex-shrink: 0; color: var(--accent-text); }
.tag-dropdown-empty { padding: 10px 12px; font-size: 12.5px; color: var(--text-faint); }

/* ---------------------------------------------------------------------
   Users tab
--------------------------------------------------------------------- */
.modal-sm { width: 400px; }
#user-form .modal-body { padding: 20px 24px; display: flex; flex-direction: column; gap: 14px; }
#delete-modal .modal-body { padding: 20px 24px; display: flex; flex-direction: column; gap: 12px; }
#delete-modal-text { margin: 0; font-size: 13.5px; color: var(--text-dim); line-height: 1.5; }

.checkbox-row { display: flex; align-items: flex-start; gap: 8px; font-size: 13px; color: var(--text); cursor: pointer; }
.checkbox-row input[type='checkbox'] { width: 16px; height: 16px; margin-top: 1px; accent-color: var(--accent); flex-shrink: 0; }

.modal-player { width: 720px; }
.player-body { padding: 0; background: #000; }
#player-video { width: 100%; max-height: 70vh; display: block; background: #000; }

.users-table-wrap { border: 1px solid var(--border-soft); border-radius: var(--radius-md); overflow: hidden; }
.users-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.users-table th {
  text-align: left;
  padding: 10px 16px;
  background: var(--surface);
  color: var(--text-faint);
  font-weight: 600;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border-bottom: 1px solid var(--border-soft);
}
.users-table td { padding: 12px 16px; border-bottom: 1px solid var(--border-soft); color: var(--text-dim); }
.users-table tr:last-child td { border-bottom: none; }
.users-table tr:hover td { background: var(--surface); }
.users-table .username-cell { color: var(--text); font-weight: 600; }

.role-badge { display: inline-flex; align-items: center; padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 700; letter-spacing: 0.02em; }
.role-badge-admin { background: var(--accent-soft); color: var(--accent-text); }
.role-badge-moderator { background: var(--surface-3); color: var(--text-dim); }

.status-dot { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; }
.status-dot::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--text-faint); }
.status-dot.active::before { background: var(--success); }

.row-actions { display: flex; gap: 6px; justify-content: flex-end; }
.row-action-btn {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-dim);
  border-radius: 7px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.row-action-btn:hover { background: var(--surface-3); color: var(--text); }
.row-action-btn.danger:hover { border-color: var(--danger); color: var(--danger); }

/* ---------------------------------------------------------------------
   Timeline tab
--------------------------------------------------------------------- */
.timeline-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
  max-width: 960px;
}
.timeline-filters select { width: auto; min-width: 150px; }
.timeline-filter-date { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-dim); }
.timeline-filter-date input { width: auto; }
.timeline-count { font-size: 12.5px; color: var(--text-faint); white-space: nowrap; }

.timeline-list { display: flex; flex-direction: column; gap: 10px; max-width: 760px; }
.timeline-item { display: flex; gap: 12px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--radius-md); }
.timeline-icon { width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.timeline-icon.create { background: var(--success-soft); color: var(--success); }
.timeline-icon.update { background: var(--accent-soft); color: var(--accent-text); }
.timeline-icon.delete { background: var(--danger-soft); color: var(--danger); }
.timeline-content { flex: 1; min-width: 0; }
.timeline-text { font-size: 13px; color: var(--text); line-height: 1.5; }
.timeline-text strong { font-weight: 700; }
.timeline-extras { color: var(--text-faint); }
.timeline-meta { font-size: 11.5px; color: var(--text-faint); margin-top: 3px; }

/* ---------------------------------------------------------------------
   Debug page
--------------------------------------------------------------------- */
body:has(.debug-page) { background: var(--bg); min-height: 100vh; }
.debug-page { max-width: 860px; margin: 0 auto; padding: 32px 24px 60px; display: flex; flex-direction: column; gap: 20px; }
.debug-header { display: flex; align-items: center; justify-content: space-between; }
.debug-header h1 { font-size: 18px; margin: 0; }
.debug-panel {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.debug-panel h2 { display: flex; align-items: center; gap: 8px; font-size: 14px; margin: 0; }
.debug-actions { display: flex; gap: 10px; }
.debug-log {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11.5px;
  line-height: 1.6;
  color: var(--text-dim);
  max-height: 400px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-all;
}
