/* Cherokee AI Solutions — design system (always dark, matte, sharp) */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root, :root.dark {
  color-scheme: dark;

  /* Brand palette — Cherokee landing vocabulary */
  --primary:        #00d4ff;            /* cyan — primary accent */
  --primary-dark:   #00a8cc;            /* deeper cyan */
  --primary-soft:   rgba(0, 212, 255, 0.12);  /* tint for active nav, soft fills */
  --magenta:        #ff3da6;            /* secondary accent */
  --violet:         #9d6cff;            /* tertiary accent */
  --blue:           #5e6ad2;            /* Linear-blue accent */

  /* Surfaces — matte, no glass */
  --bg:             #040406;            /* deep matte black */
  --surface:        #0c0c14;            /* card/panel surface */
  --surface-2:      #13131e;            /* hover/active surface */

  /* Borders — thin white at low opacity */
  --border:         rgba(255, 255, 255, 0.06);
  --border-strong:  rgba(255, 255, 255, 0.12);

  /* Text */
  --text:           #f4f4f6;
  --text-muted:     #9da0ac;
  --text-dim:       #5a5d68;

  /* Semantic */
  --success:        #00d886;
  --warning:        #ffb020;
  --danger:         #f97583;

  /* No real shadows — keep flat. These exist to satisfy existing references. */
  --shadow-sm:      0 1px 0 rgba(0, 0, 0, 0.3);
  --shadow:         0 8px 24px rgba(0, 0, 0, 0.45);
  --shadow-lg:      0 16px 40px rgba(0, 0, 0, 0.55);

  --radius:         8px;
  --radius-sm:      6px;
  --radius-lg:      12px;

  /* ----- Motion easings — named curves replace bare `ease` everywhere.
     Use --ease-out for entrance, --ease-in-out for state changes,
     --ease-spring for buttons/cards that should feel tactile. ----- */
  --ease-out:       cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out:    cubic-bezier(0.65, 0, 0.35, 1);
  --ease-spring:    cubic-bezier(0.34, 1.56, 0.64, 1);

  /* Focus ring — single source of truth so every interactive element
     gets the same accessible halo without per-component box-shadows. */
  --focus-ring:     0 0 0 2px var(--bg), 0 0 0 4px var(--primary);

  /* Spacing scale (4 → 96) — exposed as variables so we can keep
     rhythm consistent across cards, sections, and dashboards. */
  --space-1:  4px;
  --space-2:  8px;
  --space-3:  12px;
  --space-4:  16px;
  --space-5:  24px;
  --space-6:  32px;
  --space-7:  48px;
  --space-8:  64px;
  --space-9:  96px;
}

/* Force dark even when no class is set, so theme toggle "light" still reads dark. */
html { background: var(--bg); }

