:root {
  color-scheme: light;
  --ink: #15191c;
  --muted: #687078;
  --line: #d9dde0;
  --paper: #f7f7f4;
  --white: #fff;
  --bitcoin: #f7931a;
  --green: #167451;
  --red: #a9372d;
  --focus: #1167a8;
  --shadow: 0 8px 24px rgb(21 25 28 / 7%);
}

* { box-sizing: border-box; }
html { font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; color: var(--ink); background: var(--paper); }
body { margin: 0; min-width: 320px; min-height: 100vh; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 3px; text-decoration-color: #92999e; }
a:hover { text-decoration-color: currentColor; }
button, input, textarea, select { font: inherit; letter-spacing: 0; }
button, .button { min-height: 42px; border: 1px solid var(--ink); border-radius: 4px; padding: 9px 14px; background: var(--ink); color: var(--white); cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 7px; }
button.secondary, .button.secondary { background: var(--white); color: var(--ink); }
button:hover, .button:hover { background: #30363a; border-color: #30363a; }
button.secondary:hover, .button.secondary:hover { background: #f0f2f1; color: var(--ink); border-color: var(--ink); }
button:active, .button:active { transform: translateY(1px); }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, a:focus-visible { outline: 3px solid color-mix(in srgb, var(--focus) 35%, transparent); outline-offset: 2px; }

.topbar { min-height: 62px; border-bottom: 1px solid var(--line); background: rgb(255 255 255 / 96%); padding: 0 max(18px, calc((100vw - 1180px) / 2)); display: flex; align-items: center; justify-content: space-between; gap: 20px; box-shadow: 0 1px 0 rgb(21 25 28 / 2%); }
.brand { font-size: 19px; font-weight: 760; text-decoration: none; white-space: nowrap; }
.topbar nav { display: flex; align-items: center; gap: 18px; font-size: 14px; overflow-x: auto; }
.topbar nav a { color: #3e464b; font-weight: 580; text-decoration: none; padding-block: 20px; }
.topbar nav a:hover { color: var(--ink); }
.test-banner { padding: 7px 18px; background: #fff0bf; border-bottom: 1px solid #d6b64b; color: #5e4900; text-align: center; font-size: 13px; font-weight: 750; text-transform: uppercase; }
main { max-width: 1180px; margin: 0 auto; padding: 32px 18px 64px; }
.page-heading { display: flex; justify-content: space-between; align-items: end; gap: 20px; margin-bottom: 26px; }
h1 { margin: 0; font-size: clamp(28px, 4vw, 44px); line-height: 1.05; letter-spacing: 0; }
h2 { margin: 0 0 12px; font-size: 21px; letter-spacing: 0; }
p { line-height: 1.55; }
.lede { color: var(--muted); max-width: 660px; margin: 8px 0 0; }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; overflow-wrap: anywhere; }

.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.product-card { border: 1px solid var(--line); border-radius: 6px; background: var(--white); overflow: hidden; display: flex; flex-direction: column; min-height: 270px; box-shadow: 0 2px 8px rgb(21 25 28 / 4%); }
.product-card:hover { border-color: #bcc2c6; box-shadow: var(--shadow); }
.product-card img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-bottom: 1px solid var(--line); }
.product-visual { aspect-ratio: 4 / 3; display: grid; place-items: center; background: #eef0ed; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.product-card-body { padding: 16px; display: flex; flex: 1; flex-direction: column; }
.product-card h2 { font-size: 18px; }
.product-card p { color: var(--muted); margin: 0 0 18px; }
.product-card-footer { margin-top: auto; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.price { font-weight: 720; white-space: nowrap; }

.product-detail { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(300px, .75fr); gap: 36px; align-items: start; }
.product-detail-media { background: #eef0ed; min-height: 420px; display: grid; place-items: center; border: 1px solid var(--line); }
.product-detail-media img { width: 100%; max-height: 70vh; object-fit: contain; }
.purchase-panel { border-left: 1px solid var(--line); padding-left: 30px; }

label { display: block; font-size: 13px; font-weight: 680; margin: 0 0 7px; }
.field { margin-bottom: 18px; }
input, textarea, select { width: 100%; min-height: 42px; border: 1px solid #aeb5ba; border-radius: 4px; background: var(--white); color: var(--ink); padding: 9px 11px; transition: border-color 120ms ease, box-shadow 120ms ease; }
input:hover, textarea:hover, select:hover { border-color: #7e878d; }
input:focus, textarea:focus, select:focus { border-color: var(--focus); box-shadow: 0 0 0 3px rgb(17 103 168 / 10%); }
textarea { min-height: 110px; resize: vertical; }
.check-field { display: flex; align-items: center; gap: 9px; }
.check-field input { width: 18px; min-height: 18px; }
.check-field label { margin: 0; }
.form-actions { display: flex; gap: 9px; align-items: center; flex-wrap: wrap; }
.field-error { color: var(--red); font-size: 13px; margin-top: 6px; }

.payment-layout { display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: 36px; align-items: start; }
.qr { width: 290px; max-width: 100%; aspect-ratio: 1; border: 10px solid var(--white); display: block; image-rendering: pixelated; }
.payment-state { border-top: 3px solid var(--bitcoin); background: var(--white); padding: 22px; }
.payment-address { padding: 13px; border: 1px solid var(--line); background: var(--paper); margin: 10px 0 16px; cursor: text; }
.amount-breakdown { margin: 14px 0; padding-block: 10px; border-block: 1px solid var(--line); }
.amount-breakdown div { display: flex; justify-content: space-between; gap: 18px; padding: 4px 0; }
.amount-breakdown dt { color: var(--muted); }
.amount-breakdown dd { margin: 0; font-weight: 650; }
.status-line { display: flex; width: fit-content; align-items: center; gap: 10px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 6px; background: #f5f6f7; color: var(--ink); }
.status-line strong, .status-line small { display: block; }
.status-line small { margin-top: 2px; color: var(--muted); font-weight: 400; }
.status-dot { flex: 0 0 auto; width: 10px; height: 10px; border-radius: 50%; background: #7a838c; }
.status-payment_seen { border-color: #d6b64b; background: #fff7d8; color: #665000; }
.status-payment_seen .status-dot { background: #b88a00; }
.status-payment_seen.confirmation-progress { border-color: #d19a38; background: #fff0c2; color: #624600; }
.status-payment_seen.confirmation-progress .status-dot { box-shadow: 0 0 0 4px rgb(184 138 0 / 18%); }
.status-paid, .status-complete { width: fit-content; border: 1px solid #9ccdb9; border-radius: 6px; background: #e9f6f0; color: #0d5d40; padding: 9px 12px; }
.status-paid .status-dot, .status-complete .status-dot { width: 20px; height: 20px; display: grid; place-items: center; background: var(--green); color: white; }
.status-paid .status-dot::after, .status-complete .status-dot::after { content: "\2713"; font-size: 13px; line-height: 1; }
.status-exception .status-dot, .status-expired .status-dot { background: var(--red); }

.notice { border: 1px solid var(--line); border-left-width: 4px; background: var(--white); padding: 12px 14px; margin-bottom: 20px; }
.notice-success { border-left-color: var(--green); }
.notice-error { border-left-color: var(--red); }
.empty-state { max-width: 620px; padding: 12vh 0; }

.metrics { display: grid; grid-template-columns: repeat(4, 1fr); border-block: 1px solid var(--line); margin-bottom: 30px; }
.metric { padding: 18px; border-right: 1px solid var(--line); }
.metric:last-child { border-right: 0; }
.metric strong { display: block; font-size: 27px; }
.metric span { color: var(--muted); font-size: 13px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 6px; background: var(--white); box-shadow: 0 2px 8px rgb(21 25 28 / 3%); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 12px 13px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-size: 12px; text-transform: uppercase; font-weight: 700; }
tbody tr:hover { background: #fafbf9; }
tr:last-child td { border-bottom: 0; }
.badge { display: inline-block; border: 1px solid var(--line); border-radius: 999px; padding: 3px 8px; font-size: 12px; background: var(--paper); white-space: nowrap; }
.admin-form { max-width: 720px; }
.create-shop { margin-bottom: 26px; padding: 20px; border: 1px solid var(--line); border-radius: 6px; background: var(--white); }
.create-shop form { display: grid; grid-template-columns: minmax(220px, 1fr) auto; align-items: end; gap: 10px; }
.create-shop .field { margin: 0; }
.wallet-state { max-width: 760px; padding: 22px; border: 1px solid var(--line); border-radius: 6px; background: var(--white); box-shadow: 0 2px 8px rgb(21 25 28 / 3%); }
.wallet-metrics { max-width: 900px; }
.definition-list { margin: 18px 0; }
.definition-list div { display: grid; grid-template-columns: 160px minmax(0, 1fr); gap: 18px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.definition-list dt { color: var(--muted); }
.definition-list dd { margin: 0; }
button:disabled { cursor: not-allowed; opacity: .55; }
.inline-fee { display: grid; grid-template-columns: 92px 110px auto; align-items: end; gap: 7px; min-width: 320px; }
.inline-fee label { margin: 0; }
.inline-fee label span { display: block; margin-bottom: 4px; color: var(--muted); font-size: 11px; }
.inline-fee input { min-height: 36px; padding-block: 6px; }
.inline-fee button { min-height: 36px; padding-block: 6px; }
.inline-network { display: flex; align-items: center; gap: 7px; min-width: 190px; }
.inline-network select, .inline-network button { min-height: 36px; padding-block: 6px; }
.network-policy { display: flex; justify-content: space-between; align-items: end; gap: 24px; margin-bottom: 26px; padding: 20px; border: 1px solid #d6b64b; border-radius: 6px; background: #fffaf0; }
.network-policy form { display: flex; align-items: end; gap: 12px; flex-wrap: wrap; }
.network-policy p { margin-bottom: 0; }
.login-shell { max-width: 430px; margin: 8vh auto 0; padding: 28px; border: 1px solid var(--line); border-top: 3px solid var(--bitcoin); border-radius: 6px; background: var(--white); box-shadow: var(--shadow); }
.login-shell .lede { margin-bottom: 24px; }
.login-shell button { width: 100%; margin-top: 4px; }
.balance-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 1px; margin-bottom: 28px; border: 1px solid var(--line); background: var(--line); }
.balance-item { min-width: 0; padding: 17px; background: var(--white); }
.balance-item span, .balance-item small { display: block; color: var(--muted); }
.balance-item strong { display: block; margin: 5px 0; font-size: 23px; overflow-wrap: anywhere; }
.ledger-section { margin-bottom: 28px; }
.ledger-heading { margin: 30px 0 12px; }
.ledger-export { display: flex; align-items: end; gap: 12px; flex-wrap: wrap; margin: -8px 0 28px; padding-block: 16px; border-block: 1px solid var(--line); }
.ledger-export > div { margin-right: auto; }
.ledger-export > div span { display: block; margin-top: 3px; font-size: 12px; }
.ledger-export label { min-width: 150px; margin: 0; }
.ledger-export label span { display: block; margin-bottom: 5px; }
.ledger-export input { min-height: 38px; }
.withdrawal-form { margin-bottom: 30px; }
.withdrawal-metrics, .test-metrics { max-width: 760px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.approval-actions { display: flex; gap: 7px; }
.approval-actions button { min-height: 34px; padding: 5px 9px; }
.status-badge.status-broadcast { border-color: #d6b64b; background: #fff7d8; color: #665000; }
.status-badge.status-confirmed { border-color: #9ccdb9; background: #e9f6f0; color: #0d5d40; }
.status-badge.status-failed, .status-badge.status-rejected { border-color: #dba8a3; background: #faeeee; color: var(--red); }
.test-tools { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 26px 34px; }
.test-tools section { border-top: 2px solid var(--line); padding-top: 17px; }
.test-tools section:last-child { grid-column: 1 / -1; max-width: 720px; }
.copy-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 7px; margin-top: 14px; }
.table-section { margin-top: 34px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 18px; margin-bottom: 12px; }
.section-heading h2, .section-heading p { margin-bottom: 0; }
.inline-form { display: flex; align-items: center; gap: 7px; min-width: min(100%, 480px); }
.copy-row.compact { grid-template-columns: minmax(140px, 220px) auto; margin-top: 7px; }
.copy-row.compact input, .copy-row.compact button { min-height: 34px; padding-block: 5px; }
.status-badge { display: inline-block; border: 1px solid var(--line); border-radius: 999px; padding: 4px 8px; background: var(--paper); white-space: nowrap; text-transform: capitalize; }
.status-badge.status-paid { border-color: #9ccdb9; background: #e9f6f0; color: #0d5d40; }
.status-badge.status-payment_seen { border-color: #d6b64b; background: #fff7d8; color: #665000; }
.status-badge.status-expired, .status-badge.status-exception, .status-badge.status-cancelled { border-color: #dba8a3; background: #faeeee; color: var(--red); }
.api-key-reveal { max-width: 820px; margin-bottom: 28px; padding: 18px; border: 1px solid #9ccdb9; border-left: 4px solid var(--green); background: #f2faf6; }
.api-create { margin-bottom: 32px; }
.api-create fieldset { margin: 0 0 20px; padding: 14px; border: 1px solid var(--line); }
.api-create .check-field { margin: 8px 0; }
.api-reference { margin-top: 30px; padding-top: 20px; border-top: 1px solid var(--line); }
.api-reference code { overflow-wrap: anywhere; }

@media (max-width: 760px) {
  .topbar { align-items: flex-start; flex-direction: column; padding-block: 13px; }
  .topbar nav { width: 100%; padding-bottom: 3px; }
  .topbar nav a { padding-block: 4px; }
  main { padding-top: 24px; }
  .page-heading { align-items: flex-start; flex-direction: column; }
  .product-detail, .payment-layout { grid-template-columns: 1fr; }
  .purchase-panel { border-left: 0; border-top: 1px solid var(--line); padding: 24px 0 0; }
  .product-detail-media { min-height: 260px; }
  .metrics { grid-template-columns: 1fr 1fr; }
  .metric:nth-child(2) { border-right: 0; }
  .metric:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .login-shell { margin-top: 3vh; padding: 22px; }
  .create-shop form { grid-template-columns: 1fr; }
  .network-policy { align-items: stretch; flex-direction: column; }
  .test-tools { grid-template-columns: 1fr; }
  .test-tools section:last-child { grid-column: auto; }
  .section-heading, .inline-form { align-items: stretch; flex-direction: column; }
}
