:root {
  --color-bg: #0f1117;
  --color-surface: #171b26;
  --color-surface-2: #1e2436;
  --color-border: #2a3045;
  --color-border-light: #3a4565;
  --color-accent: #5b7fff;
  --color-accent-hover: #7b9fff;
  --color-accent-dim: rgba(91, 127, 255, 0.12);
  --color-text: #e8ecf5;
  --color-text-muted: #8892a8;
  --color-text-dim: #5a6480;
  --color-success: #34d399;
  --color-warning: #fbbf24;
  --color-danger: #f87171;
  --color-info: #60a5fa;
  --font: 'Inter', -apple-system, sans-serif;
  --radius: 8px;
  --radius-sm: 4px;
  --sidebar-width: 240px;
  --transition: 150ms ease;
}

html[data-theme="light"] {
  --color-bg: #f3f4f8;
  --color-surface: #ffffff;
  --color-surface-2: #eef0f6;
  --color-border: #dde1ee;
  --color-border-light: #c8cedf;
  --color-accent: #4c6ef5;
  --color-accent-hover: #3557e0;
  --color-accent-dim: rgba(76, 110, 245, 0.10);
  --color-text: #1a1f35;
  --color-text-muted: #5a6480;
  --color-text-dim: #9099b2;
  --color-success: #059669;
  --color-warning: #d97706;
  --color-danger: #dc2626;
  --color-info: #2563eb;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 15px; }

body {
  font-family: var(--font);
  background: var(--color-bg);
  color: var(--color-text);
  min-height: 100vh;
  display: flex;
  line-height: 1.6;
}

a { color: var(--color-accent); text-decoration: none; }
a:hover { color: var(--color-accent-hover); }

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-width);
  min-height: 100vh;
  background: var(--color-surface);
  border-right: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
}

.sidebar-brand {
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--color-border);
}

.brand-link { display: flex; align-items: center; gap: 10px; color: var(--color-text); font-weight: 600; font-size: 1rem; }
.brand-icon { font-size: 1.4rem; color: var(--color-accent); }
.brand-name { letter-spacing: -0.02em; }

.sidebar-org {
  padding: 12px 20px;
  border-bottom: 1px solid var(--color-border);
  display: flex; flex-direction: column; gap: 4px;
}
.org-label { font-size: 0.8rem; font-weight: 600; color: var(--color-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.badge { display: inline-block; font-size: 0.7rem; font-weight: 600; padding: 2px 8px; border-radius: 20px; letter-spacing: 0.02em; }
.badge-trial { background: rgba(251, 191, 36, 0.15); color: var(--color-warning); border: 1px solid rgba(251, 191, 36, 0.3); }
.badge-active { background: rgba(52, 211, 153, 0.12); color: var(--color-success); border: 1px solid rgba(52, 211, 153, 0.3); }
.badge-locked { background: rgba(248, 113, 113, 0.12); color: var(--color-danger); border: 1px solid rgba(248, 113, 113, 0.3); }
.badge-pending { background: rgba(96, 165, 250, 0.12); color: var(--color-info); border: 1px solid rgba(96, 165, 250, 0.3); }

.sidebar-nav { flex: 1; padding: 12px 0; list-style: none; overflow-y: auto; }
.nav-section-label { font-size: 0.68rem; font-weight: 600; color: var(--color-text-dim); letter-spacing: 0.08em; text-transform: uppercase; padding: 12px 20px 4px; }
.nav-item { }
.nav-link { display: flex; align-items: center; gap: 10px; padding: 9px 20px; color: var(--color-text-muted); font-size: 0.88rem; font-weight: 500; transition: var(--transition); border-left: 3px solid transparent; }
.nav-link:hover { color: var(--color-text); background: var(--color-accent-dim); }
.nav-item.active .nav-link { color: var(--color-accent); background: var(--color-accent-dim); border-left-color: var(--color-accent); }
.nav-icon { width: 18px; text-align: center; font-size: 0.9rem; }

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--color-border);
  display: flex; flex-direction: column; gap: 6px;
}
.user-info { display: flex; flex-direction: column; gap: 2px; }
.user-email { font-size: 0.78rem; color: var(--color-text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 0.7rem; color: var(--color-text-dim); }
.logout-link { font-size: 0.8rem; color: var(--color-text-dim); }
.logout-link:hover { color: var(--color-danger); }
.admin-link { font-size: 0.78rem; color: var(--color-accent); font-weight: 500; }

/* ── Main Content ── */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-height: 100vh;
  padding: 32px;
  max-width: 1400px;
}
.main-content.full-width { margin-left: 0; max-width: 100%; }

