/* Manrope — primary typeface, self-hosted (variable font) for offline / PWA use. */
@font-face {
  font-family: 'Manrope';
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url('fonts/Manrope.woff2') format('woff2');
}
/* Inter — kept as a graceful fallback (already cached). */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('fonts/InterVariable.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: italic;
  font-weight: 100 900;
  font-display: swap;
  src: url('fonts/InterVariable-Italic.woff2') format('woff2');
}

/* ════════════════════════════════════════════════════════════════════════════
   Tapfolio Console — design system v2
   Light-first professional SaaS UI. Soft-gray canvas, white surfaces, crisp
   borders, indigo accent. Dark mode is a first-class variant, not an inversion.
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #fafbfc;
  --border: #e6e8ef;
  --border-strong: #d4d8e3;
  --text: #131722;
  --muted: #697386;
  --faint: #98a1b3;

  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent-soft: #eef0fe;
  --accent-text: #4440c9;

  --success: #16a34a;  --success-bg: #e9f9ef;  --success-text: #077d55;
  --warning: #d97706;  --warning-bg: #fdf3e0;  --warning-text: #a15c07;
  --danger:  #dc2626;  --danger-bg:  #fdecec;  --danger-text:  #b42323;
  --info-bg: #eaf3fe;  --info-text: #175cd3;

  --radius-lg: 12px;
  --radius: 10px;
  --radius-sm: 8px;

  --shadow-xs: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .06);
  --shadow-md: 0 4px 8px -2px rgba(16, 24, 40, .08), 0 2px 4px -2px rgba(16, 24, 40, .06);
  --shadow-lg: 0 12px 24px -6px rgba(16, 24, 40, .14), 0 4px 10px -4px rgba(16, 24, 40, .08);

  --font: "Manrope", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  /* Glassmorphism — frosted translucent chrome (topbar, sidebar, .glass). */
  --glass-bg: rgba(255, 255, 255, .62);
  --glass-border: rgba(255, 255, 255, .65);
  --glass-hi: rgba(255, 255, 255, .8);
  --glass-blur: saturate(180%) blur(16px);

  /* Legacy aliases (v1 token names still referenced in some view inline styles). */
  --indigo: var(--accent);
  --indigo-600: var(--accent-hover);
  --card: var(--surface);
  --elev: var(--surface-2);
  --fg: var(--text);
}

:root { color-scheme: light; }

/* Dark palette — shared by the explicit choice and the automatic (system) mode. */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0e1118;
  --surface: #171b26;
  --surface-2: #1c2130;
  --border: #262d40;
  --border-strong: #343d57;
  --text: #e8ebf3;
  --muted: #97a0b5;
  --faint: #6d7690;

  --accent: #6c66f7;
  --accent-hover: #7d78f9;
  --accent-soft: rgba(108, 102, 247, .16);
  --accent-text: #a5a1ff;

  --success-bg: rgba(22,163,74,.16);   --success-text: #4ade80;
  --warning-bg: rgba(217,119,6,.16);   --warning-text: #fbbf24;
  --danger-bg:  rgba(220,38,38,.15);   --danger-text:  #f87171;
  --info-bg:    rgba(23,92,211,.18);   --info-text:    #7ab3ff;

  --shadow-xs: 0 1px 2px rgba(0,0,0,.4);
  --shadow-sm: 0 1px 3px rgba(0,0,0,.45);
  --shadow-md: 0 4px 10px -2px rgba(0,0,0,.5);
  --shadow-lg: 0 14px 30px -8px rgba(0,0,0,.6);

  --glass-bg: rgba(20, 24, 34, .55);
  --glass-border: rgba(255, 255, 255, .09);
  --glass-hi: rgba(255, 255, 255, .12);
}

