:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-2: #eef1f8;
  --text: #121826;
  --muted: #5d6679;
  --border: #dde2ee;
  --accent: #2f6bff;
  --accent-text: #ffffff;
  --accent-soft: #e6eeff;
  --ok: #138a4a;
  --ok-soft: #e3f5ea;
  --warn: #9a5b00;
  --warn-soft: #fff3dc;
  --err: #c0262d;
  --err-soft: #fde8e9;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 4px 16px rgba(16, 24, 40, .06);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e121a;
    --surface: #161b26;
    --surface-2: #1d2433;
    --text: #e8ecf4;
    --muted: #98a2b6;
    --border: #2a3245;
    --accent: #5b8cff;
    --accent-text: #0b0f17;
    --accent-soft: #1c2a4a;
    --ok: #4cc485;
    --ok-soft: #14301f;
    --warn: #f0b44c;
    --warn-soft: #3a2c10;
    --err: #ff7a7f;
    --err-soft: #3b171a;
    --shadow: none;
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--accent); }

.wrap { width: 100%; max-width: 980px; margin: 0 auto; padding: 0 16px; }
.center { text-align: center; }
.pad { padding: 48px 0; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.hidden { display: none !important; }

/* Top bar */
.topbar { background: var(--surface); border-bottom: 1px solid var(--border); }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; height: 60px; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--text); text-decoration: none; white-space: nowrap; }
.brand-mark { width: 32px; height: 32px; border-radius: 50%; background: #fff url("/icon-192.png?v=3") center/cover; box-shadow: 0 0 0 1px rgba(0, 0, 0, .08); }
.topnav { display: flex; gap: 18px; font-size: 15px; }
.topnav a { color: var(--muted); text-decoration: none; }
.topnav a:hover { color: var(--text); }

main { flex: 1; padding-bottom: 48px; }

.footer { border-top: 1px solid var(--border); padding: 20px 0; font-size: 14px; }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; }

/* Hero */
.hero { padding: 48px 0 24px; }
.hero h1 { font-size: clamp(28px, 5vw, 42px); line-height: 1.15; margin: 0 0 12px; letter-spacing: -.02em; }
.hero p { font-size: 18px; color: var(--muted); margin: 0; max-width: 620px; }

.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 28px 0 8px; padding: 0; list-style: none; counter-reset: step; }
.steps li { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; counter-increment: step; display: flex; gap: 12px; align-items: flex-start; }
.steps li::before { content: counter(step); flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-weight: 700; display: grid; place-items: center; font-size: 14px; }

h2 { font-size: 24px; margin: 40px 0 16px; letter-spacing: -.01em; }

/* Plans */
.plans { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.plan { display: flex; flex-direction: column; gap: 14px; }
.plan h3 { margin: 0; font-size: 20px; }
.plan-features { margin: 0; padding: 0; list-style: none; color: var(--muted); font-size: 15px; display: grid; gap: 4px; }
.plan-features li::before { content: "✓"; color: var(--ok); margin-right: 8px; font-weight: 700; }
.plan-desc { margin: 0; color: var(--muted); font-size: 14px; white-space: pre-line; }

.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg button { flex: 1 1 auto; min-width: 72px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); border-radius: 10px; padding: 8px 10px; font: inherit; font-size: 14px; cursor: pointer; }
.seg button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); font-weight: 600; }

