/* ============================================================
   Drexora Support — Global Stylesheet
   Themes: Light (default) · Dark (via .dark-mode on <html>)
   Palette: White + Cream + Warm Gold
   ============================================================ */

/* ── Light theme (default) ─────────────────────────────────── */
:root {
  /* Brand */
  --primary:          #B8860B;
  --primary-light:    #D4A017;
  --primary-dark:     #8B6508;
  --accent:           #F5EDD0;

  /* Backgrounds */
  --bg-base:          #ffffff;
  --bg-mid:           #faf7f2;
  --bg-top:           #f4ede0;

  /* Surfaces */
  --surface:          #ffffff;
  --surface-raised:   #faf7f2;
  --surface-overlay:  rgba(0,0,0,.03);

  /* Borders / glass */
  --border:           rgba(0,0,0,.09);
  --border-strong:    rgba(0,0,0,.15);
  --glass-bg:         rgba(0,0,0,.03);
  --glass-border:     rgba(0,0,0,.09);
  --glass-hover:      rgba(0,0,0,.05);
  --glass-active:     rgba(184,134,11,.10);

  /* Text */
  --text-primary:     #1a1005;
  --text-secondary:   #5a4e38;
  --text-muted:       #9a8c72;
  --text-on-primary:  #ffffff;

  /* Specific surfaces */
  --sidebar-bg:       #f5f0e6;
  --sidebar-border:   rgba(0,0,0,.08);
  --topbar-bg:        rgba(255,255,255,.95);
  --navbar-bg:        rgba(255,255,255,.92);
  --modal-bg:         #ffffff;
  --toast-bg:         #ffffff;
  --auth-card-bg:     #ffffff;
  --input-bg:         rgba(0,0,0,.04);
  --code-bg:          #f4f1eb;
  --code-color:       #7a5c0a;

  /* Page gradient */
  --page-grad:        linear-gradient(160deg, #ffffff 0%, #faf7f2 50%, #f5f0e8 100%);
  --page-radial-1:    rgba(184,134,11,.05);
  --page-radial-2:    rgba(212,160,23,.04);

  /* Landing hero preview */
  --hero-preview-bg:  linear-gradient(135deg, #f4ede0, #ede3cc);

  /* Status */
  --success:          #059669;
  --warning:          #d97706;
  --danger:           #dc2626;
  --info:             #2563eb;

  /* Sizing */
  --sidebar-w:        250px;
  --radius:           14px;
  --radius-sm:        8px;
  --radius-lg:        20px;

  /* Shadows */
  --shadow-sm:        0 1px 4px rgba(0,0,0,.07), 0 2px 8px rgba(0,0,0,.05);
  --shadow-md:        0 4px 16px rgba(0,0,0,.10), 0 8px 32px rgba(0,0,0,.07);
  --shadow-lg:        0 12px 40px rgba(0,0,0,.14), 0 24px 60px rgba(0,0,0,.09);
  --shadow-glow:      0 0 24px rgba(184,134,11,.18);

  --transition:       all .2s ease;
}

/* ── Dark theme override ────────────────────────────────────── */
.dark-mode {
  --bg-base:          #0D0B07;
  --bg-mid:           #181309;
  --bg-top:           #211A0C;

  --surface:          rgba(255,248,220,.05);
  --surface-raised:   rgba(255,248,220,.08);
  --surface-overlay:  rgba(255,248,220,.04);

  --border:           rgba(255,248,220,.09);
  --border-strong:    rgba(255,248,220,.16);
  --glass-bg:         rgba(255,248,220,.04);
  --glass-border:     rgba(255,248,220,.09);
  --glass-hover:      rgba(255,248,220,.07);
  --glass-active:     rgba(201,162,39,.15);

  --text-primary:     #F5EDD0;
  --text-secondary:   #C4B896;
  --text-muted:       #7A6E57;
  --text-on-primary:  #1a1005;

  --sidebar-bg:       rgba(13,11,7,.92);
  --sidebar-border:   rgba(255,248,220,.09);
  --topbar-bg:        rgba(13,11,7,.80);
  --navbar-bg:        rgba(10,8,5,.80);
  --modal-bg:         #1C1508;
  --toast-bg:         #1C1508;
  --auth-card-bg:     rgba(24,19,9,.95);
  --input-bg:         rgba(255,248,220,.05);
  --code-bg:          rgba(0,0,0,.40);
  --code-color:       #E4BC5A;

  --page-grad:        linear-gradient(160deg, #0D0B07 0%, #181309 50%, #120F06 100%);
  --page-radial-1:    rgba(201,162,39,.14);
  --page-radial-2:    rgba(245,237,208,.06);

  --hero-preview-bg:  linear-gradient(135deg, #1C1508, #120F06);

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

  --shadow-sm:        0 2px 8px rgba(0,0,0,.35);
  --shadow-md:        0 8px 32px rgba(0,0,0,.45);
  --shadow-lg:        0 20px 60px rgba(0,0,0,.55);
  --shadow-glow:      0 0 30px rgba(201,162,39,.25);
}

/* ── Reset ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  transition: background .3s ease, color .3s ease;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; border: none; background: none; font: inherit; }
input, textarea, select { font: inherit; }
ul, ol { list-style: none; }

/* ── Page background ────────────────────────────────────────── */
.page-bg {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 20% 10%, var(--page-radial-1) 0%, transparent 60%),
    radial-gradient(ellipse 60% 50% at 80% 80%, var(--page-radial-2) 0%, transparent 55%),
    var(--page-grad);
  z-index: -1;
  transition: background .3s ease;
}

/* ── Theme toggle button ────────────────────────────────────── */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 13px;
  border-radius: 99px;
  font-size: .8rem;
  font-weight: 600;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  transition: var(--transition);
  white-space: nowrap;
  cursor: pointer;
}
.theme-toggle:hover {
  border-color: var(--primary-light);
  color: var(--text-primary);
  background: var(--glass-hover);
}
.theme-toggle-icon { font-size: .95rem; line-height: 1; }
.theme-toggle-label { font-size: .78rem; }

/* ── Glass card ─────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 24px;
  transition: var(--transition);
}
.card:hover { border-color: var(--primary-light); box-shadow: var(--shadow-md); }
.card--elevated {
  background: var(--surface);
  box-shadow: var(--shadow-md);
}

/* ── Buttons ────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: .875rem;
  font-weight: 600;
  transition: var(--transition);
  white-space: nowrap;
}
.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: var(--text-on-primary);
  box-shadow: 0 4px 16px rgba(184,134,11,.35);
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(184,134,11,.50);
}
.btn-primary:active { transform: translateY(0); }
.btn-ghost {
  border: 1px solid var(--border);
  color: var(--text-secondary);
  background: var(--glass-bg);
}
.btn-ghost:hover {
  border-color: var(--primary-light);
  color: var(--text-primary);
  background: var(--glass-hover);
}
.btn-danger {
  background: rgba(220,38,38,.10);
  border: 1px solid rgba(220,38,38,.25);
  color: var(--danger);
}
.btn-danger:hover { background: rgba(220,38,38,.18); }
.btn-success {
  background: rgba(5,150,105,.10);
  border: 1px solid rgba(5,150,105,.25);
  color: var(--success);
}
.btn-success:hover { background: rgba(5,150,105,.18); }
.btn-sm { padding: 7px 14px; font-size: .8rem; }
.btn-lg { padding: 14px 30px; font-size: 1rem; }
.btn-block { width: 100%; justify-content: center; }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none !important; }

/* ── Forms ──────────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.form-label {
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: .03em;
  text-transform: uppercase;
}
.form-input {
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 11px 14px;
  font-size: .9rem;
  transition: var(--transition);
  width: 100%;
}
.form-input:focus {
  outline: none;
  border-color: var(--primary-light);
  background: rgba(184,134,11,.06);
  box-shadow: 0 0 0 3px rgba(184,134,11,.12);
}
.form-input::placeholder { color: var(--text-muted); }
textarea.form-input { resize: vertical; min-height: 90px; }
.form-hint { font-size: .78rem; color: var(--text-muted); margin-top: 4px; }
.form-error { font-size: .78rem; color: var(--danger); margin-top: 4px; }

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

/* Sidebar */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow-y: auto;
  transition: transform .3s ease, background .3s ease;
}
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  min-height: 0;
}
.sidebar-logo-img {
  width: 30px;
  height: 30px;
  object-fit: contain;
  flex-shrink: 0;
  border-radius: 6px;
  background: #fff;
  padding: 2px;
  box-shadow: var(--shadow-sm);
}
.sidebar-logo-icon {
  width: 30px; height: 30px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-size: 1rem;
  box-shadow: var(--shadow-glow);
  flex-shrink: 0;
}
.sidebar-logo-text { font-size: .9rem; font-weight: 700; letter-spacing: -.01em; line-height: 1.2; }
.sidebar-logo-text span { color: var(--primary); }
.sidebar-nav { flex: 1; padding: 14px 10px; display: flex; flex-direction: column; gap: 2px; }
.nav-section-label {
  font-size: .65rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: 10px 8px 4px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: .875rem;
  font-weight: 500;
  transition: var(--transition);
  position: relative;
}
.nav-item:hover {
  background: var(--glass-hover);
  color: var(--text-primary);
}
.nav-item.active {
  background: var(--glass-active);
  color: var(--primary);
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 60%;
  background: var(--primary);
  border-radius: 0 2px 2px 0;
}
.nav-icon { width: 18px; height: 18px; opacity: .7; flex-shrink: 0; }
.nav-badge {
  margin-left: auto;
  background: var(--primary);
  color: #fff;
  font-size: .65rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 99px;
}
.sidebar-footer {
  padding: 12px 10px;
  border-top: 1px solid var(--border);
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  background: var(--glass-bg);
}
.sidebar-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  display: grid;
  place-items: center;
  font-size: .78rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name { font-size: .8rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-role { font-size: .7rem; color: var(--text-muted); }
.sidebar-logout {
  margin-left: auto;
  font-size: .75rem;
  padding: 4px 8px;
  border-radius: 6px;
  background: rgba(220,38,38,.08);
  border: 1px solid rgba(220,38,38,.18);
  color: var(--danger);
  transition: var(--transition);
}
.sidebar-logout:hover { background: rgba(220,38,38,.15); }

/* Main content */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 32px;
  border-bottom: 1px solid var(--border);
  background: var(--topbar-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  position: sticky;
  top: 0;
  z-index: 50;
  transition: background .3s ease;
}
.topbar-title { font-size: 1.05rem; font-weight: 700; }
.topbar-subtitle { font-size: .8rem; color: var(--text-muted); margin-top: 1px; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.page-body { padding: 28px 32px; flex: 1; }

/* Mobile sidebar toggle */
.sidebar-toggle {
  display: none;
  position: fixed;
  top: 14px; left: 14px;
  z-index: 200;
  width: 38px; height: 38px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 1.1rem;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-sm);
}
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 99;
}