/* Automatic: follow the OS unless the user explicitly picked light or dark. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="dark"]) {
    color-scheme: dark;
    --bg: #0e1118;
    --surface: #171b26;
    --surface-2: #1c2130;
    --border: #262d40;
    --border-strong: #343d57;
    --text: #e8ebf3;
    --muted: #97a0b5;
    --faint: #6d7690;

    --accent: #6c66f7;
    --accent-hover: #7d78f9;
    --accent-soft: rgba(108, 102, 247, .16);
    --accent-text: #a5a1ff;

    --success-bg: rgba(22,163,74,.16);   --success-text: #4ade80;
    --warning-bg: rgba(217,119,6,.16);   --warning-text: #fbbf24;
    --danger-bg:  rgba(220,38,38,.15);   --danger-text:  #f87171;
    --info-bg:    rgba(23,92,211,.18);   --info-text:    #7ab3ff;

    --shadow-xs: 0 1px 2px rgba(0,0,0,.4);
    --shadow-sm: 0 1px 3px rgba(0,0,0,.45);
    --shadow-md: 0 4px 10px -2px rgba(0,0,0,.5);
    --shadow-lg: 0 14px 30px -8px rgba(0,0,0,.6);

    --glass-bg: rgba(20, 24, 34, .55);
    --glass-border: rgba(255, 255, 255, .09);
    --glass-hi: rgba(255, 255, 255, .12);
  }
}

/* ── Base ──────────────────────────────────────────────────────────────────── */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg); color: var(--text);
  font-family: var(--font); font-size: 14px; line-height: 1.55;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  letter-spacing: -0.005em;
}
/* Ambient colour wash — gives the frosted-glass chrome something to refract.
   Scoped to the authenticated shell so public card templates keep their own look. */
.shell::before {
  content: ''; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(58% 44% at 12% -4%, color-mix(in srgb, var(--accent) 20%, transparent), transparent 70%),
    radial-gradient(50% 40% at 100% 12%, color-mix(in srgb, #8b5cf6 16%, transparent), transparent 72%),
    radial-gradient(46% 42% at 60% 108%, color-mix(in srgb, #22d3ee 12%, transparent), transparent 72%);
}
a { color: inherit; text-decoration: none; }
h1, h2, h3 { margin: 0; font-weight: 700; letter-spacing: -0.02em; color: var(--text); }
h1 { font-size: 22px; line-height: 1.2; }
h2 { font-size: 17px; }
h3 { font-size: 15px; }
::selection { background: var(--accent-soft); }

.wrap { width: 100%; max-width: 760px; margin: 0 auto; padding: 40px 22px 72px; }
.wrap-sm { max-width: 420px; }
.center { min-height: 100dvh; display: flex; flex-direction: column; justify-content: center; }
.muted { color: var(--muted); }
.mini { font-size: 12px; color: var(--muted); }
.row { display: flex; align-items: center; gap: 12px; }
.between { justify-content: space-between; }
.stack { display: grid; gap: 14px; }
.link { color: var(--accent-text); font-weight: 600; }
.link:hover { text-decoration: underline; text-underline-offset: 3px; }
.icon { width: 20px; height: 20px; vertical-align: middle; }

/* ── Surfaces ──────────────────────────────────────────────────────────────── */
.surface {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-xs);
}
.glass {
  background: var(--glass-bg);
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-md), inset 0 1px 0 var(--glass-hi);
}
.shadow { box-shadow: var(--shadow-md); }
.panel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-xs);
  padding: 20px 22px; margin-top: 16px;
}

