/* One design system for the marketing site and the app.
   Tokens first; every component below uses them, so spacing, type and color stay consistent. */
:root {
  --ink: #12151b; --ink-2: #2b313b; --muted: #5d6470; --line: #e3e6eb; --line-2: #cdd2da;
  --bg: #f6f7f9; --card: #fff; --tint: #eef3ff;
  --accent: #1f4fd8; --accent-2: #1a43b8; --accent-ink: #fff;
  --ok: #0f7a4a; --ok-bg: #e4f5ec; --warn: #8a5a00; --warn-bg: #fdf1d3; --danger: #b3261e; --danger-bg: #fdecea;
  --radius: 12px; --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(16, 20, 28, .05);
  --shadow: 0 1px 2px rgba(16, 20, 28, .04), 0 6px 20px rgba(16, 20, 28, .06);
  --shadow-lg: 0 2px 6px rgba(16, 20, 28, .05), 0 24px 60px rgba(16, 20, 28, .14);
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px; --s8: 72px;
  --gutter: 20px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 16px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
img { max-width: 100%; }
a { color: var(--accent); text-underline-offset: 2px; }
a:hover { color: var(--accent-2); }

/* type scale: display (hero) › h1 › h2 › h3 › body › small */
h1, h2, h3 { color: var(--ink); letter-spacing: -.015em; }
h1 { font-size: clamp(1.75rem, 1.2rem + 2.2vw, 2.25rem); line-height: 1.15; margin: 0 0 var(--s4); }
h2 { font-size: clamp(1.3rem, 1.1rem + .9vw, 1.6rem); line-height: 1.25; margin: 0 0 var(--s3); }
h3 { font-size: 1.08rem; line-height: 1.35; margin: 0 0 var(--s2); }
p { margin: 0 0 var(--s4); }
code { font: .9em ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: #eef0f4; padding: 1px 6px; border-radius: 5px; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.mt { margin-top: var(--s5); }
[hidden] { display: none !important; }

/* layout */
.wrap { max-width: 760px; margin: 0 auto; padding: 0 var(--gutter); }
main.wrap { padding-top: var(--s6); padding-bottom: var(--s8); min-height: 70vh; }
main.wide { max-width: 1120px; }
@media (max-width: 560px) { :root { --gutter: 16px; } main.wrap { padding-top: var(--s5); } }

/* header */
.top { background: #fff; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 10; }
.top .wrap { max-width: 1120px; }
.top-in { display: flex; align-items: center; justify-content: space-between; gap: var(--s4); min-height: 60px; }
.logo { font-weight: 800; font-size: 1.05rem; letter-spacing: -.01em; color: var(--ink); text-decoration: none; white-space: nowrap; }
.top nav { display: flex; align-items: center; gap: var(--s1); font-size: .95rem; }
.top nav a:not(.btn), .top nav .link { color: var(--ink-2); text-decoration: none; font-weight: 500; white-space: nowrap;
  padding: 8px 10px; border-radius: var(--radius-sm); }
.top nav a:not(.btn):hover, .top nav .link:hover { background: #f0f2f5; color: var(--ink); }
.top nav .btn { margin-left: var(--s2); }
.top nav form { margin: 0; }
@media (max-width: 480px) {
  .top-in { flex-wrap: wrap; row-gap: 0; padding-top: var(--s2); padding-bottom: var(--s2); }
  .top nav { gap: 0; font-size: .9rem; }
  .top nav a:not(.btn), .top nav .link { padding: 8px; }
}

/* footer */
.foot { border-top: 1px solid var(--line); background: var(--card); padding: var(--s6) 0; font-size: .875rem; color: var(--muted); }
.foot .wrap { max-width: 1120px; display: flex; flex-wrap: wrap; gap: var(--s2) var(--s5); align-items: center; }
.foot span { color: var(--ink-2); font-weight: 600; flex-basis: 100%; margin-bottom: var(--s2); }
.foot a { color: var(--muted); text-decoration: none; padding: 4px 0; }
.foot a:hover { color: var(--ink); text-decoration: underline; }
@media (max-width: 560px) { .foot .wrap { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s1) var(--s4); } .foot span { grid-column: 1 / -1; } }

/* buttons: one style, three sizes, two weights */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--s2); min-height: 44px;
  background: var(--accent); color: var(--accent-ink); border: 1px solid var(--accent); border-radius: var(--radius-sm);
  padding: 10px 18px; font: inherit; font-weight: 600; line-height: 1.2; text-decoration: none; cursor: pointer; text-align: center;
  box-shadow: 0 1px 2px rgba(31, 79, 216, .25); transition: background .15s, box-shadow .15s, transform .05s; }
.btn:hover { background: var(--accent-2); border-color: var(--accent-2); color: var(--accent-ink); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.small { min-height: 36px; padding: 6px 12px; font-size: .875rem; }
.btn.big { min-height: 52px; padding: 13px 24px; font-size: 1.05rem; }
.btn.block { display: flex; width: 100%; }
.btn.ghost { background: var(--card); color: var(--ink); border-color: var(--line-2); box-shadow: var(--shadow-sm); }
.btn.ghost:hover { background: #f3f5f8; border-color: #b9c0ca; }
.btn.danger-btn { background: var(--danger); border-color: var(--danger); box-shadow: none; }
.link { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.danger, .link.danger { color: var(--danger); }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 40%, transparent); outline-offset: 2px; }

/* surfaces */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--s5); margin-bottom: var(--s4); box-shadow: var(--shadow); }
@media (max-width: 560px) { .card { padding: var(--s4) var(--s4) var(--s5); } }
.pill { display: inline-flex; align-items: center; font-size: .75rem; font-weight: 600; line-height: 1; padding: 6px 10px; border-radius: 99px;
  background: #eceef2; color: var(--muted); white-space: nowrap; vertical-align: middle; }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.flash { padding: var(--s3) var(--s4); border-radius: var(--radius-sm); background: var(--danger-bg); color: var(--danger); margin-bottom: var(--s5); font-weight: 500; }
.flash.ok { background: var(--ok-bg); color: var(--ok); }
.row { display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; }
.row.between { justify-content: space-between; }

/* forms */
label { display: block; font-weight: 600; font-size: .92rem; color: var(--ink-2); }
input[type=text], input[type=email], input[type=password], textarea {
  display: block; width: 100%; margin-top: 6px; min-height: 44px; padding: 10px 12px; font: inherit; color: var(--ink);
  background: #fff; border: 1px solid var(--line-2); border-radius: var(--radius-sm); transition: border-color .15s, box-shadow .15s; }
input[type=text]:focus, input[type=email]:focus, input[type=password]:focus, textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
input[type=color] { display: block; margin-top: 6px; width: 64px; height: 44px; padding: 3px; border: 1px solid var(--line-2); border-radius: var(--radius-sm); background: #fff; }
input[type=file] { display: block; margin-top: 8px; font: inherit; font-size: .9rem; max-width: 100%; }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--accent); }
.hint { display: block; font-weight: 400; font-size: .82rem; color: var(--muted); margin-top: 6px; }
.stack > * + * { margin-top: var(--s4); }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; }
.check input { margin-top: 3px; flex: none; }
.logo-preview { display: block; max-height: 56px; max-width: 220px; margin: var(--s2) 0; }