/* ── Flash Messages ── */
.flash-messages { display: flex; flex-direction: column; gap: 8px; margin-bottom: 20px; }
.alert { padding: 12px 16px; border-radius: var(--radius); display: flex; align-items: center; justify-content: space-between; font-size: 0.88rem; }
.alert-success { background: rgba(52, 211, 153, 0.1); color: var(--color-success); border: 1px solid rgba(52, 211, 153, 0.25); }
.alert-danger { background: rgba(248, 113, 113, 0.1); color: var(--color-danger); border: 1px solid rgba(248, 113, 113, 0.25); }
.alert-warning { background: rgba(251, 191, 36, 0.1); color: var(--color-warning); border: 1px solid rgba(251, 191, 36, 0.25); }
.alert-info { background: rgba(96, 165, 250, 0.1); color: var(--color-info); border: 1px solid rgba(96, 165, 250, 0.25); }
.alert-close { background: none; border: none; color: inherit; cursor: pointer; font-size: 1.1rem; line-height: 1; opacity: 0.7; }
.alert-close:hover { opacity: 1; }

/* ── Cards ── */
.card { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); padding: 24px; }
.card-sm { padding: 16px; }
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.card-title { font-size: 1rem; font-weight: 600; color: var(--color-text); }
.card-subtitle { font-size: 0.82rem; color: var(--color-text-muted); margin-top: 2px; }

/* ── Page Header ── */
.page-header { margin-bottom: 28px; }
.page-title { font-size: 1.6rem; font-weight: 700; letter-spacing: -0.02em; color: var(--color-text); }
.page-subtitle { font-size: 0.9rem; color: var(--color-text-muted); margin-top: 4px; }

