/* ══════════════════════════════════════════════════════════════════════════════
   VIDDLY — Global Stylesheet
   All custom CSS for every page. Loaded via:
     <link rel="stylesheet" href="/css/global.css"/>

   Sections:
     1.  Box-sizing reset
     2.  Base / Shared
     3.  Shared components  (.orb, .gradient-text, .glass, scrollbar, @keyframes)
     4.  Auth pages         (.page-auth  → login.html · register.html)
     5.  Landing page       (.page-landing → index.html)
     6.  Dashboard          (.page-dashboard → dashboard.html)
         6a. Design tokens / layout
         6b. Sidebar
         6c. Topbar & main
         6d. Cards, stats, inputs
         6e. Table & badges
         6f. Modals, toasts, tabs
         6g. Mobile bottom-nav & user sheet
         6h. Responsive breakpoints
══════════════════════════════════════════════════════════════════════════════ */


/* ── 1. Box-sizing reset ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }


/* ── 2. Base / Shared ────────────────────────────────────────────────────── */
html { overflow-x: hidden; }
body {
  background: #09090b;
  font-family: 'Inter', sans-serif;
  color: #fafafa;
  -webkit-font-smoothing: antialiased;
}

/* Common scrollbar */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #2d2d3d; border-radius: 99px; }

/* Spin keyframe (used in auth loading spinner + dashboard download button) */
@keyframes spin { to { transform: rotate(360deg); } }


/* ── 3. Shared components ────────────────────────────────────────────────── */

/* Blurred background orbs (auth + landing pages) */
.orb { position: absolute; border-radius: 50%; filter: blur(80px); pointer-events: none; }

