/* ===========================================================================
   Pingwire — design system & styles
   Mobile-first, custom properties, base-8 spacing.
   =========================================================================== */

:root {
  /* Brand */
  --primary: #2563EB;
  --primary-dark: #1D4ED8;
  --accent: #22D3EE;
  --success: #10B981;
  --warning: #F59E0B;
  --danger: #EF4444;

  /* App (dark) surfaces */
  --bg-dark: #0B1220;
  --surface: #111827;
  --surface-2: #1B2435;
  --surface-3: #243049;
  --text-dark: #E5E7EB;
  --muted: #94A3B8;
  --border-dark: #243049;

  /* Landing (light) */
  --landing-bg: #FFFFFF;
  --landing-bg-2: #F8FAFC;
  --landing-text: #0F172A;
  --landing-muted: #475569;
  --landing-border: #E2E8F0;

  /* Priority badge colors */
  --pri-min: #64748B;
  --pri-low: #0EA5E9;
  --pri-default: #2563EB;
  --pri-high: #F59E0B;
  --pri-urgent: #EF4444;

  /* Type */
  --font-head: "Plus Jakarta Sans", system-ui, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  /* Spacing (base-8) */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px;
  --s6: 32px; --s7: 48px; --s8: 64px; --s9: 96px;

  /* Radius / shadow */
  --radius-card: 12px;
  --radius-bubble: 20px;
  --radius-pill: 999px;
  --shadow-sm: 0 1px 2px rgba(15,23,42,.06), 0 1px 3px rgba(15,23,42,.08);
  --shadow-md: 0 4px 12px rgba(15,23,42,.08), 0 2px 4px rgba(15,23,42,.06);
  --shadow-lg: 0 20px 40px rgba(15,23,42,.12);
  --shadow-glow: 0 0 0 4px rgba(37,99,235,.15);

  /* ---- Semantic app tokens (dark UI polish; reconciled with existing brand) ----
     UI chrome (focus rings, active-tab underlines, callout borders) uses the
     marketing/Create blue via --accent-ui. --accent itself stays the brand
     cyan: it colors TEXT on dark surfaces (code tokens, senders, links) where
     the blue only reaches ~3.4:1 contrast and reads as invisible on phones. */
  --bg: #0b0f17;                 /* app page base — darker so panels read as raised */
  --surface-raised: #1b2433;     /* modals/popovers — visibly lighter than --surface */
  --border: var(--border-dark);  /* #243049 */
  --border-strong: #2f3a4d;
  --text: var(--text-dark);
  --text-muted: var(--muted);
  --accent-ui: var(--primary);         /* #2563EB */
  --accent-hover: var(--primary-dark); /* #1D4ED8 */
  --accent-soft: rgba(37,99,235,.14); /* #2563EB @ 14% — callout tints / focus ring */
  --radius-sm: 8px; --radius-md: 12px; --radius-lg: 16px;
  --shadow-app-md: 0 8px 24px -8px rgba(0,0,0,.55);
  --shadow-app-lg: 0 20px 48px -16px rgba(0,0,0,.65);
  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px; --space-5: 24px; --space-6: 32px;

  --transition: 200ms ease;
  --container: 1200px;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; max-width: 100%; overflow-x: hidden; }
/* Pages are hard-light by default; the app shell is hard-dark. Declaring the
   scheme (with the matching <meta name="color-scheme">) opts out of Chrome/
   WebView auto-dark, which otherwise inverts text but not gradients/images and
   leaves light pages unreadable in the TWA when the phone is in dark mode. */
