/* Sandstorm Secure design system (v5.1.0).
 * ONE stylesheet for the dashboard, the demo and the landing page. Keep the copies
 * in demo/ and landing/ identical (run scripts/sync_shared_assets.py).
 * This project does not use the owner's default teal palette (see AGENTS.md).
 * Font: Inter (SIL OFL 1.1, see vendor/LICENSE-inter-OFL.txt). No external CDNs.
 */

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("vendor/inter-latin-wght-normal.woff2") format("woff2");
}

/* ------------------------------------------------------------------ tokens */

:root {
  color-scheme: light;

  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-subtle: #f1f5f9;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --text: #0f172a;
  --text-muted: #64748b;

  /* --primary is for links and focus rings; --primary-solid is the button fill. */
  --primary: #2563eb;
  --primary-solid: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-soft: #eff6ff;
  --on-primary: #ffffff;

  --sidebar-bg: #0b1220;
  --sidebar-text: #cbd5e1;
  --sidebar-muted: #8391a7;
  --sidebar-active-bg: #1e293b;
  --sidebar-active-text: #ffffff;
  --sidebar-border: #1e293b;

  /* Brand mark only. Never use it for buttons or status. */
  --brand-sand: #c8a165;

  /* Status colours are for status only. */
  --success: #16a34a;
  --success-soft: #dcfce7;
  --success-text: #166534;
  --warning: #d97706;
  --warning-soft: #fef3c7;
  --warning-text: #92400e;
  --danger: #dc2626;
  --danger-soft: #fee2e2;
  --danger-text: #991b1b;
  --danger-hover: #b91c1c;
  --info: #0284c7;
  --info-soft: #e0f2fe;
  --info-text: #075985;
  --neutral-soft: #f1f5f9;
  --neutral-text: #475569;

  --font-sans: "Inter", "Segoe UI Variable", "Segoe UI", system-ui, sans-serif;
  --font-mono: "Cascadia Mono", Consolas, "SFMono-Regular", Menlo, monospace;

  --text-xs: 12px;
  --text-sm: 14px;
  --text-md: 16px;
  --text-lg: 20px;
  --text-xl: 24px;
  --text-2xl: 32px;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;

  --radius-card: 8px;
  --radius-control: 6px;
  --radius-pill: 999px;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.16);
  --focus-ring: 0 0 0 3px rgba(37, 99, 235, 0.35);

  --sidebar-width: 240px;
  --topbar-height: 56px;
}

/* Dark theme tokens. The same block appears twice: once for the system setting
 * and once for the manual toggle (data-theme="dark"). Keep both blocks equal. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0b1220;
    --surface: #111a2e;
    --surface-subtle: #16213a;
    --border: #1f2a44;
    --border-strong: #2c3a5a;
    --text: #e2e8f0;
    --text-muted: #94a3b8;
    --primary: #3b82f6;
    --primary-solid: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-soft: rgba(59, 130, 246, 0.14);
    --sidebar-bg: #080e1a;
    --sidebar-border: #1f2a44;
    --success-soft: rgba(22, 163, 74, 0.16);
    --success-text: #4ade80;
    --warning-soft: rgba(217, 119, 6, 0.16);
    --warning-text: #fbbf24;
    --danger-soft: rgba(220, 38, 38, 0.16);
    --danger-text: #f87171;
    --info-soft: rgba(2, 132, 199, 0.18);
    --info-text: #38bdf8;
    --neutral-soft: rgba(148, 163, 184, 0.14);
    --neutral-text: #cbd5e1;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.5);
    --focus-ring: 0 0 0 3px rgba(59, 130, 246, 0.45);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b1220;
  --surface: #111a2e;
  --surface-subtle: #16213a;
  --border: #1f2a44;
  --border-strong: #2c3a5a;
  --text: #e2e8f0;
  --text-muted: #94a3b8;
  --primary: #3b82f6;
  --primary-solid: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-soft: rgba(59, 130, 246, 0.14);
  --sidebar-bg: #080e1a;
  --sidebar-border: #1f2a44;
  --success-soft: rgba(22, 163, 74, 0.16);
  --success-text: #4ade80;
  --warning-soft: rgba(217, 119, 6, 0.16);
  --warning-text: #fbbf24;
  --danger-soft: rgba(220, 38, 38, 0.16);
  --danger-text: #f87171;
  --info-soft: rgba(2, 132, 199, 0.18);
  --info-text: #38bdf8;
  --neutral-soft: rgba(148, 163, 184, 0.14);
  --neutral-text: #cbd5e1;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.5);
  --focus-ring: 0 0 0 3px rgba(59, 130, 246, 0.45);
}

/* -------------------------------------------------------------------- base */

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  line-height: 1.5;
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  color: var(--text);
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.25;
}

p {
  margin: 0;
}

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

a:hover {
  text-decoration: underline;
}

:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-radius: var(--radius-control);
}

code,
.mono {
  font-family: var(--font-mono);
  font-size: 0.92em;
}