/* ── Stats grid ─────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: var(--transition);
}
.stat-card:hover { border-color: var(--primary-light); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.stat-icon {
  width: 42px; height: 42px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 1.2rem;
  margin-bottom: 4px;
}
.stat-icon.purple { background: rgba(184,134,11,.12); }
.stat-icon.cyan   { background: rgba(5,150,105,.10); }
.stat-icon.green  { background: rgba(5,150,105,.10); }
.stat-icon.amber  { background: rgba(217,119,6,.12); }
.stat-value { font-size: 1.8rem; font-weight: 800; line-height: 1; color: var(--text-primary); }
.stat-label { font-size: .8rem; color: var(--text-secondary); font-weight: 500; }
.stat-change {
  font-size: .75rem;
  color: var(--success);
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 2px;
}

/* ── Table ──────────────────────────────────────────────────── */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
table { width: 100%; border-collapse: collapse; font-size: .875rem; }
thead tr { border-bottom: 1px solid var(--border); background: var(--surface-raised); }
th {
  padding: 12px 16px;
  text-align: left;
  font-size: .73rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: .06em;
  text-transform: uppercase;
  white-space: nowrap;
}
td {
  padding: 13px 16px;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tbody tr { transition: var(--transition); }
tbody tr:hover { background: var(--glass-hover); }

/* ── Badge ──────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .02em;
}
.badge-primary { background: rgba(184,134,11,.12); color: var(--primary); border: 1px solid rgba(184,134,11,.2); }
.badge-success { background: rgba(5,150,105,.10); color: var(--success); border: 1px solid rgba(5,150,105,.2); }
.badge-warning { background: rgba(217,119,6,.10); color: var(--warning); border: 1px solid rgba(217,119,6,.2); }
.badge-danger  { background: rgba(220,38,38,.10); color: var(--danger);  border: 1px solid rgba(220,38,38,.2); }
.badge-info    { background: rgba(37,99,235,.10); color: var(--info);    border: 1px solid rgba(37,99,235,.2); }
.badge-muted   { background: var(--surface-raised); color: var(--text-secondary); border: 1px solid var(--border); }

/* ── Empty state ────────────────────────────────────────────── */
.empty-state {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; padding: 60px 20px;
  text-align: center; color: var(--text-muted); gap: 12px;
}
.empty-state-icon { font-size: 3rem; opacity: .4; }
.empty-state-title { font-size: 1rem; font-weight: 600; color: var(--text-secondary); }
.empty-state-desc { font-size: .875rem; max-width: 320px; line-height: 1.6; }

/* ── Modal ──────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow-y: auto;
  overscroll-behavior: contain;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
  background: var(--modal-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  width: 100%;
  max-width: 480px;
  max-height: calc(100dvh - 40px);
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  margin: auto 0;
  box-shadow: var(--shadow-lg);
  transform: translateY(20px) scale(.97);
  transition: transform .25s ease;
}
.modal-overlay.open .modal { transform: translateY(0) scale(1); }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.modal-title { font-size: 1.05rem; font-weight: 700; }
.modal-close {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: var(--glass-bg);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  display: grid; place-items: center;
  font-size: 1.1rem;
  transition: var(--transition);
}
.modal-close:hover { background: var(--glass-hover); color: var(--text-primary); }
.modal-footer { display: flex; gap: 10px; margin-top: 20px; justify-content: flex-end; }

/* ── Toast ──────────────────────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 24px; right: 24px;
  z-index: 9999;
  display: flex; flex-direction: column; gap: 10px;
  pointer-events: none;
}
.toast {
  background: var(--toast-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  display: flex; align-items: flex-start; gap: 12px;
  box-shadow: var(--shadow-md);
  max-width: 320px;
  animation: toastIn .3s ease both;
  pointer-events: all;
  font-size: .875rem;
  color: var(--text-primary);
}
.toast.success { border-left: 3px solid var(--success); }
.toast.error   { border-left: 3px solid var(--danger); }
.toast.info    { border-left: 3px solid var(--info); }
.toast-icon { font-size: 1rem; margin-top: 1px; flex-shrink: 0; }
.toast-msg { flex: 1; line-height: 1.5; }
@keyframes toastIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }

/* ── Section header ─────────────────────────────────────────── */
.section-header {
  display: flex; align-items: center;
  justify-content: space-between;
  margin-bottom: 20px; flex-wrap: wrap; gap: 12px;
}
.section-title { font-size: 1rem; font-weight: 700; }
.section-desc { font-size: .8rem; color: var(--text-muted); margin-top: 2px; }

/* ── Code block ─────────────────────────────────────────────── */
.code-block {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  font-family: 'Fira Code', 'Cascadia Code', monospace;
  font-size: .8rem;
  color: var(--code-color);
  word-break: break-all;
  line-height: 1.7;
  position: relative;
  overflow-x: auto;
}
.code-copy {
  position: absolute;
  top: 8px; right: 8px;
  padding: 4px 10px;
  font-size: .72rem;
  background: var(--primary);
  color: #fff;
  border-radius: 6px;
  transition: var(--transition);
  font-family: system-ui, sans-serif;
  font-weight: 600;
}
.code-copy:hover { background: var(--primary-dark); }

/* ── Search input ───────────────────────────────────────────── */
.search-wrap { position: relative; flex: 1; max-width: 320px; }
.search-icon {
  position: absolute;
  left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--text-muted); pointer-events: none; font-size: .9rem;
}
.search-input {
  width: 100%;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 9px 14px 9px 36px;
  font-size: .875rem;
  transition: var(--transition);
}
.search-input:focus {
  outline: none;
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(184,134,11,.12);
}
.search-input::placeholder { color: var(--text-muted); }

