:root {
  --accent: #1773b0;
  --text: #000;
  --muted: #707070;
  --border: #dedede;
  --field-border: #d9d9d9;
  --bg: #fff;
  --summary-bg: #f5f5f5;
  --error: #dd1d1d;
  --radius: 5px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); font-size: 14px; line-height: 1.45; }
h2 { font-size: 21px; font-weight: 600; margin: 0 0 14px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.link { color: var(--accent); }

/* Top bar */
.topbar { border-bottom: 1px solid var(--border); }
.topbar-inner { max-width: 1110px; margin: 0 auto; padding: 20px 21px; display: flex; align-items: center; justify-content: space-between; }
.brand { font-size: 24px; font-weight: 600; color: var(--text); text-decoration: none; }
.brand img { max-height: 42px; max-width: 220px; display: block; }
.cart-icon { color: var(--accent); display: flex; }

/* Layout: form left, summary right (desktop); summary collapses on top (mobile) */
.layout { display: grid; grid-template-columns: 1fr; }
.main { padding: 21px; max-width: 640px; width: 100%; margin: 0 auto; }
.summary { background: var(--summary-bg); border-bottom: 1px solid var(--border); display: none; }
.summary.open { display: block; }
.summary-inner { padding: 21px; max-width: 640px; margin: 0 auto; }
.summary-toggle { display: flex; width: 100%; justify-content: space-between; align-items: center; padding: 16px 21px; background: var(--summary-bg); border: 0; border-bottom: 1px solid var(--border); font: inherit; color: var(--accent); cursor: pointer; }
.toggle-label { display: flex; gap: 6px; align-items: center; }
.summary-toggle[aria-expanded="true"] svg { transform: rotate(180deg); }
.toggle-total { color: var(--text); font-weight: 600; font-size: 17px; }

@media (min-width: 1000px) {
  .summary-toggle { display: none; }
  .layout { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); min-height: calc(100vh - 83px); }
  .main { justify-self: end; max-width: 576px; padding: 38px 38px 38px 21px; margin: 0; }
  .summary { display: block; border-bottom: 0; border-left: 1px solid var(--border); }
  .summary-inner { position: sticky; top: 0; max-width: 470px; margin: 0; padding: 38px 21px 38px 38px; }
}

/* Blocks and fields */
.block { margin-bottom: 30px; }
.block-head { display: flex; justify-content: space-between; align-items: baseline; }
.row { display: grid; grid-template-columns: 1fr 1fr; column-gap: 12px; }
.row-3 { grid-template-columns: 1fr 1fr 1fr; }
@media (max-width: 560px) { .row-3 { grid-template-columns: 1fr; } }

