/* ═══════════════════════════════════════════════════════
   DocuScan — Modern SaaS UI
   Clean white light mode + deep navy dark mode
   Blue/purple brand — matches reference design
═══════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

/* ── Tokens ─────────────────────────────────────────── */
:root {
  /* Brand — electric indigo */
  --brand:        #635bff;
  --brand-light:  #818cf8;
  --brand-dark:   #4b44e0;
  --brand-glow:   rgba(99,91,255,.22);
  --brand-subtle: rgba(99,91,255,.07);

  /* Light mode — crisp white like reference image */
  --bg:           #f4f6fb;
  --bg-card:      #ffffff;
  --bg-card2:     #f0f2f9;
  --bg-input:     #ffffff;
  --sidebar-bg:   #ffffff;
  --topbar-bg:    #ffffff;

  /* Light borders */
  --border:       #e8eaf4;
  --border-md:    #d4d6e8;

  /* Light text */
  --text-1:       #111827;
  --text-2:       #4b5577;
  --text-3:       #9ba3c0;

  /* Status */
  --success:      #10b981;
  --warning:      #f59e0b;
  --danger:       #ef4444;
  --info:         #3b82f6;

  /* Shadows — soft blue tint */
  --shadow-xs:    0 1px 3px rgba(17,24,39,.05), 0 1px 2px rgba(99,91,255,.03);
  --shadow-sm:    0 2px 8px rgba(17,24,39,.07), 0 2px 6px rgba(99,91,255,.04);
  --shadow-md:    0 4px 20px rgba(17,24,39,.09), 0 4px 12px rgba(99,91,255,.06);
  --shadow-lg:    0 8px 40px rgba(17,24,39,.12), 0 8px 20px rgba(99,91,255,.08);
  --shadow-brand: 0 4px 16px rgba(99,91,255,.32);

  /* Layout */
  --sidebar-w:    240px;
  --topbar-h:     64px;
  --radius:       12px;
  --radius-sm:    8px;
  --radius-lg:    16px;
  --radius-xl:    24px;
  --transition:   0.18s cubic-bezier(.4,0,.2,1);
}

[data-theme="dark"] {
  --bg:           #080c18;
  --bg-card:      #0f1426;
  --bg-card2:     #161d35;
  --bg-input:     #1a2240;
  --sidebar-bg:   #0b0f20;
  --topbar-bg:    #0b0f20;
  --border:       #1e2640;
  --border-md:    #283050;
  --text-1:       #e8edf8;
  --text-2:       #8892b0;
  --text-3:       #4a5580;
  --shadow-xs:    0 1px 3px rgba(0,0,0,.35);
  --shadow-sm:    0 2px 8px rgba(0,0,0,.45);
  --shadow-md:    0 4px 20px rgba(0,0,0,.55);
  --shadow-lg:    0 8px 40px rgba(0,0,0,.65);
  --brand-subtle: rgba(99,91,255,.1);
}

/* ── Reset ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  background: var(--bg);
  color: var(--text-1);
  -webkit-font-smoothing: antialiased;
  transition: background var(--transition), color var(--transition);
}
a { text-decoration: none; color: inherit; }
button { font-family: inherit; cursor: pointer; }
img { display: block; max-width: 100%; }

/* ── App Layout ─────────────────────────────────────── */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 200;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  transition: transform var(--transition);
}
.sidebar::-webkit-scrollbar { width: 0; }

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 20px 18px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.logo-icon {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-light) 100%);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-brand);
  flex-shrink: 0;
}
.logo-icon svg { width: 18px; height: 18px; color: #fff; }
.logo-text {
  font-size: 16px;
  font-weight: 800;
  color: var(--text-1);
  letter-spacing: -.3px;
}
.logo-text span { color: var(--brand); }

/* Company switcher */
.company-switcher {
  margin: 12px;
  padding: 10px 12px;
  background: var(--bg-card2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: all var(--transition);
}
.company-switcher:hover { border-color: var(--brand); background: var(--brand-subtle); }
.company-avatar {
  width: 28px; height: 28px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
}
.company-name {
  flex: 1;
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-1);
}
.company-chevron { color: var(--text-3); flex-shrink: 0; }

/* Nav sections */
.nav-section { padding: 8px 12px 4px; }
.nav-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 0 8px;
  margin-bottom: 4px;
  display: block;
}
.nav-list { list-style: none; display: flex; flex-direction: column; gap: 1px; }
.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-size: 13.5px;
  font-weight: 500;
  transition: all var(--transition);
  position: relative;
}
.nav-link svg { width: 16px; height: 16px; flex-shrink: 0; }
.nav-link:hover {
  background: var(--brand-subtle);
  color: var(--brand);
}
.nav-link.active {
  background: var(--brand-subtle);
  color: var(--brand);
  font-weight: 600;
}
.nav-link.active::before {
  content: '';
  position: absolute;
  left: 0; top: 20%; bottom: 20%;
  width: 3px;
  background: var(--brand);
  border-radius: 0 3px 3px 0;
}
.nav-badge {
  margin-left: auto;
  background: var(--brand);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 20px;
  line-height: 1.4;
}