/* ── Buttons ───────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 36px; padding: 0 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font-size: 13.5px; font-weight: 600; font-family: inherit; letter-spacing: -0.006em;
  cursor: pointer; box-shadow: var(--shadow-xs); white-space: nowrap;
  transition: background .13s ease, border-color .13s ease, box-shadow .13s ease, transform .08s ease;
}
.btn:hover { background: var(--surface-2); border-color: var(--faint); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: default; }
.btn-primary {
  background: var(--accent); border-color: var(--accent); color: #fff;
  box-shadow: var(--shadow-xs), inset 0 1px 0 rgba(255,255,255,.14);
}
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-danger { color: var(--danger-text); border-color: color-mix(in srgb, var(--danger) 34%, var(--border)); background: var(--surface); }
.btn-danger:hover { background: var(--danger-bg); border-color: var(--danger); }
.btn-sm { height: 30px; padding: 0 11px; font-size: 12.5px; border-radius: 7px; }
.btn-block { width: 100%; }
.btn .icon { width: 15px; height: 15px; }

/* ── Forms ─────────────────────────────────────────────────────────────────── */
.field { display: block; min-width: 0; }
.field > span { display: block; font-size: 12.5px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.input, .textarea, .select, select.input, select.select {
  width: 100%; height: 38px; padding: 0 12px; font-size: 13.5px; font-family: inherit;
  color: var(--text); background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  outline: none; box-shadow: var(--shadow-xs);
  transition: border-color .13s ease, box-shadow .13s ease;
}
textarea.input, .textarea { height: auto; padding: 10px 12px; resize: vertical; min-height: 80px; line-height: 1.55; }
.input::placeholder, .textarea::placeholder { color: var(--faint); }
.input:hover, .textarea:hover, .select:hover { border-color: var(--faint); }
.input:focus, .textarea:focus, .select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}
.input:disabled, .select:disabled { background: var(--surface-2); color: var(--muted); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 560px) { .grid-2 { grid-template-columns: 1fr; } }
fieldset { border: 0; margin: 0; padding: 0; }
legend { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 10px; }
.form-section {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-xs); padding: 20px 22px;
}
.form-section > legend {
  float: left; width: 100%; margin: 0 0 15px; padding: 0;
  font-size: 14px; font-weight: 700; color: var(--text);
  text-transform: none; letter-spacing: -0.012em;
}

/* ── Badges / pills / flash ────────────────────────────────────────────────── */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.pill-pro { background: var(--accent-soft); color: var(--accent-text); }
.badge-verified { color: #0ea5e9; }

.tag {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px;
  border-radius: 6px; font-size: 11.5px; font-weight: 600; line-height: 1.7;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--muted);
  text-transform: capitalize;
}
.tag.completed, .tag.paid, .tag.active, .tag.sent   { background: var(--success-bg); border-color: transparent; color: var(--success-text); }
.tag.pending, .tag.scheduled, .tag.sending, .tag.open { background: var(--warning-bg); border-color: transparent; color: var(--warning-text); }
.tag.failed, .tag.refunded, .tag.void, .tag.cancelled, .tag.suspended, .tag.urgent { background: var(--danger-bg); border-color: transparent; color: var(--danger-text); }

.chip { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11px; font-weight: 600; background: var(--accent-soft); color: var(--accent-text); }
.chip.off { background: var(--surface-2); border: 1px solid var(--border); color: var(--muted); }
.role-badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11px; font-weight: 600; background: var(--surface-2); border: 1px solid var(--border); color: var(--muted); }
.role-badge.admin { background: var(--accent-soft); border-color: transparent; color: var(--accent-text); }
.role-badge.superadmin { background: rgba(168,85,247,.14); border-color: transparent; color: #9333ea; }
.role-badge.support { background: var(--success-bg); border-color: transparent; color: var(--success-text); }

.flash {
  display: flex; align-items: flex-start; gap: 9px;
  padding: 11px 14px; border-radius: var(--radius); font-size: 13.5px; font-weight: 500;
  margin-bottom: 14px; border: 1px solid var(--border); background: var(--surface); color: var(--text);
}
.flash::before { content: "•"; font-weight: 800; }
.flash.success { background: var(--success-bg); border-color: transparent; color: var(--success-text); }
.flash.error   { background: var(--danger-bg);  border-color: transparent; color: var(--danger-text); }
.flash.warning { background: var(--warning-bg); border-color: transparent; color: var(--warning-text); }

/* ── Tables ────────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border-radius: var(--radius-lg); }
.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th {
  text-align: left; color: var(--muted); font-weight: 600; font-size: 11px;
  text-transform: uppercase; letter-spacing: .055em;
  padding: 10px 14px; border-bottom: 1px solid var(--border);
  background: var(--surface-2); white-space: nowrap;
}
.tbl td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr, .tbl tr { transition: background .1s ease; }
.tbl tbody tr:hover, .tbl tr:hover { background: color-mix(in srgb, var(--accent) 3%, var(--surface)); }
.tbl .link { font-weight: 600; }

/* ── Stats / metrics ───────────────────────────────────────────────────────── */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 8px; }
@media (max-width: 420px){ .stat-grid { grid-template-columns: 1fr 1fr; } }
.stat { padding: 16px 18px; }
.stat .n { font-size: 24px; font-weight: 800; letter-spacing: -0.03em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat .l { font-size: 12px; color: var(--muted); margin-top: 5px; font-weight: 500; }
.admin-metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 22px; }

