/* EdgeNFC design system (spec/15). No build step: one token sheet powering both
   the marketing site (index.html) and the app SPA (app.html). Brand palette is
   the logo's indigo→cyan shield gradient. Light + dark via prefers-color-scheme.
   All motion is opt-out under prefers-reduced-motion (spec/15 §3 R2). */

:root {
  /* brand */
  --brand-1: #1e40af;         /* deep indigo (shield base) */
  --brand-2: #0891b2;         /* teal mid */
  --brand-3: #22d3ee;         /* bright cyan (shield edge) */
  --brand-grad: linear-gradient(135deg, var(--brand-1) 0%, var(--brand-2) 55%, var(--brand-3) 100%);

  /* dark theme (default) */
  --bg: #0b0f14;
  --bg-2: #0e141b;
  --panel: #131a22;
  --panel-2: #1a232d;
  --border: #253039;
  --text: #e6eef5;
  --muted: #93a1b0;
  --accent: #1f6feb;          /* interactive (AA on white text) */
  --accent-hover: #388bfd;
  --link: #6cb6ff;
  --ok: #2ea043;
  --danger: #f85149;
  --warn: #d29922;

  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 8px 30px rgba(0, 0, 0, .35);
  --dur-1: .18s;
  --dur-2: .5s;
  --ease: cubic-bezier(.4, 0, .2, 1);
  --maxw: 1080px;
}
@media (prefers-color-scheme: light) {
  :root {
    --bg: #f6f8fa; --bg-2: #eef2f6; --panel: #ffffff; --panel-2: #f1f4f8;
    --border: #d5dde5; --text: #1f2328; --muted: #59636e;
    --accent: #0969da; --accent-hover: #0a5cc0; --link: #0969da;
    --shadow: 0 8px 30px rgba(20, 40, 80, .10);
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  display: flex; flex-direction: column; min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- app shell (app.html) ---- */
header {
  display: flex; align-items: center; gap: 24px;
  padding: 12px 24px; border-bottom: 1px solid var(--border); background: color-mix(in srgb, var(--panel) 88%, transparent);
  backdrop-filter: blur(8px); position: sticky; top: 0; z-index: 10;
}
.brand { font-weight: 700; letter-spacing: .2px; display: flex; align-items: center; gap: 9px; font-size: 16px; color: var(--text); }
.brand:hover { text-decoration: none; }
.logo { width: 28px; height: 28px; display: block; }
nav { display: flex; gap: 4px; flex: 1; }
nav a { color: var(--muted); padding: 6px 12px; border-radius: var(--radius-sm); font-size: 14px; }
nav a:hover { color: var(--text); background: var(--panel-2); text-decoration: none; }
nav a.active { color: var(--text); background: var(--panel-2); }
#authbox { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 10px; }
main { flex: 1; max-width: 960px; width: 100%; margin: 0 auto; padding: 28px 24px; }
footer { padding: 16px 24px; border-top: 1px solid var(--border); color: var(--muted); font-size: 12.5px; text-align: center; }

h1 { font-size: 22px; margin: 0 0 4px; letter-spacing: -.01em; }
h2 { font-size: 16px; margin: 24px 0 10px; }
.sub { color: var(--muted); margin: 0 0 20px; }

/* ---- components (shared) ---- */
.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 16px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
label { display: block; font-size: 12.5px; color: var(--muted); margin: 10px 0 4px; }
input, textarea, select {
  width: 100%; background: var(--panel-2); border: 1px solid var(--border); color: var(--text);
  border-radius: var(--radius-sm); padding: 9px 11px; font: inherit; font-size: 14px;
}
textarea { min-height: 120px; font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 12.5px; }
input:focus, textarea:focus, select:focus { outline: 2px solid transparent; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent); }
button, .btn {
  background: var(--accent); color: #fff; border: none; border-radius: var(--radius-sm);
  padding: 9px 16px; font: inherit; font-weight: 600; font-size: 14px; cursor: pointer;
  transition: background var(--dur-1) var(--ease), transform var(--dur-1) var(--ease); display: inline-block;
}
button:hover, .btn:hover { background: var(--accent-hover); text-decoration: none; }
button:active, .btn:active { transform: translateY(1px); }
button.ghost, .btn.ghost { background: transparent; border: 1px solid var(--border); color: var(--text); }
button.ghost:hover, .btn.ghost:hover { background: var(--panel-2); }
button.small, .btn.small { padding: 5px 10px; font-size: 13px; }
.btn.grad { background: var(--brand-grad); }
.btn.grad:hover { filter: brightness(1.08); background: var(--brand-grad); }
.btn.lg { padding: 12px 22px; font-size: 15px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

code, .mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 12.5px; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.pill { display: inline-block; padding: 1px 8px; border-radius: 20px; font-size: 11.5px; border: 1px solid var(--border); }
.pill.ok { color: var(--ok); border-color: var(--ok); }
.pill.bad { color: var(--danger); border-color: var(--danger); }
.banner { border-radius: var(--radius-sm); padding: 12px 14px; margin: 12px 0; font-size: 13.5px; }
.banner.warn { background: color-mix(in srgb, var(--warn) 12%, transparent); border: 1px solid var(--warn); color: var(--warn); }
.banner.ok { background: color-mix(in srgb, var(--ok) 12%, transparent); border: 1px solid var(--ok); color: var(--ok); }
.banner.bad { background: color-mix(in srgb, var(--danger) 12%, transparent); border: 1px solid var(--danger); color: var(--danger); }
.keyreveal { word-break: break-all; background: var(--bg); padding: 10px; border-radius: 6px; border: 1px dashed var(--warn); }
.muted { color: var(--muted); }
.loading { color: var(--muted); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.spacer { flex: 1; }
@media (max-width: 680px) { .grid2 { grid-template-columns: 1fr; } header { gap: 12px; } nav { order: 3; width: 100%; } }

/* ==========================================================================
   Marketing site (index.html) — .mk-* scope
   ========================================================================== */
.mk-header {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 18px;
  padding: 14px 28px; border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(10px);
}
.mk-header .brand { font-size: 17px; }
.mk-header nav { display: flex; gap: 6px; flex: 1; justify-content: center; }
.mk-header nav a { color: var(--muted); padding: 6px 12px; border-radius: var(--radius-sm); font-size: 14px; }
.mk-header nav a:hover { color: var(--text); background: var(--panel-2); text-decoration: none; }
.mk-header nav a[aria-current="page"] { color: var(--text); background: var(--panel-2); }
.mk-header .actions { display: flex; gap: 10px; align-items: center; flex: none; }
/* the in-panel "Sign in" is the mobile twin of .actions .mk-signin — exactly one
   of the pair is ever rendered, so it is never a duplicate link for AT. */
.mk-header .mk-nav-signin { display: none; }
/* hamburger: only ever exists in the JS-enhanced mobile render (see nav.js) */
.mk-navtoggle { display: none; }
.mk-wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 28px; width: 100%; }
.mk-section { padding: 84px 0; border-bottom: 1px solid color-mix(in srgb, var(--border) 60%, transparent); }
.mk-section h2 { font-size: clamp(24px, 3.4vw, 34px); margin: 0 0 10px; letter-spacing: -.02em; text-align: center; }
.mk-section .lead { color: var(--muted); text-align: center; max-width: 620px; margin: 0 auto 44px; font-size: 16px; }
.eyebrow { text-transform: uppercase; letter-spacing: .14em; font-size: 12px; font-weight: 700;
  background: var(--brand-grad); -webkit-background-clip: text; background-clip: text; color: transparent; text-align: center; }

/* hero */
.hero { position: relative; overflow: hidden; text-align: center; padding: 96px 0 80px; }
.hero::before { content: ""; position: absolute; inset: -40% 0 auto 0; height: 620px; z-index: -1;
  background: radial-gradient(60% 60% at 50% 0%, color-mix(in srgb, var(--brand-2) 26%, transparent), transparent 70%); }
.hero h1 { font-size: clamp(34px, 6vw, 60px); line-height: 1.05; letter-spacing: -.03em; margin: 18px auto 16px; max-width: 16ch; }
.hero .grad-text { background: var(--brand-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p.tag { color: var(--muted); font-size: clamp(16px, 2.2vw, 20px); max-width: 60ch; margin: 0 auto 30px; }
.hero .cta { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.hero .trust { margin-top: 22px; color: var(--muted); font-size: 13px; }
.hero-art { display: block; margin: 40px auto 0; max-width: 520px; width: 100%; }

/* how-it-works animated flow */
.flow { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; align-items: stretch; }
.step { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px 18px; text-align: center; position: relative; }
.step .n { width: 26px; height: 26px; border-radius: 50%; background: var(--brand-grad); color: #fff; font-size: 13px; font-weight: 700; display: grid; place-items: center; margin: 0 auto 12px; }
.step h3 { margin: 0 0 6px; font-size: 15px; }
.step p { margin: 0; color: var(--muted); font-size: 13px; }
.step .art { height: 92px; margin: 4px auto 12px; display: block; }
.flow .arrow { display: none; }
@media (max-width: 820px) { .flow { grid-template-columns: 1fr 1fr; } }
@media (max-width: 460px) { .flow { grid-template-columns: 1fr; } }

/* feature grid */
.feat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.feat { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; }
.feat .ico { width: 34px; height: 34px; margin-bottom: 12px; color: var(--brand-3); }
.feat h3 { margin: 0 0 6px; font-size: 16px; }
.feat p { margin: 0; color: var(--muted); font-size: 14px; }
@media (max-width: 820px) { .feat-grid { grid-template-columns: 1fr; } }

/* pricing */
.plans { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; align-items: stretch; }
.plan { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px 20px; display: flex; flex-direction: column; }
.plan.featured { border-color: var(--accent); box-shadow: var(--shadow); position: relative; }
.plan.featured::after { content: "Most popular"; position: absolute; top: -11px; left: 50%; transform: translateX(-50%);
  background: var(--brand-grad); color: #fff; font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 20px; white-space: nowrap; }
.plan .name { font-weight: 700; font-size: 16px; }
.plan .price { font-size: 34px; font-weight: 800; letter-spacing: -.02em; margin: 10px 0 2px; }
.plan .price small { font-size: 14px; font-weight: 500; color: var(--muted); }
.plan .cap { color: var(--muted); font-size: 13px; margin-bottom: 16px; }
.plan ul { list-style: none; padding: 0; margin: 0 0 20px; display: grid; gap: 8px; font-size: 13.5px; }
.plan li { padding-left: 22px; position: relative; color: var(--text); }
.plan li::before { content: "✓"; position: absolute; left: 0; color: var(--ok); font-weight: 700; }
.plan .btn { width: 100%; text-align: center; margin-top: auto; }
.license-note { text-align: center; margin-top: 26px; color: var(--muted); font-size: 14px; }
.license-note b { color: var(--text); }
@media (max-width: 920px) { .plans { grid-template-columns: 1fr 1fr; } }
@media (max-width: 520px) { .plans { grid-template-columns: 1fr; } }

/* faq */
.faq { max-width: 760px; margin: 0 auto; }
.faq details { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px 18px; margin-bottom: 10px; background: var(--panel); }
.faq summary { cursor: pointer; font-weight: 600; font-size: 15px; }
.faq details p { color: var(--muted); margin: 10px 0 0; font-size: 14px; }

/* marketing footer */
.mk-footer { background: var(--bg-2); border-top: 1px solid var(--border); padding: 40px 0; text-align: center; color: var(--muted); font-size: 13px; }
.mk-footer .links { display: flex; gap: 18px; justify-content: center; flex-wrap: wrap; margin-bottom: 14px; }
.mk-footer a { color: var(--muted); }
.mk-footer a:hover { color: var(--text); }

/* ---- first-run onboarding stepper (#/onboarding, spec/19 §2 K1) ---- */
.auth-wrap { min-height: calc(100vh - 220px); display: grid; place-items: center; }
.auth-card { width: 100%; max-width: 400px; text-align: center; }
.auth-card .mark { width: 48px; height: 48px; margin: 0 auto 14px; display: block; }
.auth-card h1 { font-size: 24px; margin-bottom: 6px; }
.auth-card .sub { margin-bottom: 22px; }
.auth-card .consent { display: flex; gap: 9px; align-items: flex-start; text-align: left; font-weight: 400; font-size: 13px; color: var(--muted); margin-top: 16px; }
.auth-card .consent input { width: auto; margin-top: 2px; flex: none; }
.auth-card .btn.grad, .auth-card button { width: 100%; margin-top: 18px; }
.auth-card .fine { font-size: 12px; color: var(--muted); margin-top: 16px; }

.stepper { display: flex; align-items: center; margin: 6px 0 24px; }
.stepper .snode { display: flex; align-items: center; gap: 9px; }
.stepper .sdot {
  width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  font-weight: 700; font-size: 13px; background: var(--panel-2); border: 1px solid var(--border); color: var(--muted);
  transition: background var(--dur-1) var(--ease), color var(--dur-1) var(--ease);
}
.stepper .snode.active .sdot { background: var(--brand-grad); color: #fff; border-color: transparent; }
.stepper .snode.done .sdot { background: var(--ok); color: #fff; border-color: transparent; }
.stepper .slabel { font-size: 13px; color: var(--muted); }
.stepper .snode.active .slabel, .stepper .snode.done .slabel { color: var(--text); }
.stepper .sline { flex: 1; height: 2px; background: var(--border); margin: 0 12px; min-width: 16px; }
.stepper .sline.done { background: var(--ok); }
.step-panel { position: relative; }
.step-panel .badge-done { color: var(--ok); font-size: 12.5px; font-weight: 600; }
.welcome-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
@media (max-width: 560px) { .stepper .slabel { display: none; } }
@media (prefers-reduced-motion: reduce) { .stepper .sdot { transition: none; } }

/* ---- scroll-reveal + flow animations (opt-out under reduced motion) ---- */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity var(--dur-2) var(--ease), transform var(--dur-2) var(--ease); }
.reveal.in { opacity: 1; transform: none; }

/* NFC ripple used in hero + step 2 */
.ripple circle { transform-origin: center; }
@keyframes ripple { 0% { r: 6; opacity: .9; } 100% { r: 34; opacity: 0; } }
@keyframes ctrtick { 0%, 40% { opacity: 1; } 50%, 90% { opacity: 0; } 100% { opacity: 1; } }
@keyframes checkdraw { to { stroke-dashoffset: 0; } }
@keyframes floaty { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
.anim-ripple circle { animation: ripple 2.4s var(--ease) infinite; }
.anim-ripple circle:nth-child(2) { animation-delay: .8s; }
.anim-ripple circle:nth-child(3) { animation-delay: 1.6s; }
.anim-check path { stroke-dasharray: 40; stroke-dashoffset: 40; animation: checkdraw 1s var(--ease) .3s forwards; }
.anim-float { animation: floaty 3s var(--ease) infinite; }
.anim-ctr { animation: ctrtick 2.4s steps(1) infinite; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .anim-ripple circle, .anim-check path, .anim-float, .anim-ctr { animation: none; }
  .anim-check path { stroke-dashoffset: 0; }
}

/* ==========================================================================
   Technical lifecycle sequence diagram (#lifecycle) + use-case cards.
   spec/06 §6.1 (content/semantics) · spec/15 §5.2/§5.4/§7.1 (render/motion).
   Self-contained, no external assets; reused verbatim in /docs by J2.
   ========================================================================== */

/* screen-reader-only text alternative (WCAG 2.2 AA, spec/15 R7) */
.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;
}

.lifecycle-fig { margin: 40px auto 0; max-width: 860px; }
.seq-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 6px; }
.seq-svg { display: block; width: 100%; min-width: 680px; height: auto; }
.seq-svg text { font: 11px/1.2 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }

/* everything in the diagram is fully legible statically; motion only highlights
   the provision → tap → verify progression (turned off under reduced-motion). */
@keyframes seqband { 0%, 4% { stroke-opacity: .95; } 24%, 100% { stroke-opacity: .18; } }
@keyframes seqdot  { 0% { transform: translateX(0); opacity: 0; } 12% { opacity: 1; } 78% { opacity: 1; } 100% { transform: translateX(var(--sd, 0)); opacity: 0; } }
.seq-band { stroke-opacity: .18; animation: seqband 6.6s var(--ease) infinite; }
.seq-band.p2 { animation-delay: 2.2s; }
.seq-band.p3 { animation-delay: 4.4s; }
.seq-dot { animation: seqdot 6.6s var(--ease) infinite; }
.seq-dot.d2 { animation-delay: 2.2s; }
.seq-dot.d3 { animation-delay: 4.4s; }

@media (prefers-reduced-motion: reduce) {
  .seq-band { stroke-opacity: .5; animation: none; }
  .seq-dot { display: none; }
}

/* use-case cards (spec/06 §6.2) */
.use-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.usecase { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; display: flex; flex-direction: column; }
.usecase .ico { width: 30px; height: 30px; color: var(--brand-3); margin-bottom: 12px; }
.usecase h3 { margin: 0 0 6px; font-size: 16px; }
.usecase p { margin: 0 0 18px; color: var(--muted); font-size: 14px; }
.usecase .play { margin-top: auto; font-weight: 600; font-size: 13.5px; display: inline-flex; align-items: center; gap: 9px; }
.usecase .soon { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); border: 1px solid var(--border); border-radius: 20px; padding: 1px 7px; }
@media (max-width: 720px) { .use-grid { grid-template-columns: 1fr; } }

/* ==========================================================================
   App shell pages — dashboard / billing / settings / analytics (H5, spec/15 §6)
   ========================================================================== */
nav { flex-wrap: wrap; }

/* plan badge (tier pill, brand-tinted) */
.plan-badge { display: inline-block; padding: 2px 11px; border-radius: 20px; font-size: 12px; font-weight: 700;
  letter-spacing: .02em; text-transform: capitalize; background: var(--brand-grad); color: #fff; }
.plan-badge.sandbox { background: var(--panel-2); color: var(--muted); border: 1px solid var(--border); }
.status-pill { font-size: 11.5px; }
.status-pill.active { color: var(--ok); border-color: var(--ok); }
.status-pill.past_due, .status-pill.canceled { color: var(--warn); border-color: var(--warn); }

/* quota meter */
.meter { height: 12px; border-radius: 20px; background: var(--panel-2); border: 1px solid var(--border); overflow: hidden; margin: 10px 0 6px; }
.meter-fill { height: 100%; width: 0; background: var(--brand-grad); border-radius: 20px; transition: width var(--dur-2) var(--ease); }
.meter-fill.near { background: linear-gradient(135deg, var(--warn), var(--danger)); }
.meter-label { display: flex; justify-content: space-between; font-size: 13px; }
.meter-label b { font-size: 15px; }

/* stat tiles (scans summary + analytics totals) */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.stat { background: var(--panel-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px 16px; }
.stat .num { font-size: 26px; font-weight: 800; letter-spacing: -.02em; }
.stat .lbl { color: var(--muted); font-size: 12.5px; text-transform: uppercase; letter-spacing: .04em; }
.stat.ok .num { color: var(--ok); }
.stat.bad .num { color: var(--danger); }
@media (max-width: 560px) { .stats { grid-template-columns: 1fr 1fr; } }

/* quick actions */
.qa { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.qa a { display: block; padding: 16px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--panel-2); color: var(--text); text-align: left; transition: border-color var(--dur-1) var(--ease), transform var(--dur-1) var(--ease); }
.qa a:hover { border-color: var(--accent); text-decoration: none; transform: translateY(-2px); }
.qa a .t { font-weight: 700; font-size: 14px; }
.qa a .d { color: var(--muted); font-size: 12.5px; margin-top: 2px; }

/* in-app plan grid (billing) — compact variant of marketing .plans */
.app-plans { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; align-items: stretch; }
.app-plan { background: var(--panel-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 16px; display: flex; flex-direction: column; }
.app-plan.current { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.app-plan .name { font-weight: 700; }
.app-plan .price { font-size: 24px; font-weight: 800; margin: 6px 0 2px; }
.app-plan .price small { font-size: 12px; font-weight: 500; color: var(--muted); }
.app-plan .cap { color: var(--muted); font-size: 12.5px; margin-bottom: 12px; }
.app-plan ul { list-style: none; padding: 0; margin: 0 0 14px; display: grid; gap: 6px; font-size: 12.5px; }
.app-plan li { padding-left: 18px; position: relative; }
.app-plan li::before { content: "✓"; position: absolute; left: 0; color: var(--ok); font-weight: 700; }
.app-plan .btn, .app-plan .cur { width: 100%; text-align: center; margin-top: auto; }
.app-plan .cur { color: var(--muted); font-size: 12.5px; padding: 9px 0; }
@media (max-width: 860px) { .app-plans { grid-template-columns: 1fr 1fr; } }
@media (max-width: 460px) { .app-plans { grid-template-columns: 1fr; } }

/* analytics: country bars + day sparkline (no chart lib, spec/15 §3) */
.bar-row { display: grid; grid-template-columns: 44px 1fr 52px; align-items: center; gap: 10px; margin: 7px 0; font-size: 13px; }
.bar-row .cc { font-weight: 700; }
.bar-track { height: 16px; background: var(--panel-2); border-radius: 6px; overflow: hidden; }
.bar-val { height: 100%; background: var(--brand-grad); border-radius: 6px; transition: width var(--dur-2) var(--ease); }
.bar-row .cnt { text-align: right; color: var(--muted); }
.spark { width: 100%; height: 80px; display: block; }
.spark rect { fill: var(--accent); transition: height var(--dur-1) var(--ease); }

/* settings: destructive DSAR zone */
.danger-zone { border-color: var(--danger); }
.danger-zone h2 { color: var(--danger); }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 6px 14px; font-size: 13.5px; margin: 4px 0; }
.kv .k { color: var(--muted); }

/* downloads: entitlement-gated asset catalog (spec/19 §4, K3) */
.assets { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; align-items: start; }
.card.asset { margin: 0; }
.card.asset h2 { font-size: 16px; }
.card.asset.locked { opacity: 0.86; }
.pill.warn { color: var(--warn); border-color: var(--warn); }
.upsell {
  margin-top: 12px; padding: 10px 12px; font-size: 13px; border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--warn) 10%, transparent); border: 1px solid var(--warn); color: var(--warn);
}
.upsell a { color: inherit; font-weight: 700; }
@media (max-width: 560px) { .assets { grid-template-columns: 1fr; } }

@media (prefers-reduced-motion: reduce) {
  .meter-fill, .bar-val, .spark rect, .qa a { transition: none; }
}

/* ==========================================================================
   Documentation portal (/docs) — spec/18 §2/§3, task J2.
   Shares the design-system tokens above; adds the docs layout (left nav,
   TOC rail, breadcrumbs), .doc-content typography, code copy-button, and the
   client search box. Reduced-motion-safe; no new color/type system.
   ========================================================================== */
.docs-layout {
  display: grid; grid-template-columns: 250px minmax(0, 1fr) 200px; gap: 36px;
  max-width: var(--maxw); margin: 0 auto; padding: 28px 28px 80px; align-items: start;
}
.docs-sidebar { position: sticky; top: 20px; align-self: start; max-height: calc(100vh - 40px); overflow-y: auto; }
.docs-nav-group { margin: 0 0 18px; }
.docs-nav-title { font-size: 12px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); margin: 0 0 6px; font-weight: 700; }
.docs-nav ul { list-style: none; margin: 0; padding: 0; }
.docs-nav li { margin: 1px 0; }
.docs-nav a { display: block; padding: 5px 10px; border-radius: var(--radius-sm); color: var(--muted); font-size: 14px; line-height: 1.35; }
.docs-nav a:hover { color: var(--text); background: var(--panel-2); text-decoration: none; }
.docs-nav a.active { color: var(--text); background: color-mix(in srgb, var(--accent) 16%, transparent); font-weight: 600; }

/* search box + client-side results dropdown */
.docs-search { position: relative; margin: 0 0 18px; }
.docs-search input { width: 100%; }
.docs-search-results {
  list-style: none; margin: 4px 0 0; padding: 4px; position: absolute; z-index: 20; left: 0; right: 0;
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow);
}
.docs-search-results li { margin: 0; }
.docs-search-results a { display: block; padding: 7px 10px; border-radius: var(--radius-sm); color: var(--text); font-size: 13.5px; }
.docs-search-results a:hover { background: var(--panel-2); text-decoration: none; }
.docs-search-results .empty { padding: 7px 10px; color: var(--muted); font-size: 13.5px; }

/* breadcrumbs */
.doc-breadcrumbs { font-size: 13px; color: var(--muted); margin: 0 0 18px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.doc-breadcrumbs .sep { color: var(--border); }
.doc-breadcrumbs a { color: var(--muted); }
.doc-breadcrumbs a:hover { color: var(--text); }
.doc-breadcrumbs [aria-current="page"] { color: var(--text); }

/* in-page TOC rail */
.doc-toc { position: sticky; top: 20px; align-self: start; font-size: 13px; max-height: calc(100vh - 40px); overflow-y: auto; }
.doc-toc-title { font-size: 12px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); margin: 0 0 6px; font-weight: 700; }
.doc-toc ul { list-style: none; margin: 0; padding: 0; }
.doc-toc a { display: block; padding: 3px 0; color: var(--muted); line-height: 1.35; border-left: 2px solid transparent; padding-left: 10px; }
.doc-toc a:hover { color: var(--text); text-decoration: none; border-left-color: var(--accent); }
.doc-toc .lvl-3 a { padding-left: 22px; font-size: 12.5px; }

/* article typography */
.doc-content { max-width: 760px; }
.doc-content h1 { font-size: 30px; margin: 0 0 14px; line-height: 1.2; }
.doc-content h2 { font-size: 22px; margin: 38px 0 10px; padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.doc-content h3 { font-size: 17px; margin: 26px 0 8px; }
.doc-content h4 { font-size: 15px; margin: 20px 0 6px; }
.doc-content p, .doc-content li { color: var(--text); line-height: 1.65; }
.doc-content p { margin: 12px 0; }
.doc-content ul, .doc-content ol { margin: 12px 0; padding-left: 24px; }
.doc-content li { margin: 4px 0; }
.doc-content a { color: var(--link); }
.doc-content hr { border: 0; border-top: 1px solid var(--border); margin: 28px 0; }
.doc-content :not(pre) > code {
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 5px;
  padding: 1px 5px; font-size: .88em; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
/* heading anchor links (appear on hover) */
.doc-content .anchor { margin-left: 8px; color: var(--muted); opacity: 0; text-decoration: none; font-weight: 400; transition: opacity var(--dur-1) var(--ease); }
.doc-content h1:hover .anchor, .doc-content h2:hover .anchor, .doc-content h3:hover .anchor, .doc-content h4:hover .anchor,
.doc-content .anchor:focus-visible { opacity: 1; }

/* fenced code + copy button */
.code-block { position: relative; margin: 16px 0; }
.code-block pre {
  background: var(--panel-2); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 14px 16px; overflow-x: auto; margin: 0;
}
.code-block pre code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; color: var(--text); line-height: 1.5;
}
.copy-btn {
  position: absolute; top: 8px; right: 8px; padding: 4px 10px; font-size: 12px;
  background: var(--panel); color: var(--muted); border: 1px solid var(--border); border-radius: var(--radius-sm); cursor: pointer;
}
.copy-btn:hover { color: var(--text); background: var(--bg-2); }

/* callouts (blockquotes with [!NOTE]/[!WARNING]/[!TIP]/[!IMPORTANT]) */
.doc-content .callout {
  margin: 16px 0; padding: 12px 16px; border-left: 3px solid var(--accent);
  background: var(--panel); border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.doc-content .callout p { margin: 6px 0; }
.doc-content .callout .callout-title { font-weight: 700; margin: 0 0 4px; }
.doc-content .callout.warning { border-left-color: var(--warn); }
.doc-content .callout.important { border-left-color: var(--danger); }
.doc-content .callout.tip { border-left-color: var(--ok); }

/* tables (scroll on narrow) */
.doc-content .table-scroll { overflow-x: auto; margin: 16px 0; }
.doc-content table { border-collapse: collapse; width: 100%; font-size: 14px; }
.doc-content th, .doc-content td { border: 1px solid var(--border); padding: 8px 11px; text-align: left; vertical-align: top; }
.doc-content th { background: var(--panel-2); font-weight: 600; }

/* mobile menu toggle (hidden on desktop) */
.docs-nav-toggle {
  display: none; margin: 14px 28px 0; padding: 8px 14px; font-size: 14px;
  background: var(--panel); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius-sm); cursor: pointer;
}

@media (max-width: 1080px) {
  .docs-layout { grid-template-columns: 230px minmax(0, 1fr); }
  .doc-toc { display: none; }
}
@media (max-width: 780px) {
  .docs-layout { display: block; padding: 0 20px 60px; }
  .docs-nav-toggle { display: inline-block; }
  .docs-sidebar { position: static; max-height: none; display: none; margin: 12px 0 20px; }
  .docs-sidebar.open { display: block; }
  .doc-content h1 { font-size: 25px; }
}

@media (prefers-reduced-motion: reduce) {
  .doc-content .anchor, .copy-btn { transition: none; }
}

/* Outbound webhooks (spec/17, N1/N2) — the #/webhooks dashboard view.
   Event subscription checkboxes must opt out of the global full-width input
   rule; the endpoint URL column truncates instead of stretching the table. */
.wh-events { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; }
.wh-ev { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 13px; color: var(--text); cursor: pointer; }
.wh-ev input[type="checkbox"] { width: auto; margin: 0; accent-color: var(--accent); cursor: pointer; }
.wh-url { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@media (max-width: 780px) {
  .wh-url { max-width: 160px; }
}

/* ==========================================================================
   Certified Blanks storefront (spec/22, Milestone O) — shared by the public
   page (/hardware) and the in-app view (/app#/hardware). Built from the
   existing plan-card component so the store and /pricing read as one product;
   adds no new colour or type system. Reduced-motion-safe, 320px→desktop.
   ========================================================================== */
.hw-hero { padding: 72px 0 56px; }

.hw-tiers { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; align-items: stretch; }
.hw-tier {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 24px 20px; display: flex; flex-direction: column; text-align: left;
}
.hw-tier.featured { border-color: var(--accent); box-shadow: var(--shadow); position: relative; }
.hw-tier.featured::after {
  content: "Most popular"; position: absolute; top: -11px; left: 50%; transform: translateX(-50%);
  background: var(--brand-grad); color: #fff; font-size: 11px; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; padding: 3px 12px; border-radius: 20px; white-space: nowrap;
}
.hw-tier .name { font-weight: 700; font-size: 16px; }
.hw-tier .pack { color: var(--muted); font-size: 13px; margin-top: 2px; }
.hw-tier .price { font-size: 34px; font-weight: 800; letter-spacing: -.02em; margin: 10px 0 0; }
.hw-tier .price small { font-size: 13px; font-weight: 500; color: var(--muted); }
.hw-tier .per-tag {
  display: inline-block; align-self: flex-start; margin: 8px 0 0; padding: 2px 10px;
  border-radius: 20px; font-size: 12.5px; font-weight: 700; color: var(--text);
  background: var(--panel-2); border: 1px solid var(--border);
}
.hw-tier .pitch { color: var(--muted); font-size: 13.5px; margin: 12px 0 14px; }
.hw-tier ul { list-style: none; padding: 0; margin: 0 0 20px; display: grid; gap: 8px; font-size: 13.5px; }
.hw-tier li { padding-left: 22px; position: relative; color: var(--text); }
.hw-tier li::before { content: "✓"; position: absolute; left: 0; color: var(--ok); font-weight: 700; }
.hw-tier .btn { width: 100%; text-align: center; margin-top: auto; }
.hw-tier .btn[disabled] { opacity: .6; cursor: progress; }

/* inline Buy Now error surface — never a dead button (spec/22 R5) */
.hw-msg:empty { display: none; }
.hw-msg { margin-top: 10px; }
.hw-err { display: block; color: var(--danger); font-size: 12.5px; line-height: 1.45; }

/* 2% allowance: a quiet guarantee line, never a warning banner (spec/22 §6 R4) */
.hw-allowance { text-align: center; color: var(--muted); font-size: 13px; margin: 26px auto 0; max-width: 660px; }
.hw-fine { text-align: center; color: var(--muted); font-size: 12.5px; margin: 10px auto 0; max-width: 660px; }
.hw-other { text-align: center; color: var(--muted); font-size: 13.5px; margin: 18px auto 0; }

.hw-why { grid-template-columns: repeat(2, 1fr); }
.hw-why .feat h3 { margin-top: 0; }
.hw-why .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .92em; }

.hw-trust { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.hw-trust > div {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px; display: flex; flex-direction: column; gap: 6px;
}
.hw-trust b { font-size: 14px; }
.hw-trust span { color: var(--muted); font-size: 13px; }

/* --- "Where to buy blanks" sourcing guide (the live /hardware, spec/16 status) ---
   The chip callout is the one thing a buyer cannot afford to miss: a non-424 chip
   has no SDM/SUN and no CMAC, so a wrong purchase can never be made to work. */
.hw-chip-warn {
  border: 1px solid var(--accent); border-left-width: 4px; border-radius: var(--radius);
  background: var(--panel); padding: 18px 20px; margin: 0 0 28px; display: grid; gap: 8px;
}
.hw-chip-warn .k { font-weight: 800; font-size: 17px; letter-spacing: -.01em; }
.hw-chip-warn p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.6; }
.hw-chip-warn .no { color: var(--danger); font-weight: 600; }
/* two recommended products instead of three tiers; the ≤900px 1fr rule below
   still wins on mobile because this override is scoped to wide viewports. */
@media (min-width: 901px) { .hw-tiers.two { grid-template-columns: repeat(2, 1fr); } }
.hw-source .name { font-size: 15px; line-height: 1.35; }
.hw-source .price { font-size: 28px; }
.hw-source .per-tag { font-weight: 500; }

/* in-app store view (#/hardware) + the dashboard "Need tags?" card */
.hw-app-note { color: var(--muted); font-size: 13px; margin: 0 0 18px; }
.hw-nudge .t { font-weight: 700; margin-bottom: 4px; }
.hw-nudge .d { color: var(--muted); font-size: 13.5px; }

@media (max-width: 900px) {
  .hw-tiers { grid-template-columns: 1fr; }
  .hw-trust { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  .hw-why { grid-template-columns: 1fr; }
  .hw-trust { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .hw-tier, .hw-trust > div { transition: none; }
}

/* ==========================================================================
   PHONE LAYOUT (spec/15 §5.1) — last block in the sheet on purpose: every rule
   here is a same-specificity override of a base rule defined above, so source
   order alone decides. Three jobs:
     1. collapse the marketing nav into an accessible disclosure "hamburger"
     2. keep the sticky header under 64px (it was 395px — half the viewport)
     3. tighten the vertical rhythm, gutters and grids so nothing is ragged,
        oversized or overflowing between 320px and the 768px breakpoint.
   ========================================================================== */

/* ---- 1. disclosure nav ---------------------------------------------------
   Semantics live on the <button aria-expanded aria-controls> + nav.js; this is
   purely the presentation, driven by header[data-nav-open]. The .js gate means
   a script-less render never shows an inert toggle — it keeps the plain nav. */
@media (max-width: 768px) {
  .js .mk-navtoggle {
    display: inline-flex; align-items: center; justify-content: center; flex: none;
    width: 40px; height: 40px; padding: 0; margin-right: -6px;
    background: transparent; color: var(--text);
    border: 1px solid transparent; border-radius: var(--radius-sm);
  }
  .js .mk-navtoggle:hover { background: var(--panel-2); border-color: var(--border); }
  .js .mk-navtoggle svg { width: 22px; height: 22px; display: block; }
  .js .mk-navtoggle .ico-close,
  .js .mk-navtoggle[aria-expanded="true"] .ico-menu { display: none; }
  .js .mk-navtoggle[aria-expanded="true"] .ico-close { display: block; }
  .js .mk-navtoggle[aria-expanded="true"] { background: var(--panel-2); border-color: var(--border); }

  /* the panel: full-bleed under the sticky bar. visibility:hidden (not just
     opacity) so the links are removed from the tab order while collapsed —
     which is also why no focus trap is needed. */
  .js .mk-header nav {
    position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; justify-content: flex-start; gap: 2px;
    padding: 8px 12px 12px;
    background: var(--panel); border-bottom: 1px solid var(--border); box-shadow: var(--shadow);
    max-height: calc(100vh - 64px); overflow-y: auto; overscroll-behavior: contain;
    opacity: 0; visibility: hidden; transform: translateY(-6px);
    transition: opacity var(--dur-1) var(--ease), transform var(--dur-1) var(--ease),
                visibility 0s linear var(--dur-1);
  }
  /* visibility flips with no delay on the way OPEN so the first link is
     focusable in the same tick nav.js opens the panel; on the way closed it is
     delayed by --dur-1 above so the fade-out is actually seen. */
  .js .mk-header[data-nav-open="true"] nav {
    opacity: 1; visibility: visible; transform: none;
    transition: opacity var(--dur-1) var(--ease), transform var(--dur-1) var(--ease), visibility 0s;
  }
  .js .mk-header nav a { padding: 11px 12px; font-size: 15px; color: var(--text); }
  .js .mk-header .mk-nav-signin {
    display: block; margin-top: 6px; padding-top: 15px;
    border-top: 1px solid var(--border); border-radius: 0; color: var(--muted);
  }
  /* one "Sign in" at a time: the panel owns it on phones, .actions on desktop */
  .js .mk-header .actions .mk-signin { display: none; }
}
/* Reduced motion: the panel appears and disappears instantly. Both states need
   the override — the open rule carries its own (higher-specificity) transition,
   so a single `.js .mk-header nav` reset would not reach it. */
@media (max-width: 768px) and (prefers-reduced-motion: reduce) {
  .js .mk-header nav,
  .js .mk-header[data-nav-open="true"] nav { transition: none; }
}

/* ---- 2. the sticky bar itself: 40px control row + 8px padding + 1px rule --- */
@media (max-width: 768px) {
  .mk-header { padding: 8px 16px; gap: 10px; }
  .mk-header .brand { font-size: 15.5px; gap: 8px; }
  .mk-header .logo { width: 24px; height: 24px; }
  .mk-header .actions { margin-left: auto; gap: 8px; }
}

/* ---- 3. rhythm, gutters, grids ------------------------------------------- */
@media (max-width: 768px) {
  .mk-wrap { padding: 0 20px; }
  .mk-section { padding: 56px 0; }
  .mk-section .lead { font-size: 15px; margin-bottom: 28px; }

  .hero { padding: 44px 0 52px; }
  .hero h1 { font-size: clamp(28px, 8.4vw, 40px); max-width: 15ch; margin: 12px auto 14px; }
  .hero p.tag { font-size: 16px; margin-bottom: 26px; }
  /* full-width, equal-width stacked CTAs — they were 186px vs 161px and read
     as mis-centred against each other */
  .hero .cta { flex-direction: column; align-items: stretch; gap: 10px; }
  .hero .cta .btn { width: 100%; }
  .hero .trust { margin-top: 18px; }
  .hero-art { margin-top: 28px; }

  .hw-hero { padding: 36px 0 40px; }

  /* stacked cards: give the "Most popular" ribbon room to clear the card above */
  .plans, .hw-tiers { gap: 22px; }
  .plan, .hw-tier, .usecase, .feat { padding: 20px 18px; }
  .plan .price, .hw-tier .price { font-size: 30px; }
  .license-note { margin-top: 20px; font-size: 13.5px; }

  figure.lifecycle-fig { margin-top: 26px; }
  .lc-kicker { margin-top: 14px; }

  .faq details { padding: 13px 16px; }
  .faq summary { font-size: 14.5px; }

  .mk-footer { padding: 32px 0; }
}

@media (max-width: 560px) {
  .mk-section { padding: 48px 0; }
  /* the footer link list wrapped into a ragged 3-row centred blob; a two-column
     grid gives it real alignment and 32px tap rows */
  .mk-footer .links {
    display: grid; grid-template-columns: 1fr 1fr; gap: 2px 16px;
    text-align: left; margin-bottom: 18px;
  }
  .mk-footer .links a { padding: 6px 0; }
}

/* 320–360px only (below the 375px iPhone class): the last few points of
   breathing room, and pull the bleeding lifecycle stage back inside the
   narrower gutter so it does not sit flush to the screen edge. */
@media (max-width: 360px) {
  .mk-wrap { padding: 0 16px; }
  .mk-header { padding: 8px 12px; }
  .mk-header .brand { font-size: 15px; }
  .lifecycle-fig .lc-stage { margin-left: -6px; margin-right: -6px; }
  .plan, .hw-tier, .usecase, .feat, .step { padding: 18px 16px; }
}

/* app shell (app.html) header/main are separate from .mk-header but shared the
   same over-generous desktop padding on phones. */
@media (max-width: 560px) {
  header { padding: 10px 16px; gap: 10px; }
  main { padding: 20px 16px; }
  footer { padding: 14px 16px; }
}

/* ==========================================================================
   P0.4/P0.7 — sitewide footer columns (spec/25 §6). The footer is the crawl
   backbone: every public route is linked here, so it is a real 5-column list
   rather than a single wrapped row. Collapses to 2 columns on phones and 1
   below 400px; the old single-row `.links` rule is left intact for any page
   that has not adopted the columns yet.
   ========================================================================== */
.mk-footer .foot-cols {
  /* six columns since Milestone S added the Developer tools group (spec/26 §5) */
  display: grid; grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 28px 20px; text-align: left; margin-bottom: 28px;
}
.mk-footer .foot-col { min-width: 0; display: flex; flex-direction: column; gap: 7px; }
.mk-footer .foot-col h2 {
  font-size: 12px; text-transform: uppercase; letter-spacing: .1em;
  color: var(--text); margin: 0 0 4px; font-weight: 700;
}
.mk-footer .foot-col a { font-size: 13px; line-height: 1.45; overflow-wrap: anywhere; }
.mk-footer .foot-base {
  display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; justify-content: space-between;
  border-top: 1px solid var(--border); padding-top: 18px; text-align: left;
}

/* ==========================================================================
   P0.2 — public /demo (spec/06 §7.1). Runs the WASM core client-side; the
   styling exists to make the accept/reject verdict unmissable, since that
   contrast IS the product demonstration.
   ========================================================================== */
.demo-hero { padding: 80px 0 44px; }
.demo-privacy {
  max-width: 62ch; margin: 26px auto 0; padding: 12px 16px; font-size: 14px; color: var(--muted);
  border: 1px solid var(--border); border-left: 3px solid var(--brand-3);
  border-radius: var(--radius-sm); background: var(--panel); text-align: left;
}
.demo-privacy b { color: var(--text); }

.demo-panel { margin-bottom: 26px; }
.demo-controls { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.demo-ident {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px 24px; margin-top: 16px;
}
.demo-ident .k { display: block; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.demo-ident .mono { overflow-wrap: anywhere; color: var(--text); }
.demo-status { margin: 14px 0 0; color: var(--muted); font-size: 14px; }
.demo-status .err { color: var(--danger); }

.demo-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.demo-step {
  border: 1px solid var(--border); border-left: 3px solid var(--border);
  border-radius: var(--radius); background: var(--panel); padding: 18px 20px;
  transition: border-color var(--dur-1) var(--ease);
}
.demo-step.ok { border-left-color: var(--ok); }
.demo-step.bad { border-left-color: var(--danger); }
.demo-step .head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.demo-step .head h3 { margin: 0; font-size: 17px; flex: 1; min-width: 0; }
.demo-step .n {
  display: grid; place-items: center; width: 26px; height: 26px; flex: none; border-radius: 50%;
  background: var(--panel-2); border: 1px solid var(--border); font-size: 13px; font-weight: 700;
}
.demo-step .badge {
  flex: none; font-size: 11.5px; text-transform: uppercase; letter-spacing: .08em;
  padding: 2px 10px; border-radius: 20px; border: 1px solid var(--border); color: var(--muted);
}
.demo-step .badge.ok { color: var(--ok); border-color: var(--ok); }
.demo-step .badge.bad { color: var(--danger); border-color: var(--danger); }
.demo-step .note { color: var(--muted); font-size: 14px; margin: 10px 0 0; }
.demo-step .body:not(:empty) { margin-top: 14px; }
.demo-step label {
  display: block; font-size: 12px; color: var(--muted); text-transform: uppercase;
  letter-spacing: .08em; margin: 12px 0 5px;
}
.demo-url, .demo-json {
  background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 10px 12px; overflow-wrap: anywhere; margin: 0;
}
.demo-json { white-space: pre-wrap; }
.demo-step .why { margin: 12px 0 0; font-size: 14px; }
.demo-step.ok .why { color: var(--ok); }
.demo-step.bad .why { color: var(--danger); }

.demo-after { margin-top: 36px; text-align: center; }
.demo-after h3 { font-size: 20px; margin: 0 0 14px; }
.demo-after ul { list-style: none; padding: 0; margin: 0 auto 26px; max-width: 62ch; text-align: left; }
.demo-after li { color: var(--muted); font-size: 15px; padding: 8px 0 8px 26px; position: relative; }
.demo-after li b { color: var(--text); }
.demo-after li::before { content: "✓"; position: absolute; left: 0; color: var(--ok); font-weight: 700; }
.demo-after .cta { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.demo-after .trust { margin-top: 18px; color: var(--muted); font-size: 13px; }
.demo-scope { margin: 32px auto 0; max-width: 62ch; text-align: center; color: var(--muted); font-size: 13px; }

/* ==========================================================================
   P0.5 — enterprise lead form (spec/06 §7.3). Posts to the existing sanitized,
   rate-limited, Turnstile-gated support pipeline; no mailto: anywhere.
   ========================================================================== */
.ent-block { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 32px; align-items: start; }
.ent-copy h2, .ent-copy h3 { text-align: left; }
.ent-copy ul { list-style: none; padding: 0; margin: 16px 0 0; }
.ent-copy li { color: var(--muted); font-size: 15px; padding: 7px 0 7px 26px; position: relative; }
.ent-copy li b { color: var(--text); }
.ent-copy li::before { content: "→"; position: absolute; left: 0; color: var(--brand-3); }
.ent-form { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px 24px; }
.ent-form h3 { margin: 0 0 4px; font-size: 18px; }
.ent-form .sub { color: var(--muted); font-size: 14px; margin: 0 0 14px; }
.ent-form label { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 5px; }
.ent-form input, .ent-form select, .ent-form textarea {
  width: 100%; padding: 10px 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--bg-2); color: var(--text);
  font: inherit; font-size: 14px;
}
.ent-form textarea { min-height: 96px; resize: vertical; }
.ent-form .btn { width: 100%; margin-top: 18px; text-align: center; }
.ent-form .fine { color: var(--muted); font-size: 12px; margin: 12px 0 0; }
/* honeypot: off-screen and hidden from AT, so no human ever fills it (src/support.ts) */
.ent-hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.ent-msg { margin-top: 14px; }
.ent-msg .banner { margin: 0; }

@media (max-width: 900px) {
  .ent-block { grid-template-columns: 1fr; gap: 24px; }
}
@media (max-width: 980px) {
  .mk-footer .foot-cols { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 768px) {
  .demo-hero { padding: 40px 0 32px; }
  .demo-privacy { margin-top: 20px; font-size: 13.5px; }
  .demo-panel, .demo-step { padding: 18px 16px; }
  .demo-controls .btn { width: 100%; text-align: center; }
  .demo-after .cta { flex-direction: column; align-items: stretch; }
  .demo-after .cta .btn { width: 100%; text-align: center; }
  .ent-form { padding: 18px 16px; }
}
@media (max-width: 620px) {
  .mk-footer .foot-cols { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px 18px; }
  .mk-footer .foot-base { justify-content: flex-start; }
}
@media (max-width: 400px) {
  .mk-footer .foot-cols { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .demo-step { transition: none; }
}

/* ==========================================================================
   P0.6 — value-prop callouts (spec/06 §7.4). Two claims, both traceable:
   "unlimited scans" to spec/13 §2.1 (billing is on active tags), and the
   $749 perpetual on-premise licence to spec/13 §2.2 + spec/10 (key custody).
   ========================================================================== */
.hero-callout {
  display: inline-block; margin: 0 auto 26px; padding: 10px 18px; max-width: 60ch;
  border: 1px solid color-mix(in srgb, var(--brand-3) 45%, var(--border));
  border-radius: 999px; background: color-mix(in srgb, var(--brand-2) 12%, transparent);
  color: var(--muted); font-size: 14.5px;
}
.hero-callout b { color: var(--text); }

/* every pricing card carries the claim, not just the hero */
.plan-uncapped {
  margin: 10px 0 0; padding: 6px 10px; border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--brand-2) 14%, transparent);
  color: var(--text); font-size: 12.5px; font-weight: 600; text-align: center;
}

.edge-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px; }
.edge-card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 22px; }
.edge-card h3 { margin: 0 0 8px; font-size: 16px; }
.edge-card p { margin: 0; color: var(--muted); font-size: 14px; }
.edge-cta { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; margin-top: 28px; }

@media (max-width: 768px) {
  .hero-callout { border-radius: var(--radius); font-size: 13.5px; padding: 10px 14px; margin-bottom: 20px; }
  .edge-card { padding: 18px 16px; }
  .edge-cta { flex-direction: column; align-items: stretch; }
  .edge-cta .btn { width: 100%; text-align: center; }
}

/* ==========================================================================
   Milestone S — the free, public developer tools (spec/26): /tools/sun-decoder
   and /tools/an10922. Shared component set; everything below is layout only —
   the crypto lives in the WASM core and the logic in /tools-core.js.

   Discipline that matters here: these pages render arbitrary pasted hex, so
   every value container wraps (overflow-wrap: anywhere) and the one real table
   scrolls inside its own box. Nothing may push the page sideways on a phone.
   ========================================================================== */
.tool-panel { margin-bottom: 26px; }
.tool-label { display: block; font-size: 12px; color: var(--muted); text-transform: uppercase;
  letter-spacing: .08em; margin: 16px 0 6px; font-weight: 700; }
.tool-panel > .tool-label:first-child { margin-top: 0; }
.tool-input, .tool-panel input[type="text"], .tool-panel input[type="password"], .tool-panel select {
  width: 100%; max-width: 100%; padding: 10px 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--bg-2); color: var(--text);
  font: inherit; font-size: 14px;
}
.tool-input { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 13px;
  resize: vertical; overflow-wrap: anywhere; }
.tool-panel .mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; }
.tool-secret { display: flex; gap: 8px; align-items: stretch; }
.tool-secret input { flex: 1; min-width: 0; }
.tool-secret .btn { flex: none; }
.tool-examples { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 12px; }
.tool-examples-label { font-size: 12.5px; color: var(--muted); }
.tool-advanced { margin-top: 18px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 12px 14px; background: var(--bg-2); }
.tool-advanced summary { cursor: pointer; font-weight: 600; font-size: 14.5px; }
.tool-advanced[open] summary { margin-bottom: 6px; }
.tool-warn { margin: 12px 0 0; padding: 10px 12px; border-radius: var(--radius-sm); font-size: 13px;
  background: color-mix(in srgb, var(--warn) 12%, transparent);
  border: 1px solid var(--warn); color: var(--text); }
.tool-warn b { color: var(--warn); }
.tool-fine { color: var(--muted); font-size: 12.5px; margin: 12px 0 0; }
.tool-modes { border: 0; padding: 0; margin: 16px 0 0; }
.tool-modes legend { padding: 0; }
.tool-radio { display: flex; gap: 9px; align-items: baseline; font-size: 14px; margin: 6px 0; }
.tool-radio input { width: auto; flex: none; accent-color: var(--accent); }
.tool-controls { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin-top: 20px; }

/* --- results ------------------------------------------------------------- */
.tool-out { display: block; }
.tool-out:empty { display: none; }
.tool-mode { display: flex; gap: 12px; align-items: baseline; flex-wrap: wrap;
  border-left: 3px solid var(--border); padding: 10px 14px; border-radius: var(--radius-sm);
  background: var(--panel); margin-bottom: 12px; }
.tool-mode.ok { border-left-color: var(--ok); }
.tool-mode.bad { border-left-color: var(--danger); }
.tool-mode-k { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.tool-issues { list-style: none; padding: 0; margin: 0 0 14px; display: grid; gap: 6px; }
.tool-issues li { font-size: 13.5px; padding: 9px 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--panel); overflow-wrap: anywhere; }
.tool-issues li.bad { border-color: var(--danger); }
.tool-issues li.bad b { color: var(--danger); }
.tool-issues li.warn { border-color: var(--warn); }
.tool-issues li.warn b { color: var(--warn); }
.tool-issues li.info b { color: var(--brand-3); }
.tool-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 0 16px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); }
.tool-table { border-collapse: collapse; width: 100%; font-size: 13px; }
.tool-table th, .tool-table td { padding: 8px 11px; text-align: left; vertical-align: top;
  border-bottom: 1px solid var(--border); }
.tool-table th { background: var(--panel-2); font-weight: 600; white-space: nowrap; }
.tool-table tr:last-child td { border-bottom: 0; }
.tool-table tr.bad td:first-child { color: var(--danger); }
.tool-table tr.muted td { color: var(--muted); }
.tool-cards { display: grid; gap: 14px; margin-bottom: 16px; }
.tool-card { background: var(--panel); border: 1px solid var(--border);
  border-left: 3px solid var(--border); border-radius: var(--radius); padding: 18px 20px; }
.tool-card.ok { border-left-color: var(--ok); }
.tool-card.bad { border-left-color: var(--danger); }
.tool-card h3 { margin: 0 0 10px; font-size: 16px; }
.tool-kv { display: grid; grid-template-columns: minmax(120px, 210px) minmax(0, 1fr);
  gap: 8px 16px; margin: 0; font-size: 13.5px; }
.tool-kv dt { color: var(--muted); }
.tool-kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.tool-note { color: var(--muted); font-size: 13px; margin: 12px 0 0; }
.tool-verdict { font-size: 13.5px; margin: 12px 0 0; padding: 10px 12px;
  border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--bg-2); }
.tool-verdict.warn { border-color: var(--warn); }
.tool-verdict.bad { border-color: var(--danger); color: var(--danger); }
.tool-key { display: block; font-size: 15px; font-weight: 700; letter-spacing: .04em;
  overflow-wrap: anywhere; color: var(--text); }
.tool-wrap { overflow-wrap: anywhere; }
.tool-out .ok, .tool-card .ok { color: var(--ok); }
.tool-out .bad, .tool-card .bad { color: var(--danger); }

/* --- static reference blocks --------------------------------------------- */
.tool-steps { max-width: 74ch; margin: 0 auto; padding-left: 22px; display: grid; gap: 10px; }
.tool-steps li { color: var(--muted); font-size: 15px; line-height: 1.6; }
.tool-steps li b { color: var(--text); }
.tool-callout { max-width: 74ch; margin: 24px auto 0; padding: 16px 20px;
  border: 1px solid var(--border); border-left: 3px solid var(--brand-3);
  border-radius: var(--radius); background: var(--panel); }
.tool-callout.warn { border-left-color: var(--warn); }
.tool-callout p { margin: 0 0 10px; color: var(--muted); font-size: 14.5px; line-height: 1.6; }
.tool-callout p:last-child { margin-bottom: 0; }
.tool-callout b { color: var(--text); }

@media (max-width: 768px) {
  .tool-panel { padding: 18px 16px; }
  .tool-card { padding: 16px; }
  .tool-kv { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .tool-kv dd { margin-bottom: 8px; }
  .tool-controls .btn { width: 100%; text-align: center; }
  .tool-callout { padding: 14px 16px; }
  .tool-steps { padding-left: 18px; }
}

/* ==========================================================================
   T6 — team management (#/team) + the APP-SHELL header on phones.
   Last block in the sheet, for the same reason the phone-layout block above it
   is: every rule here is a same-specificity override of a base rule defined
   earlier, so source order alone decides. Everything is scoped to
   `.app-header` / `#nav` / `.team-*`, so none of it can reach `.mk-header`.
   ========================================================================== */

/* small print + inline checkbox inside a normal card — the auth-card and
   ent-form variants of these already exist, scoped to those two components. */
.card .fine { color: var(--muted); font-size: 12px; line-height: 1.55; margin: 12px 0 0; }
.card .consent { display: flex; gap: 9px; align-items: flex-start; font-size: 13px; color: var(--muted); }
.card .consent input { width: auto; margin-top: 3px; flex: none; }

/* a table of email addresses is the one thing guaranteed to be wider than a
   phone, so it scrolls inside its card instead of pushing the page sideways. */
.tbl-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.team-actions { white-space: nowrap; }
.team-actions .btn, .team-actions button { margin-right: 6px; }
.tbl-scroll select { width: auto; min-width: 130px; padding: 5px 8px; font-size: 13px; }

/* the disclosure control: hidden on desktop, where the links are simply there */
.app-navtoggle { display: none; }
.nav-email { display: none; }

@media (max-width: 768px) {
  /* 8px + 40px control row + 8px + 1px rule = 57px, inside the ≤64px budget */
  .app-header { padding: 8px 16px; gap: 10px; position: sticky; }
  .app-header .brand { font-size: 15.5px; gap: 8px; }
  .app-header .logo { width: 24px; height: 24px; }
  .app-header #authbox { margin-left: auto; flex: none; }
  /* the address moves into the panel (.nav-email); exactly one copy renders */
  .app-header #authbox .authbox-email { display: none; }

  .app-navtoggle {
    display: inline-flex; align-items: center; justify-content: center; flex: none;
    width: 40px; height: 40px; padding: 0; margin-right: -6px;
    background: transparent; color: var(--text);
    border: 1px solid transparent; border-radius: var(--radius-sm);
  }
  .app-navtoggle:hover { background: var(--panel-2); border-color: transparent; }
  .app-navtoggle svg { width: 22px; height: 22px; display: block; }
  .app-navtoggle .ico-close,
  .app-navtoggle[aria-expanded="true"] .ico-menu { display: none; }
  .app-navtoggle[aria-expanded="true"] .ico-close { display: block; }
  .app-navtoggle[aria-expanded="true"] { background: var(--panel-2); border-color: var(--border); }

  /* the panel. visibility (not just opacity) so the links leave the tab order
     while collapsed — which is why this disclosure needs no focus trap. */
  .app-header #nav {
    position: absolute; top: 100%; left: 0; right: 0; width: auto; order: 0;
    flex-direction: column; gap: 2px; padding: 8px 12px 12px;
    background: var(--panel); border-bottom: 1px solid var(--border); box-shadow: var(--shadow);
    max-height: calc(100vh - 64px); overflow-y: auto; overscroll-behavior: contain;
    opacity: 0; visibility: hidden; transform: translateY(-6px);
    transition: opacity var(--dur-1) var(--ease), transform var(--dur-1) var(--ease),
                visibility 0s linear var(--dur-1);
  }
  /* visibility flips with no delay on the way OPEN so the first link is
     focusable in the same tick the panel opens; closing keeps the delay so the
     fade-out is actually seen. */
  .app-header[data-nav-open="true"] #nav {
    opacity: 1; visibility: visible; transform: none;
    transition: opacity var(--dur-1) var(--ease), transform var(--dur-1) var(--ease), visibility 0s;
  }
  .app-header #nav a { padding: 11px 12px; font-size: 15px; color: var(--text); }
  .app-header #nav .nav-email {
    display: block; padding: 4px 12px 10px; margin-bottom: 4px;
    border-bottom: 1px solid var(--border); font-size: 13px; overflow-wrap: anywhere;
  }
}
@media (max-width: 768px) and (prefers-reduced-motion: reduce) {
  .app-header #nav,
  .app-header[data-nav-open="true"] #nav { transition: none; }
}
