/* ============ CINEQUAY DESIGN SYSTEM & BASE TOKENS ============ */
:root {
  --bg: #ffffff;
  --ink: #09090b;
  --muted: #64748b;
  --border-l: #e2e8f0;
  --card-bg: #ffffff;
  --card-hover: #f8fafc;
  --dark: #09090b;
  --dark2: #121316;
  --dark3: #181920;
  --border-d: rgba(255, 255, 255, 0.08);
  --mint: #2fe6c6;
  --mint-deep: #0d9488;
  --blue-primary: #2563eb;
  --blue-hover: #1d4ed8;
  --blue-subtle: rgba(37, 99, 235, 0.08);
  --blue-border: rgba(37, 99, 235, 0.22);
  --blue-grad: linear-gradient(135deg, #1d4ed8 0%, #2563eb 50%, #38bdf8 100%);
  --blue: #2563eb;
  --purple: #3b82f6; /* Harmonized purple token to modern blue */
  --amber: #f59e0b;
  --red: #ef4444;
  --cta1: #091321;
  --cta2: #0f233a;
  --radius: 16px;
  --radius-sm: 8px;
  --maxw: 1160px;
  --opacity-muted: 0.72;
  --opacity-subtle: 0.5;
  --opacity-disabled: 0.45;
  --opacity-overlay: 0.7;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  box-sizing: border-box;
  transition: background-color .25s ease, color .25s ease;
}

:root[data-theme="dark"] {
  --bg: #09090b;
  --ink: #f4f4f5;
  --muted: #a1a1aa;
  --border-l: #27272a;
  --card-bg: #121316;
  --card-hover: #18191f;
  --panel-tint: #121316;
  --dark: #09090b;
  --dark2: #121316;
  --dark3: #181920;
  --border-d: rgba(255, 255, 255, 0.08);
  --blue-subtle: rgba(37, 99, 235, 0.16);
  --blue-border: rgba(37, 99, 235, 0.35);
}

* { box-sizing: inherit; margin: 0; padding: 0; transition: background-color .2s ease, border-color .2s ease, color .2s ease; }
html { scroll-padding-top: calc(64px + env(safe-area-inset-top, 0px)); scroll-behavior: smooth; }
body { font-family: 'Inter', system-ui, -apple-system, sans-serif; color: var(--ink); background: var(--bg); line-height: 1.5; -webkit-font-smoothing: antialiased; overflow-x: hidden; min-height: 100vh; }
img, svg { max-width: 100%; }
a { color: inherit; text-decoration: none; }
.icon { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; display: inline-block; vertical-align: middle; }
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }
section { padding: 80px 0; }
@media (max-width: 720px) { section { padding: 48px 0; } }

