:root {
  --text: #1a1a1a;
  --muted: #707070;
  --border: #dedede;
  --border-strong: #c9c9c9;
  --bg: #ffffff;
  --panel: #f5f5f5;
  --accent: #1773b0;
  --accent-hover: #135f92;
  --danger: #d82c0d;
  --success: #2e7d4f;
  --radius: 6px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 14px; line-height: 1.5; color: var(--text); background: var(--bg); }
h1, h2, h3 { margin: 0; font-weight: 600; }
h2 { font-size: 20px; margin-bottom: 14px; }
img { max-width: 100%; }

.site-header { display: flex; justify-content: center; align-items: center; padding: 18px 16px; border-bottom: 1px solid var(--border); }
.brand { color: var(--text); text-decoration: none; display: inline-flex; align-items: center; }
.brand img { max-height: 56px; width: auto; height: auto; }
.brand-text { font-size: 20px; font-weight: 600; letter-spacing: .02em; }

.summary-toggle { display: none; width: 100%; align-items: center; justify-content: space-between; gap: 12px; padding: 16px; border: 0; border-bottom: 1px solid var(--border); background: var(--panel); color: var(--accent); font: inherit; cursor: pointer; }
.summary-toggle-label { display: inline-flex; align-items: center; gap: 8px; }
.summary-toggle svg { width: 18px; height: 18px; }
.toggle-thumb { width: 44px; height: 44px; object-fit: cover; border: 1px solid var(--border); border-radius: 6px; background: #fff; }
.summary-toggle .chevron { width: 10px; height: 10px; transition: transform .2s; }
.summary-toggle[aria-expanded="true"] .chevron { transform: rotate(180deg); }
.summary-toggle-total { color: var(--text); font-size: 17px; }

.layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); min-height: calc(100vh - 93px); }
.main-column { padding: 38px 38px 64px max(16px, calc(50vw - 590px)); border-right: 1px solid var(--border); }
.main-column > * { max-width: 560px; margin-left: auto; }
.summary-column { background: var(--panel); padding: 38px max(16px, calc(50vw - 590px)) 38px 38px; }
.summary-inner { max-width: 440px; position: sticky; top: 38px; }