.price { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.price strong { font-size: 30px; letter-spacing: -.02em; }
.price .old { text-decoration: line-through; color: var(--muted); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 12px; padding: 13px 18px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; text-align: center; }
.btn-primary { background: var(--accent); color: var(--accent-text); }
.btn-primary:hover { filter: brightness(1.06); }
.btn-secondary { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.btn-block { width: 100%; }
.btn-lg { padding: 16px 20px; font-size: 17px; }
.btn[disabled] { opacity: .6; cursor: progress; }

.field { display: flex; gap: 8px; flex-wrap: wrap; }
.field input, .field select { flex: 1 1 240px; min-width: 0; border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 12px; padding: 12px 14px; font: inherit; }
.field input:focus, .field select:focus, .btn:focus-visible, .seg button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Notices */
.notice { border-radius: 12px; padding: 12px 14px; margin: 12px 0; font-size: 15px; }
.notice-ok { background: var(--ok-soft); color: var(--ok); }
.notice-warn { background: var(--warn-soft); color: var(--warn); }
.notice-err { background: var(--err-soft); color: var(--err); }
.notice-info { background: var(--accent-soft); color: var(--text); }

/* FAQ */
.faq details { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px 16px; margin-bottom: 8px; }
.faq summary { cursor: pointer; font-weight: 600; }
.faq p { margin: 8px 0 0; color: var(--muted); }

/* Order / subscription */
.panel { max-width: 640px; margin: 32px auto 0; }
.panel h1 { font-size: 28px; margin: 0 0 8px; letter-spacing: -.01em; }
.status { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); }
.dot-ok { background: var(--ok); }
.dot-warn { background: var(--warn); }
.dot-err { background: var(--err); }

.spinner { width: 44px; height: 44px; border-radius: 50%; border: 4px solid var(--surface-2); border-top-color: var(--accent); animation: spin 1s linear infinite; margin: 24px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } }

.step { display: grid; grid-template-columns: 32px 1fr; gap: 12px; padding: 18px 0; border-top: 1px solid var(--border); }
.step:first-of-type { border-top: 0; }
.step-num { width: 32px; height: 32px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-weight: 700; display: grid; place-items: center; }
.step > div { min-width: 0; }
.step h3 { margin: 4px 0 8px; font-size: 18px; }
.step p { margin: 0 0 10px; color: var(--muted); font-size: 15px; }

.apps { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.apps .btn { font-weight: 500; font-size: 14px; padding: 10px 12px; }

.linkbox { display: flex; gap: 8px; align-items: stretch; margin-top: 10px; }
.linkbox code { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; font-size: 13px; }

.qr { display: flex; justify-content: center; margin: 14px 0 4px; }
.qr-box { background: #fff; padding: 12px; border-radius: 12px; line-height: 0; }
.qr-box img { width: 200px; height: 200px; image-rendering: pixelated; }

.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 12px 0 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; }

.steps a { color: var(--accent); }
@media (max-width: 960px) { .steps { grid-template-columns: repeat(2, 1fr); } }

/* Mobile: the top links fold into a menu behind ☰, top right. */
.topbar { position: relative; }
.menu-toggle { display: none; flex-direction: column; justify-content: center; gap: 5px; width: 42px; height: 42px; padding: 0 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); cursor: pointer; }
.menu-toggle span { display: block; height: 2px; border-radius: 2px; background: var(--text); transition: transform .2s, opacity .2s; }
.topbar.open .menu-toggle span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.topbar.open .menu-toggle span:nth-child(2) { opacity: 0; }
.topbar.open .menu-toggle span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

@media (max-width: 720px) {
  .steps { grid-template-columns: 1fr; }
  .hero { padding-top: 32px; }
  .menu-toggle { display: inline-flex; }
  nav.topnav { display: none; position: absolute; top: 56px; right: 12px; z-index: 40; flex-direction: column; gap: 0; min-width: 220px;
    padding: 6px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 10px 30px rgba(0, 0, 0, .18); font-size: 16px; }
  .topbar.open nav.topnav { display: flex; }
  .topnav a { display: block; padding: 12px 14px; border-radius: 8px; color: var(--text); }
  .topnav a:hover { background: var(--surface-2); }
  .topnav #account-nav, .topbar.open .topnav #account-nav { display: flex; flex-direction: column; gap: 0; }
}