/* ── Stats Grid ── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 28px; }
.stat-card { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); padding: 20px; }
.stat-label { font-size: 0.75rem; font-weight: 600; color: var(--color-text-muted); letter-spacing: 0.05em; text-transform: uppercase; margin-bottom: 8px; }
.stat-value { font-size: 1.8rem; font-weight: 700; color: var(--color-text); letter-spacing: -0.03em; line-height: 1; }
.stat-sub { font-size: 0.78rem; color: var(--color-text-muted); margin-top: 6px; }
.stat-positive { color: var(--color-success); }
.stat-negative { color: var(--color-danger); }

/* ── Forms ── */
.form-group { margin-bottom: 20px; }
.form-label { display: block; font-size: 0.85rem; font-weight: 500; color: var(--color-text-muted); margin-bottom: 6px; }
.form-control {
  width: 100%; padding: 10px 14px;
  background: var(--color-surface-2); border: 1px solid var(--color-border);
  border-radius: var(--radius-sm); color: var(--color-text);
  font-family: var(--font); font-size: 0.9rem;
  transition: var(--transition); outline: none;
}
.form-control:focus { border-color: var(--color-accent); box-shadow: 0 0 0 3px var(--color-accent-dim); }
.form-control::placeholder { color: var(--color-text-dim); }
.form-select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%238892a8' d='M6 8L0 0h12z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }
.form-error { font-size: 0.78rem; color: var(--color-danger); margin-top: 4px; }
.form-help { font-size: 0.78rem; color: var(--color-text-dim); margin-top: 4px; }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 20px; border-radius: var(--radius-sm);
  font-family: var(--font); font-size: 0.875rem; font-weight: 600;
  cursor: pointer; border: none; transition: var(--transition);
  text-decoration: none; white-space: nowrap;
}
.btn-primary { background: var(--color-accent); color: #fff; }
.btn-primary:hover { background: var(--color-accent-hover); color: #fff; }
.btn-secondary { background: var(--color-surface-2); color: var(--color-text); border: 1px solid var(--color-border); }
.btn-secondary:hover { border-color: var(--color-border-light); color: var(--color-text); }
.btn-danger { background: rgba(248, 113, 113, 0.15); color: var(--color-danger); border: 1px solid rgba(248, 113, 113, 0.3); }
.btn-danger:hover { background: rgba(248, 113, 113, 0.25); }
.btn-sm { padding: 6px 14px; font-size: 0.8rem; }
.btn-full { width: 100%; justify-content: center; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Tables ── */
.table-container { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
th { padding: 10px 14px; text-align: left; font-size: 0.72rem; font-weight: 600; color: var(--color-text-muted); text-transform: uppercase; letter-spacing: 0.06em; border-bottom: 1px solid var(--color-border); white-space: nowrap; }
td { padding: 12px 14px; border-bottom: 1px solid var(--color-border); color: var(--color-text); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--color-accent-dim); }

/* ── Auth Pages ── */
.auth-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; background: var(--color-bg); }
.auth-card { width: 100%; max-width: 420px; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: 12px; padding: 40px; }
.auth-logo { text-align: center; margin-bottom: 32px; }
.auth-logo .brand-icon { font-size: 2rem; color: var(--color-accent); }
.auth-logo .brand-name { display: block; font-size: 1.4rem; font-weight: 700; color: var(--color-text); margin-top: 8px; }
.auth-title { font-size: 1.25rem; font-weight: 700; color: var(--color-text); margin-bottom: 6px; }
.auth-subtitle { font-size: 0.875rem; color: var(--color-text-muted); margin-bottom: 28px; }
.auth-footer { text-align: center; margin-top: 20px; font-size: 0.85rem; color: var(--color-text-muted); }

/* ── Landing ── */
.landing-page { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 48px 24px; text-align: center; background: var(--color-bg); }
.landing-logo { font-size: 2.5rem; color: var(--color-accent); margin-bottom: 16px; }
.landing-title { font-size: 3rem; font-weight: 800; letter-spacing: -0.04em; color: var(--color-text); margin-bottom: 16px; line-height: 1.1; }
.landing-sub { font-size: 1.1rem; color: var(--color-text-muted); max-width: 540px; margin-bottom: 36px; line-height: 1.7; }
.landing-actions { display: flex; gap: 14px; justify-content: center; }

/* ── Locked ── */
.locked-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.locked-card { text-align: center; max-width: 480px; }
.locked-icon { font-size: 3rem; margin-bottom: 20px; color: var(--color-warning); }
.locked-title { font-size: 1.5rem; font-weight: 700; margin-bottom: 10px; }
.locked-desc { color: var(--color-text-muted); margin-bottom: 28px; line-height: 1.7; }
.locked-actions { display: flex; gap: 12px; justify-content: center; }

/* ── Section Layout ── */
.section-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 24px; }
.section-grid-3 { grid-template-columns: 1fr 1fr 1fr; }
@media (max-width: 900px) { .section-grid, .section-grid-3 { grid-template-columns: 1fr; } }

/* ── Free Offer Pipeline ── */
.pipe-detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
/* Allow each lane column to shrink below its content's min-width so the
   inner .pipe-lane-scroll shows a localized horizontal scrollbar instead
   of the whole table bleeding past the card. */
.pipe-detail-grid > div { min-width: 0; }
.pipe-lane-scroll { overflow-x: auto; max-width: 100%; }
/* Stack lanes vertically below ~1100px so each panel keeps full width
   instead of cramping (or scrolling) at common laptop sizes. */
@media (max-width: 1100px) { .pipe-detail-grid { grid-template-columns: 1fr; } }
.pipe-row:focus-visible { outline: 2px solid var(--color-accent); outline-offset: -2px; }
.pipe-row:hover { background: var(--color-surface-2); }

/* Stack the pipeline tables as cards on phones so they fit a 375px viewport
   without horizontal scrolling. Targets the main pipeline rows and the
   nested fast/slow lane "top paid offers" tables. */
@media (max-width: 640px) {
  .pipe-card .table-container { overflow-x: visible; }
  .pipe-card > .table-container > table,
  .pipe-card > .table-container > table > thead,
  .pipe-card > .table-container > table > tbody,
  .pipe-card .pipe-lane-table,
  .pipe-card .pipe-lane-table > thead,
  .pipe-card .pipe-lane-table > tbody { display: block; width: 100%; }
  .pipe-card > .table-container > table > thead,
  .pipe-card .pipe-lane-table > thead { display: none; }
  .pipe-card .pipe-row,
  .pipe-card .pipe-lane-table > tbody > tr {
    display: block;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    margin-bottom: 10px;
    padding: 10px 12px;
    background: var(--color-surface);
  }
  .pipe-card .pipe-detail-row { display: block; padding: 0; }
  .pipe-card .pipe-detail-row > td { display: block; padding: 0 !important; border: none; }
  .pipe-card .pipe-detail-row > td:first-child { display: none; }
  .pipe-card .pipe-row > td,
  .pipe-card .pipe-lane-table > tbody > tr > td {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    text-align: right !important;
    padding: 4px 0 !important;
    border: none;
    max-width: none !important;
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: clip !important;
  }
  .pipe-card .pipe-row > td[data-label]::before,
  .pipe-card .pipe-lane-table > tbody > tr > td[data-label]::before {
    content: attr(data-label);
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    flex-shrink: 0;
  }
  .pipe-card .pipe-cell-caret { display: none; }
  .pipe-card .pipe-cell-title {
    font-weight: 700;
    border-bottom: 1px solid var(--color-border);
    padding-bottom: 6px !important;
    margin-bottom: 4px;
  }
  .pipe-card .pipe-cell-title::before { display: none; }
  .pipe-card .pipe-row[aria-expanded="true"] { border-color: var(--color-accent); }
}

/* ── Empty State ── */
.empty-state { text-align: center; padding: 48px 24px; }
.empty-icon { font-size: 2.5rem; color: var(--color-text-dim); margin-bottom: 16px; }
.empty-title { font-size: 1rem; font-weight: 600; color: var(--color-text-muted); margin-bottom: 6px; }
.empty-desc { font-size: 0.875rem; color: var(--color-text-dim); max-width: 360px; margin: 0 auto 20px; }

/* ── Status Badges ── */
.status { display: inline-flex; align-items: center; gap: 5px; font-size: 0.78rem; font-weight: 600; padding: 3px 10px; border-radius: 20px; }
.status::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-success { background: rgba(52, 211, 153, 0.1); color: var(--color-success); }
.status-warning { background: rgba(251, 191, 36, 0.1); color: var(--color-warning); }
.status-danger { background: rgba(248, 113, 113, 0.1); color: var(--color-danger); }
.status-info { background: rgba(96, 165, 250, 0.1); color: var(--color-info); }
.status-muted { background: var(--color-surface-2); color: var(--color-text-muted); }

/* ── Dividers ── */
hr { border: none; border-top: 1px solid var(--color-border); margin: 24px 0; }

/* ── Inline Row ── */
.inline-form { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.inline-form .form-group { margin-bottom: 0; flex: 1; min-width: 200px; }

/* ── Sync indicator ── */
.sync-status { display: flex; align-items: center; gap: 8px; font-size: 0.82rem; }
.sync-dot { width: 8px; height: 8px; border-radius: 50%; }
.sync-dot-success { background: var(--color-success); }
.sync-dot-running { background: var(--color-info); animation: pulse 1.2s infinite; }
.sync-dot-failed { background: var(--color-danger); }
.sync-dot-pending { background: var(--color-text-dim); }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }

/* ── Admin ── */
.admin-header { background: linear-gradient(135deg, rgba(91, 127, 255, 0.15), rgba(91, 127, 255, 0.05)); border: 1px solid var(--color-border); border-radius: var(--radius); padding: 20px 24px; margin-bottom: 28px; }
.admin-title { font-size: 0.8rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--color-accent); margin-bottom: 4px; }
.admin-name { font-size: 1.4rem; font-weight: 700; color: var(--color-text); }

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

