/*
 * xenzee.css — bespoke design system for the account app.
 *
 * Single file. Zero dependencies. ~14KB minified target.
 * Inspired by Linear / Vercel / Stripe — soft surfaces, deliberate
 * whitespace, monochrome + accent, gentle motion.
 *
 *   §1  Reset & base
 *   §2  Design tokens (colors, type, space, radius, shadow)
 *   §3  Layout primitives (.container, .stack, .row)
 *   §4  Typography
 *   §5  Buttons
 *   §6  Forms & inputs
 *   §7  Cards & surfaces
 *   §8  Alerts & badges
 *   §9  Navigation (sidebar, topbar)
 *   §10 Auth split-screen
 *   §11 Tables & lists
 *   §12 Utilities
 *   §13 Motion
 *   §14 Dark theme overrides
 */

/* ─────────────────────────────────────────────────────────────────
 * §1 Reset
 * ───────────────────────────────────────────────────────────────── */
*,*::before,*::after { box-sizing: border-box; }
html,body { margin:0; padding:0; }
html { -webkit-text-size-adjust:100%; -webkit-tap-highlight-color:transparent; }
body { min-height:100vh; line-height:1.5; -webkit-font-smoothing:antialiased; -moz-osx-font-smoothing:grayscale; text-rendering:optimizeLegibility; }
img,svg,video { max-width:100%; height:auto; display:block; }
button,input,select,textarea { font:inherit; color:inherit; }
button { background:none; border:0; cursor:pointer; }
a { color:inherit; text-decoration:none; }
hr { border:0; height:1px; background:var(--border); margin:var(--space-6) 0; }

/* ─────────────────────────────────────────────────────────────────
 * §2 Design tokens
 * ───────────────────────────────────────────────────────────────── */
:root {
  /* Brand — indigo-violet, modern SaaS feel */
  --brand-50:  #eef2ff;
  --brand-100: #e0e7ff;
  --brand-200: #c7d2fe;
  --brand-400: #818cf8;
  --brand-500: #6366f1;
  --brand-600: #4f46e5;   /* primary */
  --brand-700: #4338ca;
  --brand-800: #3730a3;
  --brand-900: #1e1b4b;

  /* Slate — neutral surface + text */
  --slate-50:  #f8fafc;
  --slate-100: #f1f5f9;
  --slate-200: #e2e8f0;
  --slate-300: #cbd5e1;
  --slate-400: #94a3b8;
  --slate-500: #64748b;
  --slate-600: #475569;
  --slate-700: #334155;
  --slate-800: #1e293b;
  --slate-900: #0f172a;
  --slate-950: #020617;

  /* Semantic — light theme defaults */
  --bg:        #f8fafc;        /* app background */
  --bg-soft:   #f1f5f9;
  --surface:   #ffffff;        /* cards */
  --surface-2: #fafbff;
  --border:    #e5e7eb;
  --border-strong: #cbd5e1;
  --text:      var(--slate-900);
  --text-muted:var(--slate-500);
  --text-soft: var(--slate-400);
  --primary:   var(--brand-600);
  --primary-hover: var(--brand-700);
  --primary-soft:  var(--brand-50);
  --primary-soft-text: var(--brand-700);
  --success:   #16a34a;
  --success-soft: #dcfce7;
  --warning:   #d97706;
  --warning-soft: #fef3c7;
  --danger:    #dc2626;
  --danger-soft:  #fee2e2;
  --info:      #0284c7;
  --info-soft: #e0f2fe;

  /* Type */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  --text-xs:   0.75rem;        /* 12px */
  --text-sm:   0.875rem;       /* 14px */
  --text-base: 1rem;           /* 16px */
  --text-lg:   1.125rem;       /* 18px */
  --text-xl:   1.25rem;        /* 20px */
  --text-2xl:  1.5rem;         /* 24px */
  --text-3xl:  1.875rem;       /* 30px */
  --text-4xl:  2.25rem;        /* 36px */
  --leading-tight: 1.2;
  --leading-snug:  1.4;
  --leading-normal:1.55;

  /* Spacing — 4-pt grid */
  --space-1:  0.25rem;  --space-2:  0.5rem;
  --space-3:  0.75rem;  --space-4:  1rem;
  --space-5:  1.25rem;  --space-6:  1.5rem;
  --space-8:  2rem;     --space-10: 2.5rem;
  --space-12: 3rem;     --space-16: 4rem;
  --space-20: 5rem;

  /* Radius */
  --radius-sm:  4px;
  --radius:     8px;
  --radius-md:  10px;
  --radius-lg:  14px;
  --radius-xl:  20px;
  --radius-pill:9999px;

  /* Shadow — layered, soft, never harsh */
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow:    0 4px 12px rgba(15, 23, 42, 0.06), 0 1px 3px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 10px 25px rgba(15, 23, 42, 0.08), 0 4px 10px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 25px 50px rgba(15, 23, 42, 0.12), 0 10px 20px rgba(15, 23, 42, 0.06);
  --shadow-glow: 0 0 0 4px rgba(99, 102, 241, 0.12);

  /* Motion */
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --duration: 180ms;
  --duration-slow: 280ms;

  /* Layout */
  --sidebar-w: 212px;          /* tightened from 248px — more content room */
  --header-h: 52px;            /* tightened from 64px — flatter top bar */
  --container-max: 1200px;
}