code {
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  color: var(--text);
  word-break: break-word;
}

.num {
  font-variant-numeric: tabular-nums;
}

.muted {
  color: var(--text-muted);
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: var(--space-4);
  top: -48px;
  z-index: 100;
  padding: var(--space-2) var(--space-3);
  background: var(--primary-solid);
  color: var(--on-primary);
  border-radius: var(--radius-control);
}

.skip-link:focus {
  top: var(--space-3);
}

[hidden] {
  display: none !important;
}

.icon {
  display: inline-flex;
  flex: none;
  width: 16px;
  height: 16px;
}

.icon svg {
  width: 100%;
  height: 100%;
}

.icon-lg {
  width: 20px;
  height: 20px;
}

.icon-xl {
  width: 28px;
  height: 28px;
}

/* --------------------------------------------------------------- app shell */

.app {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
  padding: var(--space-5) var(--space-3);
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  border-right: 1px solid var(--sidebar-border);
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 0 var(--space-2);
  color: #ffffff;
  font-weight: 600;
  font-size: var(--text-md);
  letter-spacing: -0.01em;
  text-decoration: none;
}

.brand:hover {
  text-decoration: none;
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: var(--brand-sand);
  color: #0b1220;
}

.brand-mark .icon {
  width: 16px;
  height: 16px;
}

.brand-name-accent {
  color: var(--brand-sand);
  font-weight: 500;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-label {
  padding: 0 var(--space-3) var(--space-2);
  color: var(--sidebar-muted);
  font-size: var(--text-xs);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-control);
  color: var(--sidebar-text);
  font-weight: 500;
  text-decoration: none;
}

.nav-link:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #ffffff;
  text-decoration: none;
}

.nav-link.active {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-active-text);
}

.nav-link .icon {
  opacity: 0.85;
}

.nav-link .nav-badge {
  margin-left: auto;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--danger);
}

.sidebar-footer {
  margin-top: auto;
  padding: var(--space-3);
  border-top: 1px solid var(--sidebar-border);
  color: var(--sidebar-muted);
  font-size: var(--text-xs);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-footer strong {
  color: var(--sidebar-text);
  font-weight: 500;
}

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  height: var(--topbar-height);
  padding: 0 var(--space-8);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--border);
}

.topbar-title {
  font-size: var(--text-sm);
  font-weight: 600;
}

.topbar-crumb {
  color: var(--text-muted);
  font-weight: 500;
}

.topbar-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.topbar .brand {
  display: none;
  color: var(--text);
  padding: 0;
}

.topbar .nav-toggle {
  display: none;
}

.content {
  width: 100%;
  max-width: 1200px;
  padding: var(--space-8);
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

.theme-toggle .icon-sun {
  display: none;
}

:root[data-theme="dark"] .theme-toggle .icon-sun {
  display: inline-flex;
}

:root[data-theme="dark"] .theme-toggle .icon-moon {
  display: none;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-sun {
    display: inline-flex;
  }

  :root:not([data-theme="light"]) .theme-toggle .icon-moon {
    display: none;
  }
}

/* ----------------------------------------------------------- page header */

.page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
}

.page-title {
  font-size: var(--text-xl);
  font-weight: 600;
}

.page-description {
  margin-top: var(--space-1);
  color: var(--text-muted);
  max-width: 70ch;
}

.page-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

/* ------------------------------------------------------------------ buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  height: 36px;
  padding: 0 var(--space-4);
  border: 1px solid transparent;
  border-radius: var(--radius-control);
  background: none;
  color: var(--text);
  font: inherit;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease;
}

.btn:hover {
  text-decoration: none;
}

.btn:disabled,
.btn[aria-disabled="true"] {
  cursor: not-allowed;
  opacity: 0.5;
}

.btn-primary {
  background: var(--primary-solid);
  color: var(--on-primary);
}

.btn-primary:not(:disabled):hover {
  background: var(--primary-hover);
}

.btn-secondary {
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.btn-secondary:not(:disabled):hover {
  background: var(--surface-subtle);
}

.btn-ghost {
  color: var(--text-muted);
}

.btn-ghost:not(:disabled):hover {
  background: var(--surface-subtle);
  color: var(--text);
}

.btn-danger {
  background: var(--danger);
  color: #ffffff;
}

.btn-danger:not(:disabled):hover {
  background: var(--danger-hover);
}

.btn-danger-outline {
  background: var(--surface);
  border-color: var(--danger);
  color: var(--danger-text);
}

.btn-danger-outline:not(:disabled):hover {
  background: var(--danger-soft);
}

.btn-sm {
  height: 30px;
  padding: 0 var(--space-3);
  font-size: var(--text-xs);
}

.btn-lg {
  height: 44px;
  padding: 0 var(--space-6);
  font-size: var(--text-md);
}

.btn-icon {
  width: 36px;
  padding: 0;
}

.btn-icon.btn-sm {
  width: 30px;
}

/* Disabled buttons do not get hover events, so the wrapper owns the tooltip. */
.tooltip {
  position: relative;
  display: inline-flex;
  border-radius: var(--radius-control);
}