html { color-scheme: only light; }
.app-body { color-scheme: dark; }
body {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  color: var(--landing-text);
  background: var(--landing-bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  /* Overflow guard: belt-and-suspenders on top of the per-component fixes below. */
  max-width: 100%;
  overflow-x: hidden;
}
/* Fluid media — never force the page wider than the viewport. */
img, svg, video, canvas { max-width: 100%; display: block; }
img, video, canvas { height: auto; }
pre, table { max-width: 100%; }
/* Any code block scrolls WITHIN its own box (developers need code copyable, not wrapped). */
pre { overflow: auto; -webkit-overflow-scrolling: touch; white-space: pre; max-height: 60vh; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; cursor: pointer; }
h1, h2, h3, h4 { font-family: var(--font-head); line-height: 1.15; font-weight: 700; color: var(--landing-text); }
code, pre, kbd { font-family: var(--font-mono); }
/* Inline code in prose (e.g. long URLs / JSON in the "Quick answer" box) wraps instead of
   overflowing the page. Block code lives in <pre>, which scrolls (overflow-x:auto) — see reset. */
:not(pre) > code { overflow-wrap: anywhere; word-break: break-word; }

.container { width: 100%; max-width: var(--container); margin-inline: auto; padding-inline: max(var(--s4), env(safe-area-inset-left)) max(var(--s4), env(safe-area-inset-right)); }
.skip-link {
  position: absolute; left: -9999px; top: 0; background: var(--primary); color: #fff;
  padding: var(--s3) var(--s4); border-radius: 0 0 var(--radius-card) 0; z-index: 100;
}
.skip-link:focus { left: 0; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  min-height: 44px; padding: var(--s3) var(--s5);
  border: 1px solid transparent; border-radius: var(--radius-pill);
  font-weight: 600; font-size: .95rem; text-decoration: none;
  transition: transform var(--transition), background var(--transition), box-shadow var(--transition);
  white-space: nowrap;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn--primary { background: var(--primary); color: #fff; }
.btn--primary:hover { background: var(--primary-dark); box-shadow: var(--shadow-md); }
.btn--ghost { background: transparent; color: var(--primary); border-color: var(--landing-border); }
.btn--ghost:hover { background: var(--landing-bg-2); }
.btn--light { background: #fff; color: var(--primary); }
.btn--block { width: 100%; }
.btn--lg { min-height: 52px; padding: var(--s4) var(--s6); font-size: 1.05rem; }
.btn--danger { background: var(--danger); color: #fff; }
.btn--sm { min-height: 36px; padding: var(--s2) var(--s4); font-size: .85rem; }
.btn:disabled { opacity: .6; cursor: not-allowed; transform: none; }
.btn:focus-visible { outline: 2px solid var(--accent-ui); outline-offset: 2px; }
/* Dark secondary (Cancel / app ghost): transparent with a strong border, subtle hover fill. */
.app-body .btn--ghost, .modal-card .btn--ghost { color: var(--text); border-color: var(--border-strong); background: transparent; }
.app-body .btn--ghost:hover, .modal-card .btn--ghost:hover { background: var(--surface); color: var(--text); }

/* ---------- Site header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255,255,255,.85); backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--landing-border);
}
.site-header__inner { display: flex; align-items: center; justify-content: space-between; height: 64px; gap: var(--s4); }
.brand { display: inline-flex; align-items: center; gap: var(--s2); font-family: var(--font-head); font-weight: 700; color: var(--landing-text); }
.brand:hover { text-decoration: none; }
.brand__name { font-size: 1.15rem; letter-spacing: -.02em; }
.primary-nav { display: flex; align-items: center; gap: var(--s5); }
.primary-nav a { color: var(--landing-muted); font-weight: 500; }
.primary-nav a:hover, .primary-nav a.is-active { color: var(--landing-text); text-decoration: none; }
.primary-nav a.btn { color: #fff; }
.primary-nav a.btn--primary:hover { color: #fff; }
.nav-toggle { display: none; flex-direction: column; gap: 5px; background: none; border: 0; padding: var(--s2); }
.nav-toggle span { width: 24px; height: 2px; background: var(--landing-text); border-radius: 2px; transition: var(--transition); }

/* ---------- Footer ---------- */
.site-footer { background: var(--bg-dark); color: var(--text-dark); margin-top: var(--s9); padding-top: var(--s8); }
.site-footer__grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: var(--s6); padding-bottom: var(--s7); }
.site-footer .brand, .site-footer .brand__name { color: #fff; }
.site-footer__tagline { color: var(--muted); margin-top: var(--s3); max-width: 36ch; font-size: .9rem; }
.site-footer__col h3 { color: #fff; font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; margin-bottom: var(--s3); }
.site-footer__col a { display: block; color: var(--muted); padding: var(--s1) 0; font-size: .92rem; }
.site-footer__col a:hover { color: #fff; }
.site-footer__bottom { border-top: 1px solid var(--border-dark); padding: var(--s5) 0; }
.site-footer__bottom p { color: var(--muted); font-size: .85rem; }

/* ---------- Landing ---------- */
.answer-summary {
  background: var(--landing-bg-2); border: 1px solid var(--landing-border);
  border-left: 4px solid var(--primary); border-radius: var(--radius-card);
  padding: var(--s5); margin: var(--s6) 0; font-size: 1.05rem; color: var(--landing-text);
}
.answer-summary strong { color: var(--primary-dark); }

.hero { padding: var(--s8) 0 var(--s7); position: relative; overflow: hidden; }
.hero__grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: var(--s7); align-items: center; }
/* min-width:0 lets grid/flex children with long code lines shrink instead of widening the page. */
.hero__grid > *, .dev-split > * { min-width: 0; }
.hero__eyebrow {
  display: inline-flex; align-items: center; gap: var(--s2); font-size: .85rem; font-weight: 600;
  color: var(--primary-dark); background: #EFF6FF; padding: var(--s2) var(--s3); border-radius: var(--radius-pill);
}
.hero h1 { font-size: clamp(2.2rem, 5vw, 3.4rem); letter-spacing: -.03em; margin: var(--s4) 0; }
/* Gradient ends at cyan-600 (not brand cyan #22D3EE): the heading sits on the
   light hero, and the brighter cyan drops below 3:1 there. */
.hero h1 .grad { background: linear-gradient(90deg, var(--primary), #0891B2); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero__sub { font-size: 1.2rem; color: var(--landing-muted); max-width: 46ch; }
.hero__cta { display: flex; gap: var(--s3); margin-top: var(--s5); flex-wrap: wrap; }
.hero__trust { margin-top: var(--s5); color: var(--landing-muted); font-size: .9rem; display: flex; gap: var(--s4); flex-wrap: wrap; }
.hero__trust span { display: inline-flex; align-items: center; gap: var(--s2); }

/* Code sample card */
.code-card {
  background: var(--surface); border-radius: var(--radius-card); box-shadow: var(--shadow-lg);
  overflow: hidden; border: 1px solid var(--border-dark);
}
.code-card__bar { display: flex; align-items: center; gap: var(--s2); padding: var(--s3) var(--s4); background: var(--surface-2); border-bottom: 1px solid var(--border-dark); }
.code-card__dot { width: 12px; height: 12px; border-radius: 50%; }
.code-card__dot--r { background: #FF5F56; } .code-card__dot--y { background: #FFBD2E; } .code-card__dot--g { background: #27C93F; }
.code-card__title { color: var(--muted); font-size: .8rem; margin-left: var(--s2); font-family: var(--font-mono); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.code-card pre { margin: 0; padding: var(--s5); overflow-x: auto; color: var(--text-dark); font-size: .9rem; line-height: 1.7; }
.code-card .tok-cmd { color: var(--accent); } .code-card .tok-str { color: #86efac; } .code-card .tok-flag { color: #fcd34d; } .code-card .tok-url { color: #93c5fd; }

/* Sections */
.section { padding: var(--s8) 0; }
.section--alt { background: var(--landing-bg-2); }
.section__head { text-align: center; max-width: 56ch; margin: 0 auto var(--s7); }
.section__head h2 { font-size: clamp(1.6rem, 3.5vw, 2.4rem); letter-spacing: -.02em; }
.section__head p { color: var(--landing-muted); margin-top: var(--s3); font-size: 1.1rem; }
.eyebrow { color: var(--primary-dark); font-weight: 600; text-transform: uppercase; letter-spacing: .08em; font-size: .8rem; }
/* On dark surfaces the small eyebrow needs a light blue to clear 4.5:1. */
.app-body .eyebrow, .section--dark .eyebrow, .modal-card .eyebrow { color: #93C5FD; }

/* Feature grid */
.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: var(--s5); }
.feature-card {
  background: #fff; border: 1px solid var(--landing-border); border-radius: var(--radius-card);
  padding: var(--s6); transition: transform var(--transition), box-shadow var(--transition);
}
.feature-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }
.feature-card__icon {
  width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center;
  background: linear-gradient(135deg, #EFF6FF, #ECFEFF); color: var(--primary); margin-bottom: var(--s4);
}
.feature-card h3 { font-size: 1.2rem; margin-bottom: var(--s2); }
.feature-card p { color: var(--landing-muted); font-size: .96rem; }

/* Steps */
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: var(--s5); counter-reset: step; }
.step { position: relative; padding: var(--s6); background: #fff; border: 1px solid var(--landing-border); border-radius: var(--radius-card); }
.step::before {
  counter-increment: step; content: counter(step);
  display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%;
  background: var(--primary); color: #fff; font-weight: 700; font-family: var(--font-head); margin-bottom: var(--s4);
}
.step h3 { font-size: 1.1rem; margin-bottom: var(--s2); }
.step p { color: var(--landing-muted); font-size: .95rem; }
.step code { background: var(--landing-bg-2); padding: 2px 6px; border-radius: 6px; font-size: .85rem; color: var(--primary-dark); }

/* Q&A / PAA accordion */
.qa-list { max-width: 820px; margin: 0 auto; display: grid; gap: var(--s3); }
.qa-item { background: #fff; border: 1px solid var(--landing-border); border-radius: var(--radius-card); overflow: hidden; }
.qa-item summary {
  list-style: none; cursor: pointer; padding: var(--s5); font-weight: 600; font-family: var(--font-head);
  display: flex; justify-content: space-between; align-items: center; gap: var(--s4);
}
.qa-item summary::-webkit-details-marker { display: none; }
.qa-item summary::after { content: "+"; font-size: 1.4rem; color: var(--primary); transition: var(--transition); }
.qa-item[open] summary::after { transform: rotate(45deg); }
.qa-item__body { padding: 0 var(--s5) var(--s5); color: var(--landing-muted); }
.qa-item__body p { margin-bottom: var(--s3); }

/* Pricing teaser */
.pricing { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: var(--s5); max-width: 980px; margin: 0 auto; }
.price-card { background: #fff; border: 1px solid var(--landing-border); border-radius: var(--radius-card); padding: var(--s6); text-align: center; }
.price-card--featured { border-color: var(--primary); box-shadow: var(--shadow-md); position: relative; }
.price-card--featured::before { content: "Popular"; position: absolute; top: -12px; left: 50%; transform: translateX(-50%); background: var(--primary); color: #fff; font-size: .75rem; padding: 4px 12px; border-radius: var(--radius-pill); }
.price-card h3 { font-size: 1.2rem; }
.price-card .price { font-size: 2.4rem; font-family: var(--font-head); margin: var(--s3) 0; }
.price-card .price span { font-size: 1rem; color: var(--landing-muted); }
.price-card ul { list-style: none; padding: 0; text-align: left; margin: var(--s4) 0; }
.price-card li { padding: var(--s2) 0; color: var(--landing-muted); display: flex; gap: var(--s2); }
.price-card li::before { content: "✓"; color: var(--success); font-weight: 700; }
/* Breathing room above the CTA so it isn't flush against the feature list / card edge. */
.price-card .btn { margin-top: var(--s5); }

.cta-band { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: #fff; border-radius: var(--radius-card); padding: var(--s8); text-align: center; }
.cta-band h2 { color: #fff; font-size: clamp(1.6rem, 3vw, 2.2rem); }
.cta-band p { color: rgba(255,255,255,.85); margin: var(--s3) 0 var(--s5); font-size: 1.1rem; }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: .72rem; font-weight: 600; padding: 2px 8px; border-radius: var(--radius-pill); text-transform: uppercase; letter-spacing: .03em; }
.badge--source { background: var(--surface-3); color: var(--muted); }
.badge--api { background: rgba(34,211,238,.15); color: var(--accent); }
.badge--webhook { background: rgba(245,158,11,.15); color: var(--warning); }
.badge--bot { background: rgba(139,92,246,.18); color: #c4b5fd; }
.badge--schedule { background: rgba(16,185,129,.15); color: var(--success); }
.badge--pri-min { background: rgba(100,116,139,.15); color: var(--pri-min); }
.badge--pri-low { background: rgba(14,165,233,.15); color: var(--pri-low); }
.badge--pri-high { background: rgba(245,158,11,.18); color: var(--pri-high); }
.badge--pri-urgent { background: rgba(239,68,68,.18); color: var(--pri-urgent); }
/* Priority palette is tuned for the dark chat; on light pages (developers docs
   tables) the same hues fall under 4.5:1 — use darker shades there. */
.site .badge--pri-min { color: #475569; }
.site .badge--pri-low { color: #0369A1; }
.site .badge--pri-high { color: #B45309; }
.site .badge--pri-urgent { color: #DC2626; }

/* ===========================================================================
   Auth pages
   =========================================================================== */
.auth-body { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; background: radial-gradient(1200px 600px at 50% -10%, #EFF6FF, var(--landing-bg)); padding: max(var(--s5), env(safe-area-inset-top)) max(var(--s5), env(safe-area-inset-right)) max(var(--s5), env(safe-area-inset-bottom)) max(var(--s5), env(safe-area-inset-left)); }
.auth-shell { width: 100%; max-width: 420px; }
.auth-brand { display: flex; align-items: center; justify-content: center; gap: var(--s2); font-family: var(--font-head); font-weight: 700; font-size: 1.3rem; color: var(--landing-text); margin-bottom: var(--s5); }
.auth-brand:hover { text-decoration: none; }
.auth-card { background: #fff; border: 1px solid var(--landing-border); border-radius: var(--radius-card); padding: var(--s7); box-shadow: var(--shadow-md); }
.auth-card h1 { font-size: 1.6rem; }
.auth-sub { color: var(--landing-muted); margin: var(--s2) 0 var(--s5); }
.auth-form { display: grid; gap: var(--s4); }
.auth-alt { text-align: center; margin-top: var(--s5); color: var(--landing-muted); }

.field { display: grid; gap: var(--s2); }
.field label { font-weight: 600; font-size: .9rem; }
.field input, .field select, .field textarea {
  width: 100%; min-height: 44px; padding: var(--s3) var(--s4);
  border: 1px solid var(--landing-border); border-radius: 10px; font: inherit; background: #fff; color: var(--landing-text);
  transition: border var(--transition), box-shadow var(--transition);
}
.field textarea { min-height: 90px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--primary); box-shadow: var(--shadow-glow); }
.field-hint { color: var(--landing-muted); font-size: .8rem; }
.field-error { color: var(--danger); font-size: .82rem; min-height: 1em; }
.form-error { background: #FEF2F2; color: #B91C1C; border: 1px solid #FECACA; padding: var(--s3) var(--s4); border-radius: 10px; font-size: .9rem; }
.form-ok { background: #ECFDF5; color: #047857; border: 1px solid #A7F3D0; padding: var(--s3) var(--s4); border-radius: 10px; font-size: .9rem; }

/* ===========================================================================
   App shell (dark) — chat dashboard, account, admin, reminders
   =========================================================================== */
.app-body { background: var(--bg); color: var(--text); min-height: 100vh; min-height: 100dvh; }
.app-topbar {
  height: 56px; display: flex; align-items: center; justify-content: space-between; gap: var(--s4);
  padding: 0 max(var(--s4), env(safe-area-inset-right)) 0 max(var(--s4), env(safe-area-inset-left));
  background: var(--surface); border-bottom: 1px solid var(--border-dark);
  position: sticky; top: 0; z-index: 40;
}
.app-topbar .brand, .app-topbar .brand__name { color: #fff; }
.app-topbar__nav { display: flex; align-items: center; gap: var(--s4); }
.app-topbar__nav a { color: var(--muted); font-weight: 500; font-size: .92rem; }
.app-topbar__nav a:hover, .app-topbar__nav a.is-active { color: #fff; text-decoration: none; }
/* App hamburger — hidden on desktop, shown < 768px (light bars for the dark topbar). */
.app-nav-toggle { display: none; flex-direction: column; gap: 5px; background: none; border: 0; padding: var(--s2); min-width: 44px; min-height: 44px; align-items: center; justify-content: center; }
.app-nav-toggle span { width: 24px; height: 2px; background: #fff; border-radius: 2px; transition: var(--transition); }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--surface-3); display: grid; place-items: center; color: #fff; font-weight: 600; overflow: hidden; flex-shrink: 0; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar--sm { width: 28px; height: 28px; font-size: .75rem; }
.avatar--lg { width: 64px; height: 64px; font-size: 1.4rem; }

/* Chat two-pane */
.chat { display: grid; grid-template-columns: 320px 1fr; height: calc(100vh - 56px); height: calc(100dvh - 56px); }
/* First-run push prompt banner (sits between the topbar and the chat). */
.push-banner {
  display: flex; align-items: center; gap: var(--s3);
  padding: var(--s3) max(var(--s4), env(safe-area-inset-right)) var(--s3) max(var(--s4), env(safe-area-inset-left));
  background: var(--surface-raised); border-bottom: 1px solid var(--border); color: var(--text); font-size: .9rem;
}
.push-banner[hidden] { display: none; }
.push-banner__icon { font-size: 1.15rem; flex-shrink: 0; }
.push-banner__text { flex: 1; min-width: 0; }
.push-banner__dismiss { background: none; border: 0; color: var(--text-muted); font-size: 1.4rem; line-height: 1; padding: 0 var(--s2); cursor: pointer; flex-shrink: 0; }
.push-banner__dismiss:hover { color: var(--text); }
/* When the banner shows, shrink the chat by its measured height so the composer stays visible. */
.app-body.has-push-banner .chat { height: calc(100vh - 56px - var(--push-banner-h, 52px)); height: calc(100dvh - 56px - var(--push-banner-h, 52px)); }
.chat__list { border-right: 1px solid var(--border-dark); background: var(--surface); display: flex; flex-direction: column; min-height: 0; }
.chat__list-head { padding: var(--s4); display: flex; align-items: center; justify-content: space-between; gap: var(--s2); border-bottom: 1px solid var(--border-dark); }
.chat__list-head h2 { font-size: 1.05rem; color: #fff; }
.chat__search { padding: var(--s3) var(--s4); }
.chat__search input { width: 100%; min-height: 38px; padding: var(--s2) var(--s3); background: var(--bg); border: 1px solid var(--border-strong); border-radius: var(--radius-md); color: var(--text); }
.chat__search input::placeholder { color: var(--text-muted); }
.chat__search input:focus { outline: none; border-color: var(--accent-ui); box-shadow: 0 0 0 3px var(--accent-soft); }
.conv-list { overflow-y: auto; flex: 1; min-height: 0; }
.conv-item { display: flex; gap: var(--s3); padding: var(--s3) var(--s4); cursor: pointer; border-bottom: 1px solid rgba(36,48,73,.5); transition: background var(--transition); }
.conv-item:hover { background: var(--surface-2); }
.conv-item.is-active { background: var(--surface-3); }
.conv-item__body { min-width: 0; flex: 1; }
.conv-item__top { display: flex; justify-content: space-between; gap: var(--s2); align-items: baseline; }
.conv-item__name { font-weight: 600; color: #fff; font-size: .95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-item__time { color: var(--muted); font-size: .72rem; flex-shrink: 0; }
.conv-item__preview { color: var(--muted); font-size: .85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 6px; }
.conv-item__unread { background: var(--primary); color: #fff; font-size: .7rem; font-weight: 700; min-width: 20px; height: 20px; padding: 0 6px; border-radius: var(--radius-pill); display: grid; place-items: center; }
.conv-type-pill { font-size: .65rem; text-transform: uppercase; color: var(--muted); border: 1px solid var(--border-dark); padding: 1px 5px; border-radius: 4px; }

.chat__main { display: flex; flex-direction: column; min-height: 0; background: var(--bg-dark); }
.chat__header { height: 60px; display: flex; align-items: center; gap: var(--s3); padding: 0 var(--s4); border-bottom: 1px solid var(--border-dark); background: var(--surface); }
.chat__header-info { min-width: 0; }
.chat__header-name { font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat__header-meta { color: var(--muted); font-size: .8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat__back { display: none; background: none; border: 0; color: var(--text-dark); font-size: 1.4rem; padding: var(--s2); }
.chat__delete { margin-left: auto; min-width: 44px; min-height: 44px; display: grid; place-items: center; background: none; border: 0; border-radius: var(--radius-card); color: var(--muted); }
.chat__delete:hover { color: var(--danger); background: var(--surface-2); }
.chat__messages { flex: 1; overflow-y: auto; padding: var(--s5) var(--s4); display: flex; flex-direction: column; gap: var(--s3); min-height: 0; }
.chat__empty, .chat__placeholder { margin: auto; text-align: center; color: var(--muted); max-width: 360px; padding: var(--s6); }
.chat__placeholder svg { margin: 0 auto var(--s4); opacity: .6; }
.chat__placeholder h3 { color: var(--text-dark); }

.msg { display: flex; gap: var(--s3); max-width: 76%; }
.msg__bubble { background: var(--surface-2); border: 1px solid var(--border-dark); border-radius: var(--radius-bubble); padding: var(--s3) var(--s4); border-top-left-radius: 6px; }
.msg__sender { font-size: .8rem; font-weight: 600; color: var(--accent); margin-bottom: 2px; display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; }
.msg__title { font-weight: 700; color: #fff; margin-bottom: 2px; }
.msg__body { color: var(--text-dark); white-space: pre-wrap; word-break: break-word; }
.msg__body a { color: var(--accent); }
.msg__meta { font-size: .7rem; color: var(--muted); margin-top: 4px; display: flex; gap: var(--s2); align-items: center; }
.msg__img { border-radius: 12px; margin-top: var(--s2); max-height: 320px; width: auto; }
.msg__file { display: inline-flex; align-items: center; gap: var(--s2); margin-top: var(--s2); padding: var(--s2) var(--s3); background: var(--surface-3); border-radius: 10px; color: var(--text-dark); }
.msg--mine { margin-left: auto; flex-direction: row-reverse; }
.msg--mine .msg__bubble { background: var(--primary); border-color: var(--primary); border-top-left-radius: var(--radius-bubble); border-top-right-radius: 6px; }
.msg--mine .msg__body, .msg--mine .msg__title { color: #fff; }
.msg--mine .msg__sender { display: none; }
.msg--mine .msg__meta { justify-content: flex-end; color: rgba(255,255,255,.7); }
.msg--system { max-width: 100%; justify-content: center; }
.msg--system .msg__bubble { background: transparent; border: 1px dashed var(--border-dark); color: var(--muted); font-size: .85rem; border-radius: var(--radius-pill); }
.msg__ticks { color: var(--accent); }
.msg__ticks--read { color: var(--accent); } .msg__ticks--sent { color: var(--muted); }
.msg--urgent .msg__bubble { border-left: 3px solid var(--pri-urgent); }
.msg--high .msg__bubble { border-left: 3px solid var(--pri-high); }
.msg__deleted { font-style: italic; color: var(--muted); }

.typing-row { color: var(--muted); font-size: .82rem; padding: 0 var(--s5) var(--s2); height: 20px; }
.typing-dots span { display: inline-block; width: 5px; height: 5px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite both; }
.typing-dots span:nth-child(2) { animation-delay: .2s; } .typing-dots span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%,80%,100%{opacity:.2} 40%{opacity:1} }

.composer { border-top: 1px solid var(--border-dark); background: var(--surface); display: flex; gap: var(--s2); align-items: flex-end;
  padding: var(--s3) max(var(--s4), env(safe-area-inset-right)) calc(var(--s3) + env(safe-area-inset-bottom)) max(var(--s4), env(safe-area-inset-left)); }
.composer textarea { flex: 1; min-width: 0; resize: none; min-height: 44px; max-height: 140px; padding: var(--s3); background: var(--bg); border: 1px solid var(--border-strong); border-radius: 14px; color: var(--text); font: inherit; }
.composer textarea::placeholder { color: var(--text-muted); }
.composer textarea:focus { outline: none; border-color: var(--accent-ui); box-shadow: 0 0 0 3px var(--accent-soft); }
.composer__btn { width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--primary); color: #fff; display: grid; place-items: center; flex-shrink: 0; }
.composer__btn:hover { background: var(--primary-dark); }
.composer__attach { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--border-dark); background: var(--surface-2); color: var(--muted); display: grid; place-items: center; flex-shrink: 0; }

/* Channel feed styling (one-way) */
.feed-msg .msg__bubble { width: 100%; }
.feed-msg { max-width: 100%; }

/* ===========================================================================
   Panels (account / admin / reminders)
   =========================================================================== */
.panel-wrap { max-width: 960px; margin: 0 auto; padding: var(--s6) var(--s4); }
.panel-wrap h1 { color: #fff; margin-bottom: var(--s2); }
.panel-wrap > .eyebrow { display: block; margin-bottom: var(--s2); }
.panel-lead { color: var(--muted); margin-bottom: var(--s6); }
.text-strong { color: var(--text); }
/* Accent callout — mirrors the marketing "Quick answer" style inside the dark app. */
.app-callout {
  background: var(--accent-soft); border-left: 3px solid var(--accent-ui); border-radius: var(--radius-sm);
  padding: var(--space-3) var(--space-4); color: var(--text-muted); font-size: .85rem;
}
.app-callout strong { color: var(--text); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: var(--s5); margin-bottom: var(--s5); box-shadow: var(--shadow-app-md); }
/* Modal dialog (e.g. "Start something new") — raised surface that sits clearly above the page. */
.modal-card {
  width: 100%; max-width: min(420px, calc(100vw - var(--space-5) * 2)); margin: auto; box-sizing: border-box;
  background: var(--surface-raised); border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-app-lg); padding: var(--space-5); color: var(--text);
}
.modal-card::backdrop { background: rgba(0,0,0,.55); backdrop-filter: blur(3px); }
.modal-card h2 { color: #fff; }
.modal-card .field input { background: var(--bg); }
.modal-card .row-between { flex-wrap: wrap; justify-content: flex-end; gap: var(--space-3); }
.modal-card .row-between .btn { box-sizing: border-box; }
/* Bottom-sheet on small phones — anchored to the bottom edge, no floating void. */
@media (max-width: 480px) {
  .modal-card {
    max-width: 100%; width: 100%; margin: 0; inset: auto 0 0 0;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0; border-bottom: 0;
    padding-bottom: calc(var(--space-5) + env(safe-area-inset-bottom));
  }
  /* Cancel/Create split the row evenly so both stay fully visible and tappable. */
  .modal-card .row-between { justify-content: stretch; }
  .modal-card .row-between .btn { flex: 1 1 0; min-width: 0; }
}
.card h2 { color: #fff; font-size: 1.2rem; margin-bottom: var(--s2); }
.card h3 { color: #fff; font-size: 1rem; }
.card__desc { color: var(--muted); font-size: .9rem; margin-bottom: var(--s4); }
.card .field label { color: var(--text-dark); }
/* App fields: recessed fill (darker than the card), strong border, clear accent focus ring. */
.card .field input, .card .field select, .card .field textarea { background: var(--bg); border: 1px solid var(--border-strong); border-radius: var(--radius-md); color: var(--text); }
.card .field input::placeholder, .card .field textarea::placeholder { color: var(--text-muted); }
.card .field input:focus, .card .field select:focus, .card .field textarea:focus { outline: none; border-color: var(--accent-ui); box-shadow: 0 0 0 3px var(--accent-soft); }
.tabs { display: flex; gap: var(--s2); border-bottom: 1px solid var(--border-dark); margin-bottom: var(--s5); overflow-x: auto; }
.tabs button { background: none; border: 0; color: var(--text-muted); padding: var(--s3) var(--s4); font-weight: 600; border-bottom: 2px solid transparent; white-space: nowrap; transition: color var(--transition); }
.tabs button:hover { color: var(--text); }
.tabs button.is-active { color: var(--text); border-bottom-color: var(--accent-ui); }
.tab-panel { display: none; } .tab-panel.is-active { display: block; }

.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: var(--s3); border-bottom: 1px solid var(--border-dark); font-size: .9rem; }
.table th { color: var(--muted); font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; }
.table td { color: var(--text-dark); }
.table code { background: var(--surface-2); padding: 2px 6px; border-radius: 6px; color: var(--accent); font-size: .82rem; }
.table-empty { color: var(--muted); padding: var(--s5); text-align: center; }
/* Wrap wide tables so they scroll within their own box instead of widening the page. */
.table-wrap { max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-wrap .table, .table-wrap .method-table { min-width: 520px; }

.secret-reveal { background: var(--bg-dark); border: 1px dashed var(--primary); border-radius: 10px; padding: var(--s4); margin: var(--s4) 0; }
.secret-reveal code { display: block; color: var(--accent); word-break: break-all; font-size: .9rem; margin-bottom: var(--s3); }

.kpi-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: var(--s4); margin-bottom: var(--s6); }
.kpi { background: var(--surface); border: 1px solid var(--border-dark); border-radius: var(--radius-card); padding: var(--s5); }
.kpi__label { color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }
.kpi__value { color: #fff; font-size: 2rem; font-family: var(--font-head); font-weight: 700; margin-top: var(--s2); }
.kpi__sub { color: var(--success); font-size: .8rem; }
.chart { display: flex; align-items: flex-end; gap: 4px; height: 160px; padding: var(--s4) 0; }
.chart__bar { flex: 1; background: linear-gradient(180deg, var(--primary), var(--primary-dark)); border-radius: 4px 4px 0 0; min-height: 2px; position: relative; transition: height var(--transition); }
.chart__bar:hover { opacity: .85; }

/* ===========================================================================
   Developer docs page
   =========================================================================== */
.docs-hero { background: var(--landing-bg-2); padding: var(--s8) 0 var(--s7); border-bottom: 1px solid var(--landing-border); }
.docs-hero h1 { font-size: clamp(2rem, 4vw, 2.8rem); }
.docs-hero p { color: var(--landing-muted); font-size: 1.15rem; max-width: 60ch; margin-top: var(--s3); }
.docs-layout { display: grid; grid-template-columns: 240px 1fr; gap: var(--s7); padding: var(--s7) 0; }
/* Grid items default to min-width:auto, which lets long code lines stretch
   .docs-content past the viewport (962px at a 360px screen) — the pre then
   "fits" its wide parent, never scrolls, and the body clips it. min-width:0 is
   what makes every code block actually scrollable on phones. */
.docs-layout > * { min-width: 0; }
.docs-nav { position: sticky; top: 80px; align-self: start; display: grid; gap: var(--s1); }
.docs-nav a { color: var(--landing-muted); padding: var(--s2) var(--s3); border-radius: 8px; font-size: .92rem; font-weight: 500; }
.docs-nav a:hover { background: var(--landing-bg-2); text-decoration: none; color: var(--landing-text); }
.docs-section { margin-bottom: var(--s8); scroll-margin-top: 80px; }
.docs-section h2 { font-size: 1.6rem; margin-bottom: var(--s3); }
.docs-section h3 { font-size: 1.15rem; margin: var(--s5) 0 var(--s2); }
.docs-section p { color: var(--landing-muted); margin-bottom: var(--s3); }
.docs-section ul { color: var(--landing-muted); padding-left: var(--s5); margin-bottom: var(--s3); }
.docs-key-callout { background: #EFF6FF; border: 1px solid #BFDBFE; border-radius: var(--radius-card); padding: var(--s4); margin: var(--s4) 0; font-size: .9rem; }
.docs-key-callout code { background: #fff; padding: 2px 8px; border-radius: 6px; color: var(--primary-dark); }

.code-tabs { background: var(--surface); border-radius: var(--radius-card); overflow: hidden; border: 1px solid var(--border-dark); margin: var(--s4) 0; }
.code-tabs__bar { display: flex; align-items: center; background: var(--surface-2); border-bottom: 1px solid var(--border-dark); overflow-x: auto; }
.code-tabs__bar button { background: none; border: 0; color: var(--muted); padding: var(--s3) var(--s4); font-size: .85rem; font-family: var(--font-mono); white-space: nowrap; border-bottom: 2px solid transparent; }
.code-tabs__bar button.is-active { color: #fff; border-bottom-color: var(--accent-ui); }
.code-tabs__copy { margin-left: auto; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; font-family: var(--font-body); }
.code-tabs__copy.copied { color: var(--success); }
.code-tabs__pane { display: none; }
.code-tabs__pane.is-active { display: block; }

/* ---------- Shared code-block component (assets/js/code-blocks.js) ---------- */
/* Every <pre> gets wrapped: box, top-right copy button, right-edge fade cue. */
.codeblock { position: relative; }
/* Standalone blocks (not already inside a dark code card) get the card look. */
.codeblock > pre:not(.code-tabs__pane pre, .code-card pre) {
  background: var(--surface); color: var(--text-dark); border: 1px solid var(--border-dark);
  border-radius: var(--radius-card); padding: var(--s5);
}
.codeblock__copy {
  position: absolute; top: 8px; right: 8px; z-index: 2;
  min-height: 40px; padding: 6px 14px;
  background: rgba(27,36,51,.92); color: var(--muted);
  border: 1px solid var(--border-strong); border-radius: 8px;
  font-size: .78rem; font-family: var(--font-body);
}
.codeblock__copy:hover { color: var(--text-dark); }
.codeblock__copy.copied { color: var(--success); border-color: var(--success); }
/* Fade cue on the right edge while there is more to scroll. */
.codeblock::after {
  content: ""; position: absolute; top: 0; right: 0; bottom: 0; width: 36px;
  background: linear-gradient(to right, transparent, rgba(11,18,32,.85));
  border-radius: 0 var(--radius-card) var(--radius-card) 0;
  opacity: 0; transition: opacity 150ms ease; pointer-events: none;
}
.codeblock.has-more::after { opacity: 1; }
/* Inline code chips are tap-to-copy (code-blocks.js). */
.code-chip { cursor: pointer; }
.code-chip--copied { background: var(--success) !important; color: #fff !important; }
/* Docs code samples scroll within their own box and stay copyable intact — never force-wrapped. */
.code-tabs pre { margin: 0; padding: var(--s5); max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; white-space: pre; color: var(--text-dark); font-size: .88rem; line-height: 1.7; }
.method-table { width: 100%; border-collapse: collapse; margin: var(--s3) 0; }
.method-table th, .method-table td { text-align: left; padding: var(--s3); border: 1px solid var(--landing-border); font-size: .9rem; }
.method-table th { background: var(--landing-bg-2); }
.method-table code { background: var(--landing-bg-2); padding: 1px 6px; border-radius: 5px; color: var(--primary-dark); }
.http-pill { font-family: var(--font-mono); font-size: .75rem; font-weight: 700; padding: 2px 8px; border-radius: 6px; }
/* Darker pill fills so the white method text clears 4.5:1. */
.http-pill--post { background: #047857; color: #fff; } .http-pill--get { background: var(--primary-dark); color: #fff; } .http-pill--delete { background: #DC2626; color: #fff; }

/* Toast */
.toast-wrap { position: fixed; bottom: calc(var(--s5) + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); z-index: 200; display: grid; gap: var(--s2); width: max-content; max-width: calc(100vw - var(--s5)); }
.toast { word-break: break-word; }
.toast { background: var(--surface); color: #fff; border: 1px solid var(--border-dark); border-left: 3px solid var(--primary); padding: var(--s3) var(--s5); border-radius: 10px; box-shadow: var(--shadow-lg); animation: toastIn .25s ease; }
.toast--ok { border-left-color: var(--success); } .toast--err { border-left-color: var(--danger); }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* Reveal on scroll */
.reveal { opacity: 0; transform: translateY(20px); transition: opacity .6s ease, transform .6s ease; }
.reveal.is-visible { opacity: 1; transform: none; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s4); }
.muted { color: var(--muted); } .center { text-align: center; }
.mt-4 { margin-top: var(--s4); } .mb-0 { margin-bottom: 0; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); flex-wrap: wrap; }
.btn-row { display: flex; flex-wrap: wrap; gap: var(--s3); align-items: center; }
.tag-chip { font-size: .72rem; background: var(--surface-3); color: var(--muted); padding: 1px 7px; border-radius: var(--radius-pill); }

/* ===========================================================================
   Responsive
   =========================================================================== */
/* ===========================================================================
   Developer tools — CLI + MCP (dark contrast bands)
   =========================================================================== */
.section--dark { background: var(--bg-dark); color: var(--text-dark); }
.dev-split { display: grid; grid-template-columns: 1.05fr 1fr; gap: var(--s7); align-items: center; }
.dev-split__text .eyebrow { display: block; margin-bottom: var(--s3); }
.dev-split__text h2 { font-size: clamp(1.6rem, 3.5vw, 2.4rem); letter-spacing: -.02em; color: #fff; margin-bottom: var(--s4); }
.dev-split__text > p { color: var(--muted); font-size: 1.08rem; max-width: 48ch; }

.dev-codes { display: grid; gap: var(--s5); min-width: 0; }
.dev-codes .code-card pre { font-size: .86rem; }

/* Terminal / code variant: deep background + subtle blue glow */
.code-card--glow { background: #080f1c; border-color: rgba(37,99,235,.35); box-shadow: 0 0 30px rgba(37,99,235,.1); }
.code-card--glow .code-card__bar { background: #0e1827; border-bottom-color: rgba(37,99,235,.18); }
.code-card--glow pre { background: #080f1c; }

/* Platform / tag pills */
.dev-tags { display: flex; flex-wrap: wrap; gap: var(--s2); margin-top: var(--s5); }
.dev-tags .pill {
  font-family: var(--font-mono); font-size: .76rem; font-weight: 600;
  padding: var(--s2) var(--s3); border-radius: var(--radius-pill);
  background: var(--surface-2); color: var(--muted); border: 1px solid var(--border-dark);
}

/* MCP tool cards */
.mcp-tools { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: var(--s3); margin-top: var(--s5); }
.mcp-tool { background: #0e1827; border: 1px solid var(--border-dark); border-radius: var(--radius-card); padding: var(--s4); }
.mcp-tool h4 { font-family: var(--font-mono); font-size: .88rem; color: var(--accent); margin-bottom: var(--s1); }
.mcp-tool p { color: var(--muted); font-size: .85rem; }

/* Inline command, labels, doc link */
.code-label { display: block; font-family: var(--font-mono); font-size: .8rem; color: var(--muted); margin-bottom: var(--s2); }
.inline-cmd {
  margin: 0; background: #080f1c; border: 1px solid rgba(37,99,235,.35); border-radius: 10px;
  padding: var(--s3) var(--s4); font-family: var(--font-mono); font-size: .9rem; color: var(--text-dark);
  overflow-x: auto; box-shadow: 0 0 30px rgba(37,99,235,.1);
}
.inline-cmd .tok-cmd { color: var(--accent); }
.dev-install { margin-top: var(--s5); }
.dev-doclink { margin-top: var(--s4); }
.dev-link { color: #93c5fd; font-weight: 600; }
.dev-link:hover { color: #bfdbfe; }

@media (max-width: 1024px) {
  .feature-grid, .steps, .pricing { grid-template-columns: repeat(2, 1fr); }
  .kpi-grid { grid-template-columns: repeat(3, 1fr); }
  .docs-layout { grid-template-columns: 200px 1fr; gap: var(--s5); }
}
@media (max-width: 768px) {
  .nav-toggle { display: flex; }
  .primary-nav {
    position: fixed; inset: 64px 0 auto 0; background: #fff; flex-direction: column; align-items: stretch;
    padding: var(--s4); gap: var(--s2); border-bottom: 1px solid var(--landing-border); box-shadow: var(--shadow-md);
    transform: translateY(-120%); transition: transform var(--transition);
    max-height: calc(100vh - 64px); max-height: calc(100dvh - 64px); overflow-y: auto;
  }
  .primary-nav.is-open { transform: none; }
  .primary-nav a { padding: var(--s3); min-height: 44px; display: flex; align-items: center; }
  .primary-nav a.btn { justify-content: center; }

  /* Authenticated app top nav → hamburger drawer (fixes off-screen links in the app). */
  .app-nav-toggle { display: flex; }
  .app-topbar__nav {
    position: fixed; inset: 56px 0 auto 0; background: var(--surface); flex-direction: column; align-items: stretch;
    gap: var(--s1); padding: var(--s3) max(var(--s3), env(safe-area-inset-right)) var(--s3) max(var(--s3), env(safe-area-inset-left));
    border-bottom: 1px solid var(--border-dark); box-shadow: var(--shadow-lg);
    transform: translateY(-120%); transition: transform var(--transition);
    max-height: calc(100dvh - 56px); overflow-y: auto; z-index: 39;
  }
  .app-topbar__nav.is-open { transform: none; }
  .app-topbar__nav a { padding: var(--s3); border-radius: 8px; min-height: 44px; display: flex; align-items: center; }
  .app-topbar__nav a:hover, .app-topbar__nav a.is-active { background: var(--surface-2); }
  .app-topbar__nav .avatar { display: none; }
  .hero__grid { grid-template-columns: 1fr; gap: var(--s6); }
  .site-footer__grid { grid-template-columns: 1fr 1fr; gap: var(--s5); }
  .feature-grid, .steps, .pricing, .grid-2, .dev-split { grid-template-columns: 1fr; }
  .docs-layout { grid-template-columns: 1fr; }
  .docs-nav { position: static; flex-direction: row; flex-wrap: wrap; gap: var(--s2); }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }

  /* Tab strips wrap on phones so no tab (e.g. Notifications) hides off the right edge. */
  .tabs { flex-wrap: wrap; overflow-x: visible; row-gap: var(--s1); }

  /* Chat: swap to single full-screen pane */
  .chat { grid-template-columns: 1fr; }
  .chat__main { display: none; }
  .chat.show-thread .chat__list { display: none; }
  .chat.show-thread .chat__main { display: flex; }
  .chat__back { display: block; }
  .msg { max-width: 88%; }

  /* Tighter vertical rhythm + breathing room so nothing feels crunched on phones. */
  .section { padding: var(--s7) 0; }
  .hero { padding: var(--s7) 0 var(--s6); }
  .cta-band { padding: var(--s6) var(--s5); }
  .hero__cta .btn, .price-card .btn { flex: 1 1 auto; }
  /* Stacked CTA button pairs: force a full-width column with a firm, consistent
     vertical gap so they read as two distinct buttons (not one block) and can't
     collapse. align-items:stretch keeps both buttons equal width = equal height. */
  .hero__cta, .feature-page .feature-cta, .btn-row {
    flex-direction: column; align-items: stretch; gap: .75rem;
  }
  /* Keep native dialogs within the viewport. */
  dialog { width: auto; max-width: calc(100vw - var(--s4) * 2); }
}
@media (max-width: 480px) {
  .site-footer__grid { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: 1fr; }
  .auth-card { padding: var(--s5); }
  .section { padding: var(--s6) 0; }
  .cta-band { padding: var(--s6) var(--s4); }
  .panel-wrap { padding: var(--s5) var(--s4); }
  /* Slightly tighter card padding so content keeps comfortable side margins. */
  .feature-card, .step, .price-card { padding: var(--s5); }
  .code-card pre, .code-tabs pre { padding: var(--s4); font-size: .82rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
  .reveal { opacity: 1; transform: none; }
}

/* ===========================================================================
   QR Channels — dashboard, detail, admin, subscribe (feature: QR Channels)
   =========================================================================== */
.qr-create-head { display:flex; align-items:center; justify-content:space-between; gap:var(--s3); }
.qr-plan-badge { font-size:.7rem; font-weight:700; letter-spacing:.05em; padding:3px 8px; border-radius:var(--radius-pill); }
.qr-plan-badge--free { background:var(--surface-3); color:var(--muted); }
.qr-plan-badge--pro { background:var(--primary); color:#fff; }
.qr-pro-tag { font-size:.65rem; font-weight:700; color:#93C5FD; background:rgba(37,99,235,.15); padding:2px 6px; border-radius:var(--radius-pill); margin-left:6px; vertical-align:middle; }
.qr-limit-note { background:var(--surface-2); border:1px solid var(--border); border-radius:var(--radius-card); padding:var(--s3); color:var(--muted); margin:var(--s3) 0; }
.qr-limit-note a, .qr-back a, .qr-card { color:var(--primary); text-decoration:none; }
.qr-create-form { margin-top:var(--s3); }

.qr-card-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(260px,1fr)); gap:var(--s4); margin-top:var(--s5); }
.qr-card { display:flex; gap:var(--s3); padding:var(--s4); background:var(--surface); border:1px solid var(--border); border-radius:var(--radius-card); transition:border-color .15s, transform .15s; }
.qr-card:hover { border-color:var(--primary); transform:translateY(-2px); }
.qr-card__thumb { flex:0 0 auto; background:#fff; border-radius:10px; padding:6px; line-height:0; }
.qr-card__thumb img { width:96px; height:96px; }
.qr-card__body h3 { margin:0 0 4px; color:var(--text); font-size:1.05rem; }
.qr-card__desc { margin:0 0 8px; color:var(--muted); font-size:.85rem; }
.qr-card__stats { display:flex; gap:var(--s3); flex-wrap:wrap; color:var(--muted); font-size:.8rem; }
.qr-card__stats strong { color:var(--text); }
.qr-empty { color:var(--muted); padding:var(--s5) 0; }

.qr-pill { display:inline-block; font-size:.7rem; padding:2px 8px; border-radius:var(--radius-pill); background:var(--surface-3); color:var(--muted); }
.qr-pill--on { background:rgba(16,185,129,.15); color:var(--success); }
.qr-pill--off { background:rgba(148,163,184,.15); color:var(--muted); }
.qr-pill--flag { background:rgba(239,68,68,.15); color:var(--danger); }

.qr-detail-grid { display:grid; grid-template-columns:minmax(0,340px) minmax(0,1fr); gap:var(--s4); margin-top:var(--s4); }
.qr-detail-qr__img { background:#fff; border-radius:var(--radius-card); padding:var(--s4); text-align:center; line-height:0; }
.qr-detail-qr__img img { width:100%; max-width:280px; height:auto; }
.qr-url-row { display:flex; gap:var(--s2); margin-top:var(--s3); }
.qr-url-row input { flex:1; font-family:var(--font-mono); font-size:.8rem; }
.qr-action-row { display:flex; gap:var(--s2); margin-top:var(--s3); flex-wrap:wrap; }
.qr-hint { color:var(--muted); font-size:.78rem; margin-top:var(--s2); }
.qr-logo-clear { display:flex; align-items:center; gap:6px; margin-top:8px; color:var(--muted); font-size:.85rem; }

.btn--danger-ghost { background:transparent; border:1px solid var(--danger); color:var(--danger); }
.btn--danger-ghost:hover { background:rgba(239,68,68,.1); }

.qr-analytics-head { display:flex; align-items:center; justify-content:space-between; }
.qr-range-tabs button { background:transparent; border:1px solid var(--border); color:var(--muted); padding:4px 12px; border-radius:var(--radius-pill); cursor:pointer; font-size:.8rem; }
.qr-range-tabs button.is-active { background:var(--primary); border-color:var(--primary); color:#fff; }
.qr-sparkline { width:100%; height:60px; margin-top:var(--s4); }

.qr-send-row { display:flex; gap:var(--s2); align-items:center; margin-top:var(--s3); }
.qr-send-row select { flex:0 0 auto; }
.qr-send-row .btn { flex:1; }

.qr-table-wrap { overflow-x:auto; }
.qr-table { width:100%; border-collapse:collapse; font-size:.88rem; }
.qr-table th, .qr-table td { text-align:left; padding:8px 10px; border-bottom:1px solid var(--border); white-space:nowrap; }
.qr-table th { color:var(--muted); font-weight:600; font-size:.78rem; text-transform:uppercase; letter-spacing:.03em; }
.qr-loading { color:var(--muted); text-align:center; padding:var(--s4); }
.qr-revoke { background:transparent; border:1px solid var(--border); color:var(--danger); padding:3px 10px; border-radius:var(--radius-pill); cursor:pointer; font-size:.78rem; }
.qr-revoke:hover { background:rgba(239,68,68,.1); }

@media (max-width:780px) {
  .qr-detail-grid { grid-template-columns:1fr; }
}

/* QR Channels — admin */
.qr-admin-toolbar { display:flex; gap:var(--s3); align-items:center; margin-bottom:var(--s3); flex-wrap:wrap; }
.qr-admin-toolbar input[type=text], .qr-admin-toolbar #qrSearch { flex:1; min-width:200px; }
.qr-admin-flagonly { display:flex; align-items:center; gap:6px; color:var(--muted); font-size:.85rem; white-space:nowrap; }
.qr-admin-acts { display:flex; gap:6px; flex-wrap:wrap; }
.qr-top-list { margin:var(--s3) 0 0; padding-left:1.2em; color:var(--muted); }
.qr-top-list li { margin-bottom:6px; }
.qr-top-list a, .qr-mono { color:var(--text); }
.qr-mono { font-family:var(--font-mono); font-size:.8rem; color:var(--muted); }

/* QR Channels — public feature page */
.feature-page .answer-box { background:var(--landing-bg-2,#F8FAFC); border:1px solid var(--landing-border,#E2E8F0); border-left:4px solid var(--primary); border-radius:var(--radius-card); padding:var(--s4); margin:var(--s4) 0; color:var(--landing-text,#0F172A); }
.feature-page .byline { color:var(--landing-muted,#475569); font-size:.85rem; margin:0 0 var(--s5); }
.feature-page pre { background:#0b1220; color:#e5e7eb; padding:var(--s4); border-radius:var(--radius-card); overflow-x:auto; font-family:var(--font-mono); font-size:.85rem; }
.feature-page .paa details { border:1px solid var(--landing-border,#E2E8F0); border-radius:var(--radius-card); padding:var(--s3) var(--s4); margin-bottom:var(--s2); }
.feature-page .paa summary { cursor:pointer; font-weight:600; color:var(--landing-text,#0F172A); }
.feature-page .paa details[open] summary { margin-bottom:var(--s2); }
.feature-page .feature-cta { display:flex; gap:var(--s3); flex-wrap:wrap; margin-top:var(--s6); }

/* Reminders list: long lists scroll inside the card instead of truncating. */
.rem-scroll { max-height: 65vh; overflow-y: auto; }