.block { margin-bottom: 32px; }
.muted { color: var(--muted); margin: -8px 0 12px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.field { position: relative; margin-bottom: 12px; }
.field input, .field select { width: 100%; height: 50px; padding: 20px 12px 6px; border: 1px solid var(--border-strong); border-radius: var(--radius); background: #fff; font: inherit; font-size: 14px; color: var(--text); outline: none; transition: border-color .15s, box-shadow .15s; appearance: none; }
.field select { padding-right: 36px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpath d='m1 1 4 4 4-4' fill='none' stroke='%23707070' stroke-width='1.4'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; background-size: 10px; }
.field input:focus, .field select:focus { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.field input[readonly] { background: var(--panel); color: var(--muted); }
.field label { position: absolute; left: 13px; top: 15px; color: var(--muted); font-size: 14px; pointer-events: none; transition: all .15s; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: calc(100% - 26px); }
.field input:focus + label, .field input:not(:placeholder-shown) + label, .field select + label { top: 6px; font-size: 12px; }
.field-error { color: var(--danger); margin: -6px 0 12px; font-size: 13px; }
.address-suggestions { position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 30; background: #fff; border: 1px solid var(--border-strong); border-radius: var(--radius); box-shadow: 0 8px 24px rgba(0,0,0,.12); overflow: hidden; }
.address-suggestion { display: block; width: 100%; padding: 11px 14px; border: 0; border-bottom: 1px solid var(--border); background: #fff; font: inherit; font-size: 14px; color: var(--text); text-align: left; cursor: pointer; }
.address-suggestion:hover, .address-suggestion[aria-selected="true"] { background: #f0f5fa; }
.address-attribution { padding: 6px 14px; font-size: 11px; color: var(--muted); background: #fafafa; }
.address-attribution a { color: var(--muted); }
.checkbox { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.checkbox input { width: 18px; height: 18px; accent-color: var(--accent); }

.option-box { display: flex; justify-content: space-between; align-items: center; padding: 16px; border: 1px solid var(--accent); border-radius: var(--radius); background: #f0f5fa; }

.payment-box { border: 1px solid var(--border-strong); border-radius: var(--radius); overflow: hidden; }
.payment-box-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; background: #f0f5fa; border-bottom: 1px solid var(--border); font-weight: 500; }
.brands { display: inline-flex; gap: 4px; }
.brands img { height: 22px; width: auto; border: 1px solid var(--border); border-radius: 3px; background: #fff; }
.payment-box-body { padding: 16px; background: var(--panel); min-height: 80px; }
.payment-placeholder { margin: 0; color: var(--muted); text-align: center; padding: 18px 8px; }

.notice { margin: 12px 0 0; padding: 12px 14px; border-radius: var(--radius); font-size: 14px; }
.notice-error { background: #fff4f4; border: 1px solid #f3c6c0; color: #8e1f0b; }
.notice-info { background: #f0f5fa; border: 1px solid #c4d9ea; color: #12466b; }

.pay-button { width: 100%; height: 56px; margin-top: 8px; border: 0; border-radius: var(--radius); background: var(--accent); color: #fff; font: inherit; font-size: 17px; font-weight: 600; cursor: pointer; transition: background .15s, opacity .15s; }
.pay-button:hover:not(:disabled) { background: var(--accent-hover); }
.pay-button:disabled { opacity: .55; cursor: not-allowed; }
.pay-button.is-loading { opacity: .8; }
.legal { color: var(--muted); font-size: 12px; margin-top: 16px; }

.line-item { display: grid; grid-template-columns: 64px 1fr auto; gap: 14px; align-items: center; }
.thumb { position: relative; width: 64px; height: 64px; border: 1px solid var(--border); border-radius: 8px; background: #fff; }
.thumb img { width: 100%; height: 100%; object-fit: cover; border-radius: 7px; }
.qty { position: absolute; top: -8px; right: -8px; min-width: 21px; height: 21px; padding: 0 6px; border-radius: 11px; background: rgba(0,0,0,.6); color: #fff; font-size: 12px; display: grid; place-items: center; }
.line-item-text { display: flex; flex-direction: column; min-width: 0; }
.line-item-text small { color: var(--muted); }
.totals { margin: 24px 0 0; }
.totals > div { display: flex; justify-content: space-between; margin-bottom: 8px; }
.totals dt, .totals dd { margin: 0; }
.grand-total { font-size: 19px; font-weight: 600; margin-top: 16px; }
.grand-total small { font-size: 12px; color: var(--muted); font-weight: 400; }

.thank-you-head { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; }
.thank-you-head h1 { font-size: 24px; }
.thank-you-head .muted { margin: 0; }
.thank-you-icon { width: 48px; height: 48px; flex: none; border-radius: 50%; border: 2px solid var(--accent); display: grid; place-items: center; }
.thank-you-icon.is-paid::after { content: ""; width: 14px; height: 24px; border: solid var(--accent); border-width: 0 3px 3px 0; transform: translateY(-3px) rotate(45deg); }
.thank-you-icon.is-pending { border-color: var(--border); border-top-color: var(--accent); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.card { border: 1px solid var(--border); border-radius: 8px; padding: 18px; margin-bottom: 16px; }
.card h2 { font-size: 17px; margin-bottom: 6px; }
.card p { margin: 0; }
.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 12px; }
.info-grid h3 { font-size: 14px; margin-bottom: 4px; }
.info-grid p { color: var(--muted); white-space: pre-line; }
#fatal-error { max-width: 520px; margin: 48px auto; }

@media (max-width: 999px) {
  .layout { grid-template-columns: 1fr; min-height: 0; }
  .summary-toggle { display: flex; }
  .summary-column { order: -1; padding: 0 16px; max-height: 0; overflow: hidden; transition: max-height .25s ease, padding .25s; border-bottom: 1px solid transparent; }
  .summary-column.is-open { max-height: 600px; padding: 20px 16px; border-bottom-color: var(--border); }
  .summary-inner { max-width: 560px; margin: 0 auto; position: static; }
  .main-column { padding: 24px 16px 48px; border-right: 0; }
  .main-column > * { margin: 0 auto; }
  body.is-complete .summary-toggle { display: none; }
}
@media (max-width: 480px) {
  .row { grid-template-columns: 1fr; gap: 0; }
  .info-grid { grid-template-columns: 1fr; }
}
