:root {
  --bg: #f6f4ef;
  --surface: #ffffff;
  --surface-2: #efece5;
  --ink: #16181a;
  --muted: #5b6066;
  --line: #e2ded5;
  --accent: #0a7a4a;
  --accent-ink: #ffffff;
  --accent-soft: #e2f1e9;
  --warn: #9a4b0f;
  --warn-soft: #fbeedd;
  --bad: #b42318;
  --bad-soft: #fbe9e7;
  --bubble-in: #ebe8e1;
  --bubble-out: #0a7a4a;
  --focus: 0 0 0 3px rgba(10, 122, 74, 0.35);
  --radius: 14px;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, "Liberation Mono", monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e100f;
    --surface: #161a18;
    --surface-2: #1d2220;
    --ink: #eceeed;
    --muted: #9ba39f;
    --line: #29302d;
    --accent: #34c285;
    --accent-ink: #062014;
    --accent-soft: #13301f;
    --warn: #f0a765;
    --warn-soft: #33230f;
    --bad: #f28b82;
    --bad-soft: #3a1714;
    --bubble-in: #232926;
    --bubble-out: #1f7a52;
    --focus: 0 0 0 3px rgba(52, 194, 133, 0.4);
    color-scheme: dark;
  }
}

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

html {
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 16px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: var(--accent); color: var(--accent-ink); }

a { color: var(--accent); text-underline-offset: 3px; }
a:focus-visible, button:focus-visible, input:focus-visible, summary:focus-visible {
  outline: none;
  box-shadow: var(--focus);
  border-radius: 8px;
}

h1, h2, h3 { line-height: 1.15; margin: 0 0 0.5em; }
h1 { font-size: clamp(2rem, 1.2rem + 3.4vw, 3.4rem); font-weight: 650; letter-spacing: -0.02em; }
h2 { font-size: clamp(1.35rem, 1.1rem + 1vw, 1.8rem); font-weight: 600; letter-spacing: -0.01em; }
h3 { font-size: 1.05rem; font-weight: 600; }
p { margin: 0 0 1em; }

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

.wrap { width: min(1080px, 100% - 32px); margin-inline: auto; }

