/* ─────────────────────────────────────────────
     Tokens — 主色沿用 beleader.com.tw (#046bd2)
     中性色带蓝偏移；语意色独立于主色
     ───────────────────────────────────────────── */
  :root {
    --brand:       #046bd2;
    --brand-deep:  #045cb4;
    --brand-wash:  #eaf2fc;

    --ink:         #10151d;
    --ink-2:       #3b4757;
    --muted:       #5c6b80;
    --line:        #e2e8f1;
    --line-2:      #ccd6e4;
    --surface:     #ffffff;
    --surface-2:   #f6f8fb;
    --ground:      #eef2f7;

    --ok:          #067a51;
    --ok-wash:     #e7f5ef;
    --warn:        #a35a00;
    --warn-wash:   #fdf2e3;
    --bad:         #c02b2b;
    --bad-wash:    #fdecec;

    --shadow: 0 1px 2px rgba(16,21,29,.05), 0 8px 24px -12px rgba(16,21,29,.18);
    --radius: 14px;

    --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI",
            "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;

    color-scheme: light;
  }

  @media (prefers-color-scheme: dark) {
    :root {
      --brand:      #4d9ff2;
      --brand-deep: #7bb8f7;
      --brand-wash: #142639;

      --ink:        #e9eef6;
      --ink-2:      #b6c2d2;
      --muted:      #8c9bb0;
      --line:       #232c3a;
      --line-2:     #334052;
      --surface:    #141a24;
      --surface-2:  #10151d;
      --ground:     #0b0f15;

      --ok:         #3fbe8b;
      --ok-wash:    #10281f;
      --warn:       #e0994a;
      --warn-wash:  #2b2013;
      --bad:        #f0736f;
      --bad-wash:   #2e1618;

      --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px -12px rgba(0,0,0,.7);
      color-scheme: dark;
    }
  }

  :root[data-theme="dark"] {
    --brand:#4d9ff2; --brand-deep:#7bb8f7; --brand-wash:#142639;
    --ink:#e9eef6; --ink-2:#b6c2d2; --muted:#8c9bb0;
    --line:#232c3a; --line-2:#334052;
    --surface:#141a24; --surface-2:#10151d; --ground:#0b0f15;
    --ok:#3fbe8b; --ok-wash:#10281f; --warn:#e0994a; --warn-wash:#2b2013;
    --bad:#f0736f; --bad-wash:#2e1618;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px -12px rgba(0,0,0,.7);
    color-scheme: dark;
  }
  :root[data-theme="light"] {
    --brand:#046bd2; --brand-deep:#045cb4; --brand-wash:#eaf2fc;
    --ink:#10151d; --ink-2:#3b4757; --muted:#5c6b80;
    --line:#e2e8f1; --line-2:#ccd6e4;
    --surface:#ffffff; --surface-2:#f6f8fb; --ground:#eef2f7;
    --ok:#067a51; --ok-wash:#e7f5ef; --warn:#a35a00; --warn-wash:#fdf2e3;
    --bad:#c02b2b; --bad-wash:#fdecec;
    --shadow: 0 1px 2px rgba(16,21,29,.05), 0 8px 24px -12px rgba(16,21,29,.18);
    color-scheme: light;
  }

  * { box-sizing: border-box; }

  /* hidden 属性必须永远赢过元件自己的 display。
     .msg{display:flex} 与 UA 的 [hidden]{display:none} 特异性同分，
     后载入者胜 → 信息藏不掉。这行是那场争议的裁决。 */
  [hidden] { display: none !important; }

  body {
    margin: 0;
    font-family: var(--font);
    background: var(--ground);
    color: var(--ink);
    -webkit-font-smoothing: antialiased;
    line-height: 1.6;
  }

  /* ── Progress rail ───────────────────────── */
  .rail-wrap {
    position: sticky; top: 0; z-index: 20;
    background: color-mix(in srgb, var(--ground) 88%, transparent);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 1px solid var(--line);
  }
  .rail {
    max-width: 660px; margin: 0 auto; padding: 14px 20px 12px;
    display: flex; flex-direction: column; gap: 10px;
  }
  .rail-top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
  /* 右侧维持原本的基线对齐，只让按钮自己置中 —— 不动既有的字排版 */
  .rail-right { display: flex; align-items: baseline; gap: 11px; }

  /* ── 外观切换 ─────────────────────────── */
  .theme { position: relative; align-self: center; }
  .theme-btn {
    display: grid; place-items: center; width: 30px; height: 30px; padding: 0;
    background: transparent; border: 1px solid transparent; border-radius: 8px;
    color: var(--muted); cursor: pointer;
    transition: background .15s, color .15s, border-color .15s;
  }
  .theme-btn:hover { background: var(--surface); color: var(--ink); border-color: var(--line); }
  .theme-btn[aria-expanded="true"] { background: var(--brand-wash); color: var(--brand); border-color: var(--brand); }
  .theme-btn:focus-visible { outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 22%, transparent); }
  .theme-btn svg { width: 17px; height: 17px; display: block; }

  .theme-menu {
    position: absolute; top: calc(100% + 7px); right: 0; z-index: 30;
    min-width: 168px; padding: 5px;
    background: var(--surface); border: 1px solid var(--line-2);
    border-radius: 11px; box-shadow: var(--shadow);
    display: flex; flex-direction: column; gap: 1px;
    animation: menuIn .16s cubic-bezier(.32,.72,0,1) both;
  }
  @keyframes menuIn { from { opacity: 0; transform: translateY(-5px); } to { opacity: 1; transform: none; } }
  @media (prefers-reduced-motion: reduce) { .theme-menu { animation: none; } }

  .theme-menu button {
    display: flex; align-items: center; gap: 10px; width: 100%;
    padding: 9px 11px; font: inherit; font-size: 14px; font-weight: 500;
    text-align: left; color: var(--ink-2); background: transparent;
    border: none; border-radius: 7px; cursor: pointer;
    transition: background .12s, color .12s;
  }
  .theme-menu button:hover { background: var(--surface-2); color: var(--ink); }
  .theme-menu button:focus-visible { outline: none; background: var(--surface-2); }
  .theme-menu button[aria-checked="true"] { background: var(--brand-wash); color: var(--brand); font-weight: 600; }
  .theme-menu svg { width: 16px; height: 16px; flex: 0 0 auto; }
  .wordmark {
    font-size: 15px; font-weight: 700; letter-spacing: .02em; color: var(--ink);
  }
  .wordmark span { color: var(--brand); }
  .rail-count {
    font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums;
    letter-spacing: .04em;
  }
  .bar { height: 3px; background: var(--line-2); border-radius: 99px; overflow: hidden; }
  .bar-fill {
    height: 100%; width: 0; background: var(--brand); border-radius: 99px;
    transition: width .5s cubic-bezier(.32,.72,0,1);
  }
  .rail-label { font-size: 13px; color: var(--ink-2); font-weight: 600; }

  /* ── Shell ───────────────────────────────── */
  main { max-width: 660px; margin: 0 auto; padding: 30px 20px 140px; }

  .step { display: none; animation: rise .45s cubic-bezier(.32,.72,0,1) both; }
  .step.on { display: block; }
  @keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
  @media (prefers-reduced-motion: reduce) {
    .step.on { animation: none; }
    .bar-fill { transition: none; }
    * { scroll-behavior: auto !important; }
  }

  .eyebrow {
    font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
    color: var(--brand); margin: 0 0 8px;
  }
  h1 {
    font-size: clamp(26px, 6vw, 34px); line-height: 1.22; letter-spacing: -.02em;
    font-weight: 700; margin: 0 0 8px; text-wrap: balance;
  }
  .sub { color: var(--muted); font-size: 15px; margin: 0 0 26px; max-width: 46ch; }

  /* ── Field ───────────────────────────────── */
  .field { margin-bottom: 22px; }
  .field > label, .legend {
    display: block; font-size: 14px; font-weight: 600; color: var(--ink);
    margin-bottom: 7px;
  }
  .req { color: var(--brand); margin-left: 3px; }
  .hint { font-size: 13px; color: var(--muted); margin: 0 0 9px; }

  input[type="text"], input[type="email"], input[type="tel"], input[type="date"], textarea, select {
    width: 100%; padding: 13px 15px; font: inherit; font-size: 16px;
    color: var(--ink); background: var(--surface);
    border: 1px solid var(--line-2); border-radius: 11px;
    transition: border-color .15s, box-shadow .15s;
    -webkit-appearance: none; appearance: none;
  }
  textarea { min-height: 88px; resize: vertical; line-height: 1.55; }
  select {
    background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
                      linear-gradient(135deg, var(--muted) 50%, transparent 50%);
    background-position: calc(100% - 19px) 21px, calc(100% - 14px) 21px;
    background-size: 5px 5px, 5px 5px; background-repeat: no-repeat;
  }
  input:focus, textarea:focus, select:focus {
    outline: none; border-color: var(--brand);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 16%, transparent);
  }
  input.err, textarea.err { border-color: var(--bad); }
  input.good { border-color: var(--ok); }

  .row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
  @media (max-width: 460px) { .row { grid-template-columns: 1fr; } }

  .msg { font-size: 13px; margin-top: 6px; display: flex; gap: 6px; align-items: flex-start; }
  .msg.bad { color: var(--bad); }
  .msg.ok  { color: var(--ok); }
  .msg.warn{ color: var(--warn); }

  /* ── Choice cards ────────────────────────── */
  .choices { display: flex; flex-direction: column; gap: 9px; }
  .choices.grid2 { display: grid; grid-template-columns: 1fr 1fr; }
  @media (max-width: 460px) { .choices.grid2 { grid-template-columns: 1fr; } }

  .choice {
    position: relative; display: flex; align-items: flex-start; gap: 12px;
    padding: 14px 15px; background: var(--surface);
    border: 1px solid var(--line-2); border-radius: 11px; cursor: pointer;
    transition: border-color .15s, background .15s, transform .1s;
  }
  .choice:hover { border-color: var(--line-2); background: var(--surface-2); }
  .choice:active { transform: scale(.993); }
  .choice input { position: absolute; opacity: 0; pointer-events: none; }
  .dot {
    flex: 0 0 auto; width: 19px; height: 19px; margin-top: 2px; border-radius: 50%;
    border: 1.5px solid var(--line-2); background: var(--surface);
    transition: border-color .15s, border-width .15s;
  }
  .choice input[type="checkbox"] ~ .dot { border-radius: 6px; }
  .choice-body { flex: 1; min-width: 0; }
  .choice-t { font-size: 15px; font-weight: 600; line-height: 1.4; }
  .choice-d { font-size: 13px; color: var(--muted); margin-top: 2px; }
  .choice:has(input:checked) { border-color: var(--brand); background: var(--brand-wash); }
  .choice:has(input:checked) .dot { border-color: var(--brand); border-width: 6px; }
  .choice:has(input:checked) .choice-t { color: var(--brand-deep); }
  .choice:has(input:focus-visible) { box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 16%, transparent); }
  .choice.disabled { opacity: .4; pointer-events: none; }

  /* ── Reveal (conditional blocks) ─────────── */
  .reveal {
    display: grid; grid-template-rows: 0fr; opacity: 0;
    transition: grid-template-rows .4s cubic-bezier(.32,.72,0,1), opacity .3s, margin .4s;
    margin-top: 0;
  }
  .reveal > div { overflow: hidden; min-height: 0; }
  .reveal.on { grid-template-rows: 1fr; opacity: 1; margin-top: 14px; }
  @media (prefers-reduced-motion: reduce) { .reveal { transition: none; } }

  .nest {
    padding: 16px; background: var(--surface-2);
    border: 1px solid var(--line); border-radius: 11px;
    border-left: 3px solid var(--brand);
  }
  .nest .field:last-child { margin-bottom: 0; }

  /* ── Callout ─────────────────────────────── */
  .note {
    display: flex; gap: 11px; padding: 13px 15px; border-radius: 11px;
    font-size: 13.5px; line-height: 1.55; margin-bottom: 20px;
  }
  .note.info { background: var(--brand-wash); color: var(--brand-deep); }
  .note.ok   { background: var(--ok-wash);   color: var(--ok); }
  .note.warn { background: var(--warn-wash); color: var(--warn); }
  .note.bad  { background: var(--bad-wash);  color: var(--bad); }
  .note b { font-weight: 700; }
  .note-i { flex: 0 0 auto; font-size: 15px; line-height: 1.45; }

  /* ── Session presets ─────────────────────── */
  .terms { display: flex; flex-direction: column; gap: 9px; }
  .term {
    display: flex; justify-content: space-between; align-items: center; gap: 12px;
    padding: 14px 16px; background: var(--surface); cursor: pointer;
    border: 1px solid var(--line-2); border-radius: 11px;
    transition: border-color .15s, background .15s;
  }
  .term:hover { background: var(--surface-2); }
  .term.sel { border-color: var(--brand); background: var(--brand-wash); }
  .term-d { font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }
  .term.sel .term-d { color: var(--brand-deep); }
  .term-m { font-size: 12.5px; color: var(--muted); margin-top: 1px; }
  .term-w {
    font-size: 12px; font-weight: 700; color: var(--muted);
    background: var(--ground); border-radius: 99px; padding: 3px 10px; white-space: nowrap;
  }
  .term.sel .term-w { background: var(--brand); color: #fff; }

  /* ── Uploader ────────────────────────────── */
  .drop {
    border: 1.5px dashed var(--line-2); border-radius: var(--radius);
    padding: 28px 20px; text-align: center; background: var(--surface);
    cursor: pointer; transition: border-color .15s, background .15s, transform .12s;
  }
  .drop:hover { border-color: var(--brand); background: var(--brand-wash); }
  .drop:focus-visible {
    outline: none; border-color: var(--brand);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 18%, transparent);
  }
  /* 拖曳进入时：实线 + 放大，让「放手」这件事有明确的着陆点 */
  .drop.over {
    border-style: solid; border-color: var(--brand); background: var(--brand-wash);
    transform: scale(1.015);
  }
  .drop.over .drop-i { transform: translateY(-3px); }
  .drop-i { font-size: 26px; transition: transform .12s; }
  .drop-t { font-size: 15px; font-weight: 600; margin-top: 8px; }
  .drop-d { font-size: 13px; color: var(--muted); margin-top: 3px; }
  @media (prefers-reduced-motion: reduce) {
    .drop, .drop-i { transition: none; }
    .drop.over { transform: none; }
  }

  /* 上传完成后的文件卡 */
  .fcard {
    display: flex; gap: 13px; align-items: center; padding: 12px;
    border: 1px solid var(--ok); background: var(--ok-wash); border-radius: var(--radius);
  }
  .fcard.bad { border-color: var(--bad); background: var(--bad-wash); }
  .fthumb {
    width: 58px; height: 58px; flex: 0 0 auto; border-radius: 9px; object-fit: cover;
    background: var(--surface); border: 1px solid var(--line);
    display: grid; place-items: center; font-size: 22px;
  }
  .fmeta { flex: 1; min-width: 0; }
  .fname { font-size: 14px; font-weight: 600; word-break: break-all; line-height: 1.35; }
  .fsize { font-size: 12.5px; color: var(--muted); margin-top: 2px; font-variant-numeric: tabular-nums; }
  .fswap {
    flex: 0 0 auto; background: var(--surface); border: 1px solid var(--line-2);
    color: var(--ink-2); font: inherit; font-size: 13px; font-weight: 600;
    padding: 7px 13px; border-radius: 8px; cursor: pointer; white-space: nowrap;
  }
  .fswap:hover { border-color: var(--brand); color: var(--brand); }
  .fswap:focus-visible { outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 20%, transparent); }

  .scan { display: flex; align-items: center; gap: 11px; font-size: 14px; color: var(--brand-deep); padding: 4px 0; }
  .spin {
    width: 16px; height: 16px; border: 2px solid var(--line-2);
    border-top-color: var(--brand); border-radius: 50%;
    animation: sp .7s linear infinite; flex: 0 0 auto;
  }
  @keyframes sp { to { transform: rotate(360deg); } }
  @media (prefers-reduced-motion: reduce) { .spin { animation-duration: 2s; } }

  /* ── MRZ 修补台 ──────────────────────────── */
  .fix {
    display: flex; flex-direction: column; gap: 14px;
    margin-top: 14px; padding: 16px;
    background: var(--surface-2); border: 1px solid var(--line);
    border-radius: var(--radius); border-left: 3px solid var(--warn);
  }
  .fix-row { display: flex; flex-direction: column; gap: 6px; }
  .fix-row label { font-size: 14px; font-weight: 600; color: var(--ink); }
  .fix-hint { font-weight: 400; color: var(--muted); font-size: 12.5px; margin-left: 4px; }
  .fix-in {
    font-family: ui-monospace, "SF Mono", Menlo, monospace !important;
    font-size: 15px !important; letter-spacing: .08em; text-transform: uppercase;
  }
  .fix-state { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
  .fix-state.ok { color: var(--ok); font-weight: 600; }
  .fix-state b { font-family: ui-monospace, "SF Mono", Menlo, monospace; }
  .fix-acts { display: flex; gap: 9px; margin-top: 13px; flex-wrap: wrap; }

  /* ── 送出前的二次确认 ─────────────────────── */
  .cover {
    position: fixed; inset: 0; z-index: 60; display: grid; place-items: center;
    padding: 20px; background: rgba(8, 12, 18, .55);
    backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
    animation: fade .18s both;
  }
  @keyframes fade { from { opacity: 0 } to { opacity: 1 } }
  .sheet {
    width: 100%; max-width: 460px; background: var(--surface);
    border: 1px solid var(--line-2); border-radius: 16px; box-shadow: var(--shadow);
    padding: 24px; animation: rise .28s cubic-bezier(.32,.72,0,1) both;
  }
  @media (prefers-reduced-motion: reduce) { .cover, .sheet { animation: none } }
  .sheet h3 { font-size: 19px; margin: 0 0 8px; letter-spacing: -.01em; text-wrap: balance; }
  .sheet p { font-size: 14px; color: var(--ink-2); margin: 0 0 16px; line-height: 1.6; }
  .sheet-facts {
    background: var(--surface-2); border: 1px solid var(--line);
    border-radius: 10px; padding: 12px 14px; margin-bottom: 16px;
    font-size: 13.5px; line-height: 1.9;
  }
  .sheet-facts b { font-variant-numeric: tabular-nums; }
  .sheet-acts { display: flex; gap: 10px; }
  .sheet-acts .btn { flex: 1; }

  /* ── Verify table ────────────────────────── */
  .verify { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
  .verify-h {
    padding: 11px 15px; background: var(--surface-2); border-bottom: 1px solid var(--line);
    font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
  }
  .vrow {
    display: grid; grid-template-columns: 82px 1fr auto; gap: 12px; align-items: baseline;
    padding: 11px 15px; border-bottom: 1px solid var(--line); font-size: 14px;
  }
  .vrow:last-child { border-bottom: none; }
  .vrow-k { color: var(--muted); font-size: 13px; }
  .vrow-v { font-variant-numeric: tabular-nums; word-break: break-word; }
  .vrow-v s { color: var(--bad); text-decoration-thickness: 1px; }
  .vrow-v em { font-style: normal; color: var(--ok); font-weight: 600; }
  .pill {
    font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 99px; white-space: nowrap;
  }
  .pill.ok  { background: var(--ok-wash);   color: var(--ok); }
  .pill.bad { background: var(--bad-wash);  color: var(--bad); }
  .pill.warn{ background: var(--warn-wash); color: var(--warn); }

  /* ── Terms scroller ──────────────────────── */
  .scroller {
    height: 300px; overflow-y: auto; padding: 20px;
    background: var(--surface); border: 1px solid var(--line-2);
    border-radius: var(--radius); font-size: 14px; line-height: 1.75;
    -webkit-overflow-scrolling: touch;
  }
  .scroller h3 {
    font-size: 14px; font-weight: 700; margin: 22px 0 7px; color: var(--brand-deep);
    letter-spacing: .01em;
  }
  .scroller h3:first-child { margin-top: 0; }
  .scroller p { margin: 0 0 11px; color: var(--ink-2); }
  .scroller ol { margin: 0 0 11px; padding-left: 20px; color: var(--ink-2); }
  .scroller li { margin-bottom: 5px; }
  .scroller-end {
    text-align: center; font-size: 12px; color: var(--muted);
    padding: 14px 0 2px; border-top: 1px dashed var(--line-2); margin-top: 18px;
  }
  .read-state {
    display: flex; align-items: center; gap: 8px; font-size: 13px;
    color: var(--muted); margin-top: 10px;
  }
  .read-state.done { color: var(--ok); font-weight: 600; }

  /* ── Review ──────────────────────────────── */
  .review { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
  .rsec {
    padding: 9px 15px; background: var(--surface-2); border-bottom: 1px solid var(--line);
    border-top: 1px solid var(--line);
    font-size: 11px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--muted);
    display: flex; justify-content: space-between; align-items: center;
  }
  .rsec:first-child { border-top: none; }
  .rsec button {
    background: none; border: none; font: inherit; font-size: 11px; font-weight: 700;
    letter-spacing: .06em; color: var(--brand); cursor: pointer; padding: 2px 4px;
    border-radius: 5px;
  }
  .rsec button:hover { text-decoration: underline; }
  .rrow {
    display: grid; grid-template-columns: 96px 1fr; gap: 12px;
    padding: 10px 15px; font-size: 14px; border-bottom: 1px solid var(--line);
  }
  .rrow:last-child { border-bottom: none; }
  .rrow-k { color: var(--muted); font-size: 13px; }
  .rrow-v { word-break: break-word; }

  /* ── Buttons ─────────────────────────────── */
  .nav {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 20;
    background: color-mix(in srgb, var(--ground) 88%, transparent);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-top: 1px solid var(--line);
    padding: 12px 20px calc(12px + env(safe-area-inset-bottom));
  }
  .nav-in { max-width: 660px; margin: 0 auto; display: flex; gap: 10px; }
  .btn {
    flex: 1; padding: 14px 20px; font: inherit; font-size: 16px; font-weight: 600;
    border-radius: 11px; border: 1px solid transparent; cursor: pointer;
    transition: background .15s, transform .1s, opacity .15s;
  }
  .btn:active { transform: scale(.985); }
  .btn:focus-visible { outline: none; box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 25%, transparent); }
  .btn-primary { background: var(--brand); color: #fff; flex: 2; }
  .btn-primary:hover { background: var(--brand-deep); }
  .btn-primary:disabled { opacity: .38; cursor: not-allowed; }
  .btn-primary:disabled:active { transform: none; }
  .btn-ghost { background: var(--surface); color: var(--ink-2); border-color: var(--line-2); }
  .btn-ghost:hover { background: var(--surface-2); }
  .btn-sm {
    flex: 0; padding: 9px 16px; font-size: 14px; border-radius: 9px;
    background: var(--surface); color: var(--brand); border: 1px solid var(--line-2);
    font-weight: 600; cursor: pointer; white-space: nowrap;
  }
  .btn-sm:hover { background: var(--brand-wash); border-color: var(--brand); }

  /* ── Done ────────────────────────────────── */
  .done-mark {
    width: 62px; height: 62px; border-radius: 50%; background: var(--ok-wash);
    display: grid; place-items: center; margin: 0 auto 22px;
    color: var(--ok); font-size: 30px;
    animation: pop .5s cubic-bezier(.34,1.56,.64,1) both;
  }
  @keyframes pop { from { transform: scale(0); } to { transform: scale(1); } }
  @media (prefers-reduced-motion: reduce) { .done-mark { animation: none; } }

  .payload {
    background: var(--surface-2); border: 1px solid var(--line); border-radius: 11px;
    padding: 15px; font-size: 12px; line-height: 1.65; overflow-x: auto;
    font-family: ui-monospace, "SF Mono", Menlo, monospace; color: var(--ink-2);
    white-space: pre; margin: 0;
  }
  .payload b { color: var(--brand-deep); font-weight: 600; }

  details.demo {
    margin-top: 14px; border: 1px solid var(--line); border-radius: 11px;
    background: var(--surface-2); overflow: hidden;
  }
  details.demo summary {
    padding: 11px 15px; font-size: 13px; font-weight: 600; color: var(--muted);
    cursor: pointer; list-style: none; user-select: none;
  }
  details.demo summary::-webkit-details-marker { display: none; }
  details.demo summary:before { content: "▸ "; color: var(--brand); }
  details.demo[open] summary:before { content: "▾ "; }
  .demo-in { padding: 0 15px 15px; }
  .demo-in p { font-size: 13px; color: var(--muted); margin: 0 0 10px; line-height: 1.6; }
  .demo-in input {
    font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 12px;
    letter-spacing: .01em;
  }
  .demo-btns { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