.tooltip-text {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  z-index: 30;
  width: max-content;
  max-width: 240px;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-control);
  background: #0f172a;
  color: #f8fafc;
  font-size: var(--text-xs);
  font-weight: 500;
  line-height: 1.4;
  text-align: center;
  box-shadow: var(--shadow-md);
  transform: translateX(-50%);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 120ms ease;
}

.tooltip:hover .tooltip-text,
.tooltip:focus-within .tooltip-text,
.tooltip:focus .tooltip-text {
  opacity: 1;
  visibility: visible;
}

.tooltip-end .tooltip-text {
  left: auto;
  right: 0;
  transform: none;
}

/* -------------------------------------------------------------------- cards */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-sm);
}

.card-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--border);
}

.card-title {
  font-size: var(--text-md);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.card-description {
  margin-top: 2px;
  color: var(--text-muted);
}

.card-body {
  padding: var(--space-6);
}

.card-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-2);
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--border);
  background: var(--surface-subtle);
  border-radius: 0 0 var(--radius-card) var(--radius-card);
}

.card-footer .muted {
  margin-right: auto;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-6);
}

/* ------------------------------------------------------------ summary cards */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-4);
}

.stat-card {
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.stat-label {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--text-muted);
  font-size: var(--text-xs);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat-value {
  font-size: var(--text-2xl);
  font-weight: 600;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.stat-value.stat-value-sm {
  font-size: var(--text-lg);
  padding: 6px 0 2px;
}

.stat-hint {
  color: var(--text-muted);
  font-size: var(--text-xs);
}

.stat-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border-strong);
}

.stat-dot-success {
  background: var(--success);
}

.stat-dot-danger {
  background: var(--danger);
}

/* -------------------------------------------------------------------- pills */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 22px;
  padding: 0 var(--space-2);
  border-radius: var(--radius-pill);
  background: var(--neutral-soft);
  color: var(--neutral-text);
  font-size: var(--text-xs);
  font-weight: 500;
  white-space: nowrap;
}

.pill::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.pill-plain::before {
  display: none;
}

.pill-success {
  background: var(--success-soft);
  color: var(--success-text);
}

.pill-warning {
  background: var(--warning-soft);
  color: var(--warning-text);
}

.pill-danger {
  background: var(--danger-soft);
  color: var(--danger-text);
}

.pill-info {
  background: var(--info-soft);
  color: var(--info-text);
}

.tag {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 var(--space-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface-subtle);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
}

.badge-local {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  color: var(--text-muted);
  font-size: var(--text-xs);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.badge-local .icon {
  width: 14px;
  height: 14px;
}

/* ------------------------------------------------------------------ banners */

.setup-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-8);
  border-bottom: 1px solid;
  font-weight: 500;
}

.setup-banner p {
  flex: 1 1 280px;
}

.setup-banner p span {
  font-weight: 400;
}

.setup-banner-danger {
  background: var(--danger-soft);
  border-color: color-mix(in srgb, var(--danger) 35%, transparent);
  color: var(--danger-text);
}

.setup-banner-warning {
  background: var(--warning-soft);
  border-color: color-mix(in srgb, var(--warning) 35%, transparent);
  color: var(--warning-text);
}

.callout {
  display: flex;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: var(--surface-subtle);
}

.callout .icon {
  margin-top: 2px;
}

.callout-info {
  border-color: color-mix(in srgb, var(--info) 30%, transparent);
  background: var(--info-soft);
  color: var(--info-text);
}

.callout-danger {
  border-color: color-mix(in srgb, var(--danger) 30%, transparent);
  background: var(--danger-soft);
  color: var(--danger-text);
}

.callout-success {
  border-color: color-mix(in srgb, var(--success) 30%, transparent);
  background: var(--success-soft);
  color: var(--success-text);
}

.callout-warning {
  border-color: color-mix(in srgb, var(--warning) 30%, transparent);
  background: var(--warning-soft);
  color: var(--warning-text);
}

.demo-ribbon {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: var(--space-2) var(--space-3);
  padding: var(--space-2) var(--space-4);
  background: var(--info-soft);
  border-bottom: 1px solid color-mix(in srgb, var(--info) 30%, transparent);
  color: var(--info-text);
  font-size: var(--text-xs);
  text-align: center;
}