/* ─────────────────────────────────────────────────────────────────
 * Body — application background.
 * Soft gradient so flat white cards pop without harsh contrast.
 * ───────────────────────────────────────────────────────────────── */
body {
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  color: var(--text);
  background: radial-gradient(1200px 800px at 100% 0%, rgba(99,102,241,0.06), transparent 60%),
              radial-gradient(1200px 800px at 0% 100%, rgba(244,114,182,0.04), transparent 60%),
              var(--bg);
  background-attachment: fixed;
}

/* Selection */
::selection { background: var(--brand-200); color: var(--brand-900); }

/* Focus ring — visible on every interactive element */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* Scrollbars (webkit) */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--slate-300); border-radius: 99px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: var(--slate-400); background-clip: content-box; }

/* ─────────────────────────────────────────────────────────────────
 * §3 Layout primitives
 * ───────────────────────────────────────────────────────────────── */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--space-6);
}
.container-sm { max-width: 720px; }
.container-md { max-width: 960px; }

.stack    { display: flex; flex-direction: column; gap: var(--space-4); }
.stack-sm { display: flex; flex-direction: column; gap: var(--space-2); }
.stack-lg { display: flex; flex-direction: column; gap: var(--space-6); }
.stack-xl { display: flex; flex-direction: column; gap: var(--space-8); }