/* ── Analytics Tabs ── */
.analytics-tabs {
  display: flex; gap: 0; margin-bottom: 20px;
  border-bottom: 1px solid var(--color-border);
}
.tab-btn {
  background: none; border: none; border-bottom: 2px solid transparent;
  color: var(--color-text-muted); font-size: 0.875rem; font-weight: 500;
  font-family: var(--font); padding: 10px 20px; cursor: pointer;
  transition: var(--transition); white-space: nowrap;
  margin-bottom: -1px;
}
.tab-btn:hover { color: var(--color-text); }
.tab-btn.active { color: var(--color-accent); border-bottom-color: var(--color-accent); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ──────────────────────────── Marketing / Landing ──────────────────────────── */
body.landing-body { display: block; background: var(--color-bg); }
body.landing-body .main-content,
body.landing-body .main-content.full-width { margin-left: 0; padding: 0; max-width: none; width: 100%; }

/* Top bar */
.landing-topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 40px;
  background: rgba(15, 17, 23, 0.85);
  backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--color-border);
}
html[data-theme="light"] .landing-topbar { background: rgba(255,255,255,0.85); }
.landing-brand { display: flex; align-items: center; gap: 10px; color: var(--color-text); font-weight: 600; font-size: 1.05rem; letter-spacing: -0.02em; }
.landing-brand .brand-icon { color: var(--color-accent); font-size: 1.4rem; }
.landing-topnav { display: flex; align-items: center; gap: 24px; }
.landing-topnav a { color: var(--color-text-muted); font-size: 0.9rem; font-weight: 500; transition: var(--transition); }
.landing-topnav a:hover { color: var(--color-text); }
.landing-topnav .topnav-signin { color: var(--color-text); }
/* Buttons inside the topnav must keep their button colors, not inherit the muted link color. */
.landing-topnav a.btn-primary,
.landing-topnav a.btn-primary:hover { color: #fff; font-weight: 600; }
.landing-topnav a.btn-ghost,
.landing-topnav a.btn-ghost:hover { color: var(--color-text); }
.btn-sm { padding: 7px 14px; font-size: 0.82rem; }
.btn-lg { padding: 14px 26px; font-size: 0.98rem; font-weight: 600; }
.btn-ghost { background: transparent; color: var(--color-text); border: 1px solid var(--color-border); }
.btn-ghost:hover { border-color: var(--color-border-light); color: var(--color-text); }

/* Hero */
.landing-hero {
  text-align: center;
  padding: 96px 24px 72px;
  max-width: 880px; margin: 0 auto;
}
.hero-tag {
  display: inline-block; padding: 6px 14px; border-radius: 999px;
  background: var(--color-accent-dim); color: var(--color-accent);
  font-size: 0.78rem; font-weight: 600; letter-spacing: 0.02em;
  margin-bottom: 24px;
}
.hero-title {
  font-size: clamp(2.4rem, 5.5vw, 4rem); font-weight: 800;
  letter-spacing: -0.04em; line-height: 1.05;
  color: var(--color-text); margin-bottom: 22px;
}
.hero-accent { color: var(--color-accent); }
.hero-sub {
  font-size: 1.12rem; color: var(--color-text-muted);
  max-width: 680px; margin: 0 auto 36px; line-height: 1.7;
}
.hero-actions { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; margin-bottom: 18px; }
.hero-meta { font-size: 0.82rem; color: var(--color-text-dim); }

/* Strip */
.landing-strip { padding: 28px 24px; border-top: 1px solid var(--color-border); border-bottom: 1px solid var(--color-border); background: var(--color-surface); }
.strip-grid { max-width: 1100px; margin: 0 auto; display: grid; grid-template-columns: repeat(4, 1fr); gap: 28px; text-align: center; }
.strip-num { font-size: 1.4rem; font-weight: 700; color: var(--color-accent); letter-spacing: -0.02em; }
.strip-label { font-size: 0.8rem; color: var(--color-text-muted); margin-top: 4px; }

/* Sections */
.landing-section { padding: 88px 24px; max-width: 1120px; margin: 0 auto; }
.landing-section-alt { background: var(--color-surface); max-width: none; }
.landing-section-alt > .section-head,
.landing-section-alt > .insight-grid,
.landing-section-alt > .pricing-card { max-width: 1120px; margin-left: auto; margin-right: auto; }

.section-head { text-align: center; max-width: 720px; margin: 0 auto 56px; }
.section-eyebrow { font-size: 0.78rem; font-weight: 600; color: var(--color-accent); letter-spacing: 0.08em; text-transform: uppercase; margin-bottom: 12px; }
.section-title { font-size: clamp(1.8rem, 3.5vw, 2.6rem); font-weight: 700; letter-spacing: -0.03em; color: var(--color-text); margin-bottom: 16px; line-height: 1.15; }
.section-sub { font-size: 1.02rem; color: var(--color-text-muted); line-height: 1.7; }

/* Insight (Course Insight feature) */
.insight-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 28px; }
.insight-card-feature {
  background: linear-gradient(135deg, var(--color-accent-dim), transparent 70%), var(--color-surface);
  border: 1px solid var(--color-border-light);
  border-radius: 16px;
  padding: 36px;
  display: flex; flex-direction: column; justify-content: center;
}
.insight-tag {
  display: inline-block; align-self: flex-start;
  padding: 5px 12px; border-radius: 999px;
  background: var(--color-accent); color: #fff;
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.04em;
  text-transform: uppercase; margin-bottom: 20px;
}
.insight-title { font-size: 1.32rem; font-weight: 600; color: var(--color-text); line-height: 1.5; letter-spacing: -0.01em; }
.insight-title em { color: var(--color-accent); font-style: normal; }
.insight-attr { margin-top: 16px; font-size: 0.82rem; color: var(--color-text-dim); }

