:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 16px; line-height: 1.6; color: #20242c; background: #fff;
  --ink: #20242c; --muted: #626976; --line: #e1e5ea; --surface: #f5f7f9;
  --brand: #315de0; --brand-dark: #2147bf; --brand-soft: #eef3ff;
  --success: #13734c; --success-soft: #eff9f3;
  --warning: #8d570e; --warning-soft: #fff7e7; --danger: #b53535; --danger-soft: #fff3f2;
}
* { box-sizing: border-box; letter-spacing: 0; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; scroll-padding-top: 100px; }
body { margin: 0; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
button, input, textarea { font: inherit; }
button, a, input, textarea, summary { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; transition: background-color .15s, border-color .15s; }
button:disabled { cursor: not-allowed; }
button:focus-visible, a:focus-visible, summary:focus-visible { outline: 3px solid #8bafff; outline-offset: 3px; }
a { color: var(--brand); text-underline-offset: 3px; }
p { margin: 0 0 16px; }
.skip-link { position: fixed; top: -100px; left: 16px; z-index: 20; background: #fff; padding: 10px 16px; }
.skip-link:focus { top: 12px; }
.topbar { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; padding: 16px max(20px, calc((100% - 960px)/2)); border-bottom: 1px solid var(--line); background: #fff; }
.brand { display: flex; align-items: center; gap: 10px; margin-right: auto; text-decoration: none; color: var(--ink); }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 19px; line-height: 1.3; }
.brand small { font-size: 12px; color: var(--muted); }
.mark { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 8px; background: var(--ink); color: #fff; font-size: 22px; font-weight: 750; }
nav { display: flex; gap: 4px; }
.nav { display: inline-flex; justify-content: center; align-items: center; gap: 7px; min-height: 44px; padding: 8px 12px; border: 0; border-radius: 6px; color: var(--muted); background: transparent; font-size: 14px; font-weight: 650; }
.nav:hover { background: var(--surface); color: var(--ink); }
.nav.active { background: var(--brand-soft); color: var(--brand); }
.secure { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.secure::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.secure[data-mode="zovo"] { color: var(--success); }
.secure[data-mode="mock"] { color: var(--warning); }
main { flex: 1; width: min(960px, 100%); margin: 0 auto; padding: 40px 20px 64px; }
.view { max-width: 660px; margin: 0 auto; }
#store { max-width: none; }
h1 { margin: 0 0 12px; font-size: 28px; font-weight: 750; line-height: 1.4; overflow-wrap: anywhere; }
h2 { margin: 0 0 16px; font-size: 19px; font-weight: 650; line-height: 1.45; overflow-wrap: anywhere; }
.lede { margin: 0 0 24px; color: var(--muted); }
.steps, .store-steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 24px 0 32px; }
.steps span, .store-step { display: flex; align-items: center; gap: 8px; min-height: 52px; padding: 8px 0; border-bottom: 2px solid var(--line); color: var(--muted); font-size: 14px; font-weight: 600; }
.steps span::before, .store-step b { display: inline-grid; place-items: center; flex: 0 0 24px; height: 24px; border-radius: 50%; background: var(--surface); font-size: 12px; font-weight: 650; }
.steps span::before { content: attr(data-step); }
.store-step em { font-style: normal; }
.steps .current, .store-step.active { border-color: var(--brand); color: var(--brand); }
.steps .current::before, .store-step.active b { background: var(--brand); color: #fff; }
.steps .done, .store-step.done { border-color: var(--success); color: var(--success); }
.steps .done::before, .store-step.done b { background: var(--success-soft); color: var(--success); }
.card, .form-section { padding: 0; margin: 0 0 24px; }
label { display: block; margin: 0 0 8px; font-size: 14px; font-weight: 650; }
input, textarea { display: block; width: 100%; min-width: 0; padding: 12px 14px; border: 1px solid #bbc2cc; border-radius: 6px; background: #fff; color: var(--ink); font-size: 16px; line-height: 1.5; }
input::placeholder, textarea::placeholder { color: #7a8290; }
input:focus, textarea:focus { border-color: var(--brand); outline: 2px solid #d7e3ff; outline-offset: 1px; }
input:disabled, textarea:disabled { background: var(--surface); color: var(--muted); }
textarea { min-height: 176px; resize: vertical; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 14px; overflow-wrap: anywhere; }
.primary, .secondary, .copy { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 10px 16px; border: 1px solid transparent; border-radius: 6px; font-weight: 650; font-size: 14px; text-decoration: none; }
.primary { width: 100%; margin-top: 16px; color: #fff; background: var(--brand); }
.primary:hover:not(:disabled) { background: var(--brand-dark); }
.secondary { color: var(--ink); border-color: #cbd1da; background: #fff; }
.secondary:hover:not(:disabled) { background: var(--surface); }
.copy { flex-shrink: 0; padding: 8px 12px; color: var(--brand); background: var(--brand-soft); }
.copy:hover:not(:disabled) { background: #e1eafe; }
.primary:disabled, .secondary:disabled { color: #707785; background: #eef0f3; border-color: #e1e5ea; }
.actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 24px; }
.actions > * { flex: 1 1 180px; margin-top: 0; }
.hint, .security { color: var(--muted); font-size: 14px; }
.hint { margin: 12px 0 0; }
.security { padding: 0 0 0 12px; border-left: 3px solid var(--line); margin: 0 0 16px; }
.check { display: flex; gap: 10px; align-items: flex-start; margin: 20px 0 0; font-weight: 500; }
.check input { flex: 0 0 18px; width: 18px; height: 18px; margin: 4px 0 0; accent-color: var(--brand); }
.result { margin-top: 20px; padding: 16px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); font-size: 14px; overflow-wrap: anywhere; }
.result.error { background: var(--danger-soft); border-color: #f0ceca; color: var(--danger); }
.result.success { background: var(--success-soft); border-color: #c7e3d1; }
.result.warning { background: var(--warning-soft); border-color: #edd9ae; }
.status { display: inline-flex; align-items: center; gap: 8px; padding: 4px 0; color: var(--brand); font-size: 14px; font-weight: 650; }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status[data-tone="success"] { color: var(--success); }
.status[data-tone="danger"] { color: var(--danger); }
.status[data-tone="warning"] { color: var(--warning); }
.task { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; padding: 14px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.task span { color: var(--muted); font-size: 14px; }
.task code { flex: 1; overflow-wrap: anywhere; font-size: 14px; }
.timeline { list-style: none; margin: 24px 0; padding: 0 0 0 20px; }
.timeline li { position: relative; border-left: 1px solid var(--line); padding: 0 0 20px 20px; color: var(--muted); font-size: 14px; overflow-wrap: anywhere; }
.timeline li:last-child { padding-bottom: 0; border-color: transparent; }
.timeline li::before { content: ""; position: absolute; left: -4px; top: 8px; width: 7px; height: 7px; border-radius: 50%; background: #adb6c3; }
.timeline li.done { color: var(--success); }
.timeline li.done::before { background: var(--success); }
.timeline time { display: block; color: var(--muted); font-size: 12px; margin-top: 3px; }
details { margin: 16px 0 24px; padding: 12px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); font-size: 14px; }
summary { cursor: pointer; font-weight: 600; min-height: 28px; }
details ol { padding-left: 22px; }
details li { margin-top: 10px; }
details a, details code { overflow-wrap: anywhere; }
.plan-summary { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; padding: 12px 0; margin: 0 0 24px; border-bottom: 1px solid var(--line); font-size: 14px; color: var(--muted); }
.plan-summary strong { color: var(--ink); }
.account-details, .query-details { display: grid; grid-template-columns: 100px minmax(0, 1fr); gap: 12px 20px; margin: 20px 0; font-size: 14px; }
.account-details dt, .query-details dt { color: var(--muted); }
.account-details dd, .query-details dd { margin: 0; overflow-wrap: anywhere; font-weight: 600; }
.store-layout { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(260px, .8fr); gap: 40px; align-items: start; }
.store-layout > * { min-width: 0; }
.section-heading, .order-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.section-heading h2, .order-head h2 { margin: 0; }
.checkout-panel { padding-left: 32px; border-left: 1px solid var(--line); }
.inventory-pill, .order-badge { display: inline-flex; padding: 4px 8px; border-radius: 4px; color: var(--muted); background: var(--surface); font-size: 13px; font-weight: 600; }
.inventory-pill.ready, .order-badge.status-delivered { color: var(--success); background: var(--success-soft); }
.order-badge.status-failed, .order-badge.status-cancelled, .order-badge.status-expired { color: var(--danger); background: var(--danger-soft); }
.order-badge.status-issuance_unknown, .order-badge.status-payment_unknown { color: var(--warning); background: var(--warning-soft); }
.product-list { display: grid; gap: 12px; }
.product-card { width: 100%; min-width: 0; text-align: left; padding: 20px; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); background: #fff; overflow-wrap: anywhere; }
.product-card:hover:not(:disabled) { border-color: #9badd5; }
.product-card.selected { border-color: var(--brand); box-shadow: inset 3px 0 var(--brand); }
.product-card-top, .product-card-foot { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.product-card-top strong { font-size: 17px; }
.product-badge { background: var(--surface); color: var(--muted); padding: 2px 6px; border-radius: 4px; font-size: 12px; font-weight: 600; }
.product-subtitle, .product-description { display: block; margin-top: 6px; color: var(--muted); font-size: 14px; }
.product-features { display: flex; flex-wrap: wrap; gap: 8px 12px; margin: 16px 0; color: var(--success); font-size: 13px; }
.product-card-foot { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.product-card-foot strong { color: var(--ink); font-size: 18px; }
.store-empty, .store-loading { margin: 0; min-height: 100px; padding: 24px 0; color: var(--muted); font-size: 14px; }
.store-summary { display: grid; gap: 8px; min-height: 108px; overflow-wrap: anywhere; }
.summary-name { font-size: 17px; }
.summary-line, .empty-summary { color: var(--muted); font-size: 14px; }
.summary-amount { margin-top: auto; padding-top: 16px; font-size: 28px; }
.quantity-row { display: flex; justify-content: space-between; padding: 20px 0 4px; color: var(--muted); font-size: 14px; }
.quantity-row strong { color: var(--ink); }
.store-legal { margin-top: 14px; color: var(--muted); font-size: 13px; }
.order-panel { margin-top: 32px; padding-top: 24px; border-top: 1px solid var(--line); }
.order-message { color: var(--muted); font-size: 14px; }
.order-meta { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, .6fr); gap: 16px; margin: 0 0 24px; }
.order-meta dt { color: var(--muted); font-size: 13px; }
.order-meta dd { margin: 4px 0 0; font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
.order-actions { display: grid; gap: 12px; }
.order-actions .primary { margin-top: 0; }
.cdk-delivery { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 20px; border: 1px solid #c7e3d1; border-radius: 8px; background: var(--success-soft); }
.cdk-label { grid-column: 1 / -1; color: var(--success); font-size: 14px; font-weight: 600; }
.cdk-value { overflow-wrap: anywhere; font-size: 15px; color: var(--ink); }
.lookup-tip { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 16px 0; margin-top: 20px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.lookup-tip strong { color: var(--ink); }
.lookup-tip span { flex: 1 1 220px; }
.order-recovery { margin-top: 24px; border-bottom: 0; }
.recovery-form { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; gap: 8px 12px; align-items: end; margin-top: 20px; }
.recovery-form label { grid-row: 1; margin: 0; }
.recovery-form input { grid-row: 2; }
.recovery-form button { grid-column: 3; grid-row: 2; }
footer { border-top: 1px solid var(--line); padding: 20px; text-align: center; color: var(--muted); font-size: 12px; }
.nav::before, .copy::before, #previewBtn::after, #preflightBtn::after, #queryBtn::before, #redeemBtn::after, .payment-link::after { content: ""; flex: 0 0 17px; width: 17px; height: 17px; background: currentColor; mask: var(--icon) center / contain no-repeat; }
.nav[data-view="store"] { --icon: url('/public/icons/ticket.svg'); }
.nav[data-view="activate"] { --icon: url('/public/icons/zap.svg'); }
.nav[data-view="query"], #queryBtn { --icon: url('/public/icons/search.svg'); }
.copy { --icon: url('/public/icons/copy.svg'); }
#previewBtn, #preflightBtn, #redeemBtn { --icon: url('/public/icons/arrow-right.svg'); }
.payment-link { --icon: url('/public/icons/external-link.svg'); }
button[aria-busy="true"] { cursor: progress; }
@media (max-width: 760px) {
  .topbar { gap: 12px; padding: 14px 20px 10px; }
  nav { order: 3; flex-basis: 100%; }
  .nav { flex: 1; }
  main { padding-top: 28px; }
  .store-layout { grid-template-columns: minmax(0, 1fr); gap: 28px; }
  .checkout-panel { border-left: 0; border-top: 1px solid var(--line); padding: 24px 0 0; }
  .recovery-form { grid-template-columns: minmax(0, 1fr); }
  .recovery-form label, .recovery-form input, .recovery-form button { grid-row: auto; grid-column: 1; }
  .recovery-form label:not(:first-child), .recovery-form button { margin-top: 8px; }
}
@media (max-width: 420px) {
  h1 { font-size: 24px; }
  main, .topbar { padding-left: 16px; padding-right: 16px; }
  .nav { padding: 8px 6px; gap: 5px; }
  .steps, .store-steps { gap: 8px; }
  .steps span, .store-step { flex-direction: column; align-items: flex-start; gap: 6px; }
  .order-meta { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .order-meta > div:first-child { grid-column: 1 / -1; }
  .account-details, .query-details { grid-template-columns: 80px minmax(0, 1fr); gap: 12px; }
  .task code { flex-basis: 55%; }
  .product-card { padding: 16px; }
  .cdk-delivery { grid-template-columns: minmax(0, 1fr); padding: 16px; }
  .cdk-delivery .copy { justify-self: end; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