.row    { display: flex; flex-wrap: wrap; gap: var(--space-4); }
.row-sm { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.row-lg { display: flex; flex-wrap: wrap; gap: var(--space-6); }

.grid   { display: grid; gap: var(--space-4); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 900px) { .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

.flex { display: flex; }
.flex-1 { flex: 1; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.justify-end { justify-content: flex-end; }
.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }
.gap-8 { gap: var(--space-8); }

/* ─────────────────────────────────────────────────────────────────
 * §4 Typography
 * ───────────────────────────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
  margin: 0;
  font-weight: 600;
  letter-spacing: -0.011em;
  line-height: var(--leading-tight);
  color: var(--text);
}
h1 { font-size: var(--text-3xl); letter-spacing: -0.025em; }
h2 { font-size: var(--text-2xl); letter-spacing: -0.02em; }
h3 { font-size: var(--text-xl); }
h4 { font-size: var(--text-lg); }
h5, h6 { font-size: var(--text-base); }
p  { margin: 0; line-height: var(--leading-normal); }

.eyebrow {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--primary);
}
.muted { color: var(--text-muted); }
.soft  { color: var(--text-soft); }
.text-xs   { font-size: var(--text-xs); }
.text-sm   { font-size: var(--text-sm); }
.text-base { font-size: var(--text-base); }
.text-lg   { font-size: var(--text-lg); }
.text-xl   { font-size: var(--text-xl); }
.text-2xl  { font-size: var(--text-2xl); }
.text-3xl  { font-size: var(--text-3xl); }

.font-mono { font-family: var(--font-mono); }
.font-medium   { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold     { font-weight: 700; }

.text-center { text-align: center; }
.text-right  { text-align: right; }

/* Display heading — used on auth pages, marketing-y feel */
.display {
  font-size: clamp(2rem, 4.5vw, 2.75rem);
  line-height: 1.05;
  letter-spacing: -0.03em;
  font-weight: 700;
  background: linear-gradient(135deg, var(--slate-900), var(--brand-700));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
/* Italic serif accent — used inside .display for an emphasised name etc.
 * Pairs the geometric sans (Inter) with a high-contrast serif italic for a
 * "designed" feel without committing to a serif everywhere. */
.display-italic {
  font-family: 'Instrument Serif', 'Times New Roman', Georgia, serif;
  font-style: italic;
  font-weight: 400;
  background: linear-gradient(135deg, var(--brand-600), var(--brand-800));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  padding-right: 0.05em;        /* the slant of the italic clips otherwise */
}

/* ─── Hero — dashboard "welcome back" panel ────────────────────────────
 * Card with a soft mesh-gradient background so it feels distinct from the
 * standard cards below it. Background uses radial gradients (no images) so
 * it scales / re-tints with the theme automatically.
 */
.hero {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: var(--surface);
  padding: clamp(var(--space-6), 4vw, var(--space-12));
}
.hero::before {
  content: "";
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 600px 400px at 80% -10%, rgba(99, 102, 241, 0.18), transparent 60%),
    radial-gradient(ellipse 500px 400px at 0% 100%, rgba(236, 72, 153, 0.14), transparent 60%),
    radial-gradient(ellipse 400px 300px at 50% 50%, rgba(34, 197, 94, 0.06), transparent 70%);
  pointer-events: none;
  z-index: 0;
}
.hero > * { position: relative; z-index: 1; }
.hero-eyebrow {
  display: inline-flex; align-items: center; gap: var(--space-1);
  padding: 4px 10px;
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
}
.hero-eyebrow svg { width: 12px; height: 12px; color: var(--primary); }
.hero h1 {
  margin-top: var(--space-4);
  font-size: clamp(1.875rem, 4vw, 3rem);
  line-height: 1.05;
  letter-spacing: -0.025em;
}
.hero p { margin-top: var(--space-3); max-width: 52ch; color: var(--text-muted); }
.hero-actions { margin-top: var(--space-6); display: flex; flex-wrap: wrap; gap: var(--space-2); }
html[data-theme="dark"] .hero-eyebrow { background: rgba(0,0,0,0.35); }
html[data-theme="dark"] .hero::before {
  background:
    radial-gradient(ellipse 600px 400px at 80% -10%, rgba(99, 102, 241, 0.30), transparent 60%),
    radial-gradient(ellipse 500px 400px at 0% 100%, rgba(236, 72, 153, 0.20), transparent 60%);
}

/* ─── Stat-strip: bigger version of the .stat card with right-side icon ── */
.metric {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  transition: transform var(--duration) var(--ease), box-shadow var(--duration) var(--ease);
  text-decoration: none; color: inherit;
}
.metric:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.metric-head { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--space-2); }
.metric-label { font-size: 0.6875rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted); }
.metric-value { font-size: var(--text-2xl); font-weight: 600; letter-spacing: -0.02em; margin-top: var(--space-2); }
.metric-hint  { font-size: var(--text-xs); color: var(--text-muted); margin-top: var(--space-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.metric-icon {
  width: 38px; height: 38px;
  border-radius: var(--radius);
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.metric-icon svg { width: 18px; height: 18px; }
/* Tones */
.tone-good    { background: rgba(34,197,94,0.12);  color: var(--success); }
.tone-warn    { background: rgba(217,119,6,0.12);  color: var(--warning); }
.tone-neutral { background: var(--primary-soft);   color: var(--primary-soft-text); }

/* ─── Product card — distinctive accent per product ──────────────────── */
.product-card {
  position: relative;
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  text-decoration: none; color: inherit;
  transition: transform var(--duration) var(--ease), box-shadow var(--duration) var(--ease);
  overflow: hidden;
}
.product-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.product-card.is-soon { opacity: 0.62; pointer-events: none; }
.product-card .product-icon {
  width: 44px; height: 44px;
  border-radius: var(--radius);
  display: inline-flex; align-items: center; justify-content: center;
}
.product-card .product-icon svg { width: 22px; height: 22px; }
.product-card h3 { margin-top: var(--space-4); font-size: var(--text-base); font-weight: 600; }
.product-card p  { margin-top: var(--space-1); font-size: var(--text-sm); color: var(--text-muted); }
.product-card .product-cta {
  margin-top: var(--space-4);
  display: inline-flex; align-items: center; gap: var(--space-1);
  font-size: var(--text-sm); font-weight: 500; color: var(--text);
}
.product-card:hover .product-cta svg { transform: translate(2px, -2px); }
.product-card .product-cta svg { width: 14px; height: 14px; transition: transform var(--duration) var(--ease); }
/* Hover underline accent */
.product-card::after {
  content: "";
  position: absolute; left: 0; right: 0; bottom: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--primary), transparent);
  transform: scaleX(0);
  transition: transform 0.5s var(--ease);
}
.product-card:hover::after { transform: scaleX(1); }

/* Per-product accent tints */
.tint-violet  { background: rgba(124, 58, 237, 0.12); color: #7c3aed; }
.tint-emerald { background: rgba(5, 150, 105, 0.12);  color: #059669; }
.tint-sky     { background: rgba(2, 132, 199, 0.12);  color: #0284c7; }
.tint-amber   { background: rgba(217, 119, 6, 0.12);  color: #d97706; }
.tint-rose    { background: rgba(225, 29, 72, 0.12);  color: #e11d48; }
.tint-fuchsia { background: rgba(217, 70, 239, 0.12); color: #d946ef; }
html[data-theme="dark"] .tint-violet  { color: #a78bfa; }
html[data-theme="dark"] .tint-emerald { color: #34d399; }
html[data-theme="dark"] .tint-sky     { color: #38bdf8; }
html[data-theme="dark"] .tint-amber   { color: #fbbf24; }
html[data-theme="dark"] .tint-rose    { color: #fb7185; }
html[data-theme="dark"] .tint-fuchsia { color: #e879f9; }

/* Links */
a.link { color: var(--primary); transition: color var(--duration) var(--ease); }
a.link:hover { color: var(--primary-hover); text-decoration: underline; text-underline-offset: 3px; }

/* Code */
code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: var(--bg-soft);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

/* ─────────────────────────────────────────────────────────────────
 * §5 Buttons
 * ───────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  font-weight: 500;
  line-height: 1;
  padding: 0.625rem 1rem;
  border-radius: var(--radius);
  border: 1px solid transparent;
  background: var(--surface);
  color: var(--text);
  transition: all var(--duration) var(--ease);
  white-space: nowrap;
  user-select: none;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; box-shadow: none; }
/* display:inline-flex above would otherwise override the [hidden] attribute,
 * so buttons toggled via el.hidden (wizard Next/Create, passkey Add) stay visible. */
.btn[hidden] { display: none !important; }

.btn-primary {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  box-shadow: 0 1px 0 0 rgba(255,255,255,0.1) inset, var(--shadow-xs);
}
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); box-shadow: 0 4px 12px rgba(99, 102, 241, 0.25); }

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border-strong);
}
.btn-secondary:hover { background: var(--bg-soft); border-color: var(--slate-400); }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: transparent;
}
.btn-ghost:hover { background: var(--bg-soft); color: var(--text); transform: none; box-shadow: none; }

.btn-danger {
  background: var(--danger);
  color: white;
  border-color: var(--danger);
}
.btn-danger:hover { background: #b91c1c; border-color: #b91c1c; box-shadow: 0 4px 12px rgba(220, 38, 38, 0.25); }

.btn-link {
  background: none;
  color: var(--primary);
  border: 0;
  padding: 0;
  font-weight: 500;
}
.btn-link:hover { color: var(--primary-hover); text-decoration: underline; transform: none; box-shadow: none; }

.btn-sm  { padding: 0.4375rem 0.75rem; font-size: var(--text-xs); border-radius: var(--radius-sm); }
.btn-lg  { padding: 0.875rem 1.5rem; font-size: var(--text-base); border-radius: var(--radius-md); }
.btn-block { width: 100%; }

/* Icon-only button — for top-bar actions etc.
 * 32px tall (down from 36px) so it sits cleanly inside the new 52px topbar. */
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius);
  color: var(--text-muted);
  background: transparent;
  transition: all var(--duration) var(--ease);
}
.icon-btn:hover { background: var(--bg-soft); color: var(--text); }
.icon-btn svg { width: 16px; height: 16px; }

/* ─────────────────────────────────────────────────────────────────
 * §6 Forms
 * ───────────────────────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: var(--space-2); }
.label {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text);
}
.label .req { color: var(--danger); }

.input,
.select,
.textarea {
  width: 100%;
  font: inherit;
  padding: 0.625rem 0.875rem;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: var(--radius);
  transition: border-color var(--duration) var(--ease), box-shadow var(--duration) var(--ease);
  appearance: none;
}
.input:hover, .select:hover, .textarea:hover { border-color: var(--border-strong); }
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: var(--shadow-glow);
}
.input::placeholder, .textarea::placeholder { color: var(--text-soft); }
.input[disabled], .select[disabled], .textarea[disabled] { background: var(--bg-soft); cursor: not-allowed; opacity: 0.7; }
.input.is-invalid, .select.is-invalid, .textarea.is-invalid { border-color: var(--danger); }
.input.is-invalid:focus, .select.is-invalid:focus, .textarea.is-invalid:focus { box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.12); }
.input-help { font-size: var(--text-xs); color: var(--text-muted); }
.input-error { font-size: var(--text-xs); color: var(--danger); display: flex; align-items: center; gap: var(--space-1); }

.textarea { min-height: 96px; resize: vertical; line-height: var(--leading-normal); }

/* Select — chevron via SVG background */
.select {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke-width='2' stroke='%2364748b'><path stroke-linecap='round' stroke-linejoin='round' d='M19.5 8.25l-7.5 7.5-7.5-7.5'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  padding-right: 36px;
}

/* Input with leading icon */
.input-icon {
  position: relative;
  display: flex;
  align-items: center;
}
.input-icon > svg {
  position: absolute;
  left: 12px;
  width: 18px;
  height: 18px;
  color: var(--text-soft);
  pointer-events: none;
}
.input-icon > .input { padding-left: 40px; }

/* Password reveal */
.input-password { position: relative; }
.input-password .input { padding-right: 40px; }
.input-password .reveal {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-soft);
  cursor: pointer;
}
.input-password .reveal:hover { color: var(--text); background: var(--bg-soft); }
.input-password .reveal svg { width: 16px; height: 16px; }

/* Checkbox + radio */
.check { display: inline-flex; gap: var(--space-2); align-items: flex-start; cursor: pointer; user-select: none; }
.check input[type="checkbox"], .check input[type="radio"] { margin-top: 2px; accent-color: var(--primary); width: 16px; height: 16px; }
.check span { font-size: var(--text-sm); line-height: var(--leading-normal); color: var(--text); }
.check small { color: var(--text-muted); display: block; font-size: var(--text-xs); }

/* OTP input row */
.otp-row { display: flex; gap: var(--space-2); justify-content: center; }
.otp-row .input { width: 44px; height: 52px; text-align: center; font-size: var(--text-xl); font-weight: 600; padding: 0; }

/* ─────────────────────────────────────────────────────────────────
 * §7 Cards & surfaces
 * ───────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
}
.card-padded { padding: var(--space-6); }
.card-header {
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-4);
}
.card-header h3 { font-size: var(--text-base); font-weight: 600; }
.card-body   { padding: var(--space-6); }
.card-footer { padding: var(--space-4) var(--space-6); border-top: 1px solid var(--border); background: var(--surface-2); }

/* Stat card */
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
}
.stat-label { font-size: var(--text-xs); color: var(--text-muted); font-weight: 500; }
.stat-value { font-size: var(--text-3xl); font-weight: 700; letter-spacing: -0.02em; margin-top: var(--space-1); }
.stat-delta { font-size: var(--text-xs); color: var(--success); }

/* Empty state */
.empty {
  text-align: center;
  padding: var(--space-12) var(--space-6);
  color: var(--text-muted);
}
.empty svg { width: 40px; height: 40px; margin: 0 auto var(--space-4); color: var(--text-soft); }
.empty h3 { font-size: var(--text-base); color: var(--text); margin-bottom: var(--space-2); }
.empty p { font-size: var(--text-sm); margin-bottom: var(--space-4); }

/* Section header */
.section-header { margin-bottom: var(--space-5); }
.section-header h2 { font-size: var(--text-xl); }
.section-header p { color: var(--text-muted); margin-top: var(--space-1); }

/* ─────────────────────────────────────────────────────────────────
 * §8 Alerts & badges
 * ───────────────────────────────────────────────────────────────── */
.alert {
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-size: var(--text-sm);
  display: flex;
  gap: var(--space-3);
  align-items: flex-start;
  line-height: var(--leading-snug);
}
.alert svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }
.alert-success { background: var(--success-soft); color: #166534; border-color: #bbf7d0; }
.alert-warning { background: var(--warning-soft); color: #92400e; border-color: #fde68a; }
.alert-danger  { background: var(--danger-soft);  color: #991b1b; border-color: #fecaca; }
.alert-info    { background: var(--info-soft);    color: #075985; border-color: #bae6fd; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 2px 8px;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-radius: var(--radius-pill);
  background: var(--bg-soft);
  color: var(--text-muted);
}
.badge-primary { background: var(--primary-soft); color: var(--primary-soft-text); }
.badge-success { background: var(--success-soft); color: #166534; }
.badge-warning { background: var(--warning-soft); color: #92400e; }
.badge-danger  { background: var(--danger-soft);  color: #991b1b; }

/* Avatar — 30px in the topbar context, 56px on profile pages */
.avatar {
  width: 30px; height: 30px;
  border-radius: var(--radius-pill);
  background: linear-gradient(135deg, var(--brand-500), var(--brand-700));
  color: white;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.8125rem;        /* 13px */
  user-select: none;
}
.avatar-lg { width: 56px; height: 56px; font-size: var(--text-lg); }

/* ─────────────────────────────────────────────────────────────────
 * §9 Navigation — sidebar + topbar (the app shell)
 * ───────────────────────────────────────────────────────────────── */
.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}
@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: var(--space-4) var(--space-2);   /* tighter horizontal padding for the narrower sidebar */
  z-index: 30;
}
@media (max-width: 900px) {
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sidebar-w);
    transform: translateX(-100%);
    transition: transform var(--duration) var(--ease);
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: translateX(0); }
}

.brand {
  display: flex; align-items: center; gap: var(--space-2);
  padding: 0 var(--space-2);
  font-weight: 700;
  font-size: var(--text-sm);            /* matches topbar text size */
  color: var(--text);
  letter-spacing: -0.01em;
  height: var(--header-h);              /* sidebar brand block lines up with topbar height */
  margin-bottom: var(--space-2);
}
.brand-mark {
  width: 24px; height: 24px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--brand-500), var(--brand-700));
  display: inline-flex; align-items: center; justify-content: center;
  color: white;
  font-weight: 800;
  font-size: 12px;
  letter-spacing: -0.05em;
}

.nav-group { margin-top: var(--space-4); }
.nav-group-label {
  padding: 0 var(--space-3);
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-soft);
  margin-bottom: var(--space-2);
}
.nav-item {
  display: flex; align-items: center; gap: var(--space-2);
  padding: 0.4375rem var(--space-3);          /* slightly shorter rows for the narrower rail */
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 0.8125rem;                       /* 13px — denser-feeling rail */
  font-weight: 500;
  transition: all var(--duration) var(--ease);
}
.nav-item svg { width: 16px; height: 16px; flex-shrink: 0; }
.nav-item:hover { background: var(--bg-soft); color: var(--text); }
.nav-item.active { background: var(--primary-soft); color: var(--primary-soft-text); }
.nav-item.active svg { color: var(--primary); }

.sidebar-footer { margin-top: auto; padding-top: var(--space-4); border-top: 1px solid var(--border); }

/* Topbar — flatter and tighter than v1. Two slot zones:
 *   .topbar-actions     → in-app actions (theme toggle, etc.) before the divider
 *   .topbar-far-right   → cross-app widget (avatar dropdown + apps grid),
 *                         flush to the right edge with a vertical divider.
 */
.topbar {
  position: sticky;
  top: 0;
  height: var(--header-h);
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--border);
  z-index: 20;
  display: flex;
  align-items: center;
  padding: 0 var(--space-3) 0 var(--space-5); /* trim right padding so the cross-app widget sits flush */
  gap: var(--space-3);
}
.topbar h1 { font-size: var(--text-sm); font-weight: 600; }
.topbar-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: var(--space-1);
}
/* Far-right slot — pushed to the actual right edge by margin-left:auto.
 * Border-left only renders when there's something in .topbar-actions
 * before us; without that, no divider since the widget is the first
 * non-title element. */
.topbar-far-right {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-left: auto;          /* THIS pushes the widget to the right edge */
  height: calc(var(--header-h) - var(--space-4));
}
.topbar-actions + .topbar-far-right {
  /* When in-app actions exist BEFORE the widget, separate them visibly. */
  padding-left: var(--space-2);
  margin-left: var(--space-2);
  border-left: 1px solid var(--border);
}
/* The injected Web Component might render at its own height — center it. */
.topbar-far-right > * { display: inline-flex; align-items: center; }

/* Mobile-only menu button */
.menu-toggle { display: none; }
@media (max-width: 900px) {
  .menu-toggle { display: inline-flex; }
}

/* Page wrapper inside app shell */
.page { padding: var(--space-8) var(--space-6) var(--space-12); }
.page-header { margin-bottom: var(--space-6); }
.page-header h1 { font-size: var(--text-2xl); }
.page-header p { color: var(--text-muted); margin-top: var(--space-1); }

/* ─────────────────────────────────────────────────────────────────
 * §10 Auth split-screen
 * ───────────────────────────────────────────────────────────────── */
.auth-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
}
@media (max-width: 900px) {
  .auth-shell { grid-template-columns: 1fr; }
  .auth-brand { display: none; }
}

