.orders-page { min-height: 100svh; }
.orders-page .shop-main { max-width: 1300px; }
.order-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin: 18px 0 28px; }
.order-heading h1 { margin: 0 0 8px; font-size: clamp(30px, 3.5vw, 47px); font-weight: 760; }
.order-heading p { margin: 0; font-size: 14px; color: var(--muted); }
.order-heading > a, .order-text-link { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; font-size: 13px; color: var(--accent-text); }
.order-heading > a svg { width: 17px; height: 17px; }
.order-columns { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(290px, 1fr); gap: 22px; align-items: start; }
.order-panel { padding: 24px; border-radius: 24px; background: var(--shop-surface); box-shadow: var(--shop-shadow); animation: surface-rise 550ms var(--settle) both; }
.order-panel h2 { margin: 0 0 17px; font-size: 21px; font-weight: 700; }
.checkout-items, .quote-lines, #order-timeline { list-style: none; margin: 0; padding: 0; }
.checkout-items { display: grid; gap: 10px; }
.checkout-items li { display: grid; align-items: center; grid-template-columns: 64px minmax(0, 1fr) auto; gap: 9px 12px; padding: 12px; background: #f0ece6; border-radius: 18px; }
.checkout-items img { width: 64px; height: 64px; object-fit: cover; border-radius: 11px; }
.checkout-product > a { font-weight: 650; font-size: 14px; }
.checkout-product small { display: block; color: var(--muted); font-size: 12px; }
.checkout-line-total { grid-column: 2 / -1; display: flex; gap: 12px; justify-content: space-between; align-items: center; font-size: 13px; }
.checkout-line-total button { background: transparent; border: 0; color: var(--accent-text); min-height: 44px; padding-inline: 12px; }
.delivery-options { border: 0; padding: 0; margin: 0 0 18px; }
.delivery-options legend { font-size: 13px; font-weight: 650; padding: 0; margin-bottom: 8px; }
.delivery-options label { display: flex; align-items: center; gap: 8px; padding: 10px 12px; margin-bottom: 6px; min-height: 44px; border-radius: 12px; background: #f0ece6; font-size: 14px; cursor: pointer; }
.delivery-options input { accent-color: var(--accent-text); }
.order-totals { display: grid; gap: 10px; margin: 0 0 17px; }
.order-totals > div { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; font-size: 13px; }
.order-totals dd { margin: 0; text-align: end; }
.order-totals .order-total { padding: 12px; border-radius: 12px; background: #f0ece6; font-weight: 700; font-size: 15px; }
.order-summary > button, #quote-actions button { width: 100%; }
.order-note { color: var(--muted); font-size: 12px; margin: 10px 0 0; }
.order-error { color: var(--accent-text); font-size: 13px; margin: 8px 0 0; }
.order-error:empty { display: none; }
.lookup-panel { margin-bottom: 20px; }
#track-form > label { display: block; font-weight: 650; margin-bottom: 8px; font-size: 14px; }
.lookup-controls { display: flex; flex-wrap: wrap; gap: 9px; }
#track-code { flex: 1 1 175px; min-width: 0; min-height: 48px; padding-inline: 13px; border: 0; border-radius: 14px; background: #f0ece6; color: var(--ink); font-size: 16px; }
.sample-orders { margin-top: 12px; }
.sample-orders summary { cursor: pointer; display: list-item; width: fit-content; padding-block: 10px; font-size: 13px; color: var(--accent-text); }
#order-examples { display: flex; flex-wrap: wrap; gap: 7px; }
#order-examples button { border: 0; border-radius: 16px; min-height: 44px; padding: 8px 12px; background: #efeae3; font-size: 12px; }
#order-examples button:hover { background: var(--accent-soft); }
.status-heading { display: flex; justify-content: space-between; align-items: start; flex-wrap: wrap; gap: 5px 12px; }
.status-label { font-size: 12px; color: var(--accent-text); }
.status-heading h2 { margin: 4px 0; }
#display-code { background: #efeae3; padding: 5px 10px; border-radius: 10px; font-size: 12px; white-space: nowrap; }
#order-next, #quote-decision { color: var(--muted); margin: 5px 0 17px; font-size: 13px; }
#order-timeline { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; margin: 20px 0; }
#order-timeline li { display: grid; align-content: start; gap: 5px; min-width: 0; background: #f2eee8; border-radius: 12px; padding: 9px; font-size: 12px; }
#order-timeline li[aria-current] { background: var(--accent-soft); }
#order-timeline li small { color: var(--muted); font-size: 10px; }
.stage-marker { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: #e6e0d7; }
#order-timeline li.done .stage-marker, #order-timeline li[aria-current] .stage-marker { background: #292724; color: white; }
.quote-lines { display: grid; gap: 7px; margin-bottom: 16px; }
.quote-lines > li { display: flex; justify-content: space-between; gap: 10px; border-radius: 11px; padding: 10px; background: #f2eee8; font-size: 12px; }
.quote-lines strong { flex-shrink: 0; }
#quote-actions { display: grid; gap: 8px; }
@media (max-width: 1100px) { #order-timeline { grid-template-columns: repeat(3,minmax(0,1fr)); } }
@media (max-width: 900px) { .order-columns { grid-template-columns: 1fr; } }
@media (max-width: 680px) {
  .order-heading { flex-direction: column; align-items: start; gap: 4px; margin-top: 8px; }
  .order-heading h1 { font-size: 30px; }
  .order-panel { padding: 18px; border-radius: 20px; }
  #order-timeline { grid-template-columns: 1fr; }
  #order-timeline li { display: flex; align-items: center; min-height: 42px; gap: 8px; }
  #order-timeline li small { margin-inline-start: auto; }
  .checkout-items li { grid-template-columns: 55px minmax(0, 1fr); gap: 7px; }
  .checkout-items img { width: 55px; height: 55px; }
  .checkout-items .qty-stepper { width: fit-content; grid-column: 1 / -1; }
  .checkout-line-total { grid-column: 1 / -1; }
  .lookup-controls > button { flex: 1 1 auto; }
  .quote-lines > li { flex-wrap: wrap; }
}
.model-cart { margin-block-end: 20px; scroll-margin-block-start: 16px; }
.model-cart-list { display: grid; gap: 8px; margin: 14px 0; padding: 0; list-style: none; }
.model-cart-list li { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, auto) auto; align-items: center; gap: 10px 16px; padding: 12px; border-radius: 14px; background: #f1ede7; }
.model-cart-list li strong { overflow-wrap: anywhere; }
.model-cart-list li small { display: block; color: var(--muted); }
.model-cart-total { font-size: .9rem; color: var(--accent-text); }
@media (max-width: 500px) {
  .model-cart-list li { grid-template-columns: minmax(0, 1fr) auto; }
  .model-cart-total { grid-column: 1; grid-row: 2; }
  .model-cart-list button { grid-column: 2; grid-row: 1 / 3; }
}

/* ================= P02 storefront additions (Workstreams C/D/E/K) = */

/* checkout line: copy | stepper | line total | remove */
.checkout-items li { grid-template-columns: minmax(0, 1.4fr) auto minmax(90px, auto) auto; }
.checkout-item-copy strong { font-size: 14px; font-weight: 650; }
.checkout-item-copy small { display: block; color: var(--muted); font-size: 12px; margin-top: 3px; }
.checkout-item-total { margin: 0; font-size: 13px; text-align: end; white-space: nowrap; }
.checkout-remove { min-height: 44px; padding-inline: 10px; border: 0; border-radius: 11px; background: transparent; color: var(--accent-text); font: inherit; font-size: 12px; }
.checkout-remove:hover { background: #f6e5da; }
.order-toman-note { color: var(--muted) !important; font-size: 12px !important; font-weight: 400 !important; }
.order-receipt { font-size: 15px; }
.order-receipt strong { font-size: 17px; }
#checkout-success h1 { display: flex; align-items: center; gap: 10px; }
#checkout-success h1 svg { width: 26px; height: 26px; color: #225338; }
#checkout-success h2, #payment-instructions h2 { font-size: 18px; margin: 22px 0 10px; }
#payment-instructions { margin-top: 10px; padding: 16px; border-radius: 16px; background: #f0ece6; }
.order-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.order-actions a { min-height: 44px; display: inline-flex; align-items: center; padding: 8px 16px; border-radius: 13px; font-weight: 680; font-size: 14px; }
#checkout-replay-note { padding: 10px 14px; border-radius: 12px; background: #e5f0e7; color: #225338; font-size: 13px; }
.contact-options { border: 0; padding: 0; margin: 0 0 18px; display: grid; gap: 12px; }
.contact-options legend { font-size: 13px; font-weight: 650; padding: 0; margin-bottom: 8px; }
.contact-options > label { display: grid; gap: 4px; font-size: 12px; font-weight: 650; }
.contact-options input, .contact-options textarea { width: 100%; min-height: 44px; padding: 10px 13px; border: 0; border-radius: 12px; background: #f0ece6; color: inherit; font: inherit; font-size: 14px; font-weight: 400; }
.contact-options textarea { min-height: 84px; resize: vertical; }
.contact-options input:focus-visible, .contact-options textarea:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 1px; }
.contact-options small { font-weight: 400; color: var(--muted); }
.phone-verified input { background: #e5f0e7; }
#checkout-auth h1 { font-size: clamp(1.5rem, 4vw, 2rem); margin: 0 0 8px; }
#checkout-auth p { color: var(--muted); margin: 0 0 14px; }
#checkout-auth[hidden], #cart-review[hidden], #checkout-success[hidden] { display: none; }
.order-entry .account-action { margin-top: 8px; }
.order-tracking-line { direction: ltr; text-align: end; }
.order-detail { display: grid; gap: 6px; }
@media (max-width: 900px) {
  .checkout-items li { grid-template-columns: minmax(0, 1fr) auto; }
  .checkout-items .qty-stepper { grid-column: 1 / -1; width: fit-content; }
  .checkout-remove { grid-column: 1 / -1; width: 100%; }
}

/* ============ P02 closure additions (checkout confirm contract) ==== */

/* explicit reconfirmation prompt after a 409 terms_changed review —
 * the customer must look and click again; never auto-resubmitted */
.order-reconfirm { padding: 12px 14px; border-radius: 12px; background: #fdf1e2; border: 1px solid #f3c98d; color: #7a4a10; font-size: 13px; font-weight: 600; }
.order-reconfirm[hidden] { display: none; }
#cart-version { font-family: ui-monospace, monospace; font-size: 13px; }
/* order-detail line snapshot (account) */
.order-snapshot li > div { display: grid; gap: 3px; }
.order-snapshot small { display: block; color: var(--muted); font-size: 12px; }
.order-line-total { margin: 2px 0 0; font-size: 13px; text-align: end; white-space: nowrap; }
.order-payment-register { margin-top: 8px; padding: 14px; border-radius: 14px; background: #f0ece6; display: grid; gap: 10px; justify-items: start; }
.order-payment-register p { margin: 0; font-size: 13px; color: var(--muted); }

/* ============ P02 final release additions ========================= */

/* explicit gated state on the checkout login panel when OTP login is
 * not activated server-side (503 otp_not_activated) — the flow must
 * not look broken; the login button is hidden and this state shows */
.checkout-gated { display: grid; gap: 8px; }
.checkout-gated[hidden] { display: none; }
.checkout-gated .channel-status { margin: 0; font-size: 14px; font-weight: 650; }
#checkout-auth[data-gated] .account-action { display: none; }
#checkout-auth[data-gated] #checkout-auth-note { display: none; }

/* ============ Tapin shipping additions (DIMA-LOGISTICS-TAPIN-01) ==== */

/* checkout shipping step — items panel and shipping panel stack in the
 * wide column of the existing .order-columns grid; same panels, tokens
 * and spacing as the rest of the checkout */
.checkout-flow { display: grid; gap: 22px; align-content: start; min-width: 0; }
#checkout-shipping-step[hidden] { display: none; }
.shipping-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 14px 0 4px; }
.shipping-field { display: grid; gap: 6px; font-size: 12px; font-weight: 650; }
.shipping-field > span:first-child { color: var(--muted); }
.shipping-field input, .shipping-field select { width: 100%; min-height: 44px; padding: 10px 13px; border: 0; border-radius: 12px; background: #f0ece6; color: inherit; font: inherit; font-size: 14px; font-weight: 400; }
.shipping-field input:focus-visible, .shipping-field select:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 1px; }
.shipping-field-wide { grid-column: 1 / -1; }
.shipping-hint { font-weight: 400; font-size: 11px; color: var(--muted); }
.shipping-methods { border: 0; padding: 0; margin: 14px 0 0; }
.shipping-methods[hidden] { display: none; }
.shipping-methods legend { font-size: 13px; font-weight: 650; padding: 0; margin-bottom: 8px; }
.shipping-methods ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.shipping-methods li label { display: flex; align-items: center; gap: 10px; padding: 10px 12px; min-height: 44px; border-radius: 12px; background: #f0ece6; font-size: 14px; cursor: pointer; }
.shipping-methods input { accent-color: var(--accent-text); flex: none; }
.shipping-methods input:disabled { cursor: default; }
.shipping-method-copy { flex: 1; min-width: 0; }
.shipping-method-copy strong { font-size: 14px; font-weight: 650; }
.shipping-method-copy small { display: block; color: var(--muted); font-size: 12px; }
.shipping-method-price { font-weight: 700; font-size: 14px; white-space: nowrap; }
.shipping-expiry { margin: 10px 0 0; font-size: 12px; color: var(--muted); }
.shipping-expiry[hidden] { display: none; }
.shipping-expiry[data-expired] { color: var(--accent-text); font-weight: 650; }
#shipping-requote[hidden] { display: none; }
#shipping-requote { margin-top: 10px; }
/* shipping tracking block (account order view / track page) */
.shipping-track { display: grid; gap: 8px; margin-top: 10px; padding: 14px; border-radius: 14px; background: #f0ece6; }
.shipping-track h3 { margin: 0 0 2px; font-size: 15px; font-weight: 700; }
.shipping-track p { margin: 0; font-size: 13px; }
.shipping-track strong { font-size: 13px; }
.shipping-track .shipping-barcode { direction: ltr; text-align: end; font-family: ui-monospace, monospace; }
.shipping-timeline { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 6px; }
.shipping-timeline li { display: flex; align-items: center; gap: 8px; min-height: 38px; background: #f2eee8; border-radius: 12px; padding: 8px 10px; font-size: 12px; }
.shipping-timeline li[aria-current] { background: var(--accent-soft); }
.shipping-timeline li small { color: var(--muted); font-size: 10px; margin-inline-start: auto; }
@media (max-width: 680px) { .shipping-fields { grid-template-columns: 1fr; } }