/* ── Divider ────────────────────────────────────────────────── */
.divider { height: 1px; background: var(--border); margin: 20px 0; }

/* ── Loading spinner ────────────────────────────────────────── */
.spinner {
  width: 36px; height: 36px;
  border: 3px solid rgba(184,134,11,.15);
  border-top-color: var(--primary-light);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  margin: 60px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-overlay {
  position: absolute; inset: 0;
  background: rgba(255,255,255,.8);
  display: grid; place-items: center;
  border-radius: inherit; z-index: 5;
}
.dark-mode .loading-overlay { background: rgba(13,11,7,.85); }

/* ── Colour swatch picker ───────────────────────────────────── */
.colour-swatches { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.colour-swatch {
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 2px solid transparent;
  transition: var(--transition);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}
.colour-swatch.selected { border-color: var(--text-primary); box-shadow: 0 0 0 3px var(--primary); }

/* ── Avatar upload ──────────────────────────────────────────── */
.avatar-upload { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; }
.avatar-preview {
  width: 72px; height: 72px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  display: grid; place-items: center;
  font-size: 1.5rem; color: #fff; font-weight: 700;
  border: 2px solid var(--border);
  overflow: hidden;
}
.avatar-preview img { width: 100%; height: 100%; object-fit: cover; }

/* ── Landing page ───────────────────────────────────────────── */
.landing-body {
  background:
    radial-gradient(ellipse 90% 70% at 15% 5%,  var(--page-radial-1) 0%, transparent 55%),
    radial-gradient(ellipse 70% 60% at 85% 85%, var(--page-radial-2) 0%, transparent 50%),
    var(--page-grad);
  min-height: 100vh;
  transition: background .3s ease;
}

/* Navbar */
.navbar {
  position: fixed; top: 0; left: 0; right: 0;
  z-index: 200;
  display: flex; align-items: center;
  justify-content: space-between;
  padding: 14px 48px;
  background: var(--navbar-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  transition: background .3s ease;
}
.navbar-brand {
  display: flex; align-items: center; gap: 10px;
  font-size: 1.1rem; font-weight: 800;
}
.navbar-brand-img {
  width: 34px; height: 34px;
  object-fit: contain;
  border-radius: 7px;
  background: #fff;
  padding: 2px;
  box-shadow: var(--shadow-sm);
}
.navbar-brand-icon {
  width: 34px; height: 34px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  border-radius: 9px;
  display: grid; place-items: center; font-size: 1rem;
}
.navbar-links {
  display: flex; align-items: center; gap: 32px;
  font-size: .875rem; color: var(--text-secondary);
}
.navbar-links a:hover { color: var(--text-primary); }
.navbar-cta { display: flex; align-items: center; gap: 10px; }

/* Hero */
.hero {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  text-align: center; padding: 120px 24px 80px; position: relative;
}
.hero-badge {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 16px;
  background: rgba(184,134,11,.10);
  border: 1px solid rgba(184,134,11,.25);
  border-radius: 99px;
  font-size: .8rem; color: var(--primary); margin-bottom: 24px; font-weight: 600;
}
.hero-title {
  font-size: clamp(2.4rem, 6vw, 4.5rem);
  font-weight: 900; line-height: 1.1;
  letter-spacing: -.03em; margin-bottom: 22px;
  max-width: 780px; margin-left: auto; margin-right: auto;
  color: var(--text-primary);
}
.hero-title .gradient-text {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero-subtitle {
  font-size: 1.1rem; color: var(--text-secondary);
  max-width: 560px; margin: 0 auto 36px; line-height: 1.7;
}
.hero-actions { display: flex; align-items: center; justify-content: center; gap: 14px; flex-wrap: wrap; }
.hero-preview { margin-top: 72px; position: relative; max-width: 900px; margin-left: auto; margin-right: auto; }
.hero-preview-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px; padding: 16px;
  box-shadow: var(--shadow-lg), 0 0 60px rgba(184,134,11,.08);
}
.hero-preview-img {
  border-radius: 12px; width: 100%; min-height: 300px;
  background: var(--hero-preview-bg);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); font-size: .9rem; overflow: hidden;
}

/* Dashboard preview mock */
.dash-preview {
  width: 100%; padding: 20px;
  display: grid; grid-template-columns: 200px 1fr;
  gap: 16px; min-height: 340px;
}
.dp-sidebar {
  background: var(--surface-raised);
  border-radius: 10px; padding: 16px;
  display: flex; flex-direction: column; gap: 8px;
}
.dp-nav-item { height: 30px; border-radius: 6px; background: var(--border); }
.dp-nav-item.active { background: rgba(184,134,11,.20); }
.dp-main { display: flex; flex-direction: column; gap: 12px; }
.dp-header { height: 40px; background: var(--border); border-radius: 8px; }
.dp-stats { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; }
.dp-stat {
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: 10px; padding: 14px;
  display: flex; flex-direction: column; gap: 6px;
}
.dp-stat-val { height: 22px; width: 60%; background: rgba(184,134,11,.25); border-radius: 4px; }
.dp-stat-lbl { height: 10px; width: 80%; background: var(--border); border-radius: 4px; }
.dp-table { background: var(--surface-raised); border: 1px solid var(--border); border-radius: 10px; flex: 1; }

/* Features section */
.features-section { padding: 100px 24px; max-width: 1100px; margin: 0 auto; }
.section-label {
  text-align: center; font-size: .8rem; font-weight: 700;
  color: var(--primary); letter-spacing: .1em;
  text-transform: uppercase; margin-bottom: 12px;
}
.section-heading {
  text-align: center;
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-weight: 800; letter-spacing: -.02em; margin-bottom: 14px;
  color: var(--text-primary);
}
.section-subheading {
  text-align: center; font-size: 1rem; color: var(--text-secondary);
  max-width: 520px; margin: 0 auto 56px; line-height: 1.7;
}
.features-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; }
.feature-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px 26px;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}
.feature-card:hover {
  border-color: var(--primary-light);
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}
.feature-icon {
  width: 50px; height: 50px;
  border-radius: 14px;
  display: grid; place-items: center;
  font-size: 1.4rem; margin-bottom: 18px;
  background: rgba(184,134,11,.10);
  border: 1px solid rgba(184,134,11,.15);
}
.feature-title { font-size: 1rem; font-weight: 700; margin-bottom: 8px; color: var(--text-primary); }
.feature-desc { font-size: .875rem; color: var(--text-secondary); line-height: 1.65; }

