/* ============================================================
   ORDERKU — Layout & struktur form embed (kelas .of-*)
   Warna & tema via CSS variables yang disuntikkan .of-root.
   Dipakai bersama oleh form order & form custom.
   ============================================================ */

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
.of-root {
  min-height: 100vh; padding: 20px 12px;
  display: flex; align-items: flex-start; justify-content: center;
  font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased;
}
@media (min-width: 480px) { .of-root { padding: 24px 16px; } }
.of-wrap { width: 100%; max-width: 448px; margin: 0 auto; }
.of-card { overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,.06), 0 8px 24px -12px rgba(0,0,0,.10); }

/* ---------- header & section ---------- */
.of-head { text-align: center; padding: 24px 20px 16px; border-bottom: 1px solid var(--of-border-soft); }
.of-head img { max-height: 56px; width: auto; margin: 0 auto 12px; object-fit: contain; display: block; }
.of-logo-fallback { width: 48px; height: 48px; margin: 0 auto 12px; display: flex; align-items: center; justify-content: center; border-radius: 12px; }
.of-logo-fallback svg { width: 24px; height: 24px; }
.of-eyebrow { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }

.of-section { padding: 20px; border-top: 1px solid var(--of-border-soft); }
.of-plain { padding: 20px; border-top: 1px solid var(--of-border-soft); background: var(--of-surface); }