.auth-brand {
  position: relative;
  background:
    radial-gradient(800px 600px at 30% 10%, rgba(255,255,255,0.18), transparent 60%),
    radial-gradient(800px 600px at 80% 80%, rgba(244,114,182,0.18), transparent 60%),
    linear-gradient(135deg, var(--brand-700), var(--brand-900));
  color: white;
  padding: var(--space-12);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
}
.auth-brand::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.04) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: radial-gradient(closest-side at 50% 30%, black 60%, transparent);
  pointer-events: none;
}
.auth-brand > * { position: relative; z-index: 1; }
.auth-brand .brand { color: white; padding: 0; margin: 0; }
.auth-brand .brand-mark { background: rgba(255,255,255,0.18); }
.auth-brand h2 { color: white; font-size: clamp(1.75rem, 3vw, 2.25rem); line-height: 1.15; letter-spacing: -0.02em; }
.auth-brand p  { color: rgba(255,255,255,0.78); font-size: var(--text-base); line-height: var(--leading-normal); max-width: 36ch; }
.auth-brand .quote {
  font-size: var(--text-sm);
  color: rgba(255,255,255,0.82);
  border-left: 2px solid rgba(255,255,255,0.3);
  padding-left: var(--space-4);
  font-style: italic;
}
.auth-brand .quote-by { font-size: var(--text-xs); color: rgba(255,255,255,0.55); margin-top: var(--space-2); font-style: normal; letter-spacing: 0.04em; }