.demo-ribbon strong {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 var(--space-2);
  border-radius: var(--radius-pill);
  background: var(--info);
  color: #ffffff;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ------------------------------------------------------------------- tables */

.table-card {
  overflow: visible;
}

.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.table th {
  position: sticky;
  top: var(--topbar-height);
  z-index: 5;
  padding: var(--space-3) var(--space-4);
  background: var(--surface-subtle);
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
  font-size: var(--text-xs);
  font-weight: 500;
  text-align: left;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.table th:first-child {
  border-top-left-radius: var(--radius-card);
}

.table th:last-child {
  border-top-right-radius: var(--radius-card);
}

.table td {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.table tbody tr:last-child td {
  border-bottom: none;
}

.table tbody tr:hover td {
  background: color-mix(in srgb, var(--primary) 4%, var(--surface));
}

.table .col-actions {
  width: 1%;
  text-align: right;
}

.device-cell {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-width: 0;
}

.device-avatar {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-control);
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.device-name {
  font-weight: 500;
}

.device-id {
  display: block;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  word-break: break-all;
}

.cell-detail {
  display: block;
  margin-top: 2px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 11px;
}

/* ------------------------------------------------------------ row menus */

.menu {
  position: relative;
  display: inline-block;
}

.menu > summary {
  list-style: none;
}

.menu > summary::-webkit-details-marker {
  display: none;
}

.menu-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 25;
  width: 300px;
  padding: var(--space-2);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-lg);
  text-align: left;
}

.menu-section {
  padding: var(--space-3);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.menu-section + .menu-section {
  border-top: 1px solid var(--border);
}

.menu-heading {
  color: var(--text-muted);
  font-size: var(--text-xs);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.inline-form {
  display: flex;
  gap: var(--space-2);
}

.inline-form select {
  flex: 1;
  min-width: 0;
}

/* -------------------------------------------------------------- danger zone */

.danger-zone {
  border: 1px solid color-mix(in srgb, var(--danger) 55%, transparent);
  border-radius: var(--radius-card);
  background: color-mix(in srgb, var(--danger-soft) 45%, var(--surface));
}

.danger-zone .menu-heading,
.danger-zone .card-title {
  color: var(--danger-text);
}

.danger-zone .card-header {
  border-bottom-color: color-mix(in srgb, var(--danger) 30%, transparent);
}

.menu-section.danger-zone {
  margin-top: var(--space-2);
}

.menu-section.danger-zone + .menu-section,
.menu-section + .menu-section.danger-zone {
  border-top: 1px solid color-mix(in srgb, var(--danger) 55%, transparent);
}

.danger-note {
  color: var(--text-muted);
  font-size: var(--text-xs);
}

/* -------------------------------------------------------------------- forms */

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-label {
  font-weight: 500;
  color: var(--text);
}

.fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.fieldset > legend {
  margin-bottom: 6px;
  padding: 0;
}

.field-hint {
  color: var(--text-muted);
  font-size: var(--text-xs);
}

.field-error {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  color: var(--danger-text);
  font-size: var(--text-xs);
  font-weight: 500;
}

.field-error .icon {
  width: 14px;
  height: 14px;
  margin-top: 1px;
}

.input,
.select,
.textarea {
  width: 100%;
  min-height: 36px;
  padding: 7px var(--space-3);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-control);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  box-shadow: var(--shadow-sm);
}

.textarea {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  line-height: 1.6;
  resize: vertical;
}

.input:focus,
.select:focus,
.textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: var(--focus-ring);
}

.input[aria-invalid="true"] {
  border-color: var(--danger);
}

.input-mono {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
}

.input-row {
  display: flex;
  gap: var(--space-2);
}

.input-row .input {
  flex: 1;
  min-width: 0;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-4);
}

/* Toggle switch: a real checkbox with role="switch". */
.setting-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-6);
  padding: var(--space-4) var(--space-6);
}

.setting-row + .setting-row,
.setting-row + .setting-sub,
.setting-sub + .setting-row {
  border-top: 1px solid var(--border);
}

.setting-sub {
  padding: 0 var(--space-6) var(--space-4) var(--space-6);
}

.setting-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.setting-title {
  font-weight: 500;
}

.setting-desc {
  color: var(--text-muted);
}

.setting-key {
  margin-top: 2px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 11px;
}

.switch {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  flex: none;
  width: 36px;
  height: 20px;
  margin: 2px 0 0;
  border-radius: var(--radius-pill);
  background: var(--border-strong);
  cursor: pointer;
  transition: background-color 150ms ease;
}

.switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.3);
  transition: transform 150ms ease;
}

.switch:checked {
  background: var(--primary-solid);
}

.switch:checked::after {
  transform: translateX(16px);
}

.switch:focus-visible {
  box-shadow: var(--focus-ring);
  border-radius: var(--radius-pill);
}

/* Option cards (radio) for the enroll mode. */
.option-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3);
}

.option-card {
  position: relative;
  display: flex;
  gap: var(--space-3);
  padding: var(--space-4);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-card);
  background: var(--surface);
  cursor: pointer;
}

.option-card:hover {
  border-color: var(--primary);
}

.option-card input {
  position: absolute;
  top: var(--space-4);
  left: var(--space-4);
  width: 1px;
  height: 1px;
  margin: 0;
  opacity: 0;
}

.option-card:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary-soft);
  box-shadow: 0 0 0 1px var(--primary);
}

.option-card:has(input:focus-visible) {
  box-shadow: var(--focus-ring);
}

