/* ============================================================
   KNOWRA DESIGN SYSTEM v1.0
   Dark cards + teal accent + colored icon badges
   Fonts: Syne (display) + DM Sans (body)
   Icons: Lucide inline SVG
   Inspired by Law.AI + Zest.AI card patterns
   ============================================================ */

/* ── GOOGLE FONTS ─────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;600;700;800&family=DM+Sans:wght@300;400;500;600&display=swap');

/* ── PRECONNECT (add to <head> of each HTML file)
   <link rel="preconnect" href="https://fonts.googleapis.com">
   <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
   ─────────────────────────────────────────────────────────── */

/* ── CSS CUSTOM PROPERTIES ───────────────────────────────── */
:root {

  /* --- COLOR PALETTE --- */

  /* Backgrounds — layered depth system */
  --bg-base:      #040b14;   /* page background — deepest */
  --bg-surface:   #081220;   /* slightly lifted surface */
  --bg-card:      #0d1c2e;   /* cards, panels */
  --bg-elevated:  #122338;   /* inputs, hover states, elevated cards */
  --bg-overlay:   rgba(4, 11, 20, 0.85); /* modal/sidebar overlays */

  /* Teal — primary brand colour, 5 steps */
  --teal-50:  #e6fafa;
  --teal-100: #b3f0ee;
  --teal-200: #66e0da;
  --teal-300: #1fcfc7;
  --teal-400: #14b8a6;   /* PRIMARY — main actions */
  --teal-500: #0e9e8e;   /* hover / pressed */
  --teal-600: #0a7d70;   /* deep accent */
  --teal-glow: rgba(20, 184, 166, 0.15);  /* glow / shadow tint */
  --teal-glow-strong: rgba(20, 184, 166, 0.30);

  /* Text */
  --text-primary:   #f0f6ff;
  --text-secondary: #8ba3c0;
  --text-muted:     #4e6a87;
  --text-inverse:   #040b14;

  /* Borders */
  --border-subtle:  #162032;
  --border-medium:  #1e3048;
  --border-strong:  #2a4260;
  --border-teal:    rgba(20, 184, 166, 0.35);

  /* Semantic colours */
  --color-success:       #22c55e;
  --color-success-bg:    rgba(34, 197, 94, 0.10);
  --color-success-border:rgba(34, 197, 94, 0.25);
  --color-danger:        #ef4444;
  --color-danger-bg:     rgba(239, 68, 68, 0.10);
  --color-danger-border: rgba(239, 68, 68, 0.25);
  --color-warning:       #f59e0b;
  --color-warning-bg:    rgba(245, 158, 11, 0.10);
  --color-warning-border:rgba(245, 158, 11, 0.25);
  --color-info:          #38bdf8;
  --color-info-bg:       rgba(56, 189, 248, 0.10);
  --color-info-border:   rgba(56, 189, 248, 0.25);

  /* Icon badge accent colours (Law.AI / Zest.AI pattern) */
  --badge-teal:    linear-gradient(135deg, #0e9e8e, #14b8a6);
  --badge-blue:    linear-gradient(135deg, #1d4ed8, #3b82f6);
  --badge-purple:  linear-gradient(135deg, #7c3aed, #a78bfa);
  --badge-pink:    linear-gradient(135deg, #be185d, #f472b6);
  --badge-orange:  linear-gradient(135deg, #c2410c, #fb923c);
  --badge-amber:   linear-gradient(135deg, #b45309, #fbbf24);
  --badge-green:   linear-gradient(135deg, #15803d, #4ade80);
  --badge-cyan:    linear-gradient(135deg, #0e7490, #22d3ee);
  --badge-red:     linear-gradient(135deg, #b91c1c, #f87171);
  --badge-indigo:  linear-gradient(135deg, #4338ca, #818cf8);
  --badge-navy:    linear-gradient(135deg, #1e3a5f, #3b6ea5);

  /* --- SPACING SCALE --- */
  /* 4px base unit, 10 steps */
  --space-1:  4px;
  --space-2:  8px;
  --space-3:  12px;
  --space-4:  16px;
  --space-5:  20px;
  --space-6:  24px;
  --space-7:  32px;
  --space-8:  40px;
  --space-9:  48px;
  --space-10: 64px;

  /* --- BORDER RADIUS SCALE --- */
  --r-xs:   4px;
  --r-sm:   8px;
  --r-md:   12px;
  --r-lg:   16px;
  --r-xl:   20px;
  --r-2xl:  24px;
  --r-3xl:  32px;
  --r-full: 9999px;

  /* --- TYPE SCALE --- */
  --text-xs:   0.75rem;   /* 12px — labels, badges */
  --text-sm:   0.8125rem; /* 13px — captions, source tags */
  --text-base: 0.9375rem; /* 15px — body copy */
  --text-md:   1rem;      /* 16px — UI text, buttons */
  --text-lg:   1.125rem;  /* 18px — card headings */
  --text-xl:   1.375rem;  /* 22px — section subheads */
  --text-2xl:  1.75rem;   /* 28px — section headings */
  --text-3xl:  2.25rem;   /* 36px — hero headings */

  /* --- FONT FAMILIES --- */
  --font-display: 'Syne', sans-serif;
  --font-body:    'DM Sans', sans-serif;

  /* --- FONT WEIGHTS --- */
  --fw-normal:   400;
  --fw-medium:   500;
  --fw-semibold: 600;
  --fw-bold:     700;
  --fw-extrabold:800;

  /* --- LINE HEIGHTS --- */
  --lh-tight:  1.1;
  --lh-snug:   1.3;
  --lh-normal: 1.5;
  --lh-relaxed:1.65;

  /* --- SHADOWS --- */
  --shadow-card:    0 2px 16px rgba(0, 0, 0, 0.3);
  --shadow-elevated:0 4px 24px rgba(0, 0, 0, 0.4);
  --shadow-overlay: 0 8px 48px rgba(0, 0, 0, 0.6);
  --shadow-teal:    0 4px 20px rgba(20, 184, 166, 0.25);
  --shadow-teal-lg: 0 8px 32px rgba(20, 184, 166, 0.35);

  /* --- TRANSITIONS --- */
  --transition-fast:   150ms ease;
  --transition-base:   250ms ease;
  --transition-slow:   400ms ease;

  /* --- Z-INDEX LAYERS --- */
  --z-base:    1;
  --z-above:   10;
  --z-nav:     100;
  --z-overlay: 199;
  --z-sidebar: 200;
  --z-toast:   300;
  --z-modal:   400;

  /* --- LAYOUT --- */
  --max-width-app:   480px;  /* mobile-first app width */
  --max-width-wide:  960px;  /* wide content */
  --bottom-nav-h:    64px;   /* bottom navigation height */
  --header-h:        56px;   /* top header height */
  --touch-target:    44px;   /* minimum touch target */
}


/* ── BASE RESET ──────────────────────────────────────────── */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: var(--fw-normal);
  line-height: var(--lh-normal);
  color: var(--text-primary);
  background: var(--bg-base);
  max-width: var(--max-width-app);
  margin: 0 auto;
  min-height: 100dvh;
  overflow-x: hidden;
  /* Safe area for notched phones */
  padding-top: env(safe-area-inset-top);
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

/* Full-screen app pages (chat) */
body.app-page {
  height: 100dvh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

img, svg { display: block; max-width: 100%; }
button { cursor: pointer; font-family: var(--font-body); }
a { color: var(--teal-400); text-decoration: none; }
a:hover { color: var(--teal-300); }


/* ── TYPOGRAPHY ──────────────────────────────────────────── */
.heading-1 {
  font-family: var(--font-display);
  font-size: var(--text-3xl);
  font-weight: var(--fw-extrabold);
  line-height: var(--lh-tight);
  letter-spacing: -0.03em;
  color: var(--text-primary);
}

.heading-2 {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: var(--fw-bold);
  line-height: var(--lh-tight);
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.heading-3 {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: var(--fw-bold);
  line-height: var(--lh-snug);
  color: var(--text-primary);
}

.heading-4 {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: var(--fw-semibold);
  line-height: var(--lh-snug);
  color: var(--text-primary);
}

/* Two-tone heading (Law.AI / Zest.AI signature) */
.heading-accent { color: var(--teal-400); }

.text-body  { font-size: var(--text-base); line-height: var(--lh-relaxed); }
.text-sm    { font-size: var(--text-sm);   line-height: var(--lh-normal);  }
.text-xs    { font-size: var(--text-xs);   line-height: var(--lh-normal);  }
.text-secondary { color: var(--text-secondary); }
.text-muted     { color: var(--text-muted); }
.text-teal      { color: var(--teal-400); }
.text-success   { color: var(--color-success); }
.text-danger    { color: var(--color-danger); }
.text-center    { text-align: center; }


/* ── LAYOUT PRIMITIVES ───────────────────────────────────── */
.section {
  padding: var(--space-8) var(--space-5);
}

.section-tight {
  padding: var(--space-6) var(--space-5);
}

/* Two-column grid — stats, tools (Law.AI pattern) */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
}

/* Single column stack */
.stack {
  display: flex;
  flex-direction: column;
}

.stack-sm  { gap: var(--space-2); }
.stack-md  { gap: var(--space-4); }
.stack-lg  { gap: var(--space-6); }

/* Inline row */
.row {
  display: flex;
  align-items: center;
}
.row-between { justify-content: space-between; }
.row-center  { justify-content: center; }
.gap-sm  { gap: var(--space-2); }
.gap-md  { gap: var(--space-4); }
.gap-lg  { gap: var(--space-6); }

.w-full  { width: 100%; }
.hidden  { display: none !important; }
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); border: 0;
}


/* ── CARD ────────────────────────────────────────────────── */
/* The Law.AI / Zest.AI signature card */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-xl);
  padding: var(--space-7) var(--space-6);
  box-shadow: var(--shadow-card);
  transition: box-shadow var(--transition-base),
              border-color var(--transition-base);
}

.card:hover {
  box-shadow: var(--shadow-elevated);
  border-color: var(--border-medium);
}

/* Teal-bordered card (featured / active state) */
.card-teal {
  border-color: var(--border-teal);
  box-shadow: var(--shadow-card), 0 0 0 1px var(--border-teal);
}

/* Full-bleed teal highlight card (like Law.AI orange section) */
.card-highlight {
  background: linear-gradient(135deg, var(--teal-600), var(--teal-400));
  border: none;
  border-radius: var(--r-xl);
  padding: var(--space-9) var(--space-7);
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-teal-lg);
}

.card-highlight::before {
  content: '';
  position: absolute;
  top: -40px; right: -40px;
  width: 160px; height: 160px;
  background: rgba(255,255,255,0.06);
  border-radius: 50%;
  pointer-events: none;
}

.card-highlight::after {
  content: '';
  position: absolute;
  bottom: -30px; left: -30px;
  width: 120px; height: 120px;
  background: rgba(255,255,255,0.04);
  border-radius: 50%;
  pointer-events: none;
}

.card-highlight .heading-2,
.card-highlight .heading-3,
.card-highlight p {
  color: #fff;
  position: relative; z-index: 1;
}

/* Compact stat card */
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-xl);
  padding: var(--space-6) var(--space-4);
  text-align: center;
  box-shadow: var(--shadow-card);
  transition: transform var(--transition-base),
              box-shadow var(--transition-base);
}

.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-elevated);
}

.stat-value {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: var(--fw-extrabold);
  color: var(--teal-400);
  letter-spacing: -0.02em;
  line-height: 1;
  margin-bottom: var(--space-1);
}

.stat-label {
  font-size: var(--text-xs);
  color: var(--text-secondary);
  font-weight: var(--fw-medium);
}


/* ── ICON BADGE ──────────────────────────────────────────── */
/* Law.AI / Zest.AI signature: colored rounded-square with white icon */
.icon-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: var(--r-md);
  flex-shrink: 0;
  background: var(--badge-teal); /* default */
}

.icon-badge--sm  { width: 36px; height: 36px; border-radius: var(--r-sm); }
.icon-badge--lg  { width: 60px; height: 60px; border-radius: var(--r-lg); }

/* Lucide icon inside badge */
.icon-badge svg  { width: 22px; height: 22px; stroke: #fff; stroke-width: 2; }
.icon-badge--sm svg { width: 16px; height: 16px; }
.icon-badge--lg svg { width: 28px; height: 28px; }

/* Colour variants */
.icon-badge--teal   { background: var(--badge-teal);   }
.icon-badge--blue   { background: var(--badge-blue);   }
.icon-badge--purple { background: var(--badge-purple); }
.icon-badge--pink   { background: var(--badge-pink);   }
.icon-badge--orange { background: var(--badge-orange); }
.icon-badge--amber  { background: var(--badge-amber);  }
.icon-badge--green  { background: var(--badge-green);  }
.icon-badge--cyan   { background: var(--badge-cyan);   }
.icon-badge--red    { background: var(--badge-red);    }
.icon-badge--indigo { background: var(--badge-indigo); }
.icon-badge--navy   { background: var(--badge-navy);   }

/* Raw Lucide icon (no badge) */
.icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.icon svg { stroke: currentColor; stroke-width: 2; fill: none;
            stroke-linecap: round; stroke-linejoin: round; }
.icon--xs  svg { width: 14px; height: 14px; }
.icon--sm  svg { width: 16px; height: 16px; }
.icon--md  svg { width: 20px; height: 20px; }
.icon--lg  svg { width: 24px; height: 24px; }
.icon--xl  svg { width: 32px; height: 32px; }
.icon--teal   { color: var(--teal-400); }
.icon--muted  { color: var(--text-muted); }
.icon--danger { color: var(--color-danger); }


/* ── BUTTONS ─────────────────────────────────────────────── */
/* Base button */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 0 var(--space-6);
  height: var(--touch-target);
  min-width: var(--touch-target);
  font-family: var(--font-body);
  font-size: var(--text-md);
  font-weight: var(--fw-semibold);
  line-height: 1;
  border: none;
  border-radius: var(--r-full);
  cursor: pointer;
  transition: transform var(--transition-fast),
              box-shadow var(--transition-fast),
              background var(--transition-fast),
              opacity var(--transition-fast);
  text-decoration: none;
  white-space: nowrap;
  -webkit-user-select: none;
  user-select: none;
}

.btn:active { transform: scale(0.97); }
.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

/* Full width (Law.AI pattern) */
.btn-full { width: 100%; }

/* Primary — teal gradient */
.btn-primary {
  background: linear-gradient(135deg, var(--teal-500), var(--teal-400));
  color: var(--text-inverse);
  box-shadow: var(--shadow-teal);
}
.btn-primary:hover {
  background: linear-gradient(135deg, var(--teal-400), var(--teal-300));
  box-shadow: var(--shadow-teal-lg);
  transform: translateY(-1px);
}

/* Outline */
.btn-outline {
  background: transparent;
  color: var(--text-secondary);
  border: 1.5px solid var(--border-medium);
}
.btn-outline:hover {
  border-color: var(--teal-400);
  color: var(--teal-400);
  background: var(--teal-glow);
}

/* Ghost — minimal */
.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}
.btn-ghost:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

/* Danger */
.btn-danger {
  background: var(--color-danger-bg);
  color: var(--color-danger);
  border: 1.5px solid var(--color-danger-border);
}
.btn-danger:hover {
  background: rgba(239, 68, 68, 0.20);
}

/* Icon-only circular button */
.btn-icon {
  width: var(--touch-target);
  height: var(--touch-target);
  padding: 0;
  border-radius: 50%;
  background: var(--bg-elevated);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
}
.btn-icon:hover {
  background: var(--teal-glow);
  border-color: var(--border-teal);
  color: var(--teal-400);
}

/* Teal circle — hamburger button style */
.btn-icon-teal {
  width: var(--touch-target);
  height: var(--touch-target);
  padding: 0;
  border-radius: 50%;
  background: var(--teal-400);
  color: var(--text-inverse);
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn-icon-teal:hover { background: var(--teal-500); }

/* Button sizes */
.btn-sm {
  height: 36px;
  padding: 0 var(--space-4);
  font-size: var(--text-sm);
}
.btn-lg {
  height: 52px;
  padding: 0 var(--space-8);
  font-size: var(--text-lg);
}


/* ── BADGE PILL ──────────────────────────────────────────── */
/* "MOST POPULAR" style labels (pricing cards) */
.badge-pill {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-4);
  border-radius: var(--r-full);
  font-size: var(--text-xs);
  font-weight: var(--fw-bold);
  letter-spacing: 0.4px;
  text-transform: uppercase;
  white-space: nowrap;
}

.badge-pill--teal    { background: linear-gradient(135deg, var(--teal-500), var(--teal-400)); color: #fff; }
.badge-pill--green   { background: linear-gradient(135deg, #15803d, #4ade80); color: #fff; }
.badge-pill--amber   { background: linear-gradient(135deg, #b45309, #fbbf24); color: var(--text-inverse); }
.badge-pill--purple  { background: linear-gradient(135deg, #7c3aed, #a78bfa); color: #fff; }
.badge-pill--subtle  { background: var(--bg-elevated); color: var(--text-secondary); border: 1px solid var(--border-medium); }

/* Role badge (top bar) */
.role-badge {
  background: var(--bg-elevated);
  color: var(--teal-400);
  border: 1px solid var(--border-teal);
  border-radius: var(--r-full);
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-xs);
  font-weight: var(--fw-semibold);
}


/* ── FORM ELEMENTS ───────────────────────────────────────── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.form-label {
  font-size: var(--text-xs);
  font-weight: var(--fw-semibold);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
}

.form-input,
.form-select {
  width: 100%;
  height: var(--touch-target);
  padding: 0 var(--space-4);
  background: var(--bg-elevated);
  border: 1.5px solid var(--border-subtle);
  border-radius: var(--r-md);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: var(--text-base);
  outline: none;
  transition: border-color var(--transition-fast),
              box-shadow var(--transition-fast);
  -webkit-appearance: none;
  appearance: none;
}

.form-input::placeholder { color: var(--text-muted); }

.form-input:focus,
.form-select:focus {
  border-color: var(--teal-400);
  box-shadow: 0 0 0 3px var(--teal-glow);
}

/* Password input wrapper (for show/hide toggle) */
.input-password-wrap {
  position: relative;
}
.input-password-wrap .form-input {
  padding-right: 48px;
}
.input-password-toggle {
  position: absolute;
  right: var(--space-3);
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: var(--space-1);
  display: flex;
  align-items: center;
  transition: color var(--transition-fast);
}
.input-password-toggle:hover { color: var(--teal-400); }

/* Search bar (glow border style) */
.search-bar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  background: var(--bg-card);
  border: 1.5px solid var(--border-teal);
  border-radius: var(--r-full);
  padding: 0 var(--space-5);
  height: var(--touch-target);
  box-shadow: 0 0 0 4px var(--teal-glow);
  transition: box-shadow var(--transition-fast);
}
.search-bar:focus-within {
  box-shadow: 0 0 0 6px var(--teal-glow-strong);
}
.search-bar input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: var(--text-base);
}
.search-bar input::placeholder { color: var(--text-muted); }


/* ── ALERT / FEEDBACK ────────────────────────────────────── */
.alert {
  display: none;
  padding: var(--space-4) var(--space-5);
  border-radius: var(--r-md);
  font-size: var(--text-sm);
  font-weight: var(--fw-medium);
  line-height: var(--lh-normal);
  border: 1px solid transparent;
  animation: alertSlide 0.25s ease;
}

.alert.show { display: block; }

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

.alert-error   { background: var(--color-danger-bg);  border-color: var(--color-danger-border);  color: var(--color-danger);  }
.alert-success { background: var(--color-success-bg); border-color: var(--color-success-border); color: var(--color-success); }
.alert-warning { background: var(--color-warning-bg); border-color: var(--color-warning-border); color: var(--color-warning); }
.alert-info    { background: var(--color-info-bg);    border-color: var(--color-info-border);    color: var(--color-info);    }

/* Toast — replaces all alert() calls */
#toast-container {
  position: fixed;
  bottom: calc(var(--bottom-nav-h) + var(--space-5));
  left: 50%;
  transform: translateX(-50%);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  pointer-events: none;
  width: calc(100% - var(--space-10));
  max-width: 400px;
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  background: var(--bg-elevated);
  border: 1px solid var(--border-medium);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-overlay);
  font-size: var(--text-sm);
  font-weight: var(--fw-medium);
  color: var(--text-primary);
  animation: toastIn 0.3s ease;
  pointer-events: auto;
}

.toast.toast-out { animation: toastOut 0.3s ease forwards; }

@keyframes toastIn  { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toastOut { from { opacity: 1; transform: translateY(0); } to { opacity: 0; transform: translateY(12px); } }

.toast-success { border-color: var(--color-success-border); }
.toast-success .toast-icon { color: var(--color-success); }
.toast-error   { border-color: var(--color-danger-border); }
.toast-error   .toast-icon { color: var(--color-danger); }
.toast-info    { border-color: var(--border-teal); }
.toast-info    .toast-icon { color: var(--teal-400); }


/* ── NAVIGATION ──────────────────────────────────────────── */

/* Top header bar */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-5);
  height: var(--header-h);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: var(--z-nav);
}

/* Bottom navigation bar — replaces hamburger-only nav */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: var(--max-width-app);
  height: var(--bottom-nav-h);
  background: var(--bg-surface);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding-bottom: env(safe-area-inset-bottom);
  z-index: var(--z-nav);
  backdrop-filter: blur(12px);
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  flex: 1;
  height: 100%;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: var(--fw-semibold);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  cursor: pointer;
  transition: color var(--transition-fast);
  text-decoration: none;
}

.bottom-nav-item svg {
  width: 22px; height: 22px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: stroke var(--transition-fast);
}

.bottom-nav-item:hover,
.bottom-nav-item.active {
  color: var(--teal-400);
}

.bottom-nav-item.active svg {
  stroke: var(--teal-400);
}

/* Active indicator dot */
.bottom-nav-item.active::before {
  content: '';
  display: block;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--teal-400);
  position: absolute;
  top: var(--space-2);
}