/* How it works */
.how-section { padding: 80px 24px; max-width: 900px; margin: 0 auto; }
.steps { display: grid; gap: 0; position: relative; }
.steps::before {
  content: '';
  position: absolute;
  left: 22px; top: 28px; bottom: 28px;
  width: 2px;
  background: linear-gradient(to bottom, var(--primary), var(--primary-light));
  opacity: .25;
}
.step { display: flex; gap: 20px; padding: 24px 0; animation: fadeUp .5s ease both; }
.step-num {
  width: 46px; height: 46px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  display: grid; place-items: center;
  font-weight: 800; font-size: .9rem; color: #fff;
  flex-shrink: 0; position: relative; z-index: 1;
  box-shadow: 0 0 0 4px var(--bg-base), var(--shadow-glow);
}
.step-title { font-size: 1rem; font-weight: 700; margin-bottom: 6px; }
.step-desc { font-size: .875rem; color: var(--text-secondary); line-height: 1.65; }

/* Pricing */
.pricing-section { padding: 80px 24px; max-width: 900px; margin: 0 auto; }
.pricing-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px,1fr)); gap: 20px; }
.pricing-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 32px 28px;
  transition: var(--transition); position: relative;
  box-shadow: var(--shadow-sm);
}
.pricing-card.featured {
  border-color: var(--primary-light);
  box-shadow: var(--shadow-glow), var(--shadow-md);
}
.pricing-badge {
  position: absolute; top: -12px; left: 50%; transform: translateX(-50%);
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: #fff; font-size: .7rem; font-weight: 800;
  padding: 3px 14px; border-radius: 99px; letter-spacing: .05em;
}
.pricing-name { font-size: .8rem; font-weight: 700; color: var(--primary); letter-spacing: .08em; text-transform: uppercase; margin-bottom: 10px; }
.pricing-price { font-size: 2.4rem; font-weight: 900; line-height: 1; margin-bottom: 4px; color: var(--text-primary); }
.pricing-period { font-size: .8rem; color: var(--text-muted); margin-bottom: 20px; }
.pricing-features { display: flex; flex-direction: column; gap: 10px; margin-bottom: 24px; }
.pricing-feature { display: flex; align-items: center; gap: 10px; font-size: .875rem; color: var(--text-secondary); }
.pricing-feature-check { color: var(--success); font-size: .9rem; flex-shrink: 0; }