.option-icon {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-control);
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  color: var(--primary);
}

.option-title {
  display: block;
  font-weight: 600;
}

.option-desc {
  display: block;
  margin-top: 2px;
  color: var(--text-muted);
  font-size: var(--text-xs);
}

/* ---------------------------------------------------------------- save bar */

.save-bar {
  position: sticky;
  bottom: var(--space-4);
  z-index: 15;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-card);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}

.save-bar-text {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-right: auto;
  font-weight: 500;
}

.save-bar-text .icon {
  color: var(--warning);
}

/* ----------------------------------------------------------- policies page */

.policies-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: var(--space-6);
  align-items: start;
}

.subnav {
  position: sticky;
  top: calc(var(--topbar-height) + var(--space-6));
  padding: var(--space-2);
}

.subnav-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.subnav-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-control);
  color: var(--text);
  font-weight: 500;
  text-decoration: none;
}

.subnav-link:hover {
  background: var(--surface-subtle);
  text-decoration: none;
}

.subnav-link.active {
  background: var(--primary-soft);
  color: var(--primary);
}

.subnav-meta {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 400;
}

.summary-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.code-block {
  margin: 0;
  max-height: 420px;
  overflow: auto;
  padding: var(--space-4) var(--space-6);
  background: var(--surface-subtle);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  line-height: 1.6;
  white-space: pre;
  border-radius: 0 0 var(--radius-card) var(--radius-card);
}

.disclosure > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-6);
  cursor: pointer;
  list-style: none;
  font-weight: 600;
}

.disclosure > summary::-webkit-details-marker {
  display: none;
}

.disclosure > summary .icon-chevron {
  color: var(--text-muted);
  transition: transform 150ms ease;
}

.disclosure[open] > summary {
  border-bottom: 1px solid var(--border);
}

.disclosure[open] > summary .icon-chevron {
  transform: rotate(180deg);
}

/* ------------------------------------------------------------- enroll page */

.stepper {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0;
  padding: 0;
  list-style: none;
}

.step {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  color: var(--text-muted);
  font-weight: 500;
}

.step + .step {
  border-left: 1px solid var(--border);
}

.step-index {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 26px;
  height: 26px;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  font-size: var(--text-xs);
  font-variant-numeric: tabular-nums;
}

.step-index .icon {
  width: 14px;
  height: 14px;
}

.step.is-current {
  color: var(--text);
}

.step.is-current .step-index {
  border-color: var(--primary-solid);
  background: var(--primary-solid);
  color: var(--on-primary);
}

.step.is-done .step-index {
  border-color: var(--success);
  background: var(--success-soft);
  color: var(--success-text);
}

.step-sub {
  display: block;
  color: var(--text-muted);
  font-size: var(--text-xs);
  font-weight: 400;
}

.enroll-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: var(--space-6);
  align-items: start;
}

.qr-frame {
  display: grid;
  place-items: center;
  padding: var(--space-6);
  border-bottom: 1px solid var(--border);
}

.qr-image {
  display: block;
  width: 220px;
  max-width: 100%;
  height: auto;
  padding: var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: #ffffff;
}

.meta-list {
  margin: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: var(--space-2) var(--space-4);
}

.meta-list dt {
  color: var(--text-muted);
}

.meta-list dd {
  margin: 0;
  font-variant-numeric: tabular-nums;
  word-break: break-word;
}

.steps-list {
  margin: 0;
  padding-left: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  color: var(--text-muted);
}

.steps-list strong {
  color: var(--text);
  font-weight: 500;
}

/* ------------------------------------------------------------ settings page */

.checklist {
  margin: 0;
  padding: 0;
  list-style: none;
}

.checklist-item {
  display: flex;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-6);
}

.checklist-item + .checklist-item {
  border-top: 1px solid var(--border);
}

.check-icon {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
}

.check-icon .icon {
  width: 14px;
  height: 14px;
}

.check-ok {
  background: var(--success-soft);
  color: var(--success-text);
}

.check-fail {
  background: var(--danger-soft);
  color: var(--danger-text);
}

.check-optional {
  background: var(--neutral-soft);
  color: var(--neutral-text);
}

.check-title {
  font-weight: 500;
}

.check-fix {
  margin-top: 2px;
  color: var(--text-muted);
}

.source-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

/* -------------------------------------------------------------- empty state */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-12) var(--space-6);
  text-align: center;
}

.empty-icon {
  display: inline-grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.empty-icon .icon {
  width: 22px;
  height: 22px;
}

.empty-title {
  font-size: var(--text-md);
  font-weight: 600;
}

.empty-text {
  max-width: 46ch;
  color: var(--text-muted);
}

/* ------------------------------------------------------------------- toasts */

.toast-region {
  position: fixed;
  right: var(--space-6);
  bottom: var(--space-6);
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  width: min(400px, calc(100vw - 32px));
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-3) var(--space-3) var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  animation: toast-in 180ms ease-out;
}