/* Page padding to account for bottom nav */
.has-bottom-nav {
  padding-bottom: calc(var(--bottom-nav-h) + var(--space-4));
}

/* Sidebar drawer */
.sidebar {
  position: fixed;
  top: 0;
  left: -300px;
  width: 280px;
  height: 100%;
  background: var(--bg-surface);
  border-right: 1px solid var(--border-subtle);
  z-index: var(--z-sidebar);
  padding: var(--space-7) var(--space-5);
  transition: left var(--transition-base);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-overlay);
}

.sidebar.open { left: 0; }

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-7);
}

.sidebar-close {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--transition-fast),
              color var(--transition-fast);
}
.sidebar-close:hover {
  background: var(--color-danger-bg);
  color: var(--color-danger);
  border-color: var(--color-danger-border);
}
.sidebar-close svg { width: 16px; height: 16px; stroke: currentColor; fill: none; }

.sidebar-nav { flex: 1; }

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--r-md);
  color: var(--text-secondary);
  font-size: var(--text-base);
  font-weight: var(--fw-medium);
  cursor: pointer;
  margin-bottom: var(--space-1);
  transition: background var(--transition-fast),
              color var(--transition-fast);
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  text-decoration: none;
}

.nav-item:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

.nav-item.active {
  background: var(--teal-glow);
  color: var(--teal-400);
  border: 1px solid var(--border-teal);
}