/* Consent dialog and documents */
.consent { position: fixed; inset: 0; z-index: 50; background: rgba(10, 14, 22, .55); display: flex; align-items: center; justify-content: center; padding: 16px; }
.consent-box { background: var(--surface); color: var(--text); border-radius: var(--radius); width: 100%; max-width: 720px; max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px); display: flex; flex-direction: column; box-shadow: 0 10px 40px rgba(0, 0, 0, .3); }
.consent-head { padding: 20px 20px 12px; border-bottom: 1px solid var(--border); }
.consent-head h2 { margin: 0 0 4px; font-size: 22px; }
.consent-head p { margin: 0; color: var(--muted); font-size: 15px; }
.consent-body:focus { outline: none; }
.consent-body:focus-visible { box-shadow: inset 0 0 0 2px var(--accent); }
.consent-body { padding: 4px 20px 16px; overflow-y: auto; -webkit-overflow-scrolling: touch; flex: 1; }
.consent-foot { padding: 14px 20px 18px; border-top: 1px solid var(--border); display: grid; gap: 12px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 15px; cursor: pointer; }
.check input { width: 20px; height: 20px; margin: 1px 0 0; flex: none; accent-color: var(--accent); }
.doc h3 { font-size: 18px; margin: 18px 0 8px; }
.doc-text { white-space: pre-line; font-size: 14px; line-height: 1.55; color: var(--text); margin: 0; overflow-wrap: anywhere; }
.consent-note { font-size: 13px; color: var(--muted); text-align: center; margin: 12px 0 0; }
body.modal-open { overflow: hidden; }
@media (max-width: 720px) {
  .consent { padding: 0; align-items: stretch; }
  .consent-box { max-width: none; max-height: none; height: 100%; border-radius: 0; }
}

.card-accent { border: 2px solid var(--accent); background: var(--accent-soft); box-shadow: none; }
.card-accent p { color: var(--text); margin: 0 0 12px; font-size: 15px; }

/* ---------- accounts ---------- */
.form { display: grid; gap: 14px; margin-top: 12px; }
.form-row { display: grid; gap: 6px; }
.form-row label { font-weight: 600; font-size: 15px; }
.form-row input { width: 100%; border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 12px; padding: 12px 14px; font: inherit; }
.form-row input:focus { outline: 2px solid var(--accent); outline-offset: 2px; }
.topnav #account-nav { display: inline-flex; gap: 18px; }
.account-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.btn-sm { padding: 8px 12px; font-size: 14px; }
.card-summary { cursor: pointer; font-weight: 600; font-size: 18px; }
details.card > summary { list-style-position: inside; }
.install { margin-top: 14px; }
.install summary { cursor: pointer; color: var(--muted); }
.install .apps { margin-top: 10px; }
.devices { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 8px; }
.devices li { display: flex; justify-content: space-between; align-items: center; gap: 12px; border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; background: var(--surface-2); }
@media (min-width: 561px) and (max-width: 720px) { nav.topnav { font-size: 15px; } }

/* ---------- landing wizard: four large cards, an arrow between them; the open stage's space under its card ---------- */
.flow { list-style: none; margin: 28px 0 40px; padding: 0; display: grid; gap: 0; }
.flow-card { background: var(--surface); border: 1px solid var(--border); border-radius: calc(var(--radius) + 4px);
  box-shadow: 0 2px 10px rgba(16, 24, 40, .05); transition: opacity .25s, box-shadow .25s, border-color .25s; scroll-margin-top: 16px; }
.flow-card.open { border-color: var(--accent); box-shadow: 0 8px 30px rgba(47, 107, 255, .14); }
/* Tall even when folded (a third of the screen): one swipe passes about one card, so a stage is not skipped. */
.flow-head { width: 100%; min-height: clamp(150px, 34vh, 300px); display: flex; align-items: center; gap: 18px; padding: 22px 24px; background: none; border: 0; color: inherit;
  font: inherit; text-align: left; cursor: pointer; border-radius: inherit; }
.flow-head:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.flow-num { flex: none; width: 56px; height: 56px; border-radius: 50%; background: var(--accent-soft); color: var(--accent);
  font-weight: 800; font-size: 26px; display: grid; place-items: center; }
/* The open card's header needs no extra height: its space below holds the stage. */
.flow-card.open .flow-head { min-height: 0; }
.flow-card.open .flow-num { background: var(--accent); color: #fff; }
.flow-text { display: grid; gap: 4px; flex: 1; min-width: 0; }
.flow-text strong { font-size: 24px; line-height: 1.25; }
.flow-text .muted { font-size: 16px; }
.flow-chev { flex: none; width: 12px; height: 12px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted);
  transform: rotate(45deg); margin: -6px 6px 0 0; transition: transform .2s; }