/* Sidebar footer */
.sidebar-footer {
  margin-top: auto;
  padding: 12px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition);
}
.sidebar-user:hover { background: var(--bg-card2); }
.user-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border);
}
.user-name { font-size: 13px; font-weight: 600; color: var(--text-1); }
.user-role { font-size: 11px; color: var(--text-3); }

/* Plan pill in sidebar */
.plan-pill {
  margin: 0 12px 12px;
  padding: 12px 14px;
  background: linear-gradient(135deg, var(--brand-subtle) 0%, rgba(99,91,255,.12) 100%);
  border: 1px solid rgba(99,91,255,.2);
  border-radius: var(--radius-sm);
}
.plan-pill-label { font-size: 10px; color: var(--text-3); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.plan-pill-name { font-size: 13px; font-weight: 700; color: var(--brand); margin-top: 2px; }
.plan-pill-status { font-size: 11px; color: var(--success); margin-top: 2px; display: flex; align-items: center; gap: 4px; }

/* ── Main content ───────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── Topbar ─────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}
.topbar-left { display: flex; align-items: center; gap: 14px; }
.topbar-right { display: flex; align-items: center; gap: 8px; }
.page-title { font-size: 17px; font-weight: 700; color: var(--text-1); }
.breadcrumb { font-size: 12px; color: var(--text-3); display: flex; align-items: center; gap: 6px; }
.breadcrumb a { color: var(--text-2); }
.breadcrumb a:hover { color: var(--brand); }

/* Topbar icon button */
.icon-btn {
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  background: var(--bg-card2);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-2);
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
}
.icon-btn svg { width: 16px; height: 16px; }
.icon-btn:hover { background: var(--brand-subtle); color: var(--brand); border-color: rgba(99,91,255,.3); }
.icon-btn .dot {
  position: absolute;
  top: 6px; right: 6px;
  width: 7px; height: 7px;
  background: var(--danger);
  border-radius: 50%;
  border: 2px solid var(--topbar-bg);
}

/* Theme toggle */
.theme-toggle {
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  background: var(--bg-card2);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-2);
  cursor: pointer;
  transition: all var(--transition);
}
.theme-toggle:hover { color: var(--brand); border-color: rgba(99,91,255,.3); }
.theme-toggle svg { width: 16px; height: 16px; }

/* ── Page content ───────────────────────────────────── */
.page-content { padding: 24px; flex: 1; }
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}
.page-header-title { font-size: 20px; font-weight: 800; }
.page-header-sub { font-size: 13px; color: var(--text-2); margin-top: 2px; }

/* ── Cards ──────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xs);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.card:hover { box-shadow: var(--shadow-sm); }
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.card-title { font-size: 14px; font-weight: 700; color: var(--text-1); }
.card-body { padding: 20px; }

/* ── Stat cards ─────────────────────────────────────── */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px,1fr)); gap: 16px; }
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  box-shadow: var(--shadow-xs);
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--stat-color, var(--brand));
  opacity: .6;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: rgba(99,91,255,.2); }