.nav-item svg {
  width: 18px; height: 18px;
  stroke: currentColor;
  fill: none;
  flex-shrink: 0;
}

/* Sidebar user section */
.sidebar-user {
  border-top: 1px solid var(--border-subtle);
  padding-top: var(--space-5);
  margin-top: var(--space-4);
}

.sidebar-user-name {
  font-weight: var(--fw-semibold);
  font-size: var(--text-base);
  color: var(--text-primary);
  margin-bottom: var(--space-1);
}

.sidebar-user-email {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-bottom: var(--space-4);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Overlay */
.overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-overlay);
  z-index: var(--z-overlay);
  display: none;
  backdrop-filter: blur(2px);
}
.overlay.show { display: block; }


/* ── LOGO ────────────────────────────────────────────────── */
.logo {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  text-decoration: none;
}

.logo-mark {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--teal-500), var(--teal-400));
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: var(--shadow-teal);
}

.logo-mark svg {
  width: 20px; height: 20px;
  stroke: #fff; fill: none;
  stroke-width: 2.5;
}

.logo-text {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: var(--fw-bold);
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.logo-text .logo-accent {
  color: var(--teal-400);
}


/* ── PROGRESS STEPS ──────────────────────────────────────── */
/* Signup multi-step indicator */
.step-progress {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin-bottom: var(--space-7);
}

.step-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  position: relative;
}