h1, h2, h3, h4 { line-height: 1.2; font-weight: 700; letter-spacing: -.02em; }
.eyebrow { color: var(--mint-deep); font-weight: 700; font-size: 13px; letter-spacing: .02em; text-transform: uppercase; }
.muted { color: var(--muted); }
code, .mono { font-family: 'JetBrains Mono', monospace; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 20px; border-radius: 999px; font-weight: 600; font-size: 14px; border: 1px solid transparent; cursor: pointer; white-space: nowrap; text-decoration: none; transition: transform .15s ease, background-color .15s ease, border-color .15s ease, opacity .15s ease, color .15s ease, box-shadow .15s ease; }
.btn:hover:not(:disabled) { transform: translateY(-1px); opacity: 0.96; }
.btn:active:not(:disabled) { transform: translateY(0); }
.btn:disabled { opacity: var(--opacity-disabled); cursor: not-allowed; }
.btn-mint { background: var(--mint); color: #04231d; }
.btn-mint:hover:not(:disabled) { background: #4ff2d4; transform: translateY(-1px); }
.btn-blue { background: var(--blue-primary); color: #fff; }
.btn-blue:hover:not(:disabled) { background: var(--blue-hover); transform: translateY(-1px); }
.btn-outline { border-color: rgba(255, 255, 255, .28); color: #fff; background: transparent; }
.btn-outline:hover:not(:disabled) { background: rgba(255, 255, 255, .08); }
.btn-outline-dark { border-color: var(--border-l); color: var(--ink); background: transparent; }
.btn-outline-dark:hover:not(:disabled) { background: rgba(0,0,0,.03); }
:root[data-theme="dark"] .btn-outline-dark:hover:not(:disabled) { background: rgba(255,255,255,.05); }
.btn-danger { background: rgba(239, 68, 68, 0.15); color: var(--red); border-color: rgba(239, 68, 68, 0.3); }
.btn-danger:hover:not(:disabled) { background: var(--red); color: #fff; }
.btn-sm { padding: 6px 14px; font-size: 12.5px; }

/* Theme Toggle */
.theme-toggle { width: 36px; height: 36px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .28); display: flex; align-items: center; justify-content: center; background: transparent; cursor: pointer; color: #fff; flex: none; }
.theme-toggle:hover { background: rgba(255, 255, 255, .08); }
.theme-toggle .icon { width: 17px; height: 17px; }
.theme-toggle .i-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .i-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .i-moon { display: block; }

/* Header */
header { position: sticky; top: 0; z-index: 50; background: rgba(7, 12, 20, .92); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border-d); padding-top: env(safe-area-inset-top, 0px); }
.nav { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.logo { display: flex; align-items: center; gap: 8px; font-weight: 800; color: #fff; font-size: 18px; }
.logo-mark { width: 28px; height: 28px; border-radius: 8px; background: linear-gradient(135deg, var(--mint), var(--blue)); display: flex; align-items: center; justify-content: center; flex: none; }
.nav-links { display: flex; gap: 26px; font-size: 14px; color: #c4cad4; font-weight: 500; }
.nav-links a:hover { color: #fff; }
.nav-right { display: flex; gap: 12px; align-items: center; }
@media (max-width: 760px) { .nav-links { display: none; } }

/* Cards & Badges */
.card { border: 1px solid var(--border-l); border-radius: var(--radius); padding: 24px; background: var(--card-bg); }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .02em; }
.badge-ready, .badge-active, .badge-qualified, .badge-mint { background: rgba(47, 230, 198, 0.15); color: var(--mint-deep); border: 1px solid rgba(47, 230, 198, 0.3); }
.badge-processing, .badge-uploading { background: rgba(37, 99, 235, 0.12); color: var(--blue-primary); border: 1px solid var(--blue-border); }
.badge-pending { background: rgba(245, 158, 11, 0.15); color: var(--amber); border: 1px solid rgba(245, 158, 11, 0.3); }
.badge-failed, .badge-suspended { background: rgba(239, 68, 68, 0.15); color: var(--red); border: 1px solid rgba(239, 68, 68, 0.3); }

/* Form Elements */
.form-group { margin-bottom: 20px; }
.form-label { display: block; font-size: 13.5px; font-weight: 600; margin-bottom: 8px; color: var(--ink); }
.form-control { width: 100%; padding: 11px 16px; border-radius: 10px; border: 1px solid var(--border-l); background: var(--bg); color: var(--ink); font-size: 14px; font-family: inherit; }
.form-control:focus { outline: none; border-color: var(--mint); box-shadow: 0 0 0 3px rgba(47, 230, 198, 0.15); }
.form-hint { font-size: 12px; color: var(--muted); margin-top: 6px; }

/* ============ DASHBOARD LAYOUT ============ */
.dash-layout { display: grid; grid-template-columns: 240px 1fr; min-height: calc(100vh - 64px); background: var(--bg); }
.dash-sidebar { background: var(--dark); border-right: 1px solid var(--border-d); padding: 24px 16px; display: flex; flex-direction: column; gap: 6px; }
.dash-nav-item { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 10px; color: #9aa3b2; font-size: 14px; font-weight: 500; cursor: pointer; border: 1px solid transparent; user-select: none; transition: background 0.15s ease, color 0.15s ease; }
.dash-nav-item * { pointer-events: none; }
.dash-nav-item:hover { color: #fff; background: rgba(255, 255, 255, 0.05); }
.dash-nav-item.active { color: var(--mint); background: rgba(47, 230, 198, 0.08); border-color: rgba(47, 230, 198, 0.2); font-weight: 600; }
.dash-main { padding: 32px; max-width: 1200px; width: 100%; margin: 0 auto; }
@media (max-width: 600px) { .dash-main { padding: 20px 16px; } }

/* Mobile dashboard sidebar */
.mobile-menu-toggle { display: none; width: 36px; height: 36px; border-radius: 8px; border: 1px solid rgba(255,255,255,.2); background: transparent; color: #fff; cursor: pointer; align-items: center; justify-content: center; }
@media (max-width: 900px) {
  .dash-layout { grid-template-columns: 1fr; }
  .dash-sidebar {
    position: fixed;
    top: 64px;
    left: -260px;
    width: 240px;
    height: calc(100vh - 64px);
    z-index: 200;
    transition: left 0.28s ease;
    border-right: 1px solid var(--border-d);
    box-shadow: 4px 0 24px rgba(0,0,0,0.3);
    overflow-y: auto;
    padding-top: 20px;
  }
  .dash-sidebar.open { left: 0; }
  .mobile-menu-toggle { display: flex !important; }
  .dash-sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    top: 64px;
    background: rgba(0,0,0,0.5);
    z-index: 199;
    backdrop-filter: blur(2px);
  }
  .dash-sidebar-overlay.active { display: block; }
}

/* Stats Grid */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 18px; margin-bottom: 28px; }
.stat-card { border: 1px solid var(--border-l); border-radius: var(--radius); padding: 20px; background: var(--card-bg); }
.stat-title { font-size: 13px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .02em; }
.stat-value { font-size: 28px; font-weight: 800; margin: 8px 0 4px; color: var(--ink); }
.stat-sub { font-size: 12.5px; color: var(--mint-deep); display: flex; align-items: center; gap: 4px; }

/* Table Styles */
.table-wrap { overflow-x: auto; border: 1px solid var(--border-l); border-radius: var(--radius); background: var(--card-bg); }
table.data-table { width: 100%; border-collapse: collapse; text-align: left; font-size: 13.5px; }
table.data-table th { padding: 14px 18px; background: rgba(0,0,0,0.02); color: var(--muted); font-weight: 600; font-size: 12.5px; border-bottom: 1px solid var(--border-l); text-transform: uppercase; letter-spacing: .03em; }
table.data-table td { padding: 14px 18px; border-bottom: 1px solid var(--border-l); color: var(--ink); vertical-align: middle; }
table.data-table tr:last-child td { border-bottom: none; }
table.data-table tr:hover td { background: rgba(0,0,0,0.01); }

/* ============ UPLOAD DROPZONE ============ */
.dropzone-box {
  border: 2px dashed var(--border-l);
  border-radius: var(--radius);
  padding: 50px 24px;
  text-align: center;
  background: var(--card-bg);
  cursor: pointer;
  transition: all .2s ease;
  position: relative;
}
.dropzone-box:hover, .dropzone-box.dragover {
  border-color: var(--mint);
  background: rgba(47, 230, 198, 0.04);
}
.dropzone-icon {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: rgba(47, 230, 198, 0.1);
  color: var(--mint-deep);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}
.dropzone-icon .icon { width: 28px; height: 28px; }

/* Progress & Multi-Provider Stages */
.upload-progress-wrap { margin-top: 24px; border: 1px solid var(--border-l); border-radius: var(--radius); padding: 24px; background: var(--card-bg); }
.progress-bar-bg { width: 100%; height: 8px; border-radius: 999px; background: var(--border-l); overflow: hidden; margin: 12px 0; }
.progress-bar-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--mint), var(--blue)); width: 0%; transition: width .3s ease; }
.provider-stages { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-top: 20px; }
.provider-chip { padding: 12px 14px; border-radius: 10px; border: 1px solid var(--border-l); background: var(--bg); display: flex; align-items: center; justify-content: space-between; font-size: 13px; font-weight: 500; }

/* ============ VIDEO PLAYER PAGE ============ */
.player-container {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
  box-shadow: 0 20px 50px rgba(0,0,0,0.3);
}
.player-container iframe { width: 100%; height: 100%; border: 0; display: block; }
.view-tracker-banner {
  margin-top: 14px;
  padding: 10px 16px;
  border-radius: 10px;
  background: rgba(47, 230, 198, 0.08);
  border: 1px solid rgba(47, 230, 198, 0.25);
  font-size: 13px;
  color: var(--mint-deep);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Modals */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.7); backdrop-filter: blur(4px); display: none; align-items: center; justify-content: center; z-index: 100; padding: 20px; }
.modal-overlay.active { display: flex; }
.modal-content { background: var(--card-bg); border: 1px solid var(--border-l); border-radius: var(--radius); max-width: 520px; width: 100%; padding: 28px; box-shadow: 0 24px 60px rgba(0,0,0,0.4); }

/* Retention Notice Box */
.retention-alert {
  padding: 14px 18px;
  border-radius: 12px;
  background: var(--blue-subtle);
  border: 1px solid var(--blue-border);
  color: var(--blue-primary);
  font-size: 13.5px;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}
:root[data-theme="dark"] .retention-alert {
  color: #60a5fa;
}

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

.spin {
  display: inline-block;
  animation: spin 1s linear infinite;
}

/* ============ TMDB FINDER & UPLOAD SUITE ============ */
.upload-mode-toggle {
  display: inline-flex;
  background: var(--border-l);
  border-radius: 10px;
  padding: 4px;
  gap: 4px;
}
.upload-mode-btn {
  border: none;
  background: transparent;
  padding: 8px 18px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all .2s ease;
}
.upload-mode-btn.active {
  background: var(--card-bg);
  color: var(--mint-deep);
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.tmdb-results-box {
  display: none;
  max-height: 290px;
  overflow-y: auto;
  border: 1px solid var(--border-l);
  border-radius: 10px;
  background: var(--card-bg);
  margin-top: 10px;
  padding: 6px;
}
.tmdb-result-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: background .15s ease;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.tmdb-result-item:last-child {
  border-bottom: none;
}
.tmdb-result-item:hover {
  background: rgba(47, 230, 198, 0.08);
}
.tmdb-item-poster {
  width: 38px;
  height: 52px;
  object-fit: cover;
  border-radius: 4px;
  background: #111;
  flex-shrink: 0;
}
.tmdb-item-info {
  flex: 1;
  min-width: 0;
}
.tmdb-item-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tmdb-item-meta {
  font-size: 12px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
}
.badge-movie {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.3);
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 600;
}
.badge-tv {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 600;
}

/* ============ LIVE ENCODING STATUS WIDGET ============ */
.encoding-status-container {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.encoding-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  user-select: none;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid var(--border-l);
  background: var(--card-bg);
  color: var(--muted);
}

.encoding-pill:hover {
  border-color: rgba(47, 230, 198, 0.4);
  color: var(--ink);
  transform: translateY(-1px);
}

.encoding-pill-active {
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.35);
  color: #f59e0b;
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.15);
}

.encoding-pill-active:hover {
  background: rgba(245, 158, 11, 0.14);
  border-color: #f59e0b;
}

.encoding-pill-idle {
  background: rgba(255, 255, 255, 0.02);
  border-color: var(--border-l);
  color: var(--muted);
}

.encoding-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.encoding-status-dot.active {
  background: #f59e0b;
  box-shadow: 0 0 8px #f59e0b;
  animation: pulseEncoding 1.8s infinite ease-in-out;
}

.encoding-status-dot.idle {
  background: #10b981;
}

@keyframes pulseEncoding {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.8; }
}

.encoding-spinner {
  display: inline-block;
  animation: spinEncoding 1.2s linear infinite;
  font-size: 13px;
}

@keyframes spinEncoding {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.encoding-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 1050;
  width: 330px;
  max-width: 90vw;
  background: #11141c;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.05);
  overflow: hidden;
  animation: fadeInDown 0.18s ease-out forwards;
}

@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

.encoding-popover-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.encoding-popover-body {
  padding: 12px 14px;
  max-height: 280px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.encoding-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.encoding-item:last-child {
  padding-bottom: 0;
  border-bottom: none;
}

.encoding-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.encoding-item-title {
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
}

.encoding-percent-badge {
  font-size: 11.5px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(245, 158, 11, 0.16);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.encoding-progress-track {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  overflow: hidden;
}

.encoding-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #f59e0b, #2fe6c6);
  border-radius: 999px;
  transition: width 0.4s ease;
}

.encoding-provider-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 2px;
}

.encoding-provider-tag {
  font-size: 10.5px;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.05);
  color: #94a3b8;
  border: 1px solid rgba(255, 255, 255, 0.07);
}