.auth-form {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-12) var(--space-6);
}
.auth-form-inner {
  width: 100%;
  max-width: 380px;
}
.auth-form-inner > .brand { padding: 0; margin: 0 0 var(--space-8); }
.auth-form-inner h1 { margin-bottom: var(--space-2); }
.auth-form-inner > .muted { margin-bottom: var(--space-6); font-size: var(--text-sm); }
.auth-footer { margin-top: var(--space-6); text-align: center; font-size: var(--text-sm); color: var(--text-muted); }

/* Stepper for multi-step forms */
.stepper { display: flex; align-items: center; gap: var(--space-2); margin-bottom: var(--space-6); }
.stepper-step {
  display: flex; align-items: center; gap: var(--space-2);
  font-size: var(--text-xs); color: var(--text-muted); font-weight: 500;
}
.stepper-dot {
  width: 24px; height: 24px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 600;
  transition: all var(--duration) var(--ease);
}
.stepper-step.active .stepper-dot { background: var(--primary); color: white; border-color: var(--primary); box-shadow: 0 0 0 4px rgba(99,102,241,0.15); }
.stepper-step.done .stepper-dot { background: var(--primary); color: white; border-color: var(--primary); }
.stepper-step.active { color: var(--text); }
.stepper-divider { flex: 1; height: 1px; background: var(--border); }