.step-dot {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-elevated);
  border: 2px solid var(--border-medium);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: var(--fw-bold);
  color: var(--text-muted);
  transition: all var(--transition-base);
  z-index: 1;
}

.step-dot.active {
  background: var(--teal-400);
  border-color: var(--teal-400);
  color: var(--text-inverse);
  box-shadow: var(--shadow-teal);
}

.step-dot.done {
  background: var(--teal-600);
  border-color: var(--teal-600);
  color: #fff;
}

.step-dot.done svg {
  width: 14px; height: 14px;
  stroke: #fff; fill: none;
  stroke-width: 2.5;
}

.step-label {
  font-size: 10px;
  font-weight: var(--fw-semibold);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  white-space: nowrap;
}

.step-label.active { color: var(--teal-400); }

.step-connector {
  width: 48px;
  height: 2px;
  background: var(--border-medium);
  margin: 0 var(--space-1);
  margin-bottom: var(--space-6);
  transition: background var(--transition-base);
}

.step-connector.done { background: var(--teal-600); }


/* ── PLAN CARD ───────────────────────────────────────────── */
.plan-card {
  background: var(--bg-card);
  border: 1.5px solid var(--border-medium);
  border-radius: var(--r-xl);
  padding: var(--space-6) var(--space-5);
  cursor: pointer;
  transition: border-color var(--transition-fast),
              background var(--transition-fast);
  position: relative;
}