.encoding-popover-footer {
  padding: 8px 14px;
  background: rgba(255, 255, 255, 0.02);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  text-align: center;
}


/* ============ ADDITIONAL MOBILE & UI IMPROVEMENTS ============ */

/* Better mobile nav */
@media (max-width: 480px) {
  .wrap { padding: 0 16px; }
  .btn { padding: 9px 16px; font-size: 13.5px; }
  .btn-sm { padding: 6px 12px; font-size: 12px; }
  .card { padding: 18px; }
  .stat-grid { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
  .stat-value { font-size: 22px; }
}

/* Improve table responsiveness */
@media (max-width: 768px) {
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table.data-table th, table.data-table td { padding: 10px 12px; font-size: 12.5px; }
  table.data-table th:nth-child(3), table.data-table td:nth-child(3),
  table.data-table th:nth-child(4), table.data-table td:nth-child(4) { display: none; }
}

/* Auth pages improvements */
.auth-container { max-width: 440px; width: 100%; }
@media (max-width: 480px) {
  main.auth-main { padding: 24px 16px; }
  .auth-container { width: 100%; }
}

/* Upload page responsive fixes */
@media (max-width: 600px) {
  .upload-mode-toggle { width: 100%; }
  .upload-mode-btn { flex: 1; justify-content: center; padding: 8px 10px; font-size: 12px; }
  .provider-stages { grid-template-columns: 1fr 1fr; }
  #readyActionsBox .btn { width: 100%; }
}

/* TMDB section responsive */
@media (max-width: 600px) {
  .tmdb-results-box { max-height: 220px; }
}

/* Better focus styles for accessibility */
*:focus-visible {
  outline: 2px solid var(--mint);
  outline-offset: 2px;
  border-radius: 4px;
}
button:focus-visible, a:focus-visible { outline: 2px solid var(--mint); outline-offset: 2px; }

/* Toast notification improvements */
#dashToastContainer { max-width: calc(100vw - 32px); }
@media (max-width: 480px) {
  #dashToastContainer { bottom: 16px; right: 16px; left: 16px; }
}

/* Improve form error display */
.error-alert {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: var(--red);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13.5px;
  margin-bottom: 16px;
}

/* Better card hover states */
.stat-card:hover { border-color: rgba(47, 230, 198, 0.2); box-shadow: 0 4px 16px rgba(0,0,0,0.04); }

/* Improve admin page responsive */
@media (max-width: 900px) {
  #adminDashboardLayout { grid-template-columns: 1fr; }
}

/* Light mode improvements */
:root:not([data-theme="dark"]) {
  --dark: #0d1626;
  --border-d: rgba(0,0,0,0.08);
}
:root:not([data-theme="dark"]) .dash-sidebar { background: #0d1626; }
:root:not([data-theme="dark"]) .theme-toggle { border-color: rgba(255,255,255,.25); color: #fff; }

/* Skip to content accessibility */
.skip-link {
  position: absolute;
  top: -40px;
  left: 16px;
  background: var(--mint);
  color: #04231d;
  padding: 8px 16px;
  border-radius: 0 0 8px 8px;
  font-weight: 600;
  font-size: 14px;
  z-index: 9999;
  transition: top 0.2s ease;
}
.skip-link:focus { top: 0; }

/* ============ GLOBAL INTERACTIVE COMPONENTS & ENHANCEMENTS ============ */

/* 1. Thin Scroll Progress Bar */
#scrollProgressBar {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0%;
  background: var(--blue-grad);
  z-index: 10000;
  transition: width 0.1s ease-out;
  pointer-events: none;
}

/* 2. Small Back-to-Top Button */
.back-to-top {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--card-bg);
  color: var(--ink);
  border: 1px solid var(--border-l);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition: opacity .25s ease, transform .25s ease, visibility .25s, border-color .15s ease, background-color .15s ease;
  z-index: 990;
}
.back-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.back-to-top:hover {
  background: var(--card-hover);
  border-color: var(--blue-primary);
  color: var(--blue-primary);
}
@media (max-width: 480px) {
  .back-to-top {
    bottom: 18px;
    right: 18px;
    width: 38px;
    height: 38px;
  }
}

/* 3. Simple Cookie Notice Banner */
.cookie-banner {
  position: fixed;
  bottom: 20px;
  left: 20px;
  right: 20px;
  max-width: 440px;
  background: var(--card-bg);
  border: 1px solid var(--border-l);
  border-radius: var(--radius);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.28);
  padding: 16px 20px;
  z-index: 9995;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transform: translateY(24px);
  opacity: 0;
  visibility: hidden;
  transition: opacity .3s ease, transform .3s ease, visibility .3s;
}
.cookie-banner.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.cookie-banner-content {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.cookie-banner-icon {
  color: var(--blue-primary);
  flex-shrink: 0;
  margin-top: 2px;
}
.cookie-banner-text {
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted);
}
.cookie-banner-actions {
  display: flex;
  gap: 8px;
  align-self: flex-end;
}