.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.metric { border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 15px 17px; background: var(--surface); box-shadow: var(--shadow-xs); }
.metric .k { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--muted); font-weight: 600; }
.metric .v { font-size: 24px; font-weight: 800; margin-top: 8px; letter-spacing: -0.03em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.metric .d { font-size: 11.5px; color: var(--muted); margin-top: 5px; }

.pkg-price { font-size: 26px; font-weight: 800; letter-spacing: -.025em; font-variant-numeric: tabular-nums; }
.pkg-price small { font-size: 13px; font-weight: 500; color: var(--muted); }

/* ── Charts ────────────────────────────────────────────────────────────────── */
.spark { display: flex; align-items: flex-end; gap: 6px; height: 110px; padding-top: 6px; }
.spark .col { flex: 1; background: var(--accent); border-radius: 3px 3px 0 0; min-height: 2px; opacity: .9; }
.spark-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 5px; justify-content: flex-end; }
.spark-bar { width: 100%; max-width: 36px; border-radius: 6px 6px 3px 3px; background: linear-gradient(180deg, var(--accent), color-mix(in srgb, var(--accent) 45%, transparent)); transition: opacity .12s; }
.spark-col:hover .spark-bar { opacity: .75; }
.spark-x { font-size: 10px; color: var(--faint); }
.bar-row { display: grid; grid-template-columns: 90px 1fr 40px; align-items: center; gap: 10px; margin: 8px 0; font-size: 13px; }
.bar { height: 8px; border-radius: 6px; background: var(--accent); min-width: 4px; }
.bar-track { background: var(--accent-soft); border-radius: 6px; }

/* ── Section headers / rows ────────────────────────────────────────────────── */
.section-title { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin: 26px 0 12px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.page-head h1 { font-size: 20px; }
.page-head .sub { font-size: 13px; color: var(--muted); margin-top: 2px; }
.card-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 13px 16px; border: 1px solid var(--border); border-radius: var(--radius-lg);
  background: var(--surface); box-shadow: var(--shadow-xs);
  transition: border-color .13s ease, box-shadow .13s ease;
}
.card-row:hover { border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); box-shadow: var(--shadow-sm); }
.card-av { width: 38px; height: 38px; border-radius: 10px; background-size: cover; background-position: center; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 600; font-size: 14px; flex-shrink: 0; }

/* ════════════════════════════════════════════════════════════════════════════
   App shell v2 — fixed sidebar + sticky topbar + canvas content
   ═══════════════════════════════════════════════════════════════════════════ */
.shell { display: flex; min-height: 100dvh; }
.scrim { display: none; }
.hamburger { background: var(--surface); font-family: inherit; }

.sidebar {
  position: sticky; top: 0; align-self: flex-start;
  width: 244px; flex: 0 0 244px; height: 100dvh; overflow-y: auto;
  background: var(--glass-bg);
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  border-right: 1px solid var(--glass-border);
  padding: 16px 12px 12px; display: flex; flex-direction: column; gap: 1px;
  scrollbar-width: thin;
}
.sidebar .brand { display: flex; align-items: center; gap: 9px; font-weight: 800; font-size: 15px; letter-spacing: -0.02em; padding: 2px 10px 14px; }
.sidebar .brand .dot { width: 24px; height: 24px; border-radius: 7px; background: linear-gradient(135deg, #6366f1, #8b5cf6); display: inline-block; box-shadow: var(--shadow-sm); flex: 0 0 auto; }
.brand-tag { margin-left: auto; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--accent-text); background: var(--accent-soft); border-radius: 5px; padding: 2px 6px; }

.nav-label { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--faint); padding: 14px 10px 5px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 7px 10px;
  border-radius: var(--radius-sm); font-size: 13.5px; font-weight: 500; color: var(--muted);
  transition: background .11s, color .11s;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }
