:root {
  --ink: #171717;
  --muted: #737373;
  --line: #d4d4d4;
  --line-soft: #e5e5e5;
  --side: #f5f5f5;
  --radius: 12px;
  --error-bg: #fef2f2;
  --error: #b91c1c;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: #fff;
  color: var(--ink);
  font: 16px/1.5 Geist, "Geist Fallback", Arial, Helvetica, sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; color: inherit; }

/* ---------- Layout: white form left, grey summary right ---------- */
.page { display: grid; grid-template-columns: 1fr 1fr; min-height: 100vh; }
.main { display: flex; justify-content: flex-end; padding: 56px 38px 64px; }
.col { width: 100%; max-width: 500px; }
.side { background: var(--side); border-left: 1px solid var(--line-soft); }
.side-inner { position: sticky; top: 0; max-width: 400px; padding: 56px 38px; }

.logo-link { display: block; text-align: center; }
.logo { width: 254px; max-width: 70%; height: auto; }
.d-logo { margin-bottom: 28px; }
.m-header, .m-summary-toggle { display: none; }

section { margin-top: 26px; }
h2 { font-size: 21px; font-weight: 500; margin: 0 0 14px; letter-spacing: -.01em; }
h2.tight { margin-bottom: 2px; }
.sub { margin: 0 0 14px; font-size: 13px; color: var(--muted); }

/* ---------- Fields ---------- */
.field { position: relative; margin-bottom: 12px; }
.row { display: grid; gap: 12px; }
.row .field { margin-bottom: 0; }
.row { margin-bottom: 12px; }
.row.two { grid-template-columns: 1fr 1fr; }
.row.three { grid-template-columns: 1fr 1.6fr 1fr; }
input, select {
  width: 100%; height: 52px; padding: 0 14px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: #fff; font-size: 14px; outline: none; transition: border-color .15s, box-shadow .15s;
}
input::placeholder { color: var(--muted); }
input:focus, select:focus { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
input.invalid { border-color: var(--error); box-shadow: 0 0 0 1px var(--error); }
.field.select label { position: absolute; left: 14px; top: 7px; font-size: 11px; color: var(--muted); pointer-events: none; }
.field.select select { appearance: none; -webkit-appearance: none; padding-top: 16px; cursor: pointer; }
.field.select .chev { position: absolute; right: 14px; top: 18px; color: var(--muted); pointer-events: none; }

/* ---------- Shipping method ---------- */
.ship-option {
  display: flex; align-items: center; gap: 14px; padding: 14px 16px;
  border: 2px solid var(--ink); border-radius: var(--radius); background: #f5f5f5; font-size: 14px;
}
.ship-text { flex: 1; line-height: 1.35; }
.ship-text span { color: var(--ink); }
.ship-option strong { font-weight: 500; }
.radio { width: 16px; height: 16px; border-radius: 50%; border: 1px solid var(--ink); position: relative; flex: none; }
.radio.on::after { content: ""; position: absolute; inset: 3px; border-radius: 50%; background: var(--ink); }

/* ---------- Payment ---------- */
.payment-box { min-height: 120px; }
.loading { padding: 40px 0; text-align: center; color: var(--muted); font-size: 14px; }
.pay-btn {
  width: 100%; height: 52px; margin-top: 26px; border: 0; border-radius: var(--radius);
  background: #000; color: #fff; font-size: 16px; font-weight: 600; cursor: pointer;
}
.pay-btn:disabled { background: #808080; cursor: not-allowed; }
.pay-btn.busy { background: #404040; cursor: wait; }
.branding { margin-top: 14px; display: flex; justify-content: center; }
.hint { text-align: center; color: var(--muted); font-size: 12px; margin: 18px 0 0; }
.hint:empty { display: none; }
.alert { background: var(--error-bg); color: var(--error); padding: 12px 14px; border-radius: var(--radius); font-size: 14px; margin-bottom: 8px; }

/* ---------- Summary ---------- */
.sum-head { display: flex; justify-content: space-between; font-size: 13px; font-weight: 500; padding-bottom: 14px; border-bottom: 1px solid var(--line-soft); }
.lines { list-style: none; margin: 0; padding: 16px 0; display: grid; gap: 14px; border-bottom: 1px solid var(--line-soft); }
.lines li { display: grid; grid-template-columns: 56px 1fr auto; gap: 14px; align-items: center; font-size: 13px; }
.thumb { position: relative; width: 56px; height: 56px; border-radius: 8px; border: 1px solid var(--line-soft); background: #fff; }
.thumb img { width: 100%; height: 100%; object-fit: cover; border-radius: 8px; }
.qty {
  position: absolute; top: -8px; right: -8px; min-width: 20px; height: 20px; padding: 0 6px;
  border-radius: 10px; background: #666; color: #fff; font-size: 11px; font-weight: 500; line-height: 20px; text-align: center;
}
.totals { margin: 0; padding-top: 14px; font-size: 13px; }
.totals div { display: flex; justify-content: space-between; padding: 3px 0; }
.totals dt, .totals dd { margin: 0; }
.totals .grand { margin-top: 12px; padding-top: 16px; border-top: 1px solid var(--line-soft); font-size: 18px; font-weight: 600; align-items: baseline; }
.totals .grand small { font-size: 11px; font-weight: 400; color: var(--muted); margin-right: 4px; }

/* ---------- Mobile ---------- */
@media (max-width: 999px) {
  .page { display: flex; flex-direction: column; }
  .m-header { display: block; padding: 24px 16px 18px; border-bottom: 1px solid var(--line-soft); }
  .d-logo { display: none; }
  .m-summary-toggle {
    display: flex; justify-content: space-between; align-items: center; width: 100%;
    padding: 22px 16px; background: var(--side); border: 0; border-bottom: 1px solid var(--line-soft);
    font-size: 16px; cursor: pointer; text-align: left;
  }
  .m-summary-toggle span { display: inline-flex; align-items: center; gap: 10px; font-weight: 500; }
  .m-summary-toggle .m-total { font-size: 18px; font-weight: 600; }
  .m-summary-toggle[aria-expanded="true"] .chev { transform: rotate(180deg); }
  .side { order: -1; display: none; border-left: 0; border-bottom: 1px solid var(--line-soft); }
  .side.open { display: block; }
  .side-inner { position: static; max-width: none; padding: 8px 16px 20px; }
  .sum-head { display: none; }
  .page > .m-header { order: -3; }
  .page > .m-summary-toggle { order: -2; }
  .main { padding: 26px 24px 48px; justify-content: center; }
  .row.three { grid-template-columns: 1.3fr 1fr 1fr; }
  .col { max-width: 560px; }
  .logo { width: 254px; }
}
@media (max-width: 420px) {
  .main { padding: 24px 24px 40px; }
}

/* ---------- Thank-you page ---------- */
.ty { max-width: 520px; margin: 0 auto; padding: 48px 24px; text-align: center; }
.ty .icon { width: 56px; height: 56px; line-height: 56px; margin: 28px auto 10px; border-radius: 50%; background: var(--side); font-size: 26px; }
.ty h1 { font-size: 26px; font-weight: 500; margin: 6px 0; }
.ty p { color: var(--muted); }
.ty .pay-btn { display: inline-block; max-width: 300px; line-height: 52px; text-decoration: none; }