.toast-icon {
  margin-top: 2px;
}

.toast-success .toast-icon {
  color: var(--success);
}

.toast-error {
  border-color: color-mix(in srgb, var(--danger) 45%, transparent);
}

.toast-error .toast-icon {
  color: var(--danger);
}

.toast-message {
  flex: 1;
  padding-top: 1px;
  word-break: break-word;
}

.toast.is-leaving {
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 180ms ease, transform 180ms ease;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* ------------------------------------------------------------------- modals */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  padding: var(--space-4);
  background: rgba(2, 6, 23, 0.6);
}

.modal {
  width: min(520px, 100%);
  max-height: calc(100vh - 32px);
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
}

.modal-header {
  display: flex;
  gap: var(--space-4);
  padding: var(--space-6) var(--space-6) 0;
}

.modal-icon {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--danger-soft);
  color: var(--danger);
}

.modal-title {
  font-size: var(--text-lg);
}

.modal-body {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-6) var(--space-6);
  color: var(--text-muted);
}

.modal-body strong {
  color: var(--text);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--border);
  background: var(--surface-subtle);
  border-radius: 0 0 10px 10px;
}

/* --------------------------------------------------------- dashboard: small */

@media (max-width: 1100px) {
  .stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .enroll-layout,
  .grid-2 {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Below 960 px the table becomes a list of cards, so it never scrolls sideways. */
@media (max-width: 960px) {
  .table thead {
    display: none;
  }

  .table,
  .table tbody,
  .table tr,
  .table td {
    display: block;
    width: 100%;
  }

  .table tr {
    position: relative;
    padding: var(--space-4);
    border-bottom: 1px solid var(--border);
  }

  .table tbody tr:last-child {
    border-bottom: none;
  }

  .table td {
    display: flex;
    justify-content: space-between;
    gap: var(--space-4);
    padding: var(--space-1) 0;
    border: none;
    text-align: right;
  }

  .table td::before {
    content: attr(data-label);
    color: var(--text-muted);
    font-size: var(--text-xs);
    text-align: left;
  }

  .table td.cell-primary {
    padding-bottom: var(--space-3);
    padding-right: 44px;
    text-align: left;
  }

  .table td.cell-primary::before,
  .table td.col-actions::before {
    display: none;
  }

  .table td.col-actions {
    position: absolute;
    top: var(--space-4);
    right: var(--space-4);
    width: auto;
    padding: 0;
  }

  .table tbody tr:hover td {
    background: none;
  }

  .policies-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .subnav {
    position: static;
  }

  .subnav-list {
    flex-direction: row;
    flex-wrap: wrap;
  }
}

/* Below 768 px the sidebar turns into a top bar with a menu button. */
@media (max-width: 768px) {
  .app {
    display: block;
  }

  .sidebar {
    position: fixed;
    inset: var(--topbar-height) 0 auto 0;
    z-index: 40;
    height: auto;
    max-height: calc(100vh - var(--topbar-height));
    overflow-y: auto;
    padding: var(--space-4);
    border-right: none;
    border-bottom: 1px solid var(--sidebar-border);
    box-shadow: var(--shadow-lg);
    transform: translateY(-8px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 150ms ease, transform 150ms ease, visibility 150ms;
  }

  .sidebar.is-open {
    transform: none;
    opacity: 1;
    visibility: visible;
  }

  .sidebar > .brand {
    display: none;
  }

  .topbar {
    padding: 0 var(--space-4);
    background: var(--sidebar-bg);
    border-bottom-color: var(--sidebar-border);
    backdrop-filter: none;
  }

  .topbar .brand {
    display: flex;
    color: #ffffff;
  }

  .topbar .topbar-title,
  .topbar .badge-local-text {
    display: none;
  }

  .topbar .badge-local {
    border-color: var(--sidebar-border);
    color: var(--sidebar-text);
  }

  .topbar .btn-ghost {
    color: var(--sidebar-text);
  }

  .topbar .btn-ghost:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
  }

  .topbar .nav-toggle {
    display: inline-flex;
  }

  .setup-banner {
    padding: var(--space-3) var(--space-4);
  }

  .content {
    padding: var(--space-5) var(--space-4) var(--space-10);
    gap: var(--space-5);
  }

  .page-title {
    font-size: var(--text-lg);
  }

  .stat-grid {
    gap: var(--space-3);
  }

  .stat-card {
    padding: var(--space-4);
  }

  .stat-value {
    font-size: var(--text-xl);
  }

  .card-header,
  .card-body,
  .card-footer,
  .setting-row,
  .checklist-item,
  .disclosure > summary,
  .code-block {
    padding-left: var(--space-4);
    padding-right: var(--space-4);
  }

  .setting-sub {
    padding-left: var(--space-4);
    padding-right: var(--space-4);
  }

  .form-grid,
  .option-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .stepper {
    grid-template-columns: minmax(0, 1fr);
  }

  .step + .step {
    border-left: none;
    border-top: 1px solid var(--border);
  }

  .input-row {
    flex-wrap: wrap;
  }

  .input-row .btn {
    flex: 1;
  }

  .menu-panel {
    width: min(300px, calc(100vw - 48px));
  }

  .toast-region {
    right: var(--space-4);
    bottom: var(--space-4);
  }
}

/* ============================================================== marketing */
/* Landing page only. Uses the same tokens as the app. */

.mkt {
  background: var(--bg);
}

.mkt-container {
  width: 100%;
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 var(--space-6);
}

.mkt-notice {
  padding: var(--space-2) 0;
  background: var(--sidebar-bg);
  border-bottom: 1px solid #1e293b;
  color: var(--sidebar-text);
  font-size: var(--text-xs);
  text-align: center;
}

.mkt-notice .mkt-container {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: var(--space-2) var(--space-3);
}

.mkt-notice strong {
  color: #ffffff;
  font-weight: 500;
}

.mkt-notice a {
  color: #93c5fd;
}

.mkt-nav {
  position: sticky;
  top: 0;
  z-index: 30;
  background: color-mix(in srgb, var(--sidebar-bg) 94%, transparent);
  backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid #1e293b;
}

.mkt-nav .mkt-container {
  display: flex;
  align-items: center;
  gap: var(--space-6);
  height: 64px;
}

.mkt-nav .brand {
  padding: 0;
}

.mkt-links {
  display: flex;
  align-items: center;
  gap: var(--space-6);
  margin-left: auto;
}

.mkt-links a {
  color: var(--sidebar-text);
  font-weight: 500;
}

.mkt-links a:hover {
  color: #ffffff;
  text-decoration: none;
}

.mkt-nav-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.mkt-nav .btn-ghost {
  color: var(--sidebar-text);
}

.mkt-nav .btn-ghost:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.mkt-hero {
  position: relative;
  overflow: hidden;
  padding: var(--space-16) 0 0;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
}

.mkt-hero .mkt-container {
  position: relative;
}

.hero-copy {
  max-width: 760px;
  margin: 0 auto;
  text-align: center;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-5);
  padding: 4px 12px;
  border: 1px solid #1e293b;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.03);
  color: var(--sidebar-text);
  font-size: var(--text-xs);
  font-weight: 500;
}

.eyebrow .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--brand-sand);
}