.insight-stack { display: flex; flex-direction: column; gap: 14px; }
.insight-mini {
  display: flex; gap: 14px;
  padding: 18px; border-radius: 12px;
  background: var(--color-surface); border: 1px solid var(--color-border);
}
.landing-section-alt .insight-mini { background: var(--color-bg); }
.mini-icon {
  flex: 0 0 36px; height: 36px; border-radius: 8px;
  background: var(--color-accent-dim); color: var(--color-accent);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 1rem;
}
.mini-title { font-weight: 600; color: var(--color-text); margin-bottom: 4px; font-size: 0.95rem; }
.mini-body { font-size: 0.85rem; color: var(--color-text-muted); line-height: 1.55; }

/* Features grid */
.features-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.feature-card {
  background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: 12px; padding: 26px;
  transition: var(--transition);
}
.feature-card:hover { border-color: var(--color-border-light); transform: translateY(-2px); }
.feature-icon { font-size: 1.5rem; color: var(--color-accent); margin-bottom: 14px; }
.feature-card h3 { font-size: 1.02rem; font-weight: 600; color: var(--color-text); margin-bottom: 8px; letter-spacing: -0.01em; }
.feature-card p { font-size: 0.88rem; color: var(--color-text-muted); line-height: 1.65; }

/* Pricing */
.pricing-card {
  max-width: 460px; margin: 0 auto;
  background: var(--color-bg); border: 1px solid var(--color-border-light);
  border-radius: 16px; padding: 36px; text-align: center;
  box-shadow: 0 10px 40px rgba(0,0,0,0.18);
}
.landing-section-alt .pricing-card { background: var(--color-bg); }
.pricing-name { font-size: 0.85rem; font-weight: 600; color: var(--color-text-muted); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 12px; }
.pricing-price { font-size: 3rem; font-weight: 800; color: var(--color-text); letter-spacing: -0.04em; margin-bottom: 24px; }
.pricing-price span { font-size: 1rem; font-weight: 500; color: var(--color-text-muted); margin-left: 4px; letter-spacing: 0; }
.pricing-list { list-style: none; text-align: left; margin: 0 0 8px; padding: 0; }
.pricing-list li { padding: 9px 0; border-bottom: 1px solid var(--color-border); color: var(--color-text); font-size: 0.92rem; }
.pricing-list li::before { content: '✓ '; color: var(--color-success); font-weight: 700; margin-right: 6px; }
.pricing-list li:last-child { border-bottom: none; }
.pricing-meta { margin-top: 12px; font-size: 0.8rem; color: var(--color-text-dim); }