.plan-card:hover {
  border-color: var(--border-teal);
  background: var(--bg-elevated);
}

.plan-card.selected {
  border-color: var(--teal-400);
  background: var(--teal-glow);
  box-shadow: 0 0 0 1px var(--teal-400);
}

/* Positioned badge on pricing cards */
.card-badge-top {
  position: absolute;
  top: -14px;
  left: 50%;
  transform: translateX(-50%);
}


/* ── OFFLINE BANNER ──────────────────────────────────────── */
#offline-banner {
  display: none;
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: var(--max-width-app);
  background: var(--color-warning-bg);
  border-bottom: 1px solid var(--color-warning-border);
  color: var(--color-warning);
  text-align: center;
  font-size: var(--text-sm);
  font-weight: var(--fw-semibold);
  padding: var(--space-3) var(--space-5);
  z-index: var(--z-modal);
}

#offline-banner.show { display: block; }


/* ── LOADING / SKELETON ──────────────────────────────────── */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--bg-elevated) 25%,
    var(--bg-card) 50%,
    var(--bg-elevated) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--r-sm);
}

@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton-text  { height: 14px; margin-bottom: var(--space-2); }
.skeleton-title { height: 22px; margin-bottom: var(--space-3); }
.skeleton-card  { height: 80px; border-radius: var(--r-xl); }