.of-step-head { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.of-step-num { width: 24px; height: 24px; border-radius: 999px; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; flex-shrink: 0; }
.of-step-title { font-size: 14px; font-weight: 700; margin: 0; }

/* ---------- fields ---------- */
.of-field { margin-bottom: 14px; }
.of-field:last-child { margin-bottom: 0; }
.of-field > label { display: block; font-size: 12px; font-weight: 600; margin-bottom: 6px; }
.of-field .req { color: #ef4444; }
.of-input { display: block; width: 100%; height: 44px; padding: 10px 12px; font-size: 14px; font-family: inherit; transition: border-color .15s, box-shadow .15s; }
textarea.of-input { min-height: 76px; resize: vertical; padding: 10px 12px; }
.of-select-wrap { position: relative; }
.of-select-wrap select { appearance: none; -webkit-appearance: none; padding-right: 34px; }
.of-select-wrap .of-caret { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); pointer-events: none; width: 16px; height: 16px; }
.of-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.of-hint { font-size: 12px; margin-top: 4px; }

/* ---------- produk ---------- */
.of-prod { padding: 20px; }
.of-prod-img { width: 100%; aspect-ratio: 4/3; object-fit: cover; border: 1px solid var(--of-border-soft); border-radius: var(--of-radius); margin-bottom: 16px; display: block; }
.of-prod h1 { font-size: 18px; font-weight: 700; line-height: 1.35; margin: 0 0 4px; }
.of-price-row { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; margin: 12px 0 0; }
.of-price-lg { font-size: 24px; font-weight: 800; letter-spacing: -.02em; }
.of-price-old { font-size: 13px; text-decoration: line-through; }
.of-price-off { background: #fef2f2; color: #dc2626; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; }
.of-desc { font-size: 13px; line-height: 1.65; margin-top: 12px; white-space: pre-line; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
.of-desc.of-full { display: block; -webkit-line-clamp: unset; overflow: visible; }
.of-more { background: none; border: 0; padding: 4px 0; font-size: 12px; font-weight: 700; cursor: pointer; margin-top: 4px; font-family: inherit; }

/* ---------- stepper qty ---------- */
.of-stepper { display: inline-flex; align-items: center; }
.of-stepper button { width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; border: 0; background: transparent; cursor: pointer; font-size: 18px; line-height: 1; }
.of-stepper button:disabled { opacity: .4; cursor: not-allowed; }
.of-stepper .of-qty { width: 48px; text-align: center; font-weight: 700; font-size: 14px; }

/* ---------- opsi (radio kartu / kurir / pembayaran) ---------- */
.of-option { display: flex; align-items: center; gap: 12px; padding: 10px 14px; margin-bottom: 8px; cursor: pointer; transition: all .15s; position: relative; }
.of-option:last-child { margin-bottom: 0; }
.of-option.dashed { border-style: dashed; cursor: default; }
.of-radio-outer { width: 16px; height: 16px; border-radius: 999px; border: 2px solid; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.of-radio-dot { width: 8px; height: 8px; border-radius: 999px; }
.of-opt-body { flex: 1; min-width: 0; }
.of-opt-row { display: flex; align-items: baseline; gap: 6px; }
.of-opt-name { font-size: 14px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.of-opt-tag { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: 1px 6px; border-radius: 4px; flex-shrink: 0; }
.of-opt-desc { font-size: 12px; margin: 2px 0 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.of-opt-price { font-size: 14px; font-weight: 700; flex-shrink: 0; }
.of-opt-col { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 12px; }
.of-opt-col .of-opt-sub { font-size: 11px; line-height: 1.4; margin-top: 2px; display: block; }
/* fix: judul tombol pembayaran boleh wrap, jangan dipotong ellipsis */
.of-opt-col .of-opt-name { white-space: normal; overflow: visible; text-overflow: clip; }
/* fix v4: list radio KLASIK untuk form custom — dipakai di .of-radios.
   Sebelumnya tiap opsi radio dirender sebagai KARTU besar ber-border
   (gaya tombol), sehingga terlihat "aneh / tidak seperti radio button".
   Sekarang: baris radio standar — lingkaran kecil + teks, rapat, tanpa
   kartu. Form order (kurir/pembayaran) tetap memakai gaya kartu karena
   menampilkan harga & subtitle — tidak terpengaruh. */
.of-radios .of-option { background: transparent; border: 0; border-radius: 10px; padding: 9px 10px; margin-bottom: 2px; }
.of-radios .of-option:last-child { margin-bottom: 0; }
.of-radios .of-option:hover { background: var(--of-accent-soft); }
.of-radios .of-option.of-active { background: var(--of-accent-soft); border-color: transparent; box-shadow: none; }
.of-radios .of-radio-outer { border-color: var(--of-muted); }
.of-radios .of-radio-outer.of-active { border-color: var(--of-accent); }
.of-radios .of-opt-name { font-weight: 600; }
.of-rates { max-height: 288px; overflow-y: auto; padding-right: 2px; }
.of-skel { height: 62px; border-radius: 12px; margin-bottom: 8px; animation: ofpulse 1.4s ease-in-out infinite; }
@keyframes ofpulse { 0%,100% { opacity: .55; } 50% { opacity: 1; } }

/* ---------- ringkasan ---------- */
.of-summary { padding: 16px; margin-top: 16px; }
.of-sum-row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 8px; font-size: 13px; }
.of-sum-row:last-child { margin-bottom: 0; }
.of-sum-total { border-top: 1px dashed var(--of-border-soft); padding-top: 10px; margin-top: 4px; font-size: 16px; font-weight: 700; display: flex; justify-content: space-between; align-items: baseline; }
.of-sum-total .of-accent { font-size: 20px; font-weight: 800; }

/* ---------- tombol ---------- */
.of-btn-primary { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; height: 52px; border: 0; font-size: 15px; font-weight: 700; cursor: pointer; transition: transform .12s, filter .15s; font-family: inherit; margin-top: 16px; }
.of-btn-primary:hover:not(:disabled) { transform: scale(1.01); }
.of-btn-primary:active:not(:disabled) { transform: scale(.99); }
.of-btn-primary:disabled { opacity: .6; cursor: not-allowed; }
.of-btn-primary svg { width: 19px; height: 19px; }
/* fix v2: ikon svg yang tidak diberi width/height atribut meledak ke
   ukuran default 300x150px (panah raksasa di tombol Kembali, ikon truk,
   dsb.) — kunci ukurannya di sini. */
.of-btn-ghost svg { width: 16px; height: 16px; flex-shrink: 0; }
.of-option svg { width: 18px; height: 18px; flex-shrink: 0; }
.of-btn-ghost { display: flex; align-items: center; justify-content: center; width: 100%; height: 44px; border: 1px solid; font-size: 14px; font-weight: 600; cursor: pointer; background: var(--of-surface); font-family: inherit; }
/* fix v3: .of-btn-ghost punya width:100% (dipakai tombol "Buat Pesanan Baru"
   di form order yang memang full-width). Di baris navigasi form custom, tombol
   Kembali + Lanjut/Kirim berbagi satu baris flex — width:100% membuat Kembali
   menggerus tombol utama sampai nyaris tak terlihat. .of-nav-row mengoreksinya. */
.of-nav-row { display: flex; gap: 10px; }
.of-nav-row .of-btn-ghost { width: auto; flex: 0 0 auto; }
.of-nav-row .of-btn-primary { width: auto; margin-top: 0; flex: 1 1 0%; min-width: 0; }
.of-btn-wa { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; height: 48px; background: #25D366; color: #fff; border: 0; border-radius: 12px; font-size: 14px; font-weight: 700; cursor: pointer; text-decoration: none; font-family: inherit; transition: transform .12s; }
.of-btn-wa:hover { transform: scale(1.01); }
.of-btn-wa svg { width: 20px; height: 20px; }
.of-trust { display: flex; align-items: center; justify-content: center; gap: 16px; font-size: 11px; margin-top: 14px; }
.of-trust span { display: flex; align-items: center; gap: 4px; }
.of-trust svg { width: 14px; height: 14px; }
.of-foot { font-size: 11px; text-align: center; margin: 16px auto 0; display: flex; align-items: center; justify-content: center; gap: 6px; max-width: 360px; }
.of-foot svg { width: 12px; height: 12px; flex-shrink: 0; }

/* ---------- error ---------- */
.of-error { display: flex; align-items: flex-start; gap: 8px; border: 1px solid #fecaca; background: #fef2f2; color: #b91c1c; border-radius: 12px; padding: 10px 14px; font-size: 13px; margin-top: 12px; }
.of-error svg { width: 16px; height: 16px; flex-shrink: 0; margin-top: 1px; }

/* ---------- progress bar (form custom) ---------- */
.of-progress { padding: 18px 20px 0; }
.of-progress-track { height: 6px; border-radius: 999px; background: var(--of-border-soft); overflow: hidden; }
.of-progress-bar { height: 100%; background: var(--of-accent); border-radius: 999px; transition: width .3s ease; }
.of-progress-label { font-size: 11px; font-weight: 600; margin-top: 6px; display: flex; justify-content: space-between; }
.of-progress-label b { font-size: 11px; }

/* ---------- layar hasil (form custom) ---------- */
/* fix v3: daftar jawaban read-only di layar konfirmasi — pengisi melihat
   jawabannya sebagai list rapi per langkah sebelum menekan "Ya, Kirim". */
.of-review { margin: 6px 20px 4px; border: 1px dashed var(--of-input-border); border-radius: var(--of-radius); padding: 12px 14px; max-height: 42vh; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.of-review-step { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 800; margin: 12px 0 2px; }
.of-review-step:first-child { margin-top: 0; }
.of-review-idx { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; border-radius: 999px; background: var(--of-accent-soft); font-size: 11px; font-weight: 800; flex-shrink: 0; }
.of-review-row { display: flex; flex-direction: column; gap: 1px; padding: 6px 0 6px 26px; border-bottom: 1px dashed var(--of-border-soft); }
.of-review-row:last-child { border-bottom: 0; }
.of-review-label { font-size: 11.5px; line-height: 1.45; }
.of-review-val { font-size: 12.5px; font-weight: 700; line-height: 1.5; word-break: break-word; white-space: pre-wrap; }
.of-result-head { text-align: center; padding: 32px 20px 24px; }
.of-result-badge { width: 64px; height: 64px; margin: 0 auto 16px; border-radius: 999px; display: flex; align-items: center; justify-content: center; }
.of-result-badge svg { width: 32px; height: 32px; }
.of-result-head h2 { font-size: 18px; font-weight: 800; margin: 0 0 8px; }
.of-result-head p { font-size: 13px; margin: 0; }
.of-tier-box { border-radius: 12px; padding: 16px; margin: 0 20px; border: 1px solid var(--of-accent-soft); background: var(--of-accent-soft); }
.of-tier-box .of-tier-name { font-size: 16px; font-weight: 800; display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.of-tier-box .of-tier-desc { font-size: 12.5px; margin-top: 6px; line-height: 1.55; }
.of-score-ring { font-size: 13px; font-weight: 800; }
.of-breakdown { padding: 4px 20px 8px; }
.of-bk-row { display: flex; align-items: flex-start; gap: 8px; font-size: 12.5px; padding: 8px 0; border-bottom: 1px dashed var(--of-border-soft); }
.of-bk-row:last-child { border-bottom: 0; }
.of-bk-label { flex: 1; min-width: 0; }
.of-bk-label b { display: block; font-size: 12.5px; }
.of-bk-label span { font-size: 11.5px; }
.of-bk-score { font-weight: 800; font-size: 12.5px; flex-shrink: 0; }
.of-summary-block { margin: 8px 20px; border: 1px dashed var(--of-input-border); border-radius: var(--of-radius); padding: 14px; max-height: 260px; overflow-y: auto; font-size: 12.5px; line-height: 1.6; white-space: pre-line; }

/* ---------- layar sukses order ---------- */
.of-success-head { text-align: center; padding: 40px 24px 32px; }
.of-success-badge { width: 64px; height: 64px; margin: 0 auto 16px; border-radius: 999px; display: flex; align-items: center; justify-content: center; }
.of-success-badge svg { width: 36px; height: 36px; }
.of-success-head h2 { font-size: 20px; font-weight: 800; margin: 0 0 8px; }
.of-success-head p { font-size: 13px; margin: 0; }
.of-order-code { display: inline-flex; align-items: center; gap: 8px; border-radius: 999px; padding: 8px 16px; font-size: 14px; font-weight: 700; margin-top: 20px; }
.of-order-code svg { width: 16px; height: 16px; }
.of-success-detail { margin: 0 24px; border-radius: 12px; padding: 16px; }
.of-success-actions { padding: 24px; display: flex; flex-direction: column; gap: 12px; }

/* ---------- panel debug ---------- */
.of-debug { position: fixed; bottom: 12px; right: 12px; z-index: 9999; width: 300px; max-width: calc(100vw - 24px); border-radius: 12px; border: 1px solid #374151; background: rgba(17,24,39,.96); color: #f3f4f6; padding: 12px; font-size: 11px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; box-shadow: 0 20px 40px -12px rgba(0,0,0,.5); }
.of-debug-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.of-debug-title { display: flex; align-items: center; gap: 6px; font-weight: 700; letter-spacing: .04em; color: #34d399; }
.of-debug-title svg { width: 14px; height: 14px; }
.of-debug-clear { background: #1f2937; color: #9ca3af; border: 0; border-radius: 6px; padding: 2px 8px; font-size: 10px; cursor: pointer; font-family: inherit; }
.of-debug-clear:hover { color: #e5e7eb; }
.of-debug-log { max-height: 224px; overflow-y: auto; }
.of-debug-log .of-debug-empty { color: #6b7280; }
.of-debug-row { display: flex; align-items: baseline; gap: 6px; line-height: 1.45; margin-bottom: 4px; }
.of-debug-t { color: #6b7280; flex-shrink: 0; }
.of-debug-name { color: #7dd3fc; font-weight: 600; flex-shrink: 0; }
.of-debug-targets { color: #9ca3af; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.of-debug-note { margin-top: 8px; padding-top: 6px; border-top: 1px solid #374151; font-size: 10px; color: #6b7280; line-height: 1.5; }
.of-debug-note code { background: #1f2937; border-radius: 4px; padding: 0 4px; }

/* skeleton loading awal */
.of-loading { text-align: center; padding: 60px 24px; }
.of-loading .of-spin { width: 32px; height: 32px; border: 3px solid var(--of-border-soft); border-top-color: var(--of-accent); border-radius: 999px; margin: 0 auto 12px; animation: ofspin 1s linear infinite; }
@keyframes ofspin { to { transform: rotate(360deg); } }

/* responsive kecil */
@media (max-width: 420px) {
  .of-grid-2 { grid-template-columns: 1fr 1fr; gap: 10px; }
  .of-root { padding: 12px 8px; }
}