/* CTA */
.cta-section { padding: 80px 24px 120px; text-align: center; }
.cta-card {
  max-width: 700px; margin: 0 auto;
  background: linear-gradient(135deg, rgba(184,134,11,.08), rgba(212,160,23,.05));
  border: 1px solid rgba(184,134,11,.20);
  border-radius: var(--radius-lg); padding: 60px 40px;
  box-shadow: var(--shadow-glow), var(--shadow-md);
}
.cta-title { font-size: 2rem; font-weight: 800; margin-bottom: 12px; color: var(--text-primary); }
.cta-desc { font-size: 1rem; color: var(--text-secondary); margin-bottom: 32px; }

/* Footer */
.landing-footer {
  padding: 28px 48px;
  border-top: 1px solid var(--border);
  display: flex; align-items: center;
  justify-content: space-between;
  font-size: .8rem; color: var(--text-muted);
  flex-wrap: wrap; gap: 12px;
  background: var(--surface-raised);
}
.footer-brand { display: flex; align-items: center; gap: 8px; }
.footer-logo {
  width: 22px; height: 22px; object-fit: contain;
  border-radius: 4px; background: #fff; padding: 2px;
}

/* Auth pages */
.auth-page {
  min-height: 100vh; display: flex;
  align-items: center; justify-content: center; padding: 24px;
}
.auth-card {
  width: 100%; max-width: 440px;
  background: var(--auth-card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px 36px;
  box-shadow: var(--shadow-lg);
}
.auth-logo {
  display: flex; align-items: center;
  justify-content: center; gap: 10px; margin-bottom: 28px;
}
.auth-logo-img {
  width: 52px; height: 52px; object-fit: contain;
  border-radius: 12px; background: #fff; padding: 4px;
  box-shadow: var(--shadow-md), 0 0 0 1px rgba(184,134,11,.2);
}
.auth-logo-text { font-size: 1.15rem; font-weight: 800; }
.auth-title { font-size: 1.4rem; font-weight: 800; text-align: center; margin-bottom: 6px; color: var(--text-primary); }
.auth-subtitle { font-size: .875rem; color: var(--text-secondary); text-align: center; margin-bottom: 28px; }
.auth-divider {
  display: flex; align-items: center; gap: 12px;
  margin: 20px 0; color: var(--text-muted); font-size: .8rem;
}
.auth-divider::before, .auth-divider::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}
.auth-footer { text-align: center; margin-top: 20px; font-size: .875rem; color: var(--text-secondary); }
.auth-footer a { color: var(--primary); font-weight: 600; }
.auth-footer a:hover { color: var(--primary-dark); }