/* ─────────────────────────────────────────────────────────────────
 * §11 Tables + lists
 * ───────────────────────────────────────────────────────────────── */
.table {
  width: 100%;
  border-collapse: collapse;
}
.table th, .table td {
  text-align: left;
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border);
  font-size: var(--text-sm);
  vertical-align: middle;
}
.table th {
  font-weight: 600;
  color: var(--text-muted);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--surface-2);
}
.table tbody tr { transition: background var(--duration) var(--ease); }
.table tbody tr:hover { background: var(--bg-soft); }
.table tbody tr:last-child td { border-bottom: 0; }

/* "List" — vertical card-divided rows (e.g. sessions, payment methods) */
.list { display: flex; flex-direction: column; }
.list-item {
  display: flex; align-items: center; gap: var(--space-4);
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border);
}
.list-item:last-child { border-bottom: 0; }
.list-item .body { flex: 1; min-width: 0; }
.list-item .title { font-weight: 500; font-size: var(--text-sm); margin: 0; }
.list-item .meta { font-size: var(--text-xs); color: var(--text-muted); margin-top: 2px; }
.list-item .icon-circle {
  width: 36px; height: 36px;
  border-radius: var(--radius);
  background: var(--bg-soft);
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  flex-shrink: 0;
}
.list-item .icon-circle svg { width: 18px; height: 18px; }