/* Header */
.top {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 18px 0;
}
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 650; color: var(--ink); text-decoration: none; letter-spacing: -0.01em; }
.brand svg { flex: none; }
.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav a {
  color: var(--muted); text-decoration: none; padding: 8px 12px; border-radius: 10px;
  user-select: none;
}
.nav a[aria-current="page"] { color: var(--ink); background: var(--surface-2); }
@media (hover: hover) { .nav a:hover { color: var(--ink); } }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border-radius: 12px; border: 1px solid transparent;
  background: var(--accent); color: var(--accent-ink); font: 600 15px/1 var(--sans);
  text-decoration: none; cursor: pointer; user-select: none;
  transition: transform 120ms ease, background-color 120ms ease;
}
.btn:active { transform: scale(0.97); }
.btn[disabled] { opacity: 0.55; cursor: default; transform: none; }
.btn.secondary { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn.danger { background: var(--bad-soft); color: var(--bad); }
@media (hover: hover) {
  .btn:not([disabled]):hover { filter: brightness(1.06); }
  .btn.secondary:not([disabled]):hover { background: var(--surface-2); filter: none; }
}

/* Cards and sections */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.section { padding: 40px 0; }
.eyebrow { color: var(--accent); font-weight: 600; font-size: 0.85rem; letter-spacing: 0.04em; text-transform: uppercase; margin-bottom: 8px; }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
.grid { display: grid; gap: 16px; }
@media (min-width: 760px) {
  .grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px;
  background: var(--surface-2); color: var(--muted); font-size: 0.8rem; font-weight: 500;
}
.pill.good { background: var(--accent-soft); color: var(--accent); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }

/* Tables */
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 11px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 0.8rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
td.r, th.r { text-align: right; }
tr:last-child td { border-bottom: 0; }

/* Forms */
form { display: grid; gap: 14px; }
label { display: grid; gap: 6px; font-weight: 500; }
input {
  width: 100%; min-height: 46px; padding: 10px 14px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font: 400 16px/1.2 var(--sans);
}
input.code { font-family: var(--mono); letter-spacing: 0.2em; }
.hint { color: var(--muted); font-size: 0.875rem; font-weight: 400; }
.error { color: var(--bad); font-size: 0.9rem; min-height: 1.4em; }
.note { background: var(--warn-soft); color: var(--warn); border-radius: 12px; padding: 12px 14px; font-size: 0.9rem; }
.note.good { background: var(--accent-soft); color: var(--accent); }

/* SMS bubbles */
.sms { font-family: var(--mono); font-size: 0.86rem; line-height: 1.45; }
.bubble {
  max-width: 88%; padding: 9px 12px; border-radius: 16px; white-space: pre-wrap; overflow-wrap: anywhere;
}
.bubble.in { background: var(--bubble-in); color: var(--ink); border-bottom-left-radius: 5px; align-self: flex-start; }
.bubble.out { background: var(--bubble-out); color: #fff; border-bottom-right-radius: 5px; align-self: flex-end; }

/* Phone simulator */
.phone {
  width: min(360px, 100%); margin-inline: auto; border-radius: 34px; padding: 12px;
  background: #121513; box-shadow: 0 1px 0 rgba(255,255,255,0.06) inset, 0 20px 50px -20px rgba(0,0,0,0.45);
}
.phone-screen { background: var(--surface); border-radius: 24px; overflow: hidden; display: flex; flex-direction: column; height: 560px; }
.phone-head { padding: 14px 16px 10px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.thread { flex: 1; overflow-y: auto; padding: 14px 12px; display: flex; flex-direction: column; gap: 8px; }
.thread-empty { margin: auto; text-align: center; color: var(--muted); font-size: 0.9rem; padding: 0 16px; font-family: var(--sans); }
.composer { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--line); }
.composer form { display: flex; gap: 8px; width: 100%; }
.composer input { min-height: 42px; border-radius: 21px; font-family: var(--mono); text-transform: uppercase; }
.composer .btn { min-height: 42px; border-radius: 21px; padding: 0 16px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 999px;
  padding: 7px 12px; font: 500 0.85rem var(--mono); cursor: pointer; user-select: none;
}
@media (hover: hover) { .chip:hover { background: var(--surface-2); } }
.typing { align-self: flex-start; color: var(--muted); font-size: 0.8rem; padding: 0 4px; }

/* Hero */
.hero { padding: 32px 0 20px; }
.hero-grid { display: grid; gap: 28px; align-items: center; }
@media (min-width: 900px) { .hero-grid { grid-template-columns: 1.15fr 0.85fr; } }
.lede { font-size: clamp(1.05rem, 0.98rem + 0.4vw, 1.25rem); color: var(--muted); max-width: 40ch; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 20px; }
.demo-thread { display: flex; flex-direction: column; gap: 8px; }

.steps { counter-reset: step; display: grid; gap: 14px; }
.step { position: relative; padding-left: 44px; }
.step::before {
  counter-increment: step; content: counter(step);
  position: absolute; left: 0; top: 0; width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-weight: 650; font-size: 0.9rem;
}

.who { display: grid; gap: 12px; }
.who-row { display: grid; grid-template-columns: 150px 1fr; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.who-row:last-child { border-bottom: 0; }
@media (max-width: 560px) { .who-row { grid-template-columns: 1fr; gap: 4px; } }

.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; font-size: 0.9rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; font-family: var(--mono); font-size: 0.82rem; }

.bar { height: 8px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--accent); }

.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: 10px 0; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }

footer { padding: 32px 0 48px; color: var(--muted); font-size: 0.875rem; border-top: 1px solid var(--line); margin-top: 32px; }

.skeleton { color: transparent; background: var(--surface-2); border-radius: 6px; }

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

.narrow { width: min(520px, 100% - 32px); margin-inline: auto; }
.stepper { display: flex; gap: 8px; margin-bottom: 18px; }
.stepper span { flex: 1; height: 4px; border-radius: 999px; background: var(--line); }
.stepper span.done { background: var(--accent); }
[hidden] { display: none !important; }
.inbox { display: flex; flex-direction: column; gap: 8px; background: var(--surface-2); border-radius: 12px; padding: 12px; }
.row { display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.big { font-size: clamp(1.8rem, 1.4rem + 1.6vw, 2.4rem); font-weight: 650; letter-spacing: -0.02em; }
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; font-weight: 500; }
.switch input { appearance: none; width: 44px; min-height: 26px; height: 26px; padding: 0; border-radius: 999px; background: var(--line); border: 0; position: relative; cursor: pointer; transition: background-color 150ms ease; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform 150ms ease; }
.switch input:checked { background: var(--bad); }
.switch input:checked::after { transform: translateX(18px); }
.party { font-family: var(--mono); font-size: 0.78rem; overflow-wrap: anywhere; color: var(--muted); }
.view-grid { display: grid; gap: 16px; }
@media (min-width: 900px) { .view-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.zero { font-size: 1.6rem; font-weight: 650; color: var(--accent); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