/* ── Widget install box ─────────────────────────────────────── */
.install-box {
  background: var(--surface-raised);
  border: 1px solid rgba(184,134,11,.25);
  border-radius: var(--radius); padding: 20px 22px; margin-top: 10px;
}
.install-step {
  display: flex; align-items: flex-start; gap: 14px;
  padding: 14px 0; border-bottom: 1px solid var(--border);
}
.install-step:last-child { border-bottom: none; padding-bottom: 0; }
.install-step-num {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--primary); display: grid; place-items: center;
  font-size: .72rem; font-weight: 800; color: #fff;
  flex-shrink: 0; margin-top: 2px;
}
.install-step-body { flex: 1; }
.install-step-title { font-size: .875rem; font-weight: 600; margin-bottom: 6px; }
.install-step-desc { font-size: .8rem; color: var(--text-muted); margin-bottom: 8px; }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.open { display: block; }
  .sidebar-toggle { display: flex; }
  .main-content { margin-left: 0; }
  .topbar { padding: 14px 18px 14px 64px; }
  .page-body { padding: 18px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .navbar { padding: 12px 20px; }
  .navbar-links { display: none; }
  .hero-title { font-size: 2rem; }
  .cta-card { padding: 40px 24px; }
  .landing-footer { padding: 20px; }
  .dp-sidebar { display: none; }
  .dash-preview { grid-template-columns: 1fr; }
  .theme-toggle-label { display: none; }
}
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .auth-card { padding: 28px 22px; }
  .modal-overlay { padding: 10px; align-items: flex-start; }
  .modal { padding: 18px; max-height: calc(100dvh - 20px); margin: 0; }
  .features-grid { grid-template-columns: 1fr; }
}