.stat-icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  background: var(--stat-bg, var(--brand-subtle));
}
.stat-icon svg { width: 20px; height: 20px; color: var(--stat-color, var(--brand)); }
.stat-value { font-size: 26px; font-weight: 800; line-height: 1.1; letter-spacing: -.5px; }
.stat-label { font-size: 12px; color: var(--text-2); margin-top: 3px; font-weight: 500; }
.stat-change { font-size: 11px; margin-top: 6px; font-weight: 600; display: flex; align-items: center; gap: 3px; }
.stat-change.up { color: var(--success); }
.stat-change.down { color: var(--danger); }

/* ── Buttons ────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  letter-spacing: -.1px;
}
.btn svg { width: 15px; height: 15px; flex-shrink: 0; }
.btn-primary {
  background: var(--brand);
  color: #fff;
  box-shadow: 0 2px 8px var(--brand-glow);
}
.btn-primary:hover {
  background: var(--brand-dark);
  transform: translateY(-1px);
  box-shadow: var(--shadow-brand);
}
.btn-secondary {
  background: var(--bg-card2);
  color: var(--text-1);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--border); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #e0003a; }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #00a87e; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-warning:hover { background: #e0a000; }
.btn-info { background: var(--info); color: #fff; }
.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-1);
}
.btn-outline:hover { background: var(--bg-card2); }
.btn-ghost {
  background: transparent;
  color: var(--text-2);
  border: none;
}
.btn-ghost:hover { background: var(--bg-card2); color: var(--text-1); }
.btn-sm { padding: 6px 13px; font-size: 12.5px; }
.btn-lg { padding: 12px 28px; font-size: 15px; border-radius: var(--radius); }
.btn-icon { padding: 8px; border-radius: var(--radius-sm); }
.btn-icon svg { width: 16px; height: 16px; }
.w-full { width: 100%; }

/* ── Forms ──────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }
.form-label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 7px;
  letter-spacing: .01em;
}
.form-control {
  display: block;
  width: 100%;
  padding: 10px 14px;
  font-size: 13.5px;
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  color: var(--text-1);
  outline: none;
  transition: all var(--transition);
}
.form-control:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-glow);
}
.form-control::placeholder { color: var(--text-3); }
.form-hint { font-size: 11.5px; color: var(--text-3); margin-top: 5px; }
.form-error { font-size: 12px; color: var(--danger); margin-top: 5px; display: flex; align-items: center; gap: 4px; }
.input-group { display: flex; }
.input-group .form-control { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.input-group .btn { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; flex-shrink: 0; }
.input-icon { position: relative; }
.input-icon .form-control { padding-left: 38px; }
.input-icon svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--text-3); pointer-events: none; }

/* ── Table ──────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th {
  padding: 11px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-3);
  background: var(--bg-card2);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table td {
  padding: 13px 16px;
  font-size: 13.5px;
  color: var(--text-1);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.table tbody tr { transition: background var(--transition); }
.table tbody tr:hover { background: var(--bg-card2); }
.table tbody tr:last-child td { border-bottom: none; }

/* ── Badges ─────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .02em;
  white-space: nowrap;
}
.badge svg { width: 10px; height: 10px; }
.badge-success { background: rgba(0,200,150,.1); color: #00a87e; border: 1px solid rgba(0,200,150,.2); }
.badge-danger  { background: rgba(255,77,106,.1); color: var(--danger); border: 1px solid rgba(255,77,106,.2); }
.badge-warning { background: rgba(255,184,0,.1);  color: #cc9400; border: 1px solid rgba(255,184,0,.2); }
.badge-info    { background: rgba(59,130,246,.1); color: var(--info); border: 1px solid rgba(59,130,246,.2); }
.badge-purple  { background: var(--brand-subtle); color: var(--brand); border: 1px solid rgba(99,91,255,.2); }
.badge-gray    { background: var(--bg-card2); color: var(--text-2); border: 1px solid var(--border); }

/* ── Alerts ─────────────────────────────────────────── */
.alert {
  padding: 13px 16px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 16px;
  border: 1px solid;
}
.alert svg { width: 16px; height: 16px; flex-shrink: 0; margin-top: 1px; }
.alert-success { background: rgba(0,200,150,.06); border-color: rgba(0,200,150,.25); color: #00a87e; }
.alert-danger  { background: rgba(255,77,106,.06); border-color: rgba(255,77,106,.25); color: var(--danger); }
.alert-warning { background: rgba(255,184,0,.06);  border-color: rgba(255,184,0,.25);  color: #cc9400; }
.alert-info    { background: rgba(59,130,246,.06); border-color: rgba(59,130,246,.25); color: var(--info); }
[data-theme="dark"] .alert-success { color: #00e6ac; }
[data-theme="dark"] .alert-danger  { color: #ff7091; }
[data-theme="dark"] .alert-warning { color: #ffd040; }
[data-theme="dark"] .alert-info    { color: #6ba3ff; }

/* ── File grid ──────────────────────────────────────── */
.file-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(175px,1fr)); gap: 14px; }
.file-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
}
.file-card:hover { border-color: var(--brand); box-shadow: var(--shadow-md); transform: translateY(-3px); }
.file-card .thumb {
  aspect-ratio: 4/3;
  background: var(--bg-card2);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  position: relative;
}
.file-card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.file-card .thumb .file-icon svg { width: 40px; height: 40px; color: var(--text-3); }
.file-card .file-info { padding: 10px 12px; }
.file-card .file-name { font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-card .file-meta { font-size: 11px; color: var(--text-3); margin-top: 3px; }
.file-card .file-actions {
  position: absolute; top: 6px; right: 6px;
  display: none; gap: 4px;
}
.file-card:hover .file-actions { display: flex; }
.file-card .file-actions button {
  background: rgba(0,0,0,.65);
  backdrop-filter: blur(4px);
  color: #fff;
  border: none;
  border-radius: 6px;
  width: 28px; height: 28px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background var(--transition);
}
.file-card .file-actions button:hover { background: rgba(0,0,0,.85); }
.file-card .file-actions button svg { width: 13px; height: 13px; }

/* Folder card */
.folder-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: all var(--transition);
  color: var(--text-1);
}
.folder-card:hover { border-color: var(--brand); background: var(--brand-subtle); transform: translateY(-2px); }
.folder-card svg { width: 28px; height: 28px; flex-shrink: 0; }
.folder-name { font-size: 13px; font-weight: 600; }
.folder-count { font-size: 11px; color: var(--text-3); }

/* ── Scanner ────────────────────────────────────────── */
.scanner-container {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 20px;
  height: calc(100vh - var(--topbar-h) - 48px);
}
.camera-panel {
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border);
}
#cameraFeed { width: 100%; height: 100%; object-fit: contain; }
.doc-border {
  position: absolute;
  inset: 40px;
  border: 2px solid rgba(99,91,255,.7);
  border-radius: 4px;
  box-shadow: 0 0 0 4000px rgba(0,0,0,.25);
  pointer-events: none;
}
.doc-border::before, .doc-border::after, .doc-border .c3, .doc-border .c4 {
  content: '';
  position: absolute;
  width: 20px; height: 20px;
  border-color: var(--brand-light);
  border-style: solid;
}
.doc-border::before  { top: -2px; left: -2px;   border-width: 3px 0 0 3px; }
.doc-border::after   { top: -2px; right: -2px;  border-width: 3px 3px 0 0; }
.doc-border .c3      { bottom: -2px; left: -2px; border-width: 0 0 3px 3px; }
.doc-border .c4      { bottom: -2px; right: -2px;border-width: 0 3px 3px 0; }
.camera-controls {
  position: absolute;
  bottom: 24px; left: 0; right: 0;
  display: flex; align-items: center; justify-content: center; gap: 20px;
}
.capture-btn {
  width: 68px; height: 68px;
  border-radius: 50%;
  background: #fff;
  border: 4px solid rgba(255,255,255,.3);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 24px rgba(0,0,0,.5);
  transition: all var(--transition);
}
.capture-btn:hover { transform: scale(1.08); }
.capture-btn:active { transform: scale(.96); }
.capture-btn svg { width: 28px; height: 28px; color: var(--brand); }
.camera-ctrl-btn {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.2);
  color: #fff;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(8px);
  transition: background var(--transition);
}
.camera-ctrl-btn:hover { background: rgba(255,255,255,.22); }
.camera-ctrl-btn svg { width: 18px; height: 18px; }
.scanner-panel { display: flex; flex-direction: column; gap: 14px; overflow-y: auto; }
.page-thumb {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px;
  display: flex; align-items: center; gap: 10px;
}
.page-thumb img { width: 44px; height: 56px; object-fit: cover; border-radius: 4px; border: 1px solid var(--border); }
.page-num { font-size: 12px; font-weight: 600; color: var(--text-2); }
.del-page {
  margin-left: auto;
  background: none; border: none;
  color: var(--danger); cursor: pointer;
  padding: 4px; border-radius: 4px;
  display: flex; align-items: center;
  transition: background var(--transition);
}
.del-page:hover { background: rgba(255,77,106,.1); }
.del-page svg { width: 14px; height: 14px; }

/* ── Auth ───────────────────────────────────────────── */
.auth-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: 24px;
  position: relative;
  overflow: hidden;
}
.auth-wrapper::before {
  content: '';
  position: absolute;
  top: -200px; left: -200px;
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(99,91,255,.12) 0%, transparent 70%);
  pointer-events: none;
}
.auth-wrapper::after {
  content: '';
  position: absolute;
  bottom: -200px; right: -200px;
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(99,91,255,.08) 0%, transparent 70%);
  pointer-events: none;
}
.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 40px;
  box-shadow: var(--shadow-lg);
  position: relative;
  z-index: 1;
}
.auth-logo { text-align: center; margin-bottom: 28px; }
.auth-logo-icon {
  width: 52px; height: 52px;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-light) 100%);
  border-radius: 14px;
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-brand);
  margin-bottom: 14px;
}
.auth-logo-icon svg { width: 26px; height: 26px; color: #fff; }
.auth-title { font-size: 22px; font-weight: 800; letter-spacing: -.3px; }
.auth-sub { font-size: 13.5px; color: var(--text-2); margin-top: 5px; }
.auth-divider {
  text-align: center;
  color: var(--text-3);
  font-size: 12px;
  position: relative;
  margin: 20px 0;
}
.auth-divider::before {
  content: '';
  position: absolute;
  top: 50%; left: 0; right: 0;
  height: 1px;
  background: var(--border);
}
.auth-divider span { background: var(--bg-card); padding: 0 12px; position: relative; }

/* ── Dropdown ───────────────────────────────────────── */
.dropdown { position: relative; }
.dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 200px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 500;
  overflow: hidden;
  display: none;
  animation: dropIn .15s ease;
}
@keyframes dropIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
.dropdown-menu.show { display: block; }
.dropdown-item {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 14px;
  font-size: 13.5px;
  color: var(--text-1);
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  transition: background var(--transition);
}
.dropdown-item svg { width: 15px; height: 15px; color: var(--text-3); }
.dropdown-item:hover { background: var(--bg-card2); }
.dropdown-item.danger { color: var(--danger); }
.dropdown-item.danger svg { color: var(--danger); }
.dropdown-divider { height: 1px; background: var(--border); margin: 4px 0; }
.dropdown-header { padding: 10px 14px 6px; font-size: 11px; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: .06em; }