/* Page-level loading state */
.page-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100dvh;
  flex-direction: column;
  gap: var(--space-4);
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border-medium);
  border-top-color: var(--teal-400);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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


/* ── EMPTY STATES ────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--space-10) var(--space-7);
  gap: var(--space-4);
}

.empty-state-icon {
  width: 64px;
  height: 64px;
  border-radius: var(--r-xl);
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
}

.empty-state-icon svg {
  width: 28px; height: 28px;
  stroke: var(--text-muted);
  fill: none;
}

.empty-state-title {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: var(--fw-bold);
  color: var(--text-primary);
}

.empty-state-desc {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: var(--lh-relaxed);
  max-width: 260px;
}


/* ── SCROLL REVEAL ANIMATION ─────────────────────────────── */
.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

.reveal-delay-1 { transition-delay: 0.05s; }
.reveal-delay-2 { transition-delay: 0.10s; }
.reveal-delay-3 { transition-delay: 0.15s; }
.reveal-delay-4 { transition-delay: 0.20s; }


/* ── UTILITY BELT ────────────────────────────────────────── */
.p-0 { padding: 0 !important; }
.mt-auto { margin-top: auto; }
.mb-0 { margin-bottom: 0 !important; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-1 { flex: 1; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.overflow-hidden { overflow: hidden; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rounded-full { border-radius: var(--r-full); }
.opacity-50 { opacity: 0.5; }
.pointer-none { pointer-events: none; }