/* Final CTA */
.landing-cta {
  text-align: center; padding: 88px 24px;
  border-top: 1px solid var(--color-border);
}
.landing-cta h2 { font-size: clamp(1.8rem, 4vw, 2.8rem); font-weight: 700; color: var(--color-text); letter-spacing: -0.03em; margin-bottom: 14px; }
.landing-cta p { color: var(--color-text-muted); font-size: 1.05rem; margin-bottom: 28px; }

/* Footer */
.landing-footer {
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  padding: 56px 40px 32px;
}
.footer-cols {
  max-width: 1120px; margin: 0 auto 36px;
  display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 36px;
}
.footer-brand { display: flex; align-items: center; gap: 10px; color: var(--color-text); font-weight: 600; font-size: 1.05rem; margin-bottom: 10px; }
.footer-tag { color: var(--color-text-muted); font-size: 0.88rem; max-width: 320px; }
.footer-col-title { font-size: 0.78rem; font-weight: 600; color: var(--color-text); letter-spacing: 0.06em; text-transform: uppercase; margin-bottom: 14px; }
.footer-col a { display: block; color: var(--color-text-muted); font-size: 0.88rem; padding: 4px 0; }
.footer-col a:hover { color: var(--color-text); }
.footer-disclaimer {
  max-width: 1120px; margin: 0 auto;
  padding-top: 28px; border-top: 1px solid var(--color-border);
  font-size: 0.78rem; color: var(--color-text-dim); line-height: 1.7;
}
.footer-disclaimer p { margin-bottom: 10px; }
.footer-disclaimer strong { color: var(--color-text-muted); font-weight: 600; }
.footer-copy { margin-top: 14px !important; }
.landing-footer-slim { padding: 28px 40px; }