/* Flash messages — dark bg, accent text */
.flash.success { background: rgba(0, 216, 134, 0.08);  color: #6ee7b7; border-color: var(--success); }
.flash.error   { background: rgba(249, 117, 131, 0.08); color: #fca5a5; border-color: var(--danger); }
.flash.info    { background: rgba(0, 212, 255, 0.08);  color: #67e8f9; border-color: var(--primary); }

.badge-status.open      { background: rgba(0, 212, 255, 0.10); color: #67e8f9; }
.badge-status.converted { background: rgba(0, 216, 134, 0.10); color: #6ee7b7; }
.badge-status.lost      { background: rgba(249, 117, 131, 0.10); color: #fca5a5; }
.badge-status.active    { background: rgba(0, 216, 134, 0.10); color: #6ee7b7; }
.badge-status.trial     { background: rgba(255, 176, 32, 0.10); color: #fcd34d; }
.badge-status.past_due  { background: rgba(249, 117, 131, 0.10); color: #fca5a5; }
.badge-status.canceled  { background: rgba(255, 255, 255, 0.04); color: var(--text-muted); }

.hero h1 {
  background: linear-gradient(120deg, var(--primary) 0%, var(--violet) 50%, var(--magenta) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

* { box-sizing: border-box; }
/* Kill iOS 300ms double-tap-zoom delay on every interactive surface. Safe
   default — only affects scrollable content if applied to that explicitly. */
button, a, input, select, textarea, summary, [role="button"] {
  touch-action: manipulation;
}

html, body {
  margin: 0;
  padding: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, sans-serif;
  font-feature-settings: "ss01", "cv11";
  letter-spacing: -0.011em;
  font-size: 16px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

code, pre, .mono { font-family: 'JetBrains Mono', ui-monospace, monospace; }

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); text-decoration: underline; }

h1, h2, h3, h4 { font-weight: 700; line-height: 1.25; margin: 0 0 .5em; letter-spacing: -0.01em; }
h1 { font-size: 2.4rem; letter-spacing: -0.02em; }
h2 { font-size: 1.7rem; }
h3 { font-size: 1.25rem; }

p { margin: 0 0 1em; color: var(--text); }
.muted { color: var(--text-muted); }
.small { font-size: .875rem; }

/* ---------- Layout ---------- */

.container { max-width: 1100px; margin: 0 auto; padding: 0 24px; }
.narrow    { max-width: 720px;  margin: 0 auto; padding: 0 24px; }

/* ---------- Header ---------- */

.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 16px 0;
  position: sticky; top: 0; z-index: 50;
}
.site-header .row {
  display: flex; align-items: center; justify-content: space-between;
}
.brand {
  display: inline-flex; align-items: center; gap: 10px;
  font-weight: 800; font-size: 1.15rem; color: var(--text);
  text-decoration: none;
}
.brand:hover { text-decoration: none; color: var(--primary); }
.brand-mark {
  /* Widened to 1200×630 panorama aspect (1.9:1) so the unedited Grok
     brand image isn't side-cropped. Height stays at 32px for nav-bar
     vertical rhythm; width follows naturally. */
  width: 60px; height: 32px; border-radius: 6px;
  background: #040406;
  display: inline-flex; align-items: center; justify-content: center;
  overflow: hidden; line-height: 0;
  flex-shrink: 0;
}
.brand-mark > svg,
.brand-mark > img { display: block; width: 100%; height: 100%; }
.nav-links { display: flex; align-items: center; gap: 20px; }
.nav-links a { color: var(--text); font-weight: 500; }
.nav-links a:hover { color: var(--primary); text-decoration: none; }
.nav-links a.nav-current { color: var(--primary); border-bottom: 1px solid var(--primary); padding-bottom: 2px; }

/* Cherokee Smart Home sub-brand — when the visitor is on /smart-home*,
   the brand wordmark splits into "Cherokee" + magenta "Smart Home" suffix
   and the brand-mark gets a subtle magenta ring so the sub-brand has a
   distinct visual identity without needing a separate logo asset. */
.brand--smart-home .brand-mark {
  box-shadow: 0 0 0 1px rgba(255, 0, 192, 0.32),
              0 0 14px rgba(255, 0, 192, 0.18);
}
.brand--smart-home .brand-suffix {
  background: linear-gradient(120deg, var(--primary), var(--magenta) 80%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-weight: 800;
}

/* Public-pages mobile nav (login/signup/faq/legal — NOT the landing hero).
   The landing template has its own hamburger system. This handles the
   shared base.html site-header which used to drop its nav at <640px with
   no replacement. */
.nav-burger-pub {
  display: none;
  width: 38px; height: 38px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(12,12,20,.6);
  color: var(--text);
  cursor: pointer;
  align-items: center; justify-content: center;
  padding: 0;
  transition: .18s;
}
.nav-burger-pub:hover { border-color: var(--primary); }
.nav-burger-pub svg { width: 18px; height: 18px; }

.mobile-menu-pub {
  display: none;
  position: absolute; top: 100%; left: 0; right: 0;
  z-index: 49;
  background: rgba(8,8,14,.95);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border-bottom: 1px solid var(--border);
  padding: 14px 18px 18px;
  flex-direction: column; gap: 6px;
}
.mobile-menu-pub.open { display: flex; }
.mobile-menu-pub a {
  color: var(--text); text-decoration: none; font-size: 15px;
  padding: 12px 14px; border-radius: 8px;
  border: 1px solid var(--border); background: rgba(12,12,20,.5);
  font-weight: 500; transition: .18s;
}
.mobile-menu-pub a:hover { border-color: var(--primary); color: var(--primary); }

@media (max-width: 640px) {
  .site-header .nav-links { display: none; }
  .nav-burger-pub { display: inline-flex; }
  .site-header { position: relative; }
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-block;
  padding: 10px 18px;
  font-weight: 600;
  font-size: .95rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: all .15s ease;
  text-align: center;
  line-height: 1.2;
}
.btn-primary {
  background: linear-gradient(120deg, var(--primary), var(--magenta));
  color: #04060a; font-weight: 700; border: 0;
}
.btn-primary:hover {
  background: linear-gradient(120deg, var(--magenta), var(--primary));
  color: #04060a; text-decoration: none;
}
.btn-secondary {
  background: var(--surface); color: var(--text);
  border-color: var(--border);
}
.btn-secondary:hover { background: var(--bg); text-decoration: none; }
.btn-ghost {
  background: transparent; color: var(--text-muted);
}
.btn-ghost:hover { color: var(--text); text-decoration: none; }
.btn-danger { background: var(--danger); color: white; }
.btn-block { display: block; width: 100%; }
.btn-lg { padding: 14px 26px; font-size: 1.05rem; }
.btn-sm { padding: 6px 12px; font-size: .85rem; }

/* OAuth buttons */
.btn-oauth {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  background: var(--surface); color: var(--text); border: 1px solid var(--border);
  padding: 12px 20px; font-weight: 600; border-radius: var(--radius-sm);
  text-decoration: none; transition: all .15s;
  width: 100%; margin-bottom: 10px;
}
.btn-oauth:hover { background: var(--bg); border-color: var(--text-muted); text-decoration: none; }
.btn-oauth svg, .btn-oauth img { width: 20px; height: 20px; }

/* ---------- Cards ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}
.card-padded { padding: 32px; }
.card-elevated { box-shadow: var(--shadow); }

/* ---------- Forms ---------- */

.form-group { margin-bottom: 18px; }
.form-group label {
  display: block; margin-bottom: 6px;
  font-weight: 600; font-size: .9rem; color: var(--text);
}
.form-group .hint {
  font-size: .82rem; color: var(--text-muted); margin-top: 4px;
}
input[type=text], input[type=email], input[type=password],
input[type=tel], input[type=url], textarea, select {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .98rem;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
  transition: border-color .15s, box-shadow .15s;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.18);
}
textarea { min-height: 80px; resize: vertical; }
.checkbox-row { display: flex; align-items: flex-start; gap: 10px; padding: 10px 0; }
.checkbox-row input[type=checkbox] { margin-top: 4px; }

/* ---------- Flash messages ---------- */

.flash-stack { margin: 20px 0; }
.flash {
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
  font-weight: 500;
  border-left: 4px solid;
}
/* Light-pastel `.flash` duplicates removed — the matte dark variants at
   lines 72–74 are canonical. Leaving them in produced a clashing palette
   where `.flash.success` was dark but `.flash.error/.info` were light
   Tailwind pastels (a regression from the woods-palette redesign). */

/* ---------- Landing page ---------- */

.hero {
  padding: 80px 0 60px;
  text-align: center;
}
.hero h1 {
  font-size: 3.2rem; margin-bottom: 16px;
  background: linear-gradient(120deg, var(--text) 0%, var(--primary) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero .lede { font-size: 1.25rem; color: var(--text-muted); max-width: 620px; margin: 0 auto 32px; }
.hero-cta { display: inline-flex; gap: 12px; }

.section { padding: 60px 0; }
.section-title { text-align: center; margin-bottom: 48px; }
.section-title h2 { font-size: 2rem; margin-bottom: 8px; }
.section-title p { color: var(--text-muted); font-size: 1.05rem; }

.three-col { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
@media (max-width: 800px) { .three-col { grid-template-columns: 1fr; } }

.feature-card {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 28px;
  border-radius: var(--radius);
}
.feature-card .icon {
  width: 44px; height: 44px;
  background: var(--primary-soft);
  color: var(--primary);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem; font-weight: 700;
  margin-bottom: 14px;
}

/* ---------- Pricing ---------- */

.pricing-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
@media (max-width: 900px) { .pricing-grid { grid-template-columns: 1fr; } }

.tier {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  display: flex; flex-direction: column;
  position: relative;
}
.tier.popular {
  border-color: var(--primary);
  box-shadow: var(--shadow-lg);
}
.tier .badge {
  position: absolute; top: -12px; right: 24px;
  background: var(--primary); color: white;
  padding: 4px 12px; font-size: .75rem; font-weight: 700;
  border-radius: 100px; letter-spacing: .05em; text-transform: uppercase;
}
.tier h3 { font-size: 1.3rem; margin-bottom: 4px; }
.tier .blurb { color: var(--text-muted); font-size: .95rem; min-height: 2.6em; margin-bottom: 16px; }
.tier .price { font-size: 2.4rem; font-weight: 800; color: var(--text); }
.tier .price span { font-size: 1rem; font-weight: 500; color: var(--text-muted); }
.tier .setup { font-size: .85rem; color: var(--text-muted); margin-bottom: 20px; }
.tier ul { list-style: none; padding: 0; margin: 0 0 24px; flex: 1; }
.tier ul li {
  padding: 8px 0 8px 26px; position: relative;
  font-size: .95rem;
}
.tier ul li::before {
  content: "→"; position: absolute; left: 0; top: 8px;
  color: var(--primary); font-weight: 800; font-family: 'JetBrains Mono', monospace;
}

/* ---------- Auth pages ---------- */

.auth-wrap {
  min-height: calc(100dvh - 80px);
  display: flex; align-items: center; justify-content: center;
  padding: 40px 24px;
  background:
    radial-gradient(ellipse 60% 50% at 30% 20%, rgba(0,212,255,.08), transparent 60%),
    radial-gradient(ellipse 60% 50% at 70% 80%, rgba(255,61,166,.06), transparent 60%);
}
.auth-card {
  width: 100%; max-width: 440px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 36px 32px;
  margin: 0 auto;
  box-shadow: 0 24px 60px rgba(0,0,0,.32), inset 0 1px 0 rgba(255,255,255,.04);
  position: relative;
}
/* Subtle gradient border accent on the auth card */
.auth-card::before {
  content: ""; position: absolute; inset: -1px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(0,212,255,.18), rgba(255,61,166,.10) 60%, transparent 90%);
  z-index: -1;
  pointer-events: none;
}
.auth-card h1 { font-size: 1.6rem; margin-bottom: 8px; }
.auth-card .subtle { color: var(--text-muted); margin-bottom: 24px; }

/* Polished auth-head block — eyebrow + display title + status readout
   stacked with consistent rhythm. Replaces the inline-style hacks across
   login/signup/forgot/verify. */
.auth-head {
  text-align: center;
  margin-bottom: 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.auth-head .auth-title {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text);
  margin: 0;
  letter-spacing: -0.025em;
  line-height: 1.1;
}
.auth-head .readout {
  margin-top: 4px;
}

/* Auth-page mark — widescreen panorama (1200×630 aspect ≈ 1.9:1) so the
   unedited Grok image isn't cropped. Sized to read at-a-glance on the
   auth card without dominating the form. */
.auth-mark {
  display: block; margin: 0 auto 20px;
  width: 200px; height: 105px;
  border-radius: 10px;
  background: #040406;
  overflow: hidden; line-height: 0;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5),
              0 0 0 1px rgba(255, 255, 255, 0.05);
}
.auth-mark > svg,
.auth-mark > img { display: block; width: 100%; height: 100%; }

.divider { display: flex; align-items: center; gap: 12px; margin: 20px 0; color: var(--text-muted); font-size: .85rem; }
.divider::before, .divider::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}

/* Unified form-input style — replaces 6+ copies of inline styling. */
.form-input {
  width: 100%;
  padding: 11px 13px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  transition: border-color .18s, box-shadow .18s, background .18s;
  box-sizing: border-box;
}
.form-input:hover { border-color: rgba(255,255,255,.18); }
.form-input:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(0,212,255,.14);
}
.form-input::placeholder { color: var(--text-dim); }
.form-label {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 6px;
  font-weight: 500;
  letter-spacing: .02em;
}

/* ---------- Onboarding ---------- */

.wizard-progress {
  display: flex; gap: 8px; margin-bottom: 32px;
}
.wizard-progress .step {
  flex: 1; height: 4px; background: var(--border); border-radius: 2px;
}
.wizard-progress .step.done   { background: var(--success); }
.wizard-progress .step.current { background: var(--primary); }

.wizard-step-label {
  font-size: .85rem; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .08em;
  margin-bottom: 8px;
}

/* ---------- Dashboard ---------- */

.dash-header {
  display: flex; align-items: center; justify-content: space-between;
  margin: 24px 0 32px;
}

.stat-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px;
  margin-bottom: 32px;
}
@media (max-width: 900px) { .stat-grid { grid-template-columns: repeat(2, 1fr); } }
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.stat-card .label { font-size: .82rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
.stat-card .value { font-size: 2.1rem; font-weight: 800; color: var(--text); margin-top: 4px; line-height: 1.1; }
.stat-card .delta { font-size: .85rem; color: var(--text-muted); margin-top: 4px; }

.dash-grid {
  display: grid; grid-template-columns: 2fr 1fr; gap: 24px;
}
@media (max-width: 900px) { .dash-grid { grid-template-columns: 1fr; } }

.activity-feed { list-style: none; padding: 0; margin: 0; }
.activity-feed li {
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  display: flex; gap: 12px; align-items: flex-start;
}
.activity-feed li:last-child { border-bottom: none; }
.activity-feed .dot {
  width: 8px; height: 8px; border-radius: 50%;
  margin-top: 8px; flex-shrink: 0;
}
.activity-feed .dot.ok    { background: var(--success); }
.activity-feed .dot.error { background: var(--danger); }
.activity-feed .meta { font-size: .82rem; color: var(--text-muted); }

table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); font-size: .92rem; }
th { font-weight: 600; color: var(--text-muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }

.badge-status {
  display: inline-block; padding: 2px 10px; border-radius: 100px;
  font-size: .75rem; font-weight: 600;
}
/* Matte dark badges — every status uses the same alpha-on-dark formula
   so the dashboard reads as one consistent palette. The light-pastel
   originals (#DBEAFE/#D1FAE5/etc) had drifted in from a pre-redesign
   sheet and were overriding the matte tokens at lines 77/79. */
.badge-status.open      { background: rgba(0, 212, 255, 0.10); color: #67e8f9; border: 1px solid rgba(0, 212, 255, 0.22); }
.badge-status.converted { background: rgba(0, 216, 134, 0.10); color: #6ee7b7; border: 1px solid rgba(0, 216, 134, 0.22); }
.badge-status.lost      { background: rgba(249, 117, 131, 0.10); color: #fca5a5; border: 1px solid rgba(249, 117, 131, 0.22); }
.badge-status.active    { background: rgba(0, 216, 134, 0.10); color: #6ee7b7; border: 1px solid rgba(0, 216, 134, 0.22); }
.badge-status.trial     { background: rgba(232, 165, 90, 0.10); color: #f3c87a; border: 1px solid rgba(232, 165, 90, 0.28); }
.badge-status.past_due  { background: rgba(249, 117, 131, 0.10); color: #fca5a5; border: 1px solid rgba(249, 117, 131, 0.22); }
.badge-status.canceled  { background: rgba(140, 140, 158, 0.10); color: #9ca3af; border: 1px solid rgba(140, 140, 158, 0.22); }

/* ---------- Footer ---------- */

footer {
  margin-top: 80px;
  padding: 32px 0;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: .9rem;
  text-align: center;
}

/* ---------------------------------------------------------- */
/* App layout — slim sidebar (rail), expands on hover         */
/* ---------------------------------------------------------- */

.app-layout {
  display: block;
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  left: 0; top: 0;
  height: 100vh;
  width: 56px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 8px 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: width .2s ease, box-shadow .2s ease;
  z-index: 50;
}
/* Expand on hover (desktop) or focus-within (keyboard accessibility). The
   child opacity transitions below MUST mirror this selector list exactly,
   otherwise the rail stretches but its contents stay invisible — looks like
   the sidebar is "half open." */
.sidebar:hover,
.sidebar:focus-within {
  width: 224px;
  box-shadow: var(--shadow-lg);
  overflow-y: auto;
}
/* iOS Safari sticks :hover after a tap. On touch devices we disable hover-
   expand entirely so a finger-tap on a sidebar icon doesn't leave the rail
   half-open after the page nav. Focus-within still works for keyboard a11y. */
@media (hover: none) {
  .sidebar:hover { width: 56px; box-shadow: none; overflow: hidden; }
  .sidebar:hover .brand span:not(.brand-mark),
  .sidebar:hover .sidebar-section-label,
  .sidebar:hover .user-card .who,
  .sidebar:hover .sidebar-footer .btn { opacity: 0; pointer-events: none; }
}

.sidebar .brand {
  padding: 6px 12px 10px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
  white-space: nowrap;
  font-size: 1.02rem;
  gap: 10px;
}
.sidebar .brand .brand-mark { width: 30px; height: 30px; font-size: .92rem; }
.sidebar .brand span:not(.brand-mark) {
  opacity: 0;
  transition: opacity .12s;
}
.sidebar:hover .brand span:not(.brand-mark),
.sidebar:focus-within .brand span:not(.brand-mark) { opacity: 1; }

.sidebar-nav {
  flex: 1 1 0;
  min-height: 0;                      /* required for child overflow to scroll in a flex column */
  padding: 6px 8px;
  display: flex;
  flex-direction: column;
  gap: 1px;
  overflow-y: auto;                   /* scroll when nav exceeds rail/drawer height */
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;  /* iOS momentum scroll inside drawer */
  /* Thin Linear-style scrollbar — hidden until hover so the rail stays clean. */
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.12) transparent;
}
.sidebar-nav::-webkit-scrollbar { width: 6px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.10);
  border-radius: 3px;
}
.sidebar-nav::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.20); }

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 500;
  font-size: .9rem;
  white-space: nowrap;
  transition: background .12s, color .12s;
}
.sidebar-nav a:hover {
  background: var(--surface-2);
  color: var(--text);
  text-decoration: none;
}
.sidebar-nav a.active {
  background: var(--primary-soft);
  color: var(--primary);
}
.sidebar-nav a svg {
  width: 18px; height: 18px;
  flex-shrink: 0;
}

.sidebar-section-label {
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
  padding: 10px 10px 2px;
  white-space: nowrap;
  opacity: 0;
  transition: opacity .12s;
}
.sidebar:hover .sidebar-section-label,
.sidebar:focus-within .sidebar-section-label { opacity: 1; }

.sidebar-footer {
  padding: 6px 8px 8px;
  border-top: 1px solid var(--border);
  margin-top: 4px;
}

.user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
}
.user-card .avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--magenta));
  color: #04060a;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800;
  flex-shrink: 0;
  font-size: .9rem;
}
.user-card .who {
  flex: 1;
  min-width: 0;
  opacity: 0;
  transition: opacity .12s;
}
.sidebar:hover .user-card .who,
.sidebar:focus-within .user-card .who { opacity: 1; }
.user-card .who .n  { font-weight: 600; font-size: .85rem; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-card .who .e  { font-size: .73rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.sidebar-footer .btn {
  opacity: 0;
  transition: opacity .12s;
  pointer-events: none;
}
.sidebar:hover .sidebar-footer .btn,
.sidebar:focus-within .sidebar-footer .btn {
  opacity: 1;
  pointer-events: auto;
}

.app-main {
  margin-left: 56px;
  min-height: 100vh;
}

/* Mobile dashboard: convert the desktop hover-rail into a slide-in drawer.
   A new floating burger (.dash-burger, injected in base.html) toggles
   `.sidebar.is-open`. A backdrop covers the page content while open. */
@media (max-width: 800px) {
  .sidebar {
    /* Hidden off-canvas by default — slides in when .is-open is set. */
    width: 268px;
    transform: translateX(-100%);
    transition: transform .2s ease, box-shadow .2s ease;
    box-shadow: none;
  }
  /* Mobile state shows ALL the expanded-rail content. Mirror the hover
     opacity rules so the drawer never looks half-painted. */
  .sidebar.is-open {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }
  .sidebar.is-open .brand span:not(.brand-mark),
  .sidebar.is-open .sidebar-section-label,
  .sidebar.is-open .user-card .who,
  .sidebar.is-open .sidebar-footer .btn { opacity: 1; pointer-events: auto; }
  /* Disable the hover-expand on mobile so the slim rail doesn't fight the
     drawer; the burger is the only way to open it. */
  .sidebar:hover, .sidebar:focus-within {
    width: 268px; /* width matches .is-open so transform animates cleanly */
  }
  .sidebar:not(.is-open):hover,
  .sidebar:not(.is-open):focus-within {
    transform: translateX(-100%); box-shadow: none;
  }
  .app-main { margin-left: 0; padding-top: 56px; }

  .dash-burger {
    position: fixed; top: 12px; left: 12px;
    width: 40px; height: 40px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    display: inline-flex; align-items: center; justify-content: center;
    z-index: 60;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,.18);
    touch-action: manipulation;
  }
  .dash-burger:active { transform: scale(.96); }
  .dash-burger svg { width: 20px; height: 20px; }
  .dash-burger-backdrop {
    position: fixed; inset: 0;
    background: rgba(0,0,0,.4);
    z-index: 49;
    opacity: 0;
    pointer-events: none;
    transition: opacity .18s ease;
  }
  .dash-burger-backdrop.is-open {
    opacity: 1; pointer-events: auto;
  }
}
@media (min-width: 801px) {
  /* Burger only renders on mobile; defensive hide for desktop. */
  .dash-burger, .dash-burger-backdrop { display: none; }
}

/* Theme toggle CSS removed 2026-05-14 — design is dark-only by design
   (see comment at the top of this file). The toggle macro and apply script
   were removed from base.html in the same change. */


/* =========================================================================
   POLISH LAYER — Phase 1 (2026-05-12)
   The base system above is the locked matte aesthetic. This layer refines
   *every* page without changing the brand: motion easings, tactile button
   feedback, accessible focus rings, card hover accents, micro-animations,
   optical typography, and a subtle grain overlay. Adding new rules instead
   of rewriting so the existing components keep their semantics.
   ========================================================================= */

/* ---------- Subtle grain texture on the matte black ----------
   Pure flat black reads cheap on retina screens. A 1% noise overlay across
   the whole body gives the matte surface depth without breaking the
   "no glass/shine" rule from the locked aesthetic. The SVG is inlined so
   there's no extra HTTP request. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.025;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='240' height='240'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)' opacity='0.8'/></svg>");
}

/* ---------- Refined typography ----------
   Slightly tighter tracking on display sizes, optical kerning, and a
   "display" treatment for marketing-hero h1s that want max impact. */
h1, h2, h3, h4 {
  text-rendering: optimizeLegibility;
  font-feature-settings: "ss01", "cv11", "kern";
}
h1 { letter-spacing: -0.025em; }
h2 { letter-spacing: -0.018em; }
.display {
  font-weight: 800;
  font-size: clamp(2.4rem, 5vw + 1rem, 4.8rem);
  line-height: 1.02;
  letter-spacing: -0.035em;
}
.eyebrow {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--primary);
}
.lede {
  font-size: 1.18rem;
  line-height: 1.6;
  color: var(--text-muted);
  max-width: 56ch;
}

/* ---------- Accessible focus ring system ----------
   One ring, everywhere. Using box-shadow over outline so border-radius
   is respected, and a transparent ring on hover so the size doesn't jump. */
:focus { outline: none; }
:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-radius: var(--radius-sm);
}
.btn:focus-visible,
.btn-oauth:focus-visible {
  box-shadow: var(--focus-ring);
}

/* ---------- Buttons: press states + spring easing ----------
   Tactile feedback — buttons scale down 2% on press, springy hover lift.
   Primary gets a subtle inner highlight so the gradient feels lit. */
.btn {
  position: relative;
  transition: transform .18s var(--ease-spring),
              background .18s var(--ease-in-out),
              box-shadow .18s var(--ease-in-out),
              border-color .18s var(--ease-in-out),
              color .18s var(--ease-in-out);
  will-change: transform;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(0.98); transition-duration: .08s; }
.btn-primary {
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.18),
              0 1px 0 rgba(0,0,0,0.3);
}
.btn-primary:hover {
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.22),
              0 6px 18px rgba(0, 212, 255, 0.25),
              0 1px 0 rgba(0,0,0,0.3);
}
.btn-secondary:hover {
  border-color: rgba(0, 212, 255, 0.3);
}
.btn-oauth {
  transition: transform .18s var(--ease-spring),
              background .18s var(--ease-in-out),
              border-color .18s var(--ease-in-out);
}
.btn-oauth:hover { transform: translateY(-1px); }
.btn-oauth:active { transform: translateY(0) scale(0.985); transition-duration: .08s; }

/* ---------- Cards: hover accent slide-in ----------
   A 2px accent strip slides in from the left edge on hover. Subtle enough
   to keep the matte feel, distinct enough that the card reads "tappable". */
.card {
  position: relative;
  overflow: hidden;
  transition: border-color .25s var(--ease-out),
              transform .25s var(--ease-out),
              box-shadow .25s var(--ease-out);
}
.card::before {
  /* Future-tech direction: single cyan hairline, not a rainbow. Restraint. */
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 1px;
  background: var(--primary);
  transform: scaleY(0);
  transform-origin: top;
  transition: transform .35s var(--ease-out);
}
a.card:hover,
.card:hover {
  border-color: rgba(0, 212, 255, 0.18);
}
a.card:hover::before,
.card:hover::before { transform: scaleY(1); }

/* ---------- Form inputs: animated focus underline ----------
   The existing 3px halo stays — we add a fluid border-color shift so
   the input doesn't snap into focus. */
input, textarea, select {
  transition: border-color .22s var(--ease-out),
              box-shadow .22s var(--ease-out),
              background .22s var(--ease-out);
}
input:focus, textarea:focus, select:focus {
  background: var(--surface-2);
}

/* ---------- Inputs disabled / placeholder polish ---------- */
input::placeholder, textarea::placeholder { color: var(--text-dim); opacity: 1; }
input:disabled, textarea:disabled, select:disabled {
  opacity: 0.55; cursor: not-allowed;
}

/* ---------- Selection ---------- */
::selection {
  background: rgba(0, 212, 255, 0.28);
  color: #ffffff;
}

/* ---------- Custom scrollbar (Webkit + Firefox) ---------- */
* { scrollbar-color: rgba(255,255,255,0.12) transparent; scrollbar-width: thin; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.08);
  border-radius: 6px;
  border: 2px solid var(--bg);
}
::-webkit-scrollbar-thumb:hover { background: rgba(0, 212, 255, 0.35); }

/* ---------- Entrance animations ----------
   .fade-up — used on page-load via Jinja class, or programmatically via
   IntersectionObserver. Reduced-motion users see content as-is. */
@keyframes pol-fade-up {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fade-up {
  animation: pol-fade-up .6s var(--ease-out) both;
}
.fade-up.delay-1 { animation-delay: .08s; }
.fade-up.delay-2 { animation-delay: .16s; }
.fade-up.delay-3 { animation-delay: .24s; }
.fade-up.delay-4 { animation-delay: .32s; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
  .fade-up { animation: none !important; opacity: 1 !important; transform: none !important; }
}

/* ---------- Tabular numerics for any .mono / monospace block ----------
   Mirror Linear/Stripe — numbers in tables line up vertically without
   needing JS or fixed widths. */
code, pre, .mono, .cw-mono {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum", "calt";
}

/* ---------- Section rhythm helpers ----------
   Generous, consistent vertical breathing room. Use on marketing pages. */
.section { padding: var(--space-9) 0; }
.section-tight { padding: var(--space-7) 0; }
.divider {
  height: 1px;
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(255,255,255,0.08) 50%,
    transparent 100%);
  margin: var(--space-8) 0;
  border: 0;
}

/* ---------- Loading skeleton ----------
   For any list/card waiting on data. Pulsing shimmer in brand cyan. */
@keyframes pol-skel {
  0%   { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
.skeleton {
  background: linear-gradient(
    90deg,
    var(--surface) 0%,
    var(--surface-2) 50%,
    var(--surface) 100%);
  background-size: 200% 100%;
  animation: pol-skel 1.4s linear infinite;
  border-radius: var(--radius-sm);
  color: transparent !important;
}

/* ---------- Pill polish: tabular nums + sharper border ---------- */
.cw-pill {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}

/* ---------- Brand mark image ----------
   The mark macro (_brand_mark.html) renders an <img> that fills its
   parent wrapper. Wrappers (.brand-mark, .auth-mark, .err-mark, etc.)
   already provide border-radius + overflow:hidden so the photo is
   circle/round-square-clipped consistently. */
.cherokee-brand-img {
  display: block;
  width: 100%;
  height: 100%;
  /* `contain` shows the full unedited panorama with no cropping; the
     wrapper aspect (1.9:1) matches the source so there are no letterbox
     bars in practice. */
  object-fit: cover;
  object-position: center center;
}


/* =========================================================================
   FUTURE-TECH LAYER — minimalist HUD aesthetic
   Direction: less color, more monospace. Hairline rules, big tabular
   numbers, status readouts, terminal-style eyebrows. Single cyan accent
   carries the brand; gradients reserved for the hero h1 only.
   ========================================================================= */

/* ---------- Terminal-style eyebrows ----------
   Replace the soft brand-cyan eyebrow with a stricter "/ system · path"
   readable as a breadcrumb or status line. Mono caps with high tracking. */
.eyebrow {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.74rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.eyebrow::before {
  content: "/";
  color: var(--text-dim);
  font-weight: 400;
}

/* ---------- Status readout — top-strip HUD ----------
   Used on dashboards / chat panels to give a "system online" feel.
   Reads like: ● ONLINE · 12 ms · v1.2.0 · BUILD 248
   The dot is the only animated piece — slow pulse, never seizure-fast. */
.readout {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.readout .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 2px rgba(0, 216, 134, 0.18);
  animation: pol-pulse 2.4s var(--ease-in-out) infinite;
}
.readout .dot.cyan   { background: var(--primary); box-shadow: 0 0 0 2px rgba(0, 212, 255, 0.20); }
.readout .dot.amber  { background: var(--warning); box-shadow: 0 0 0 2px rgba(255, 176, 32, 0.20); }
.readout .dot.danger { background: var(--danger);  box-shadow: 0 0 0 2px rgba(249, 117, 131, 0.22); }
.readout .sep { color: var(--text-dim); }
@keyframes pol-pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.45; }
}

/* ---------- Mono number (HUD-style metric) ----------
   For "$1,840 / mo recovered" hero numbers and dashboard tiles. Tabular
   nums so groups of figures stay aligned column-wise. */
.mono-num {
  font-family: 'JetBrains Mono', monospace;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum", "ss01";
  font-weight: 600;
  letter-spacing: -0.02em;
}
.mono-num.lg { font-size: clamp(2.4rem, 5vw + 1rem, 4.2rem); line-height: 1.0; }
.mono-num.md { font-size: 1.6rem; line-height: 1.1; }
.mono-num.sm { font-size: 1.0rem; }

/* ---------- Hairline rule ----------
   1px low-opacity divider, used between sections without consuming
   vertical space the way a margin would. */
.hairline {
  height: 1px;
  background: var(--border);
  border: 0;
  margin: 0;
}

/* ---------- Hairline grid backdrop ----------
   1px CSS-grid overlay for hero sections — futuristic, technical, no
   image cost. Layer behind content with `position: relative; z-index: 1;`
   on the parent and z-index: 0 on the grid. */
.grid-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse at center, #000 30%, transparent 80%);
  -webkit-mask-image: radial-gradient(ellipse at center, #000 30%, transparent 80%);
}

/* ---------- Terminal-style label ::before tags ----------
   For section headers: `<h2 class="t-label">customers</h2>` →
   "[01] CUSTOMERS". Cheap structural numbering. */
.t-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* ---------- Crosshair caps on cards (HUD frame corners) ----------
   Opt-in via .card-hud — adds 4 corner ticks reminiscent of a mission
   control viewport. Strictly decorative, costs zero bytes. */
.card-hud { position: relative; }
.card-hud::after {
  content: "";
  position: absolute;
  inset: 6px;
  pointer-events: none;
  background:
    linear-gradient(90deg, var(--primary) 0 8px, transparent 8px 100%) top left/100% 1px no-repeat,
    linear-gradient(90deg, transparent 0 calc(100% - 8px), var(--primary) calc(100% - 8px) 100%) top right/100% 1px no-repeat,
    linear-gradient(180deg, var(--primary) 0 8px, transparent 8px 100%) top left/1px 100% no-repeat,
    linear-gradient(180deg, transparent 0 calc(100% - 8px), var(--primary) calc(100% - 8px) 100%) top right/1px 100% no-repeat,
    linear-gradient(90deg, var(--primary) 0 8px, transparent 8px 100%) bottom left/100% 1px no-repeat,
    linear-gradient(90deg, transparent 0 calc(100% - 8px), var(--primary) calc(100% - 8px) 100%) bottom right/100% 1px no-repeat,
    linear-gradient(180deg, var(--primary) 0 8px, transparent 8px 100%) bottom left/1px 100% no-repeat,
    linear-gradient(180deg, transparent 0 calc(100% - 8px), var(--primary) calc(100% - 8px) 100%) bottom right/1px 100% no-repeat;
  opacity: 0.55;
}

/* ---------- Restraint pass on secondary buttons ----------
   Drop the cyan hover-border tint added in Phase 1; future-tech wants
   a colder, mono-toned interaction state. */
.btn-secondary:hover {
  background: var(--surface-2);
  border-color: rgba(255, 255, 255, 0.16);
}

/* ---------- Selection: less saturation, more precision ---------- */
::selection {
  background: rgba(0, 212, 255, 0.20);
  color: #ffffff;
}

/* ---------- Inputs: drop the surface-2 fill on focus, just sharpen ----------
   Future-tech inputs feel like terminal fields — the cursor moves, the
   chrome doesn't. */
input:focus, textarea:focus, select:focus {
  background: var(--surface);
  border-color: var(--primary);
  box-shadow: inset 0 -1px 0 var(--primary), 0 0 0 1px rgba(0, 212, 255, 0.18);
}