/* ── Modal ──────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.55);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 600;
  backdrop-filter: blur(4px);
  padding: 20px;
}
.modal-overlay.show { display: flex; }
.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: modalIn .18s ease;
}
@keyframes modalIn { from { transform: scale(.95) translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
}
.modal-title { font-size: 15px; font-weight: 700; }
.modal-close {
  background: var(--bg-card2); border: none;
  width: 28px; height: 28px;
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--text-2);
  transition: all var(--transition);
}
.modal-close:hover { background: var(--danger); color: #fff; }
.modal-close svg { width: 14px; height: 14px; }
.modal-body { padding: 20px; }
.modal-footer { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }

/* ── Toast ──────────────────────────────────────────── */
.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 1000; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 13px 16px;
  box-shadow: var(--shadow-lg);
  display: flex; align-items: center; gap: 10px;
  font-size: 13.5px;
  animation: toastIn .22s ease;
  min-width: 280px; max-width: 380px;
}
@keyframes toastIn { from { transform: translateX(110%); opacity: 0; } to { transform: none; opacity: 1; } }
.toast svg { width: 18px; height: 18px; flex-shrink: 0; }
.toast.success { border-left: 3px solid var(--success); }
.toast.success svg { color: var(--success); }
.toast.error   { border-left: 3px solid var(--danger); }
.toast.error svg { color: var(--danger); }
.toast.info    { border-left: 3px solid var(--info); }
.toast.info svg { color: var(--info); }
.toast.warning { border-left: 3px solid var(--warning); }
.toast.warning svg { color: var(--warning); }