/* 4. Subtle Fade-In-On-Scroll Animation */
.fade-in-scroll {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.45s cubic-bezier(0.16, 1, 0.3, 1), transform 0.45s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: opacity, transform;
}
.fade-in-scroll.is-visible {
  opacity: 1;
  transform: translateY(0);
}
@media (prefers-reduced-motion: reduce) {
  .fade-in-scroll {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
}

/* 5. Password Visibility Toggle */
.password-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}
.password-input-wrap .form-control {
  padding-right: 44px;
}
.password-toggle-btn {
  position: absolute;
  right: 8px;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--muted);
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: color .15s ease;
  line-height: 1;
}
.password-toggle-btn:hover {
  color: var(--ink);
}

/* 6. Accessible Form Validation & Error States */
.form-control.is-invalid {
  border-color: var(--red) !important;
  background-color: rgba(239, 68, 68, 0.04);
}
.form-control.is-invalid:focus {
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
}
.form-control.is-valid {
  border-color: #10b981 !important;
}
.form-feedback {
  font-size: 12.5px;
  margin-top: 5px;
  display: block;
}
.form-feedback.error {
  color: var(--red);
  font-weight: 500;
}
.form-feedback.success {
  color: #10b981;
  font-weight: 500;
}

/* 7. Copy Button States */
.btn-copy {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
  transition: all .2s ease;
}
.btn-copy.copied {
  background: rgba(16, 185, 129, 0.12) !important;
  color: #10b981 !important;
  border-color: rgba(16, 185, 129, 0.3) !important;
}