/* ── Animations ─────────────────────────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .5; } }
.animate-fadeUp { animation: fadeUp .5s ease both; }
.animate-fadeIn { animation: fadeIn .4s ease both; }
.stagger-1 { animation-delay: .05s; }
.stagger-2 { animation-delay: .10s; }
.stagger-3 { animation-delay: .15s; }
.stagger-4 { animation-delay: .20s; }

/* ── FAQ management ─────────────────────────────────────────── */
.faq-list { display: flex; flex-direction: column; gap: 12px; }
.faq-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px 20px;
  display: flex; align-items: flex-start; gap: 16px;
  transition: var(--transition); box-shadow: var(--shadow-sm);
}
.faq-item:hover { border-color: var(--primary-light); box-shadow: var(--shadow-md); }
.faq-item-body { flex: 1; min-width: 0; }
.faq-question { font-size: .9rem; font-weight: 600; margin-bottom: 5px; color: var(--text-primary); }
.faq-answer { font-size: .825rem; color: var(--text-secondary); line-height: 1.6; }
.faq-actions { display: flex; gap: 8px; flex-shrink: 0; }

/* ── Chat messages ──────────────────────────────────────────── */
.chat-messages { display: flex; flex-direction: column; gap: 12px; padding: 20px; }
.msg { display: flex; flex-direction: column; gap: 3px; max-width: 75%; }
.msg.visitor { align-self: flex-end; }
.msg.bot { align-self: flex-start; }
.msg-bubble {
  padding: 10px 14px; border-radius: 12px;
  font-size: .875rem; line-height: 1.55;
}
.msg.bot .msg-bubble {
  background: rgba(184,134,11,.08);
  border: 1px solid rgba(184,134,11,.15);
  border-top-left-radius: 3px;
  color: var(--text-primary);
}
.msg.visitor .msg-bubble {
  background: var(--primary);
  color: #fff;
  border-top-right-radius: 3px;
}
.msg-time { font-size: .72rem; color: var(--text-muted); }
.msg.visitor .msg-time { text-align: right; }

/* ── Settings sections ──────────────────────────────────────── */
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(400px, 1fr)); gap: 20px; }
@media (max-width: 850px) { .settings-grid { grid-template-columns: 1fr; } }
.settings-section-title {
  font-size: .95rem; font-weight: 700; margin-bottom: 16px;
  padding-bottom: 12px; border-bottom: 1px solid var(--border);
  color: var(--text-primary);
}