.hero-title {
  color: #ffffff;
  font-size: clamp(32px, 5.2vw, 52px);
  font-weight: 650;
  letter-spacing: -0.035em;
  line-height: 1.08;
}

.hero-title .accent {
  color: #93c5fd;
}

.hero-sub {
  max-width: 620px;
  margin: var(--space-5) auto 0;
  color: #94a3b8;
  font-size: 18px;
  line-height: 1.6;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-3);
  margin-top: var(--space-8);
}

.mkt-hero .btn-secondary {
  background: transparent;
  border-color: #334155;
  color: #e2e8f0;
  box-shadow: none;
}

.mkt-hero .btn-secondary:hover {
  background: rgba(255, 255, 255, 0.06);
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-2) var(--space-6);
  margin-top: var(--space-6);
  color: #94a3b8;
  font-size: var(--text-xs);
}

.hero-meta span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.hero-meta .icon {
  width: 14px;
  height: 14px;
  color: #60a5fa;
}

.browser-frame {
  position: relative;
  max-width: 1040px;
  margin: var(--space-12) auto 0;
  border: 1px solid #1e293b;
  border-bottom: none;
  border-radius: 12px 12px 0 0;
  background: #0f172a;
  box-shadow: 0 -8px 60px rgba(37, 99, 235, 0.18);
  overflow: hidden;
}

.browser-bar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  height: 36px;
  padding: 0 var(--space-4);
  border-bottom: 1px solid #1e293b;
}

.browser-dots {
  display: flex;
  gap: 6px;
}

.browser-dots span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #334155;
}