/* 8. Global Mobile Navigation Drawer */
.mobile-nav-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  z-index: 1001;
  opacity: 0;
  visibility: hidden;
  transition: opacity .25s ease, visibility .25s;
}
.mobile-nav-backdrop.open {
  opacity: 1;
  visibility: visible;
}
.mobile-nav-drawer {
  position: fixed;
  top: 0;
  right: -320px;
  width: 290px;
  max-width: 86vw;
  height: 100vh;
  height: 100dvh;
  background: var(--card-bg);
  border-left: 1px solid var(--border-l);
  z-index: 1002;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  transition: right .28s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: -8px 0 28px rgba(0,0,0,0.35);
  overflow-y: auto;
}
.mobile-nav-drawer.open {
  right: 0;
}
.mobile-nav-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-l);
}
.mobile-nav-close {
  background: transparent;
  border: 1px solid var(--border-l);
  color: var(--ink);
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.mobile-nav-links {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}
.mobile-nav-links a {
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 10px;
  transition: background .15s ease, color .15s ease;
}
.mobile-nav-links a:hover {
  background: rgba(255,255,255,0.06);
  color: var(--blue-primary);
}
body.no-scroll {
  overflow: hidden !important;
  touch-action: none;
}

/* 9. Small-screen mobile overflow guard (320px - 414px) */
@media (max-width: 440px) {
  html, body {
    max-width: 100vw;
    overflow-x: hidden;
  }
  .wrap {
    padding: 0 14px;
  }
  .card {
    padding: 16px;
  }
  .table-wrap {
    margin: 0 -14px;
    border-radius: 0;
    border-left: none;
    border-right: none;
  }
  h1 { font-size: 26px !important; }
  h2 { font-size: 20px !important; }
}