/* Gradient headline text */
.gradient-text {
  background: linear-gradient(135deg, #fff 0%, #a78bfa 50%, #818cf8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Frosted glass card (landing page) */
.glass {
  background: rgba(255,255,255,0.04);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.08);
}

/* Base btn-primary (shared gradient core) */
.btn-primary {
  background: linear-gradient(135deg, #7c3aed, #4f46e5);
  border: none;
  border-radius: 10px;
  color: #fff;
  cursor: pointer;
  font-weight: 600;
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}


/* ── 4. Auth pages (login.html · register.html) ──────────────────────────── */

/* Auth-specific body */
.page-auth body { background: #080810; overflow: auto; }

/* Clerk component dark-theme overrides */
.cl-rootBox { width: 100% !important; }
.cl-card {
  background: rgba(255,255,255,0.03) !important;
  border: 1px solid rgba(255,255,255,0.08) !important;
  box-shadow: 0 24px 48px rgba(0,0,0,0.4) !important;
  border-radius: 20px !important;
}
.cl-headerTitle { color: #ffffff !important; }
.cl-headerSubtitle,
.cl-footerActionText,
.cl-formFieldLabel { color: #9ca3af !important; }
.cl-formFieldInput {
  background: rgba(0,0,0,0.35) !important;
  border: 1px solid rgba(255,255,255,0.1) !important;
  color: #e2e2e9 !important;
  border-radius: 10px !important;
}
.cl-formFieldInput:focus {
  border-color: #7c3aed !important;
  box-shadow: 0 0 0 3px rgba(124,58,237,0.15) !important;
  outline: none !important;
}
.cl-formButtonPrimary {
  background: linear-gradient(135deg,#7c3aed,#4f46e5) !important;
  border-radius: 10px !important;
  font-weight: 600 !important;
  box-shadow: 0 8px 24px rgba(124,58,237,0.3) !important;
}
.cl-footerActionLink,
.cl-identityPreviewEditButton { color: #a78bfa !important; }
.cl-dividerLine  { background: rgba(255,255,255,0.08) !important; }
.cl-dividerText  { color: #6b7280 !important; }
.cl-socialButtonsBlockButton {
  background: rgba(255,255,255,0.04) !important;
  border: 1px solid rgba(255,255,255,0.1) !important;
  color: #e2e2e9 !important;
  border-radius: 10px !important;
}
.cl-socialButtonsBlockButton:hover { background: rgba(255,255,255,0.08) !important; }
.cl-internal-b3fm6y { color: #6b7280 !important; }

/* Loading spinner */
.spinner {
  width: 36px; height: 36px;
  border: 3px solid rgba(124,58,237,0.2);
  border-top-color: #7c3aed;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* Auth form controls */
.form-input {
  width: 100%;
  background: rgba(0,0,0,0.35);
  border: 1px solid rgba(255,255,255,0.1);
  color: #e2e2e9;
  border-radius: 10px;
  padding: 11px 14px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  font-family: inherit;
}
.form-input:focus { border-color: #7c3aed; box-shadow: 0 0 0 3px rgba(124,58,237,0.15); }
.form-input::placeholder { color: #4b5563; }

/* Auth btn-primary — full-width submit */
.page-auth .btn-primary {
  width: 100%;
  padding: 12px;
  font-size: 14px;
  box-shadow: 0 8px 24px rgba(124,58,237,0.3);
  transition: opacity 0.2s, transform 0.1s;
  border-radius: 10px;
}
.page-auth .btn-primary:hover   { opacity: 0.9; }
.page-auth .btn-primary:active  { transform: scale(0.99); }
.page-auth .btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }

.field-error { color: #f87171; font-size: 12px; margin-top: 4px; display: none; }
.divider { display: flex; align-items: center; gap: 12px; margin: 20px 0; }
.divider hr { flex: 1; border: none; border-top: 1px solid rgba(255,255,255,0.08); }
.divider span { color: #4b5563; font-size: 12px; }
.btn-social {
  width: 100%; display: flex; align-items: center; justify-content: center; gap: 10px;
  background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1);
  color: #e2e2e9; border-radius: 10px; padding: 11px;
  font-size: 14px; font-weight: 500; cursor: pointer; transition: background 0.2s;
  font-family: inherit;
}
.btn-social:hover { background: rgba(255,255,255,0.09); }


/* ── 5. Landing page (index.html) ────────────────────────────────────────── */

.page-landing body { background: #080810; overflow-x: hidden; }

/* Landing btn-primary (links + CTA buttons — no width:100%) */
.page-landing .btn-primary { transition: all 0.3s ease; }
.page-landing .btn-primary::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.15), transparent);
  opacity: 0; transition: opacity 0.3s;
}
.page-landing .btn-primary:hover::after { opacity: 1; }
.page-landing .btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 20px 40px rgba(124,58,237,0.4);
}

/* Ghost button */
.btn-ghost {
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.04);
  transition: all 0.3s ease;
}
.btn-ghost:hover {
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.25);
  transform: translateY(-2px);
}

/* Feature cards */
.feature-card {
  background: linear-gradient(135deg, rgba(255,255,255,0.04) 0%, rgba(255,255,255,0.02) 100%);
  border: 1px solid rgba(255,255,255,0.07);
  transition: all 0.4s ease;
}
.feature-card:hover {
  border-color: rgba(124,58,237,0.4);
  transform: translateY(-4px);
  box-shadow: 0 20px 40px rgba(0,0,0,0.4), 0 0 0 1px rgba(124,58,237,0.2);
}

/* Step connector line */
.step-line::after {
  content: ''; position: absolute; top: 24px; left: calc(50% + 40px);
  width: calc(100% - 80px); height: 1px;
  background: linear-gradient(90deg, rgba(124,58,237,0.5), rgba(79,70,229,0.5));
}

/* Scrolled navbar */
.nav-scrolled {
  background: rgba(8,8,16,0.9) !important;
  border-bottom: 1px solid rgba(255,255,255,0.06) !important;
}

/* Landing mockup chrome */
.mockup-card { background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.08); border-radius: 16px; }
.url-bar     { background: rgba(0,0,0,0.4); border: 1px solid rgba(255,255,255,0.1); }
.counter     { font-variant-numeric: tabular-nums; }


/* ── 6. Dashboard (dashboard.html) ──────────────────────────────────────── */

/* 6a. Design tokens */
.page-dashboard {
  --bg:          #09090b;
  --surface:     #0d0d11;
  --card:        #111117;
  --card-hover:  #16161e;
  --border:      #1f1f2e;
  --border-muted:#18181f;
  --input-bg:    #0d0d14;
  --primary:     #7c3aed;
  --primary-fg:  #fff;
  --ring:        rgba(124,58,237,0.4);
  --success:     #10b981;
  --warning:     #f59e0b;
  --danger:      #ef4444;
  --info:        #3b82f6;
  --text:        #fafafa;
  --muted:       #a1a1aa;
  --subtle:      #52525b;
}
.page-dashboard body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
}
.page-dashboard html { height: 100%; }

/* 6b. App layout */
.app { display: flex; height: 100vh; overflow: hidden; }

/* 6c. Sidebar */
.sidebar {
  width: 260px; flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  transition: width 0.3s cubic-bezier(.4,0,.2,1);
  overflow: hidden; position: relative; z-index: 20;
}
.sidebar.collapsed { width: 68px; }
.sidebar-logo {
  padding: 18px 16px; display: flex; align-items: center; gap: 10px;
  border-bottom: 1px solid var(--border-muted); min-height: 64px;
}
.logo-icon { height: 32px; width: auto; flex-shrink: 0; }
.logo-text {
  font-weight: 800; font-size: 1rem; color: var(--text);
  white-space: nowrap; overflow: hidden; transition: opacity 0.2s, width 0.3s;
}
.sidebar.collapsed .logo-text { opacity: 0; width: 0; }

.nav-section { padding: 10px 8px; flex: 1; overflow-y: auto; overflow-x: hidden; }
.nav-label {
  font-size: 0.65rem; font-weight: 700; color: var(--subtle);
  text-transform: uppercase; letter-spacing: 0.1em;
  padding: 8px 10px 4px; white-space: nowrap; overflow: hidden; transition: opacity 0.2s;
}
.sidebar.collapsed .nav-label { opacity: 0; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: 8px; margin-bottom: 2px;
  color: var(--muted); font-size: 0.875rem; font-weight: 500;
  cursor: pointer; transition: all 0.15s ease; white-space: nowrap; overflow: hidden;
  position: relative; text-decoration: none;
}
.nav-item:hover  { background: rgba(255,255,255,0.05); color: var(--text); }
.nav-item.active { background: rgba(124,58,237,0.12); color: #a78bfa; }
.nav-item.active::before {
  content: ''; position: absolute; left: 0; top: 20%; bottom: 20%;
  width: 3px; background: #7c3aed; border-radius: 0 3px 3px 0;
}
.nav-icon { width: 20px; height: 20px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.nav-text { white-space: nowrap; transition: opacity 0.2s; }
.sidebar.collapsed .nav-text { opacity: 0; width: 0; overflow: hidden; }
.nav-badge {
  margin-left: auto; background: rgba(124,58,237,0.2); color: #a78bfa;
  font-size: 0.65rem; font-weight: 700; padding: 1px 6px;
  border-radius: 99px; flex-shrink: 0;
}
.sidebar.collapsed .nav-badge { display: none; }

.sidebar-footer { padding: 12px 8px; border-top: 1px solid var(--border-muted); }
.user-row {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px;
  border-radius: 8px; transition: background 0.15s; overflow: hidden; cursor: pointer;
}
.user-row:hover { background: rgba(255,255,255,0.05); }
.user-avatar {
  width: 32px; height: 32px; border-radius: 99px;
  background: linear-gradient(135deg,#7c3aed,#4f46e5);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.8rem; flex-shrink: 0; overflow: hidden;
}
.user-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 99px; }
.user-info { flex: 1; min-width: 0; transition: opacity 0.2s; }
.sidebar.collapsed .user-info { opacity: 0; width: 0; }
.user-name { font-size: 0.8rem; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 0.7rem; color: var(--subtle); }
.logout-icon { flex-shrink: 0; transition: opacity 0.2s; }
.sidebar.collapsed .logout-icon { opacity: 0; width: 0; overflow: hidden; }

/* 6d. Main area */
.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

/* Topbar */
.topbar {
  height: 68px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 32px; border-bottom: 1px solid var(--border); flex-shrink: 0;
  background: var(--surface);
}
.topbar-left  { display: flex; align-items: center; gap: 12px; }
.collapse-btn {
  width: 32px; height: 32px; border-radius: 8px; background: none;
  border: 1px solid var(--border); color: var(--muted); cursor: pointer;
  display: flex; align-items: center; justify-content: center; transition: all 0.15s;
}
.collapse-btn:hover { background: rgba(255,255,255,0.06); color: var(--text); }
.breadcrumb { display: flex; align-items: center; gap: 6px; font-size: 0.85rem; color: var(--muted); }
.breadcrumb-sep     { color: var(--subtle); }
.breadcrumb-current { color: var(--text); font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.icon-btn {
  width: 36px; height: 36px; border-radius: 8px; background: none;
  border: 1px solid var(--border); color: var(--muted); cursor: pointer;
  display: flex; align-items: center; justify-content: center; transition: all 0.15s;
}
.icon-btn:hover { background: rgba(255,255,255,0.06); color: var(--text); }

/* Content */
.content { flex: 1; overflow-y: auto; padding: 32px; }

/* 6e. Cards */
.card       { background: var(--card); border: 1px solid var(--border); border-radius: 14px; }
.card-hover { transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s; }
.card-hover:hover {
  border-color: rgba(124,58,237,0.25);
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}

/* Stats */
.stat-icon  { width: 44px; height: 44px; border-radius: 12px; display: flex; align-items: center; justify-content: center; }
.stat-value { font-size: 1.75rem; font-weight: 800; color: var(--text); line-height: 1; }
.stat-label { font-size: 0.75rem; color: var(--muted); margin-top: 4px; font-weight: 500; }
.stat-trend { font-size: 0.72rem; font-weight: 600; padding: 2px 7px; border-radius: 99px; }

/* URL input */
.url-input {
  background: var(--input-bg); border: 1px solid var(--border);
  border-radius: 10px; padding: 12px 16px; color: var(--text);
  font-family: inherit; font-size: 0.9rem; flex: 1;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.url-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--ring); }
.url-input::placeholder { color: var(--subtle); }

/* Dashboard btn-primary */
.page-dashboard .btn-primary {
  font-family: inherit; font-size: 0.875rem;
  padding: 12px 22px; white-space: nowrap;
  transition: all 0.25s ease;
}
.page-dashboard .btn-primary::after {
  content: ''; position: absolute; inset: 0;
  background: rgba(255,255,255,0); transition: background 0.2s;
}
.page-dashboard .btn-primary:hover::after { background: rgba(255,255,255,0.08); }
.page-dashboard .btn-primary:hover  { transform: translateY(-1px); box-shadow: 0 8px 24px rgba(124,58,237,0.4); }
.page-dashboard .btn-primary:active { transform: translateY(0); }
.page-dashboard .btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }

.btn-secondary {
  background: rgba(255,255,255,0.05); border: 1px solid var(--border);
  border-radius: 10px; color: var(--muted); font-family: inherit;
  font-size: 0.82rem; font-weight: 500; padding: 8px 14px;
  cursor: pointer; transition: all 0.15s;
}
.btn-secondary:hover { background: rgba(255,255,255,0.09); color: var(--text); border-color: rgba(255,255,255,0.12); }

/* 6f. Table */
.tbl { width: 100%; border-collapse: collapse; }
.tbl th {
  text-align: left; font-size: 0.72rem; font-weight: 600;
  color: var(--subtle); text-transform: uppercase;
  letter-spacing: 0.06em; padding: 0 12px 12px;
}
.tbl td { padding: 13px 12px; vertical-align: middle; }
.tbl tbody tr { border-top: 1px solid var(--border-muted); transition: background 0.15s; }
.tbl tbody tr:hover { background: rgba(255,255,255,0.025); }

/* Status badges */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 99px;
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.02em;
}
.badge-done    { background: rgba(16,185,129,0.12); color: #34d399; border: 1px solid rgba(16,185,129,0.2); }
.badge-dl      { background: rgba(59,130,246,0.12); color: #60a5fa; border: 1px solid rgba(59,130,246,0.2); }
.badge-pending { background: rgba(245,158,11,0.12); color: #fbbf24; border: 1px solid rgba(245,158,11,0.2); }
.badge-failed  { background: rgba(239,68,68,0.12);  color: #f87171; border: 1px solid rgba(239,68,68,0.2); }
.dot { width: 6px; height: 6px; border-radius: 99px; display: inline-block; }
.dot-done    { background: #34d399; }
.dot-dl      { background: #60a5fa; animation: pulse 1.5s infinite; }
.dot-pending { background: #fbbf24; animation: pulse 2s infinite; }
.dot-failed  { background: #f87171; }
@keyframes pulse { 0%,100% { opacity:1; } 50% { opacity:.4; } }

/* Action buttons */
.act-btn {
  width: 30px; height: 30px; border-radius: 7px; background: transparent; border: none;
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
  color: var(--subtle); transition: all 0.15s;
}
.act-btn:hover       { background: rgba(255,255,255,0.08); color: var(--text); }
.act-btn.play:hover  { background: rgba(124,58,237,0.15); color: #a78bfa; }
.act-btn.save:hover  { background: rgba(16,185,129,0.12); color: #34d399; }
.act-btn.del:hover   { background: rgba(239,68,68,0.12);  color: #f87171; }

/* Skeleton */
.skel {
  background: linear-gradient(90deg, #1c1c28 25%, #23232f 50%, #1c1c28 75%);
  background-size: 200% 100%; animation: shimmer 1.5s infinite; border-radius: 6px;
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* 6g. Toast */
.toast-wrap {
  position: fixed; bottom: 24px; right: 24px; z-index: 9999;
  display: flex; flex-direction: column; gap: 10px; pointer-events: none;
}
.toast {
  min-width: 280px; padding: 14px 16px; border-radius: 12px; pointer-events: all;
  display: flex; align-items: center; gap: 10px; font-size: 0.875rem; font-weight: 500;
  backdrop-filter: blur(12px); box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}
.toast-success { background: rgba(16,185,129,0.12); border: 1px solid rgba(16,185,129,0.3); color: #34d399; }
.toast-error   { background: rgba(239,68,68,0.12);  border: 1px solid rgba(239,68,68,0.3);  color: #f87171; }
.toast-info    { background: rgba(59,130,246,0.12); border: 1px solid rgba(59,130,246,0.3); color: #60a5fa; }

/* Video modal */
.modal-overlay {
  position: fixed; inset: 0; z-index: 9000;
  display: flex; align-items: center; justify-content: center; padding: 20px;
  background: rgba(0,0,0,0); backdrop-filter: blur(0px);
  transition: all 0.3s ease; pointer-events: none;
}
.modal-overlay.open { background: rgba(0,0,0,0.8); backdrop-filter: blur(8px); pointer-events: all; }
.modal-box {
  background: #0d0d11; border: 1px solid #1f1f2e; border-radius: 20px;
  width: 100%; max-width: 920px; overflow: hidden;
  box-shadow: 0 40px 80px rgba(0,0,0,0.7);
  transform: scale(0.95); opacity: 0;
  transition: all 0.3s cubic-bezier(0.34,1.56,0.64,1);
}
.modal-overlay.open .modal-box { transform: scale(1); opacity: 1; }
#videoPlayer { width: 100%; display: block; max-height: 68vh; background: #000; }
.modal-topbar {
  padding: 14px 18px; display: flex; justify-content: space-between;
  align-items: center; border-bottom: 1px solid var(--border);
}
.modal-btmbar {
  padding: 12px 18px; display: flex; align-items: center;
  justify-content: space-between; border-top: 1px solid var(--border);
}
.modal-close {
  background: rgba(255,255,255,0.06); border: 1px solid var(--border);
  color: var(--muted); cursor: pointer; width: 30px; height: 30px;
  border-radius: 7px; display: flex; align-items: center; justify-content: center;
  font-size: 0.8rem; transition: all 0.15s;
}
.modal-close:hover { background: rgba(239,68,68,0.15); border-color: rgba(239,68,68,0.3); color: #f87171; }

/* Tabs */
.tabs {
  display: flex; gap: 2px; background: rgba(255,255,255,0.04);
  border: 1px solid var(--border); border-radius: 10px; padding: 3px;
}
.tab-btn {
  flex: 1; padding: 7px 14px; border-radius: 7px; border: none;
  font-family: inherit; font-size: 0.82rem; font-weight: 500; cursor: pointer;
  transition: all 0.15s; background: transparent; color: var(--muted);
}
.tab-btn.active        { background: rgba(124,58,237,0.15); color: #a78bfa; }
.tab-btn:hover:not(.active) { color: var(--text); background: rgba(255,255,255,0.04); }

/* Empty state */
.empty { text-align: center; padding: 60px 20px; }
.empty-icon  { font-size: 3rem; margin-bottom: 16px; filter: grayscale(0.4); }
.empty-title { font-size: 1rem; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.empty-sub   { font-size: 0.85rem; color: var(--muted); }

/* Progress bar (downloading/converting/uploading) */
.progress-wrap {
  height: 3px; background: rgba(255,255,255,0.08);
  border-radius: 99px; overflow: hidden; margin-top: 6px;
}
.progress-bar {
  height: 100%; background: linear-gradient(90deg,#7c3aed,#4f46e5);
  border-radius: 99px; animation: progress-indeterminate 1.5s ease-in-out infinite;
}
@keyframes progress-indeterminate {
  0%   { transform: translateX(-100%); width: 50%; }
  100% { transform: translateX(250%);  width: 50%; }
}

/* Glow helpers */
.glow-purple { box-shadow: 0 0 24px rgba(124,58,237,0.25); }
.glow-green  { box-shadow: 0 0 24px rgba(16,185,129,0.2); }
.glow-blue   { box-shadow: 0 0 24px rgba(59,130,246,0.2); }
.glow-red    { box-shadow: 0 0 24px rgba(239,68,68,0.2); }

/* 6h. Mobile bottom nav */
.mobile-nav {
  display: none;
  position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--surface); border-top: 1px solid var(--border);
  z-index: 50; padding: 8px 0 max(8px, env(safe-area-inset-bottom));
}
.mobile-nav-inner { display: flex; justify-content: space-around; align-items: center; }
.mobile-nav-btn {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 6px 10px; border-radius: 10px; background: none; border: none;
  color: var(--subtle); cursor: pointer;
  font-size: 0.6rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em;
  transition: color 0.15s; text-decoration: none; min-width: 56px; font-family: inherit;
}
.mobile-nav-btn.active { color: #a78bfa; }
.mobile-nav-btn svg { width: 22px; height: 22px; }
.mobile-nav-avatar {
  width: 28px; height: 28px; border-radius: 50%; overflow: hidden;
  background: linear-gradient(135deg,#7c3aed,#4f46e5);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.75rem; color: #fff; flex-shrink: 0;
}
.mobile-nav-avatar img { width: 100%; height: 100%; object-fit: cover; }

/* Sidebar backdrop (mobile — kept for JS compatibility, hidden by default) */
.sidebar-backdrop {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.6); z-index: 199;
  backdrop-filter: blur(2px);
}
.sidebar-backdrop.show { display: block; }

/* User bottom sheet */
.user-sheet-backdrop {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.65); z-index: 299;
  backdrop-filter: blur(4px);
}
.user-sheet-backdrop.show { display: block; }
.user-sheet {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 300;
  background: var(--surface); border-top: 1px solid var(--border);
  border-radius: 20px 20px 0 0;
  padding: 12px 20px max(20px, env(safe-area-inset-bottom));
  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.34,1.56,0.64,1);
}
.user-sheet.open { transform: translateY(0); }
.user-sheet-handle {
  width: 36px; height: 4px; background: var(--border);
  border-radius: 99px; margin: 0 auto 18px;
}
.user-sheet-avatar {
  width: 56px; height: 56px; border-radius: 50%; overflow: hidden;
  background: linear-gradient(135deg,#7c3aed,#4f46e5);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem; font-weight: 700; color: #fff; margin: 0 auto 12px;
}
.user-sheet-avatar img { width: 100%; height: 100%; object-fit: cover; }
.user-sheet-name  { text-align: center; font-size: 1rem; font-weight: 700; color: var(--text); }
.user-sheet-email { text-align: center; font-size: 0.8rem; color: var(--muted); margin-top: 2px; }
.user-sheet-role  { display: flex; align-items: center; justify-content: center; margin-top: 8px; }
.user-sheet-divider { border: none; border-top: 1px solid var(--border); margin: 16px 0; }
.user-sheet-action {
  display: flex; align-items: center; gap: 12px; padding: 13px 16px;
  border-radius: 12px; background: none; border: none; width: 100%; cursor: pointer;
  color: var(--text); font-family: inherit; font-size: 0.9rem; font-weight: 500;
  transition: background 0.15s; text-align: left;
}
.user-sheet-action:hover        { background: rgba(255,255,255,0.06); }
.user-sheet-action.danger       { color: #f87171; }
.user-sheet-action.danger:hover { background: rgba(239,68,68,0.1); }

/* Mobile table → cards */
@media (max-width: 768px) {
  .tbl thead { display: none; }
  .tbl, .tbl tbody { display: block; }
  .tbl tbody tr {
    display: block; background: var(--card); border: 1px solid var(--border);
    border-radius: 12px; margin-bottom: 10px; padding: 12px 14px;
    border-top: 1px solid var(--border) !important;
  }
  .tbl tbody tr:hover { background: var(--card-hover); }
  .tbl td { display: flex; align-items: center; padding: 3px 0; font-size: 0.82rem; }
  .tbl td:first-child { margin-bottom: 6px; display: block; }
  .tbl td:first-child div:first-child { font-size: 0.88rem; white-space: normal !important; }
  .tbl td:nth-child(3),
  .tbl td:nth-child(4) { display: none; }
  .tbl td:last-child {
    justify-content: flex-end; margin-top: 8px;
    padding-top: 8px; border-top: 1px solid var(--border-muted);
  }
}

/* 6i. Responsive breakpoints */

/* Tablet (≤ 1024px) */
@media (max-width: 1024px) {
  #statsGrid { grid-template-columns: repeat(2, 1fr) !important; }
}

/* Mobile (≤ 768px) */
@media (max-width: 768px) {
  .page-dashboard html,
  .page-dashboard body { overflow: auto; height: auto; }

  .app  { display: block; height: auto; overflow: visible; min-height: 100vh; }
  .main { width: 100vw; display: flex; flex-direction: column; overflow: visible; }

  /* Sidebar: completely hidden on mobile — bottom nav takes over */
  .sidebar { display: none !important; }

  /* Hide hamburger — no sidebar to toggle on mobile */
  .collapse-btn { display: none !important; }

  /* Topbar */
  .topbar {
    padding: 0 16px; height: 58px;
    position: sticky; top: 0; z-index: 18; width: 100%;
  }
  .topbar-right > div:last-child > span { display: none; }
  .topbar-right > div:last-child > svg  { display: none; }
  .breadcrumb { font-size: 0.78rem; }

  /* Content */
  .content { padding: 14px; padding-bottom: 88px; overflow: visible; }

  /* Stats grid: 2×2 */
  #statsGrid { grid-template-columns: repeat(2, 1fr) !important; gap: 10px !important; }

  /* Download card: stack input + button */
  #dlCard .dl-row { flex-direction: column !important; }
  #dlCard .dl-row .btn-primary { width: 100%; justify-content: center; }

  /* Page header: stack */
  .page-header { flex-direction: column !important; align-items: flex-start !important; gap: 10px !important; }
  .page-header > button { align-self: flex-start; }

  /* Admin stats grid: 2×2 */
  .admin-stats-grid { grid-template-columns: repeat(2, 1fr) !important; }

  /* Modal: bottom sheet */
  .modal-overlay { padding: 0; align-items: flex-end; }
  .modal-box { border-radius: 20px 20px 0 0; max-width: 100%; }
  #videoPlayer { max-height: 50vh; }

  /* Toast: above bottom nav */
  .toast-wrap { bottom: 76px; right: 10px; left: 10px; }
  .toast { min-width: 0; width: 100%; }

  /* Confirm modal: safe padding */
  #confirmBox { margin: 0 16px; }

  /* Show mobile bottom nav */
  .mobile-nav { display: block; }
}

/* Small mobile (≤ 380px) */
@media (max-width: 380px) {
  #statsGrid  { grid-template-columns: 1fr 1fr !important; }
  .stat-value { font-size: 1.35rem; }
  .content    { padding: 10px; padding-bottom: 80px; }
  .topbar     { padding: 0 10px; }
}
