:root {
  color-scheme: light dark;
  --bg: #f6f8f7;
  --surface: #ffffff;
  --surface-2: #edf3f0;
  --surface-3: #dfeae5;
  --text: #12231d;
  --muted: #5b6d66;
  --line: #d6e0dc;
  --accent: #0f6b4f;
  --accent-strong: #084c38;
  --accent-soft: #d9eee6;
  --danger: #b42318;
  --danger-soft: #fee4e2;
  --warning: #8a5d00;
  --warning-soft: #fff2cc;
  --success: #087443;
  --shadow: 0 20px 55px rgba(28, 68, 52, .1);
  --radius: 14px;
  --font: "Avenir Next", Avenir, "Segoe UI", sans-serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

[data-theme="dark"] {
  --bg: #0d1512;
  --surface: #131f1b;
  --surface-2: #192923;
  --surface-3: #243b32;
  --text: #e9f2ee;
  --muted: #a0b4ac;
  --line: #2b4037;
  --accent: #45b88a;
  --accent-strong: #7ed9b5;
  --accent-soft: #173e30;
  --danger: #ff8f86;
  --danger-soft: #47201e;
  --warning: #ffd06a;
  --warning-soft: #493916;
  --success: #69d69f;
  --shadow: 0 24px 70px rgba(0, 0, 0, .3);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 15px; line-height: 1.5; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
button { cursor: pointer; }
button:active, .button:active { transform: translateY(1px); }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 2px; }
.skip-link { position: fixed; top: -60px; left: 16px; z-index: 100; padding: 10px 14px; background: var(--surface); border-radius: 8px; }
.skip-link:focus { top: 16px; }

.button, button.button { display: inline-flex; min-height: 42px; align-items: center; justify-content: center; gap: 8px; border: 1px solid transparent; border-radius: 10px; padding: 9px 16px; background: var(--accent); color: #f8fffc; font-weight: 700; text-decoration: none; white-space: nowrap; transition: transform .18s ease, background .18s ease, border-color .18s ease; }
.button:hover { background: var(--accent-strong); }
.button.secondary { background: var(--surface); border-color: var(--line); color: var(--text); }
.button.secondary:hover { background: var(--surface-2); }
.button.ghost { background: transparent; color: var(--muted); }
.button.danger { background: transparent; border-color: color-mix(in srgb, var(--danger) 35%, var(--line)); color: var(--danger); }
.button.small { min-height: 34px; padding: 6px 11px; font-size: 13px; border-radius: 8px; }
.button:disabled { cursor: not-allowed; opacity: .55; transform: none; }

.public-nav { position: sticky; top: 0; z-index: 20; height: 72px; display: flex; align-items: center; background: color-mix(in srgb, var(--bg) 88%, transparent); border-bottom: 1px solid color-mix(in srgb, var(--line) 75%, transparent); backdrop-filter: blur(16px); }
.nav-inner, .marketing-section, .footer-inner { width: min(1180px, calc(100% - 40px)); margin: auto; }
.nav-inner { display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); font-weight: 800; letter-spacing: -.03em; text-decoration: none; font-size: 20px; }
.brand-mark { display: grid; width: 34px; height: 34px; place-items: center; border-radius: 10px; background: var(--accent); color: #f8fffc; font-size: 16px; }
.nav-links { display: flex; align-items: center; gap: 28px; }
.nav-links a { color: var(--muted); text-decoration: none; font-weight: 650; }
.nav-links a:hover { color: var(--text); }
.nav-actions { display: flex; align-items: center; gap: 8px; }
.theme-toggle { display: grid; width: 40px; height: 40px; place-items: center; border: 1px solid var(--line); border-radius: 10px; background: transparent; color: var(--text); }

.hero { min-height: calc(100dvh - 72px); display: grid; grid-template-columns: .95fr 1.05fr; align-items: center; gap: clamp(40px, 7vw, 94px); padding-block: 64px; }
.eyebrow { margin: 0 0 18px; color: var(--accent); font: 700 12px/1 var(--mono); letter-spacing: .13em; text-transform: uppercase; }
.hero h1 { max-width: 720px; margin: 0; font-size: clamp(46px, 6vw, 76px); line-height: .98; letter-spacing: -.065em; }
.hero-copy > p:not(.eyebrow) { max-width: 560px; margin: 24px 0 28px; color: var(--muted); font-size: clamp(17px, 2vw, 20px); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.flow-visual { position: relative; min-height: 520px; overflow: hidden; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); }
.flow-top { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.flow-title { font-weight: 800; letter-spacing: -.02em; }
.status { display: inline-flex; align-items: center; width: fit-content; border-radius: 999px; padding: 5px 9px; background: var(--accent-soft); color: var(--accent-strong); font-size: 12px; font-weight: 750; text-transform: capitalize; }
.status::before { content: ""; width: 6px; height: 6px; margin-right: 6px; border-radius: 50%; background: currentColor; }
.status.pending, .status.setup_required, .status.draft { background: var(--warning-soft); color: var(--warning); }
.status.failed, .status.rejected, .status.revoked, .status.suspended { background: var(--danger-soft); color: var(--danger); }
.flow-body { padding: 28px; }
.flow-route { display: grid; grid-template-columns: 1fr 34px 1fr; align-items: center; gap: 8px; }
.flow-node { min-height: 116px; padding: 18px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); }
.flow-node strong, .flow-message strong { display: block; margin-bottom: 7px; }
.flow-node p, .flow-message p { margin: 0; color: var(--muted); }
.flow-arrow { text-align: center; color: var(--accent); font-size: 24px; }
.flow-message { margin-top: 16px; padding: 20px; border-radius: 12px; background: var(--accent); color: #f8fffc; }
.flow-message p { color: #dff7ed; }
.delivery-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 18px; }
.delivery-row div { padding: 14px; border-radius: 10px; background: var(--surface-2); }
.delivery-row span { display: block; color: var(--muted); font-size: 12px; }
.delivery-row strong { display: block; margin-top: 4px; font-size: 18px; }

.marketing-section { padding-block: 110px; }
.section-copy { max-width: 680px; }
.section-copy h2 { margin: 0; font-size: clamp(34px, 5vw, 56px); line-height: 1.02; letter-spacing: -.05em; }
.section-copy p { margin: 20px 0 0; color: var(--muted); font-size: 18px; }
.steps { display: grid; grid-template-columns: repeat(6, minmax(160px, 1fr)); gap: 10px; margin-top: 48px; overflow-x: auto; scrollbar-width: thin; }
.step { min-height: 190px; padding: 20px; border-left: 1px solid var(--line); }
.step:first-child { border-left: 3px solid var(--accent); }
.step b { display: block; margin-bottom: 36px; color: var(--accent); font: 700 13px/1 var(--mono); }
.step strong { display: block; font-size: 18px; }
.step p { color: var(--muted); }
.capability-grid { display: grid; grid-template-columns: 1.15fr .85fr; grid-template-rows: auto auto; gap: 14px; margin-top: 48px; }
.capability { min-height: 250px; padding: 30px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); }
.capability:first-child { grid-row: span 2; min-height: 514px; background: var(--accent); color: #f8fffc; }
.capability:nth-child(2) { background: var(--surface-3); }
.capability h3 { margin: 0 0 12px; font-size: 28px; letter-spacing: -.035em; }
.capability p { max-width: 50ch; margin: 0; color: var(--muted); }
.capability:first-child p { color: #dff7ed; }
.capability-list { display: grid; gap: 0; margin-top: 50px; }
.capability-list div { display: grid; grid-template-columns: 26px 1fr; gap: 10px; padding: 18px 0; border-bottom: 1px solid rgba(255, 255, 255, .2); }
.code-section { display: grid; grid-template-columns: .8fr 1.2fr; align-items: center; gap: 64px; }
.code-window { overflow: hidden; border-radius: var(--radius); background: #101915; border: 1px solid #2b4037; box-shadow: var(--shadow); }
.code-bar { padding: 14px 18px; border-bottom: 1px solid #2b4037; color: #a0b4ac; font: 13px var(--mono); }
pre { margin: 0; padding: 24px; overflow: auto; color: #dff7ed; font: 13px/1.75 var(--mono); }
.pricing-grid { display: grid; grid-template-columns: .8fr 1.2fr; gap: 32px; margin-top: 48px; }
.pricing-note { padding: 30px 0; color: var(--muted); }
.plan-list { border-top: 1px solid var(--line); }
.plan-row { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 24px; padding: 24px 0; border-bottom: 1px solid var(--line); }
.plan-row strong { display: block; font-size: 20px; }
.plan-row span { color: var(--muted); }
.plan-price { min-width: 112px; text-align: right; font: 700 20px var(--mono); }
.public-footer { padding: 54px 0; background: var(--surface); border-top: 1px solid var(--line); }
.footer-inner { display: flex; justify-content: space-between; gap: 30px; color: var(--muted); }
.footer-inner a { color: var(--text); }

.auth-page { min-height: 100dvh; display: grid; grid-template-columns: .9fr 1.1fr; }
.auth-brand { display: flex; flex-direction: column; justify-content: space-between; padding: clamp(28px, 5vw, 70px); background: var(--accent); color: #f8fffc; }
.auth-brand .brand { color: #f8fffc; }
.auth-brand .brand-mark { background: #f8fffc; color: var(--accent-strong); }
.auth-message h1 { max-width: 600px; margin: 0; font-size: clamp(42px, 5vw, 72px); line-height: 1; letter-spacing: -.06em; }
.auth-message p { max-width: 500px; color: #dff7ed; font-size: 18px; }
.auth-main { display: grid; place-items: center; padding: 28px; }
.auth-panel { width: min(480px, 100%); }
.auth-panel h2 { margin: 0 0 8px; font-size: 34px; letter-spacing: -.04em; }
.auth-panel > p { margin: 0 0 28px; color: var(--muted); }
.form-grid { display: grid; gap: 16px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field { display: grid; gap: 7px; }
.field label { color: var(--text); font-weight: 700; font-size: 13px; }
.field input, .field select, .field textarea { width: 100%; min-height: 44px; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: var(--surface); color: var(--text); }
.field textarea { min-height: 105px; resize: vertical; }
.field small { color: var(--muted); }
.form-error { padding: 11px 13px; border-radius: 10px; background: var(--danger-soft); color: var(--danger); }
.auth-switch { margin-top: 20px; color: var(--muted); }
.auth-switch button { border: 0; padding: 0; background: transparent; color: var(--accent); font-weight: 750; }

.app-shell { min-height: 100dvh; display: grid; grid-template-columns: 250px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100dvh; display: flex; flex-direction: column; padding: 20px 14px; background: var(--surface); border-right: 1px solid var(--line); }
.sidebar .brand { padding: 0 10px 22px; }
.workspace-chip { margin: 0 6px 18px; padding: 11px 12px; border-radius: 10px; background: var(--surface-2); }
.workspace-chip strong, .workspace-chip span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.workspace-chip span { color: var(--muted); font-size: 12px; text-transform: capitalize; }
.sidebar nav { display: grid; gap: 2px; overflow-y: auto; }
.nav-group { margin: 18px 10px 6px; color: var(--muted); font: 700 10px/1 var(--mono); letter-spacing: .11em; text-transform: uppercase; }
.side-link { display: flex; align-items: center; width: 100%; min-height: 40px; border: 0; border-radius: 9px; padding: 8px 11px; background: transparent; color: var(--muted); font-weight: 650; text-align: left; }
.side-link:hover, .side-link.active { background: var(--accent-soft); color: var(--accent-strong); }
.sidebar-bottom { display: grid; gap: 7px; margin-top: auto; padding: 14px 6px 0; border-top: 1px solid var(--line); }
.user-block { overflow: hidden; }
.user-block strong, .user-block span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-block span { color: var(--muted); font-size: 12px; }
.app-main { min-width: 0; }
.app-topbar { position: sticky; top: 0; z-index: 15; min-height: 68px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px clamp(18px, 4vw, 46px); background: color-mix(in srgb, var(--bg) 90%, transparent); border-bottom: 1px solid var(--line); backdrop-filter: blur(14px); }
.app-topbar h1 { margin: 0; font-size: 20px; letter-spacing: -.025em; }
.top-actions { display: flex; gap: 8px; }
.menu-toggle { display: none; }
.page { width: min(1220px, calc(100% - 44px)); margin: auto; padding: 40px 0 70px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 30px; }
.page-head h2 { margin: 0 0 7px; font-size: 34px; letter-spacing: -.045em; }
.page-head p { max-width: 650px; margin: 0; color: var(--muted); }
.metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.metric { min-height: 132px; padding: 20px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); }
.metric span { color: var(--muted); font-size: 13px; }
.metric strong { display: block; margin-top: 22px; font: 750 clamp(26px, 3vw, 36px)/1 var(--mono); letter-spacing: -.05em; }
.dashboard-grid { display: grid; grid-template-columns: 1.1fr .9fr; gap: 14px; margin-top: 14px; }
.panel { border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 20px 22px; border-bottom: 1px solid var(--line); }
.panel-head h3 { margin: 0; font-size: 18px; letter-spacing: -.025em; }
.panel-body { padding: 22px; }
.checklist { display: grid; gap: 0; }
.check-item { display: grid; grid-template-columns: 28px 1fr auto; align-items: center; gap: 10px; min-height: 58px; border-bottom: 1px solid var(--line); }
.check-item:last-child { border-bottom: 0; }
.check-mark { display: grid; width: 24px; height: 24px; place-items: center; border-radius: 50%; background: var(--surface-2); color: var(--muted); font-weight: 800; }
.check-item.done .check-mark { background: var(--accent); color: #f8fffc; }
.health-list { display: grid; gap: 16px; }
.health-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.health-row span { color: var(--muted); }
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 14px 16px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; white-space: nowrap; }
th { color: var(--muted); font-size: 12px; font-weight: 750; }
tr:last-child td { border-bottom: 0; }
td.wrap { min-width: 250px; white-space: normal; }
.mono { font-family: var(--mono); font-size: 13px; }
.muted { color: var(--muted); }
.empty { padding: 64px 24px; text-align: center; }
.empty h3 { margin: 0 0 8px; font-size: 22px; }
.empty p { max-width: 470px; margin: 0 auto 20px; color: var(--muted); }
.modal-backdrop { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 20px; background: rgba(5, 17, 12, .6); backdrop-filter: blur(8px); }
.modal { width: min(620px, 100%); max-height: calc(100dvh - 40px); overflow: auto; border-radius: var(--radius); background: var(--surface); box-shadow: 0 25px 90px rgba(0, 0, 0, .28); }
.modal-head { display: flex; justify-content: space-between; gap: 16px; padding: 22px 24px; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; font-size: 24px; letter-spacing: -.035em; }
.modal-close { width: 34px; height: 34px; border: 0; border-radius: 8px; background: var(--surface-2); color: var(--text); font-size: 20px; }
.modal-body { padding: 24px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 24px; }
.secret-box { margin: 18px 0; padding: 18px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); word-break: break-all; font-family: var(--mono); }
.template-layout { display: grid; grid-template-columns: 1fr 340px; gap: 24px; }
.phone-preview { position: sticky; top: 90px; align-self: start; padding: 18px; border-radius: 30px; background: #dfe8e2; border: 10px solid #1c2723; color: #12231d; }
.phone-screen { min-height: 430px; padding: 54px 12px 14px; border-radius: 17px; background: #e9e2d8; }
.message-bubble { padding: 12px; border-radius: 9px 9px 0 9px; background: #d9fdd3; box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.message-bubble strong, .message-bubble p, .message-bubble small { display: block; margin: 0 0 8px; white-space: pre-wrap; }
.message-bubble small { margin-bottom: 0; color: #5b6d66; }
.docs-layout { display: grid; grid-template-columns: 260px 1fr; gap: 38px; }
.docs-nav { position: sticky; top: 96px; align-self: start; display: grid; gap: 8px; }
.docs-nav a { padding: 6px 0; color: var(--muted); text-decoration: none; }
.docs-content section { margin-bottom: 46px; scroll-margin-top: 90px; }
.docs-content h3 { font-size: 26px; letter-spacing: -.035em; }
.docs-content code { padding: 2px 6px; border-radius: 5px; background: var(--surface-2); font-family: var(--mono); }
.toast { position: fixed; right: 22px; bottom: 22px; z-index: 80; max-width: 420px; padding: 14px 17px; border-radius: 10px; background: var(--text); color: var(--bg); box-shadow: var(--shadow); }
.toast.error { background: var(--danger); color: #fff; }
.boot-shell { width: min(1100px, calc(100% - 40px)); margin: 40px auto; }
.skeleton { border-radius: 10px; background: linear-gradient(100deg, var(--surface-2) 20%, var(--surface-3) 45%, var(--surface-2) 70%); background-size: 200% 100%; animation: shimmer 1.3s infinite; }
.boot-logo { width: 160px; height: 40px; }
.boot-line { width: 60%; height: 54px; margin-top: 80px; }
.boot-panel { width: 100%; height: 440px; margin-top: 30px; }
@keyframes shimmer { to { background-position-x: -200%; } }

@media (max-width: 1024px) {
  .nav-links { display: none; }
  .hero { grid-template-columns: 1fr; min-height: auto; }
  .flow-visual { min-height: 460px; }
  .steps { grid-template-columns: repeat(6, 220px); }
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .template-layout { grid-template-columns: 1fr 300px; }
}

@media (max-width: 767px) {
  .nav-inner, .marketing-section, .footer-inner { width: min(100% - 28px, 1180px); }
  .public-nav { height: 64px; }
  .nav-actions .button.ghost { display: none; }
  .hero { padding-block: 44px 64px; gap: 36px; }
  .hero h1 { font-size: clamp(42px, 13vw, 60px); }
  .flow-visual { min-height: auto; }
  .flow-route { grid-template-columns: 1fr; }
  .flow-arrow { transform: rotate(90deg); }
  .delivery-row { grid-template-columns: 1fr; }
  .marketing-section { padding-block: 74px; }
  .capability-grid, .code-section, .pricing-grid { grid-template-columns: 1fr; }
  .capability:first-child { grid-row: auto; min-height: 420px; }
  .footer-inner { flex-direction: column; }
  .auth-page { grid-template-columns: 1fr; }
  .auth-brand { min-height: 250px; gap: 40px; }
  .auth-message h1 { font-size: 40px; }
  .form-row { grid-template-columns: 1fr; }
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; z-index: 40; width: min(290px, 86vw); transform: translateX(-105%); transition: transform .22s ease; box-shadow: var(--shadow); }
  .sidebar.open { transform: translateX(0); }
  .menu-toggle { display: inline-flex; }
  .page { width: min(100% - 28px, 1220px); padding-top: 28px; }
  .page-head { flex-direction: column; }
  .metric-grid, .dashboard-grid { grid-template-columns: 1fr; }
  .template-layout, .docs-layout { grid-template-columns: 1fr; }
  .phone-preview, .docs-nav { position: static; }
  .phone-preview { max-width: 340px; }
  .top-actions .button.secondary { display: none; }
}

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