/* Backup-codes grid */
.codes-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-2);
  font-family: var(--font-mono);
  background: var(--bg-soft);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  padding: var(--space-4);
}
.codes-grid > div {
  background: var(--surface);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
}

/* ─────────────────────────────────────────────────────────────────
 * §12 Utilities
 * ───────────────────────────────────────────────────────────────── */
.hidden { display: none !important; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0;
  margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
.mt-0 { margin-top: 0; }   .mt-1 { margin-top: var(--space-1); }
.mt-2 { margin-top: var(--space-2); } .mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); } .mt-5 { margin-top: var(--space-5); }
.mt-6 { margin-top: var(--space-6); } .mt-8 { margin-top: var(--space-8); }
.mb-0 { margin-bottom: 0; } .mb-2 { margin-bottom: var(--space-2); }
.mb-4 { margin-bottom: var(--space-4); } .mb-6 { margin-bottom: var(--space-6); }
.w-full { width: 100%; }
.relative { position: relative; }

/* "Spinner" — for buttons in pending state */
.spinner {
  display: inline-block;
  width: 14px; height: 14px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─────────────────────────────────────────────────────────────────
 * §13 Motion
 * ───────────────────────────────────────────────────────────────── */
.fade-in { animation: fadeIn var(--duration-slow) var(--ease) both; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ─────────────────────────────────────────────────────────────────
 * §14 Dark theme — opt in via <html data-theme="dark">
 * ───────────────────────────────────────────────────────────────── */
html[data-theme="dark"] {
  --bg:        #0b1020;
  --bg-soft:   #131a30;
  --surface:   #161e36;
  --surface-2: #1a2340;
  --border:    #25304e;
  --border-strong: #34416a;
  --text:      #e2e8f0;
  --text-muted:#94a3b8;
  --text-soft: #64748b;
  --primary-soft:      rgba(99,102,241,0.16);
  --primary-soft-text: #c7d2fe;
  --success-soft: rgba(34,197,94,0.16);
  --warning-soft: rgba(217,119,6,0.16);
  --danger-soft:  rgba(220,38,38,0.16);
  --info-soft:    rgba(2,132,199,0.16);
  --shadow-xs: 0 1px 2px rgba(0,0,0,0.5);
  --shadow-sm: 0 4px 12px rgba(0,0,0,0.4);
  --shadow-md: 0 10px 25px rgba(0,0,0,0.5);
}
html[data-theme="dark"] body {
  background: radial-gradient(1200px 800px at 100% 0%, rgba(99,102,241,0.18), transparent 60%),
              radial-gradient(1200px 800px at 0% 100%, rgba(244,114,182,0.10), transparent 60%),
              var(--bg);
}
html[data-theme="dark"] .topbar { background: rgba(22, 30, 54, 0.85); }
html[data-theme="dark"] .auth-brand {
  background:
    radial-gradient(800px 600px at 30% 10%, rgba(255,255,255,0.06), transparent 60%),
    linear-gradient(135deg, var(--brand-800), var(--brand-900));
}
html[data-theme="dark"] .display {
  background: linear-gradient(135deg, #fff, var(--brand-300, #a5b4fc));
  -webkit-background-clip: text;
  background-clip: text;
}


/* ── Unified sidebar hamburger (adopted from Delta) ─────────────── */
.hamburger-icon{width:20px;height:14px;position:relative;display:block;margin:0 auto;cursor:pointer}
.hamburger-icon span{display:block;position:absolute;height:2px;width:100%;background:currentColor;border-radius:2px;opacity:1;left:0;transition:.25s ease-in-out}
.hamburger-icon span:nth-child(1){top:0;width:80%}
.hamburger-icon span:nth-child(2){top:6px}
.hamburger-icon span:nth-child(3){top:12px;width:60%}
.menu-toggle:hover .hamburger-icon span:nth-child(1),
.menu-toggle:hover .hamburger-icon span:nth-child(3),
.topbar__toggle:hover .hamburger-icon span:nth-child(1),
.topbar__toggle:hover .hamburger-icon span:nth-child(3){width:100%}


/* ── Thin, light sidebar scrollbar (match Haven) ──────── */
.sidebar{scrollbar-width:thin;scrollbar-color:transparent transparent;transition:scrollbar-color .2s ease}
.sidebar:hover{scrollbar-color:rgba(148,163,184,.45) transparent}
.sidebar::-webkit-scrollbar{width:6px;height:6px}
.sidebar::-webkit-scrollbar-track{background:transparent}
.sidebar::-webkit-scrollbar-thumb{background:transparent;border-radius:999px;transition:background .2s ease}
.sidebar:hover::-webkit-scrollbar-thumb{background:rgba(148,163,184,.4)}
.sidebar::-webkit-scrollbar-thumb:hover{background:rgba(148,163,184,.6)}

/* ── Brand logo in the sidebar ──────────────────────────────────────
   Real wordmark in two colourways: navy on light theme, white on dark
   (html[data-theme="dark"] is stamped by xenzee_theme_preinit). The
   square X icon replaces the wordmark when the rail is collapsed. */
.brand .brand-logo { height: 17px; width: auto; display: block; }
.brand .brand-logo--light { display: none; }
html[data-theme="dark"] .brand .brand-logo--dark { display: none; }
html[data-theme="dark"] .brand .brand-logo--light { display: block; }
.brand .brand-icon { display: none; width: 28px; height: 28px; border-radius: var(--radius-sm); }

/* ── Collapsed sidebar (desktop rail) ───────────────────────────────
   html.sidebar-collapsed is toggled by the topbar hamburger and saved
   in localStorage (restored pre-paint by the head script in the app
   layout). Mobile (≤900px) keeps the off-canvas drawer instead. */
@media (min-width: 901px) {
  html.sidebar-collapsed .app-shell { grid-template-columns: 64px 1fr; }
  html.sidebar-collapsed .sidebar { overflow: hidden; }
  html.sidebar-collapsed .brand { justify-content: center; padding: 0; }
  html.sidebar-collapsed .brand .brand-logo { display: none !important; }
  html.sidebar-collapsed .brand .brand-icon { display: block; }
  html.sidebar-collapsed .nav-group-label { display: none; }
  /* Icon-only rows: font-size 0 hides the text nodes, the 16px svg stays. */
  html.sidebar-collapsed .nav-item { font-size: 0; gap: 0; justify-content: center; padding-left: 0; padding-right: 0; }
}

/* "xenzee" is a wordmark, not a word — same treatment as the marketing
   site: display face, heavier weight, tight tracking, always lowercase. */
.brand-word{font-family:'Plus Jakarta Sans','Inter',sans-serif;font-weight:700;letter-spacing:-.02em;text-transform:lowercase;color:inherit}