/* ── Progress ───────────────────────────────────────── */
.progress { background: var(--bg-card2); border-radius: 20px; height: 6px; overflow: hidden; }
.progress-bar { background: var(--brand); height: 100%; border-radius: 20px; transition: width .4s ease; }
.progress-bar.success { background: var(--success); }
.progress-bar.warning { background: var(--warning); }
.progress-bar.danger  { background: var(--danger); }

/* ── Empty state ────────────────────────────────────── */
.empty-state { text-align: center; padding: 60px 24px; }
.empty-icon { width: 64px; height: 64px; background: var(--bg-card2); border-radius: 16px; display: inline-flex; align-items: center; justify-content: center; margin-bottom: 16px; }
.empty-icon svg { width: 30px; height: 30px; color: var(--text-3); }
.empty-title { font-size: 15px; font-weight: 700; color: var(--text-1); margin-bottom: 6px; }
.empty-desc { font-size: 13.5px; color: var(--text-2); }

/* ── Pagination ─────────────────────────────────────── */
.pagination { display: flex; align-items: center; gap: 4px; list-style: none; flex-wrap: wrap; }
.page-item .page-link {
  display: flex; align-items: center; justify-content: center;
  min-width: 34px; height: 34px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  color: var(--text-2);
  font-size: 13px;
  background: var(--bg-card);
  transition: all var(--transition);
}
.page-item .page-link:hover { background: var(--brand-subtle); color: var(--brand); border-color: rgba(99,91,255,.3); }
.page-item.active .page-link { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: 0 2px 8px var(--brand-glow); }
.page-item.disabled .page-link { opacity: .4; pointer-events: none; }