/* Legal pages */
.legal-page {
  max-width: 760px; margin: 0 auto;
  padding: 64px 24px 48px;
}
.legal-eyebrow { font-size: 0.78rem; font-weight: 600; color: var(--color-accent); letter-spacing: 0.08em; text-transform: uppercase; margin-bottom: 12px; }
.legal-title { font-size: clamp(2rem, 4vw, 2.8rem); font-weight: 700; letter-spacing: -0.03em; color: var(--color-text); margin-bottom: 8px; line-height: 1.15; }
.legal-meta { font-size: 0.82rem; color: var(--color-text-dim); margin-bottom: 32px; }
.legal-body { color: var(--color-text); line-height: 1.75; font-size: 0.96rem; }
.legal-body .legal-lead { font-size: 1.06rem; color: var(--color-text-muted); margin-bottom: 28px; }
.legal-body h2 { font-size: 1.18rem; font-weight: 700; color: var(--color-text); letter-spacing: -0.01em; margin: 32px 0 12px; }
.legal-body p { margin-bottom: 14px; color: var(--color-text); }
.legal-body ul { margin: 8px 0 16px 22px; }
.legal-body li { margin-bottom: 8px; color: var(--color-text); }
.legal-body strong { color: var(--color-text); font-weight: 600; }
.legal-body a { color: var(--color-accent); text-decoration: underline; text-underline-offset: 2px; }
.legal-footer-nav {
  display: flex; gap: 10px; flex-wrap: wrap;
  margin-top: 48px; padding-top: 24px; border-top: 1px solid var(--color-border);
  font-size: 0.85rem; color: var(--color-text-dim);
}
.legal-footer-nav a { color: var(--color-text-muted); }
.legal-footer-nav a:hover { color: var(--color-text); }