.nav-item.active .icon { opacity: 1; }
.nav-item .icon { width: 16px; height: 16px; opacity: .8; flex: 0 0 auto; }
.nav-item .count { margin-left: auto; font-size: 11px; font-weight: 700; background: var(--accent); color: #fff; border-radius: 999px; padding: 1px 7px; }
.nav-item .count.red { background: var(--danger); }
.sidebar .spacer { flex: 1 1 auto; }
.sidebar .who { border-top: 1px solid var(--border); margin-top: 10px; padding: 12px 10px 2px; }
.sidebar .who .nm { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar .who .em { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 12px;
  height: 54px; padding: 0 26px;
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid var(--glass-border);
}
.hamburger { display: none; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 8px; cursor: pointer; color: var(--muted); border: 1px solid var(--border); }
.tb-title { font-size: 13.5px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-crumb { color: var(--faint); font-weight: 500; }
.tb-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.tb-link { font-size: 12.5px; font-weight: 600; color: var(--muted); padding: 6px 10px; border-radius: 7px; }
.tb-link:hover { background: var(--surface-2); color: var(--text); }
.theme-toggle { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 8px; cursor: pointer; color: var(--muted); background: var(--surface); border: 1px solid var(--border); transition: background .13s, color .13s; }
.theme-toggle:hover { background: var(--surface-2); color: var(--text); }
.theme-toggle svg { width: 17px; height: 17px; }
.theme-toggle .ti { display: none; align-items: center; }
:root[data-theme="dark"] .theme-toggle .ti-dark,
:root[data-theme="light"] .theme-toggle .ti-light,
:root[data-theme="auto"] .theme-toggle .ti-auto,
:root:not([data-theme]) .theme-toggle .ti-auto { display: inline-flex; }
.tb-chip {
  display: flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 999px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6); color: #fff;
  font-size: 11.5px; font-weight: 700; letter-spacing: 0;
  box-shadow: var(--shadow-xs);
}

.content { flex: 1; padding: 26px 32px 64px; width: 100%; min-width: 0; }
/* One consistent, centred content column for every authenticated page. */
.content .wrap { max-width: 1120px; padding: 0; margin: 0 auto; }

/* Admin views open with an obsolete "<h1>Admin</h1>"-era gap; tighten first headings. */
.content .wrap > h2:first-child { margin-top: 0; }

/* Empty state */
.empty { text-align: center; padding: 42px 20px; color: var(--muted); font-size: 13.5px; }

/* ── Mobile: sidebar becomes a drawer ─────────────────────────────────────── */
@media (max-width: 880px) {
  .sidebar {
    position: fixed; inset: 0 auto 0 0; z-index: 60;
    width: 268px; transform: translateX(-102%);
    transition: transform .22s cubic-bezier(.4,0,.2,1);
    box-shadow: var(--shadow-lg);
  }
  body.nav-open .sidebar { transform: none; }
  .scrim {
    display: block; position: fixed; inset: 0; z-index: 50;
    background: rgba(9,11,16,.44); opacity: 0; pointer-events: none;
    transition: opacity .2s ease;
  }
  body.nav-open .scrim { opacity: 1; pointer-events: auto; }
  .hamburger { display: inline-flex; }
  .topbar { padding: 0 16px; }
  .content { padding: 20px 16px 56px; }
}

/* ── Landing / marketing ───────────────────────────────────────────────────── */
.hero { text-align: center; }
.hero h1 { font-size: clamp(34px, 7vw, 58px); line-height: 1.04; margin-top: 20px; letter-spacing: -0.03em; }
.hero p { font-size: 17px; color: var(--muted); max-width: 540px; margin: 16px auto 0; }
.features { display: grid; grid-template-columns: repeat(3,1fr); gap: 16px; margin-top: 54px; }
@media (max-width: 640px) { .features { grid-template-columns: 1fr; } }
.feature { padding: 22px; text-align: left; border-radius: var(--radius-lg); }
.feature .ic { width: 38px; height: 38px; display: flex; align-items: center; justify-content: center; border-radius: 10px; background: var(--accent-soft); color: var(--accent-text); margin-bottom: 12px; }
.tiers { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px; margin-top: 26px; align-items: start; }

/* ── Public profile card (customer-facing product) ─────────────────────────── */
.cover { height: 190px; width: 100%; }
.profile-wrap { max-width: 430px; margin: -78px auto 0; padding: 0 16px 64px; }
.profile { text-align: center; padding: 62px 24px 24px; border-radius: 22px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-lg); }
.avatar, .avatar-fallback {
  width: 108px; height: 108px; border-radius: 50%; margin: -124px auto 16px;
  box-shadow: 0 0 0 4px var(--surface), var(--shadow-md); object-fit: cover; display: block;
}
.avatar-fallback { display: flex; align-items: center; justify-content: center; font-size: 34px; font-weight: 700; color: #fff; }
.profile h1 { font-size: 25px; display: inline-flex; align-items: center; gap: 6px; }
.actions { display: grid; gap: 11px; margin-top: 18px; }
.actions-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; }
.action { padding: 14px; border-radius: 13px; font-weight: 600; font-size: 14px; border: 1px solid var(--border); background: var(--surface-2); transition: transform .1s ease, border-color .14s ease; }
.action:hover { border-color: var(--border-strong); }
.action:active { transform: scale(.98); }
.save { color: #fff; font-size: 15px; padding: 15px; border-radius: 13px; font-weight: 700; letter-spacing: -0.01em; display: flex; align-items: center; justify-content: center; gap: 8px; transition: transform .1s ease; box-shadow: var(--shadow-md); }
.save:active { transform: scale(.985); }
.socials { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 20px; }
.social { width: 42px; height: 42px; border-radius: 50%; display: flex; align-items: center; justify-content: center; border: 1px solid var(--border); background: var(--surface-2); transition: transform .1s ease; }
.social:active { transform: scale(.94); }
.qr-box { display: flex; flex-direction: column; align-items: center; gap: 12px; margin-top: 16px; padding: 22px; border-radius: var(--radius-lg); }
.qr-box img, .qr-box svg { width: 180px; height: 180px; }

/* Portfolio */
.pf-public { display: grid; gap: 14px; }
.portfolio-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 12px; }
.pf-item { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: var(--surface); }
.pf-thumb { height: 88px; background-size: cover; background-position: center; color: var(--muted); }

/* ── Misc ──────────────────────────────────────────────────────────────────── */
.ai-btn {
  display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 700;
  padding: 3px 9px; border-radius: 7px; border: 1px solid var(--border);
  background: var(--surface); color: var(--accent-text); cursor: pointer; font-family: inherit;
}
.ai-btn:hover:not(:disabled) { background: var(--accent-soft); }
.ai-btn:disabled { opacity: .5; cursor: not-allowed; color: var(--muted); }
.ai-btn.loading { opacity: .6; pointer-events: none; }

/* Segmented control (account-type toggle) */
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); }
.seg-opt { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 9px 10px; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--muted); font-family: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer; transition: background .13s, color .13s, box-shadow .13s; }
.seg-opt.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-xs); }
.seg-opt .icon { width: 15px; height: 15px; }