/* ── Public site nav ────────────────────────────────── */
.site-nav {
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--border);
  padding: 0 48px;
  height: 66px;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 100;
}
.site-nav-links { display: flex; align-items: center; gap: 4px; list-style: none; }
.site-nav-links a {
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-size: 14px;
  font-weight: 500;
  transition: color var(--transition);
}
.site-nav-links a:hover { color: var(--text-1); }
.site-nav-actions { display: flex; align-items: center; gap: 10px; }

/* ── Hero ───────────────────────────────────────────── */
.hero {
  padding: 100px 48px 80px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute;
  top: -100px; left: 50%; transform: translateX(-50%);
  width: 800px; height: 600px;
  background: radial-gradient(ellipse at center, rgba(99,91,255,.1) 0%, transparent 70%);
  pointer-events: none;
}
.hero-badge {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--brand-subtle);
  color: var(--brand);
  border: 1px solid rgba(99,91,255,.2);
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 24px;
}
.hero-badge svg { width: 14px; height: 14px; }
.hero-title {
  font-size: clamp(36px, 6vw, 62px);
  font-weight: 900;
  line-height: 1.08;
  letter-spacing: -.04em;
  margin-bottom: 20px;
}
.hero-title .accent {
  background: linear-gradient(135deg, var(--brand) 0%, #a78bfa 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero-sub { font-size: 17px; color: var(--text-2); max-width: 540px; margin: 0 auto 36px; line-height: 1.65; }
.hero-actions { display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap; }
.hero-mockup {
  margin: 64px auto 0;
  max-width: 900px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 80px rgba(0,0,0,.14), 0 0 0 1px rgba(99,91,255,.1);
  overflow: hidden;
}
.mockup-bar {
  background: var(--bg-card2);
  padding: 12px 16px;
  display: flex; align-items: center; gap: 6px;
  border-bottom: 1px solid var(--border);
}
.mockup-dot { width: 11px; height: 11px; border-radius: 50%; }

/* ── Features section ───────────────────────────────── */
.section-label { text-align: center; color: var(--brand); font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: .1em; margin-bottom: 10px; }
.section-title { text-align: center; font-size: clamp(24px,4vw,38px); font-weight: 800; letter-spacing: -.02em; margin-bottom: 12px; }
.section-sub { text-align: center; color: var(--text-2); max-width: 500px; margin: 0 auto 52px; font-size: 15px; }
.features-section { padding: 80px 48px; }
.features-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(280px,1fr)); gap: 20px; max-width: 1100px; margin: 0 auto; }
.feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px;
  transition: all var(--transition);
}
.feature-card:hover { border-color: rgba(99,91,255,.3); box-shadow: var(--shadow-md); transform: translateY(-3px); }
.feature-icon {
  width: 46px; height: 46px;
  background: var(--brand-subtle);
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 16px;
}
.feature-icon svg { width: 22px; height: 22px; color: var(--brand); }
.feature-title { font-size: 15px; font-weight: 700; margin-bottom: 8px; }
.feature-desc { font-size: 13.5px; color: var(--text-2); line-height: 1.65; }