.flow-card.open .flow-chev { transform: rotate(-135deg); margin-top: 6px; }
.flow-panel { padding: 4px 24px 24px 98px; animation: flow-open .18s ease-out; }
@keyframes flow-open { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
/* Arrows between the cards: bright and long, so a card has room to open while the next one comes up. */
.flow-arrow { height: 80px; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.flow-arrow::before { content: ""; width: 3px; height: 54px; border-radius: 2px; background: var(--accent); }
.flow-arrow::after { content: ""; width: 16px; height: 16px; margin-top: -14px; border-right: 3px solid var(--accent); border-bottom: 3px solid var(--accent);
  transform: rotate(45deg); }
.flow .plans { margin-top: 4px; }
.auth-tabs { margin-bottom: 8px; max-width: 360px; }

.app-row { display: flex; align-items: center; gap: 16px; padding: 14px 0; border-top: 1px solid var(--border); }
.app-row:first-child { border-top: 0; padding-top: 0; }
.app-logo { width: 56px; height: 56px; border-radius: 14px; flex: none; object-fit: cover; }
.app-info { flex: 1; min-width: 0; display: grid; gap: 2px; }
.app-info strong { font-size: 18px; }
.app-more { margin-top: 4px; font-size: 14px; }
.app-more summary { cursor: pointer; color: var(--muted); }
.app-more .apps { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 6px; }
.app-row + .btn { margin-top: 14px; }

.connect { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.connect .btn { display: flex; align-items: center; justify-content: center; gap: 10px; }
.connect .btn img { width: 26px; height: 26px; border-radius: 7px; }

@media (max-width: 720px) {
  .flow-head { padding: 18px 16px; gap: 14px; }
  .flow-num { width: 48px; height: 48px; font-size: 22px; }
  .flow-text strong { font-size: 21px; }
  .flow-panel { padding: 4px 16px 18px; }
  .app-row { flex-wrap: wrap; }
  .app-row > .btn { width: 100%; }
  .connect { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { .flow-card, .flow-chev { transition: none; } .flow-panel { animation: none; } }

/* The route on top (after the header scrolls away): four numbered dots on a line, the current one larger. */
.flow-route { position: fixed; top: 0; left: 0; right: 0; z-index: 30; background: var(--surface); border-bottom: 1px solid var(--border);
  box-shadow: 0 4px 16px rgba(16, 24, 40, .08); transform: translateY(-110%); transition: transform .2s ease-out; }
.flow-route.show { transform: none; }
.flow-route ol { list-style: none; margin: 0 auto; padding: 10px 16px; max-width: 420px; display: flex; align-items: center; justify-content: space-between;
  background: linear-gradient(var(--border), var(--border)) center / calc(100% - 64px) 2px no-repeat; }
.flow-route button { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--border); background: var(--surface); color: var(--muted);
  font: inherit; font-weight: 700; font-size: 14px; cursor: pointer; display: grid; place-items: center; padding: 0;
  transition: width .2s, height .2s, font-size .2s, background .2s, color .2s, border-color .2s; }
.flow-route button.done { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.flow-route button.on { width: 42px; height: 42px; font-size: 18px; border-color: var(--accent); background: var(--accent); color: #fff; }
.flow-route button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { .flow-route, .flow-route button { transition: none; } }

/* Done stages: green card, a green tick instead of the number, a green dot on the route. */
.flow-card.done { border-color: var(--ok); }
.flow-card.done .flow-num, .flow-card.done.open .flow-num { background: var(--ok); color: #fff; }
.flow-card.done.open { box-shadow: 0 8px 30px rgba(19, 138, 74, .16); }
.flow-route button.ok { border-color: var(--ok); background: var(--ok-soft); color: var(--ok); }
.flow-route button.ok.on { background: var(--ok); color: #fff; }