/* Responsive */
@media (max-width: 880px) {
  .landing-topbar { padding: 14px 20px; }
  .landing-topnav { gap: 14px; }
  .landing-topnav a:not(.btn) { display: none; }
  .strip-grid { grid-template-columns: repeat(2, 1fr); gap: 20px; }
  .insight-grid { grid-template-columns: 1fr; }
  .features-grid { grid-template-columns: 1fr; }
  .footer-cols { grid-template-columns: 1fr 1fr; gap: 28px; }
  .landing-section { padding: 64px 20px; }
}

/* ──────────────────────────── Account / Settings ──────────────────────────── */
.account-card hr { border: none; border-top: 1px solid var(--color-border); }

.account-delete-modal {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.65);
  z-index: 200;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.account-delete-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 24px;
  max-width: 460px; width: 100%;
  box-shadow: 0 16px 40px rgba(0,0,0,0.45);
}

/* ──────────────────────────── Mobile sweep (≤ 720px) ──────────────────────────── */
@media (max-width: 720px) {
  /* Sidebar collapses to a top bar so the 240px gutter doesn't crush 375px content. */
  body { display: block; }
  .sidebar {
    position: relative;
    width: 100%;
    min-height: auto;
    border-right: none;
    border-bottom: 1px solid var(--color-border);
    flex-direction: column;
  }
  .sidebar-brand { padding: 12px 16px; }
  .sidebar-org { padding: 8px 16px; }
  .sidebar-nav {
    display: flex; flex-direction: row; overflow-x: auto;
    padding: 8px 8px; gap: 4px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .sidebar-nav::-webkit-scrollbar { display: none; }
  .nav-section-label { display: none; }
  .nav-item { flex: 0 0 auto; }
  .nav-link {
    border-left: none;
    border-bottom: 2px solid transparent;
    padding: 8px 12px;
    white-space: nowrap;
    font-size: 0.82rem;
  }
  .nav-item.active .nav-link {
    border-left-color: transparent;
    border-bottom-color: var(--color-accent);
  }
  .sidebar-footer {
    flex-direction: row; align-items: center; justify-content: space-between;
    padding: 10px 16px; gap: 12px;
  }
  .sidebar-footer .user-info { flex: 1; min-width: 0; }
  .main-content,
  .main-content.full-width {
    margin-left: 0;
    padding: 20px 16px;
    max-width: 100%;
  }

  /* Landing hero / topbar tighten */
  .landing-topbar { padding: 12px 16px; }
  .landing-hero { padding: 56px 16px 40px; }
  .hero-title { font-size: clamp(1.9rem, 8vw, 2.6rem); }
  .hero-actions .btn-lg { padding: 12px 20px; font-size: 0.95rem; }
  .strip-grid { grid-template-columns: 1fr 1fr; gap: 16px; }
  .landing-section { padding: 56px 16px; }

  /* Auth pages */
  .auth-card { padding: 28px 22px; }

  /* Generic min tap target for buttons */
  .btn, .btn-sm { min-height: 38px; }

  /* Settings-page cards: kill the cramped inline grid on phones */
  .card { padding: 18px; }
}

/* Even tighter at 375px */
@media (max-width: 400px) {
  .stat-value { font-size: 1.5rem; }
  .page-title { font-size: 1.35rem; }
  .hero-actions { flex-direction: column; align-items: stretch; }
  .hero-actions .btn-lg { width: 100%; }
}