.field { position: relative; margin-bottom: 12px; }
.field input, .field select {
  width: 100%; height: 50px; padding: 20px 12px 4px; font: inherit; font-size: 14px;
  border: 1px solid var(--field-border); border-radius: var(--radius); background: #fff; color: var(--text);
  appearance: none; -webkit-appearance: none; outline: none;
}
.field select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath fill='none' stroke='%23707070' stroke-width='1.5' d='m2 4 4 4 4-4'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; background-size: 11px; padding-right: 32px; }
.field input:focus, .field select:focus { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.field label { position: absolute; left: 13px; top: 15px; color: var(--muted); pointer-events: none; transition: all .12s ease; font-size: 14px; }
.field input:focus + label, .field input:not(:placeholder-shown) + label, .field select + label { top: 6px; font-size: 12px; }
.field.invalid input, .field.invalid select { border-color: var(--error); box-shadow: 0 0 0 1px var(--error); }
.field-error { color: var(--error); font-size: 13px; margin: -4px 0 10px; }

/* Shipping method choices */
.choice-list { border: 1px solid var(--field-border); border-radius: var(--radius); overflow: hidden; }
.choice-list .placeholder { margin: 0; padding: 16px; background: var(--summary-bg); color: var(--muted); }
.choice { display: flex; align-items: center; gap: 12px; padding: 16px; border-top: 1px solid var(--field-border); cursor: pointer; }
.choice:first-child { border-top: 0; }
.choice.selected { background: #f0f5ff; box-shadow: inset 0 0 0 1px var(--accent); border-radius: var(--radius); }
.choice input { accent-color: var(--accent); width: 18px; height: 18px; margin: 0; }
.choice .title { flex: 1; }
.choice .price { font-weight: 600; }
.billing-fields { margin-top: 14px; }

/* Payment */
.pay-box { border: 1px solid var(--accent); border-radius: var(--radius); overflow: hidden; }
.pay-box-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; background: #f0f5ff; border-bottom: 1px solid var(--field-border); font-weight: 500; }
.card-brands { display: flex; gap: 4px; }
.brand-pill { font-size: 9px; font-weight: 700; letter-spacing: .02em; border: 1px solid var(--field-border); border-radius: 3px; padding: 2px 4px; background: #fff; color: #333; }
.pay-box-body { padding: 16px; background: var(--summary-bg); }
#card-container { min-height: 90px; }
.pay-box-body p { margin: 4px 0 0; }

.pay-button { width: 100%; height: 56px; border: 0; border-radius: var(--radius); background: var(--accent); color: #fff; font: inherit; font-size: 17px; font-weight: 600; cursor: pointer; margin-top: 4px; }
.pay-button:disabled { opacity: .55; cursor: default; }
.pay-button.busy { position: relative; color: transparent; }
.pay-button.busy::after { content: ""; position: absolute; inset: 0; margin: auto; width: 20px; height: 20px; border: 2px solid rgba(255,255,255,.5); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.error-banner { background: #fff4f4; border: 1px solid #f3c1c1; color: #8a1010; border-radius: var(--radius); padding: 12px 14px; margin-bottom: 14px; }
.notice { padding: 40px 0; text-align: center; }
.loading { padding: 60px 0; text-align: center; color: var(--muted); }

.policies { display: flex; flex-wrap: wrap; gap: 16px; border-top: 1px solid var(--border); margin-top: 30px; padding-top: 16px; }
.policies a { color: var(--accent); font-size: 12px; }

/* Summary */
.lines { list-style: none; margin: 0 0 20px; padding: 0; }
.line { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.thumb { position: relative; width: 64px; height: 64px; flex: none; border: 1px solid var(--border); border-radius: 8px; background: #fff; }
.thumb img { width: 100%; height: 100%; object-fit: contain; border-radius: 8px; }
.qty { position: absolute; top: -9px; right: -9px; min-width: 21px; height: 21px; padding: 0 6px; border-radius: 11px; background: rgba(0,0,0,.72); color: #fff; font-size: 12px; font-weight: 600; display: flex; align-items: center; justify-content: center; }
.line-info { flex: 1; min-width: 0; }
.line-title { font-weight: 500; }
.line-variant { color: var(--muted); font-size: 12px; }
.line-price { text-align: right; white-space: nowrap; }
.line-price s { color: var(--muted); font-size: 12px; display: block; }

.discount-row { display: flex; gap: 10px; }
.discount-row .field { flex: 1; }
.secondary { height: 50px; padding: 0 18px; border-radius: var(--radius); border: 1px solid var(--field-border); background: #f0f0f0; color: #555; font: inherit; font-weight: 600; cursor: pointer; }
.secondary:not(:disabled) { background: var(--accent); color: #fff; border-color: var(--accent); }
.codes { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.code-tag { display: inline-flex; align-items: center; gap: 6px; background: #e6e6e6; border-radius: 4px; padding: 5px 8px; font-size: 13px; font-weight: 500; }
.code-tag button { border: 0; background: none; cursor: pointer; font-size: 15px; line-height: 1; color: #555; padding: 0; }

.totals { margin: 16px 0 0; }
.totals > div { display: flex; justify-content: space-between; margin-bottom: 8px; }
.totals dt, .totals dd { margin: 0; }
.totals .grand { margin-top: 14px; font-size: 19px; font-weight: 600; align-items: baseline; }
.currency { font-size: 12px; font-weight: 400; color: var(--muted); margin-right: 4px; }

/* Balance-due page */
.main.balance-main { max-width: 560px; margin: 0 auto; padding: 32px 21px; justify-self: auto; }
.balance-summary { background: var(--summary-bg); border: 1px solid var(--border); border-radius: 8px; padding: 20px; }
.balance-summary .lines { margin-bottom: 8px; }