/* ── Pricing section ────────────────────────────────── */
.pricing-section { padding: 80px 48px; background: var(--bg-card2); }
.pricing-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(240px,1fr)); gap: 20px; max-width: 1000px; margin: 0 auto; }
.pricing-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  position: relative;
  transition: all var(--transition);
}
.pricing-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.pricing-card.featured {
  border-color: var(--brand);
  box-shadow: 0 0 0 1px var(--brand), var(--shadow-md);
}
.pricing-card.featured::before {
  content: 'Most Popular';
  position: absolute;
  top: -13px; left: 50%; transform: translateX(-50%);
  background: var(--brand);
  color: #fff;
  font-size: 11px; font-weight: 700;
  padding: 3px 14px;
  border-radius: 20px;
  white-space: nowrap;
  box-shadow: 0 2px 8px var(--brand-glow);
}
.pricing-name { font-size: 15px; font-weight: 800; margin-bottom: 4px; }
.pricing-price { font-size: 38px; font-weight: 900; letter-spacing: -.04em; margin: 14px 0; line-height: 1; }
.pricing-price sup { font-size: 18px; vertical-align: top; margin-top: 7px; font-weight: 600; }
.pricing-price .cycle { font-size: 13px; font-weight: 400; color: var(--text-2); }
.pricing-features { list-style: none; margin: 18px 0 24px; display: flex; flex-direction: column; gap: 10px; }
.pricing-features li { font-size: 13.5px; display: flex; align-items: center; gap: 9px; color: var(--text-2); }
.pricing-features li svg { width: 15px; height: 15px; color: var(--success); flex-shrink: 0; }

/* ── Share page ─────────────────────────────────────── */
.share-page { min-height: 100vh; background: var(--bg); }

/* ── Utilities ──────────────────────────────────────── */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.gap-5 { gap: 20px; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mt-5 { margin-top: 20px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.mb-5 { margin-bottom: 20px; }
.text-muted { color: var(--text-2); }
.text-xs { font-size: 11px; }
.text-sm { font-size: 12.5px; }
.text-lg { font-size: 16px; }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-brand { color: var(--brand); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.w-full { width: 100%; }
.overflow-hidden { overflow: hidden; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4,1fr); gap: 16px; }
.rounded { border-radius: var(--radius-sm); }
.rounded-full { border-radius: 50%; }
.border-t { border-top: 1px solid var(--border); }
.border-b { border-bottom: 1px solid var(--border); }
.p-4 { padding: 16px; }
.p-5 { padding: 20px; }
.mobile-only { display: none; }

/* ── Scrollbar ──────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-md); border-radius: 3px; }

/* ── Spinner ────────────────────────────────────────── */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Responsive ─────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: none; }
  .main-content { margin-left: 0; }
  .mobile-only { display: flex; }
  .hide-mobile { display: none !important; }
  .page-content { padding: 16px; }
  .scanner-container { grid-template-columns: 1fr; height: auto; }
  .site-nav { padding: 0 20px; }
  .hero { padding: 60px 20px 50px; }
  .features-section, .pricing-section { padding: 50px 20px; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .auth-card { padding: 28px 20px; }
}