.browser-url {
  flex: 1;
  max-width: 320px;
  margin: 0 auto;
  padding: 2px var(--space-3);
  border-radius: var(--radius-control);
  background: #1e293b;
  color: #94a3b8;
  font-size: 11px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.browser-frame img {
  display: block;
  width: 100%;
  height: auto;
}

.browser-caption {
  padding: var(--space-3) 0 var(--space-6);
  color: #64748b;
  font-size: var(--text-xs);
  text-align: center;
}

.mkt-section {
  padding: var(--space-16) 0;
}

.mkt-section + .mkt-section {
  border-top: 1px solid var(--border);
}

.mkt-section-alt {
  background: var(--surface);
}

.section-head {
  max-width: 640px;
  margin-bottom: var(--space-10);
}

.section-head-center {
  margin-left: auto;
  margin-right: auto;
  text-align: center;
}

.section-kicker {
  margin-bottom: var(--space-2);
  color: var(--primary);
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.section-title {
  font-size: clamp(24px, 3.2vw, 32px);
  letter-spacing: -0.025em;
}

.section-sub {
  margin-top: var(--space-3);
  color: var(--text-muted);
  font-size: var(--text-md);
}

/* Six columns: the first three cards span two, the last two span three. */
.feature-grid {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: var(--space-4);
}

.feature-card {
  grid-column: span 2;
  padding: var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.feature-card:nth-child(n + 4) {
  grid-column: span 3;
}

.feature-icon {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  margin-bottom: var(--space-2);
  border-radius: var(--radius-control);
  background: var(--primary-soft);
  color: var(--primary);
}

.feature-title {
  font-size: var(--text-md);
}

.feature-text {
  color: var(--text-muted);
}

.feature-key {
  margin-top: auto;
  padding-top: var(--space-2);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 11px;
}

.how-steps {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-4);
  counter-reset: how;
}

.how-step {
  padding: var(--space-6);
  counter-increment: how;
}

.how-step::before {
  content: counter(how);
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  margin-bottom: var(--space-4);
  border-radius: 50%;
  background: var(--primary-solid);
  color: var(--on-primary);
  font-size: var(--text-xs);
  font-weight: 600;
}

.how-step h3 {
  font-size: var(--text-md);
  margin-bottom: var(--space-2);
}

.how-step p {
  color: var(--text-muted);
}

.audience {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr);
  gap: var(--space-8);
  align-items: center;
  padding: var(--space-8);
}

.audience h2 {
  font-size: var(--text-xl);
  letter-spacing: -0.02em;
}

.audience p {
  color: var(--text-muted);
}

.audience-text {
  margin-top: var(--space-3);
}

.textarea-prose {
  font-family: inherit;
  font-size: inherit;
}

.audience-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3);
}

.audience-list li {
  display: flex;
  gap: var(--space-2);
}

.audience-list .icon {
  margin-top: 3px;
  color: var(--success);
}

.visibility-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-4);
}

.visibility-card {
  padding: var(--space-6);
}

.visibility-card h3 {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
  font-size: var(--text-md);
}

.visibility-card ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.visibility-card li {
  display: flex;
  gap: var(--space-3);
}

.visibility-card li .icon {
  margin-top: 2px;
}

.visibility-card.can-see h3 .icon,
.visibility-card.can-see li .icon {
  color: var(--warning);
}

.visibility-card.cannot-see h3 .icon,
.visibility-card.cannot-see li .icon {
  color: var(--success);
}

.faq {
  max-width: 760px;
  margin: 0 auto;
}

.faq-item + .faq-item {
  border-top: 1px solid var(--border);
}

.faq-item > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-5) var(--space-6);
  cursor: pointer;
  list-style: none;
  font-size: var(--text-md);
  font-weight: 500;
}

.faq-item > summary::-webkit-details-marker {
  display: none;
}

.faq-item > summary .icon {
  color: var(--text-muted);
  transition: transform 150ms ease;
}

.faq-item[open] > summary .icon {
  transform: rotate(180deg);
}

.faq-answer {
  padding: 0 var(--space-6) var(--space-5);
  color: var(--text-muted);
}

.signup-layout {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: var(--space-10);
  align-items: start;
}

.signup-points {
  margin: var(--space-6) 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.signup-points li {
  display: flex;
  gap: var(--space-2);
  color: var(--text-muted);
}

.signup-points .icon {
  margin-top: 3px;
  color: var(--primary);
}

.signup-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.mkt-footer {
  padding: var(--space-10) 0;
  background: var(--sidebar-bg);
  color: var(--sidebar-muted);
  font-size: var(--text-xs);
}

.mkt-footer .mkt-container {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-6);
}

.mkt-footer .brand {
  padding: 0;
  margin-bottom: var(--space-2);
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3) var(--space-6);
}

.footer-links a {
  color: var(--sidebar-text);
}

@media (max-width: 960px) {
  .feature-grid,
  .how-steps {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .feature-card,
  .feature-card:nth-child(n + 4) {
    grid-column: auto;
  }

  .audience,
  .signup-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .mkt-links {
    display: none;
  }

  .mkt-nav-actions {
    margin-left: auto;
  }
}

@media (max-width: 640px) {
  .mkt-container {
    padding: 0 var(--space-4);
  }

  .mkt-hero {
    padding-top: var(--space-10);
  }

  .hero-sub {
    font-size: var(--text-md);
  }

  .hero-actions .btn {
    width: 100%;
  }

  .mkt-section {
    padding: var(--space-12) 0;
  }

  .feature-grid,
  .how-steps,
  .visibility-grid,
  .audience-list {
    grid-template-columns: minmax(0, 1fr);
  }

  .audience {
    padding: var(--space-5);
  }

  .browser-frame {
    margin-top: var(--space-8);
  }

  .faq-item > summary,
  .faq-answer {
    padding-left: var(--space-4);
    padding-right: var(--space-4);
  }

  .mkt-nav .btn-primary {
    display: none;
  }
}

/* ------------------------------------------------------------ reduced motion */

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