/* Plan usage meter */
.usage-lbl { font-size: 13px; font-weight: 500; color: var(--text); }
.usage-val { font-size: 12.5px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.usage-val.warn { color: var(--warning-text); }
.usage-val.over { color: var(--danger-text); }
.usage-track { height: 7px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); overflow: hidden; }
.usage-fill { height: 100%; border-radius: 999px; background: var(--accent); transition: width .3s ease; }
.usage-fill.warn { background: var(--warning); }
.usage-fill.over { background: var(--danger); }
.usage-nudge { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 16px; padding: 11px 14px; border-radius: var(--radius); background: var(--accent-soft); color: var(--accent-text); font-size: 13px; font-weight: 600; }

.rise { animation: rise .45s cubic-bezier(.22,1,.36,1) both; }
@keyframes rise { from { opacity: 0; transform: translateY(10px);} to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce){ .rise { animation: none; } .btn, .sidebar { transition: none; } }

/* ── Legal / policy pages ──────────────────────────────────────────────────── */
.legal { max-width: 760px; margin: 0 auto; padding: 56px 22px 90px; }
.legal-top { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:28px; flex-wrap:wrap; }
.legal-brand { display:inline-flex; align-items:center; gap:9px; font-weight:800; font-size:16px; color:var(--text); }
.legal-brand .dot { width:22px; height:22px; border-radius:7px; background:linear-gradient(135deg,#6366f1,#8b5cf6); }
.legal h1 { font-size:30px; letter-spacing:-.02em; margin:0 0 6px; }
.legal .updated { color:var(--muted); font-size:13.5px; margin:0 0 30px; }
.legal h2 { font-size:19px; margin:34px 0 10px; }
.legal p, .legal li { color:var(--text); font-size:15px; line-height:1.7; }
.legal p { margin:0 0 14px; }
.legal ul { margin:0 0 16px; padding-left:20px; }
.legal li { margin:0 0 7px; }
.legal a { color:var(--accent-text); font-weight:600; }
.legal .legal-foot { margin-top:44px; padding-top:20px; border-top:1px solid var(--border); font-size:13.5px; color:var(--muted); }

/* ── Auth split-screen (login / signup / verify / checkout) ──────────────────── */
.auth-split { min-height:100dvh; display:grid; grid-template-columns:1.05fr 1fr; }
.auth-aside { position:relative; overflow:hidden; color:#fff; padding:48px 52px; display:flex; flex-direction:column;
  background:linear-gradient(150deg,#4f46e5 0%,#7c3aed 55%,#a855f7 100%); }
.auth-aside::before { content:''; position:absolute; inset:0; pointer-events:none;
  background:radial-gradient(50% 40% at 85% 8%, rgba(255,255,255,.22), transparent 60%),
            radial-gradient(45% 45% at 5% 100%, rgba(0,0,0,.18), transparent 60%); }
.auth-aside > * { position:relative; z-index:1; }
.auth-abrand { display:inline-flex; align-items:center; gap:10px; font-weight:800; font-size:19px; color:#fff; }
.auth-abrand .dot { width:26px; height:26px; border-radius:8px; background:rgba(255,255,255,.22); box-shadow:inset 0 0 0 1px rgba(255,255,255,.4); }
.auth-ahead { margin-top:auto; }
.auth-ahead h2 { color:#fff; font-size:32px; line-height:1.15; letter-spacing:-.02em; margin:0 0 14px; max-width:15ch; }
.auth-ahead p { color:rgba(255,255,255,.82); font-size:15.5px; line-height:1.6; margin:0; max-width:42ch; }
.auth-feats { margin:26px 0 0; display:grid; gap:13px; }
.auth-feat { display:flex; align-items:flex-start; gap:11px; font-size:14.5px; color:rgba(255,255,255,.94); }
.auth-feat .fi { width:26px; height:26px; border-radius:8px; background:rgba(255,255,255,.16); display:flex; align-items:center; justify-content:center; flex:0 0 auto; }
.auth-quote { margin:auto 0 0; padding:18px 20px; background:rgba(255,255,255,.12); border:1px solid rgba(255,255,255,.18); border-radius:16px; backdrop-filter:blur(6px); }
.auth-quote p { color:#fff; font-size:14.5px; line-height:1.6; margin:0 0 12px; }
.auth-quote .who { display:flex; align-items:center; gap:10px; }
.auth-quote .av { width:34px; height:34px; border-radius:50%; background:rgba(255,255,255,.28); display:flex; align-items:center; justify-content:center; font-weight:700; font-size:13px; }
.auth-quote .nm { font-weight:700; font-size:13.5px; } .auth-quote .rl { font-size:12px; color:rgba(255,255,255,.75); }
.auth-stats { display:flex; gap:26px; margin-top:22px; }
.auth-stats .n { font-size:22px; font-weight:800; } .auth-stats .l { font-size:12px; color:rgba(255,255,255,.72); }

.auth-main { display:flex; align-items:center; justify-content:center; padding:40px 22px; }
.auth-card { width:100%; max-width:400px; animation:authIn .5s cubic-bezier(.2,.7,.3,1) both; }
.auth-brand-m { display:none; }
.auth-head { margin-bottom:22px; }
.auth-head h1 { font-size:26px; letter-spacing:-.02em; margin:0 0 6px; }
.auth-head p { color:var(--muted); font-size:14.5px; margin:0; }
@keyframes authIn { from { opacity:0; transform:translateY(14px); } to { opacity:1; transform:none; } }

@media (max-width:900px) {
  .auth-split { grid-template-columns:1fr; }
  .auth-aside { display:none; }
  .auth-brand-m { display:inline-flex; align-items:center; gap:9px; font-weight:800; font-size:18px; margin-bottom:22px; }
  .auth-brand-m .dot { width:24px; height:24px; border-radius:7px; background:linear-gradient(135deg,#6366f1,#8b5cf6); }
}
@media (prefers-reduced-motion: reduce) { .auth-card { animation:none; } }

/* ── Feature gate (blur + "upgrade to unlock") ───────────────────────────────── */
.gate { position: relative; border-radius: var(--radius-lg); }
.gate.locked > .gate-body { filter: blur(2.5px) saturate(.72); opacity: .5; pointer-events: none; user-select: none; }
.gate.locked { overflow: hidden; }
.gate-lock { position: absolute; inset: 0; z-index: 4; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 9px; text-align: center; padding: 16px;
  background: color-mix(in srgb, var(--surface) 30%, transparent); }
.gate-lock .gate-note { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.pill-pro { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 700; letter-spacing: .02em;
  color: #fff; background: linear-gradient(135deg, #6366f1, #8b5cf6); padding: 3px 10px; border-radius: 999px; text-decoration: none; box-shadow: 0 2px 8px rgba(99,102,241,.35); }

/* Locked-feature placeholder — rendered INSTEAD of the real premium fields, so
   nothing sensitive ships to the browser for plans without the feature. */
.feature-locked { border: 1px dashed color-mix(in srgb, var(--accent) 40%, var(--border)); border-radius: var(--radius-lg);
  padding: 16px 18px; background: color-mix(in srgb, var(--accent-soft) 55%, var(--surface)); display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.feature-locked .fl-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; }
.feature-locked .fl-title { display: inline-flex; align-items: center; gap: 7px; font-weight: 700; font-size: 14px; color: var(--text); }
.feature-locked .fl-title svg { color: var(--accent); }
.feature-locked .fl-note { margin: 0; font-size: 12.5px; color: var(--muted); }

/* Accent colour picker (preset swatches + custom) in the card editor. */
.accent-picker { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.accent-sw { width: 28px; height: 28px; border-radius: 8px; background: var(--sw); border: 2px solid transparent; box-shadow: 0 0 0 1px var(--border) inset; cursor: pointer; padding: 0; transition: transform .1s, box-shadow .12s; }
.accent-sw:hover { transform: scale(1.08); }
.accent-sw.on { border-color: var(--surface); box-shadow: 0 0 0 2px var(--sw); }
.accent-custom { width: 34px; height: 28px; border-radius: 8px; overflow: hidden; border: 1px dashed var(--border-strong); display: inline-flex; cursor: pointer; }
.accent-custom input[type="color"] { width: 150%; height: 150%; margin: -25%; border: 0; padding: 0; background: transparent; cursor: pointer; }

/* Drag-to-reposition image frame (cover banner + profile photo). */
.imgpos { position: relative; width: 100%; border-radius: 12px; overflow: hidden; border: 1px solid var(--border); background: var(--surface-2); touch-action: none; }
.imgpos-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; cursor: grab; -webkit-user-drag: none; user-select: none; }
.imgpos-img:active { cursor: grabbing; }
.imgpos-empty { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 12.5px; }
.imgpos-hint { position: absolute; left: 8px; bottom: 8px; background: rgba(0,0,0,.62); color: #fff; font-size: 10.5px; font-weight: 600; padding: 3px 8px; border-radius: 6px; pointer-events: none; }