/* single-column pages (login, sign up, connect, install): a centred card */
.narrow { max-width: 440px; margin: var(--s4) auto 0; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: var(--s6); box-shadow: var(--shadow); }
.narrow h1 { font-size: 1.6rem; }
.narrow .btn:not(.small) { width: 100%; }
.narrow form + p, .narrow form + .muted { margin-top: var(--s5); margin-bottom: 0; }
@media (max-width: 560px) { .narrow { padding: var(--s5) var(--s4); margin-top: 0; } }
.prose { max-width: 680px; }
.prose h2 { margin-top: var(--s6); }
.prose li { margin-bottom: var(--s2); }

/* ---- landing ---- */
.hero { padding: var(--s7) 0 var(--s6); max-width: 820px; }
.hero h1 { font-size: clamp(2.1rem, 1.3rem + 3.6vw, 3.4rem); line-height: 1.07; letter-spacing: -.03em; margin-bottom: var(--s5); }
.hero.end { text-align: center; margin: var(--s7) auto 0; max-width: none; padding: var(--s7) var(--s5);
  background: linear-gradient(135deg, var(--accent), #3b6cf0); border-radius: 20px; color: #fff; box-shadow: var(--shadow-lg); }
.hero.end h2 { color: #fff; font-size: clamp(1.5rem, 1.1rem + 1.8vw, 2.1rem); margin-bottom: var(--s5); }
.hero.end .btn { background: #fff; color: var(--accent); border-color: #fff; }
.hero.end .btn:hover { background: #eef3ff; }
.eyebrow { display: inline-block; font-weight: 700; color: var(--accent); font-size: .8rem; text-transform: uppercase; letter-spacing: .08em;
  margin-bottom: var(--s4); background: var(--tint); padding: 6px 12px; border-radius: 99px; }
.lede { font-size: clamp(1.08rem, 1rem + .4vw, 1.25rem); line-height: 1.6; color: var(--ink-2); max-width: 680px; }
.cta-row { display: flex; align-items: center; gap: var(--s3) var(--s4); flex-wrap: wrap; margin: var(--s5) 0 var(--s3); }
.hero.end .cta-row { justify-content: center; margin: 0; }
@media (max-width: 560px) {
  .hero { padding-top: var(--s5); }
  .hero .cta-row .btn { width: 100%; }
  .hero.end { border-radius: 16px; padding: var(--s6) var(--s4); }
}

.hero-shot { display: block; max-width: 1040px; margin: 0 auto var(--s8); border: 1px solid var(--line); border-radius: 16px; overflow: hidden;
  background: #fff; box-shadow: var(--shadow-lg); text-decoration: none; color: var(--ink); position: relative; }
.hero-shot .bar { display: flex; align-items: center; gap: 6px; padding: 10px 14px; background: #f1f3f6; border-bottom: 1px solid var(--line); }
.hero-shot .bar i { width: 11px; height: 11px; border-radius: 50%; background: #d3d8df; }
.hero-shot .bar i:nth-child(1) { background: #ff6159; } .hero-shot .bar i:nth-child(2) { background: #ffbd2e; } .hero-shot .bar i:nth-child(3) { background: #28c941; }
.hero-shot .bar b { font-weight: 500; font-size: .8rem; color: var(--muted); margin-left: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hero-shot img { display: block; width: 100%; height: auto; }
.hero-shot .see { position: absolute; right: 18px; bottom: 18px; background: var(--accent); color: #fff; font-weight: 600; padding: 10px 16px;
  border-radius: var(--radius-sm); box-shadow: 0 6px 18px rgba(31, 79, 216, .35); }
.hero-shot:hover .see { background: var(--accent-2); }
@media (max-width: 640px) {
  /* On a phone the full page is too small to read: show its top-left, where the steps start. */
  .hero-shot { margin-bottom: var(--s7); border-radius: 12px; }
  .hero-shot img { width: 190%; max-width: none; }
  .hero-shot .see { position: static; display: block; text-align: center; border-radius: 0; box-shadow: none; padding: 14px; }
}

.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: var(--s4); margin: 0 0 var(--s8); }
.grid3 .card { margin: 0; padding: var(--s5); }
.grid3 h3 { font-size: 1.15rem; }
.grid3 p { margin: 0; color: var(--ink-2); }
.n { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; background: var(--tint); color: var(--accent);
  font-weight: 800; font-size: .95rem; margin-bottom: var(--s3); flex: none; }

.split { display: grid; grid-template-columns: 1.25fr 1fr; gap: var(--s7); align-items: center; margin-bottom: var(--s8); }
.split h2 { font-size: clamp(1.5rem, 1.2rem + 1.3vw, 2rem); }
.split > div > p { color: var(--ink-2); font-size: 1.05rem; }
@media (max-width: 860px) { .split { grid-template-columns: 1fr; gap: var(--s6); } }
.ticks { list-style: none; padding: 0; margin: 0 0 var(--s5); }
.ticks li { padding-left: 30px; position: relative; margin-bottom: var(--s3); }
.ticks li::before { content: ""; position: absolute; left: 0; top: 3px; width: 20px; height: 20px; border-radius: 50%;
  background: var(--ok-bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M6 10.5l2.5 2.5L14 7.5' fill='none' stroke='%230f7a4a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 20px no-repeat; }

.price { border: 2px solid var(--accent); padding: var(--s6); box-shadow: 0 2px 6px rgba(31, 79, 216, .08), 0 24px 50px rgba(31, 79, 216, .14); position: relative; margin: 0; }
.price h3 { color: var(--accent); text-transform: uppercase; letter-spacing: .08em; font-size: .82rem; }
.price .amount { font-size: 3.4rem; font-weight: 800; letter-spacing: -.03em; line-height: 1; margin: var(--s2) 0 var(--s5); }
.price .amount span { font-size: 1rem; font-weight: 500; letter-spacing: 0; color: var(--muted); margin-left: 4px; }
.price .ticks { padding-top: var(--s5); border-top: 1px solid var(--line); }
.price .small { margin: var(--s4) 0 0; line-height: 1.55; }
@media (max-width: 560px) { .price { padding: var(--s5) var(--s4); } }

.faq { max-width: 760px; margin: 0 auto var(--s4); }
.faq h2 { text-align: center; margin-bottom: var(--s5); }
.faq details { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: var(--s2); box-shadow: var(--shadow-sm); }
.faq summary { font-weight: 600; cursor: pointer; list-style: none; padding: var(--s4) 52px var(--s4) var(--s5); position: relative; min-height: 44px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; position: absolute; right: var(--s5); top: 50%; transform: translateY(-50%); font-size: 1.4rem; font-weight: 400; color: var(--muted); }
.faq details[open] summary::after { content: "−"; }
.faq details p { margin: 0; padding: 0 var(--s5) var(--s4); color: var(--ink-2); }
@media (max-width: 560px) { .faq summary { padding-left: var(--s4); padding-right: 44px; } .faq summary::after { right: var(--s4); } .faq details p { padding: 0 var(--s4) var(--s4); } }

/* ---- dashboard ---- */
main > .row.between:first-of-type { margin-bottom: var(--s4); }
main > .row.between h1 { margin: 0; }
.subscribe-strip { display: flex; gap: var(--s3) var(--s4); align-items: center; background: var(--tint); border-color: #d6e0fb; box-shadow: none; }
.subscribe-strip span { flex: 1 1 260px; color: var(--ink-2); }
@media (max-width: 560px) { .subscribe-strip .btn { width: 100%; } }
.onboarding h2 { margin-bottom: var(--s5); }
.onboarding h3 { display: flex; align-items: center; gap: var(--s3); margin: var(--s5) 0 var(--s3); font-size: 1.05rem; }
.onboarding h3:first-of-type { margin-top: 0; }
.onboarding h3 .n { margin: 0; }
.onboarding > p { margin-left: 44px; }
@media (max-width: 560px) { .onboarding > p { margin-left: 0; } }
.manuals { list-style: none; padding: 0; margin: 0; }
.manuals li { display: flex; align-items: center; gap: var(--s2) var(--s4); flex-wrap: wrap; background: var(--card); box-shadow: var(--shadow-sm);
  border: 1px solid var(--line); border-radius: var(--radius); padding: var(--s4) var(--s5); margin-bottom: var(--s3); transition: border-color .15s, box-shadow .15s; }
.manuals li:hover { border-color: var(--line-2); box-shadow: var(--shadow); }
.m-title { font-weight: 650; font-size: 1.05rem; color: var(--ink); text-decoration: none; flex: 1 1 240px; }
.m-title:hover { color: var(--accent); }

/* install steps (dashboard, /install, connect, settings) */
.install-steps { list-style: none; counter-reset: inst; padding: 0; margin: 0 0 var(--s4); }
.install-steps > li { counter-increment: inst; position: relative; padding: 0 0 var(--s3) 40px; margin: 0; }
.install-steps > li::before { content: counter(inst); position: absolute; left: 0; top: 0; width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center; font-size: .8rem; font-weight: 700; background: #eceef2; color: var(--ink-2); }
.install-steps > li:first-child::before { top: 9px; }
.install-steps > li:first-child { padding-bottom: var(--s4); }
.install-steps > li:first-child .muted { display: block; margin-top: var(--s2); }
@media (max-width: 560px) { .install-steps > li:first-child .btn { width: 100%; } }
details > summary { cursor: pointer; }
.card details summary, .narrow details summary { font-weight: 600; padding: var(--s1) 0; }
.card details[open] summary, .narrow details[open] summary { margin-bottom: var(--s3); }

/* ---- editor ---- */
.editor { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: var(--s6); align-items: start; }
@media (max-width: 900px) { .editor { grid-template-columns: 1fr; gap: var(--s4); } }
.editor-side { position: sticky; top: 76px; }
@media (max-width: 900px) { .editor-side { position: static; } }
.crumbs { font-size: .9rem; display: flex; justify-content: space-between; margin-bottom: var(--s3); }
.crumbs a { text-decoration: none; font-weight: 500; }
.title-input { font-size: clamp(1.35rem, 1.1rem + 1.2vw, 1.85rem) !important; font-weight: 750; letter-spacing: -.015em; line-height: 1.25;
  border-color: transparent !important; background: transparent !important; padding-left: 0 !important; text-overflow: ellipsis; }
.intro-input { border-color: transparent !important; background: transparent !important; padding-left: 0 !important; resize: vertical; margin-bottom: var(--s5); color: var(--ink-2); }
.title-input:hover, .title-input:focus, .intro-input:hover, .intro-input:focus { border-color: var(--line-2) !important; background: #fff !important; padding-left: 12px !important; }
.steps { list-style: none; padding: 0; margin: 0; counter-reset: step; }
.step { counter-increment: step; }
.step-head { display: flex; gap: var(--s3); align-items: flex-start; }
.step .num { flex: none; width: 32px; height: 32px; border-radius: 50%; background: var(--ink); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: .9rem; margin-top: 12px; }
.step .num::before { content: counter(step); }
.step-text { margin-top: 0 !important; resize: none; overflow: hidden; font-weight: 600 !important; }
.step-actions { display: flex; gap: var(--s2); align-items: center; flex-wrap: wrap; margin: var(--s3) 0 var(--s4) 44px; }
.step-actions .link { margin-left: auto; font-size: .875rem; padding: 8px 0; }
@media (max-width: 560px) { .step-actions { margin-left: 0; } }
.shot { container-type: inline-size; position: relative; margin: 0; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; line-height: 0; background: #eef0f3; }
.shot img { width: 100%; height: auto; display: block; }
.marker { position: absolute; width: clamp(14px, 4.4cqw, 36px); aspect-ratio: 1; transform: translate(-50%, -50%); border-radius: 50%;
  border: 3px solid #ff3b30; background: rgba(255, 59, 48, .10); box-shadow: 0 0 0 2px rgba(255,255,255,.85); pointer-events: none; }
.panel h2 { font-size: 1.1rem; display: flex; align-items: center; gap: var(--s2); }
.panel details { margin: var(--s3) 0; }
.panel summary { cursor: pointer; font-size: .92rem; margin-bottom: var(--s3); }
.panel form { margin: 0; }
.panel .row { margin: var(--s2) 0; }
#share-url { font-size: .9rem; }

dialog#blur-dialog { border: 0; border-radius: 16px; padding: 0; width: min(1100px, 96vw); max-height: 96vh; box-shadow: var(--shadow-lg); }
dialog::backdrop { background: rgba(10, 12, 16, .6); }
.blur-box { padding: var(--s5); }
.canvas-wrap { max-height: 64vh; overflow: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); margin-bottom: var(--s4); line-height: 0; background: #eef0f3; }
#blur-canvas { width: 100%; height: auto; cursor: crosshair; touch-action: none; display: block; }

#connect-status[data-state=waiting] .when-done, #connect-status[data-state=done] .when-waiting { display: none; }
#connect-status { box-shadow: none; background: var(--bg); }
summary.danger { cursor: pointer; }
