/* Номын захиалгын цонх (js/order.js). styles.css-ийн токенуудыг (--surface, --ink, --muted, --line, --soft, --bg,
   --good, --focus) ашиглана; байхгүй бол харанхуй fallback утгатай. Зөвхөн .vo-аар эхэлсэн класс — сайтын бусад хэсгийг өөрчлөхгүй. */

.vo {
  --vo-surface: var(--surface, #111114);
  --vo-ink: var(--ink, #f2f2f4);
  --vo-ink-inv: var(--ink-inv, #000);
  --vo-muted: var(--muted, #a6a6b0);
  --vo-line: var(--line, #26262d);
  --vo-soft: var(--soft, #1c1c22);
  --vo-field: var(--field, #222229);
  --vo-field-line: var(--field-line, #686875);
  --vo-ok: var(--good, #5fe36a);
  --vo-focus: var(--focus, #7fb2ff);
  /* Нийтийн сайт зөвхөн харанхуй (styles.css) — цонхны төлөвийн өнгө ч харанхуй дэвсгэрт тааруулав */
  --vo-err: #ff8593;
  --vo-err-bg: #3a1a20;
  --vo-warn: #ffc979;
  --vo-warn-bg: #2e2414;
  --vo-key-bg: #2a2614;
  --vo-radius: 10px;
  --vo-body: var(--body, Inter, system-ui, sans-serif);
  --vo-display: var(--display, var(--vo-body));
}

html.vo-lock { overflow: hidden; }

/* ---------- Цонх ---------- */
.vo {
  width: min(600px, calc(100% - 32px)); max-width: none; max-height: calc(100dvh - 32px); height: auto;
  padding: 0; border: 0; border-radius: 20px; overflow: hidden;
  background: var(--vo-surface); color: var(--vo-ink); font: 16px/1.5 var(--vo-body);
  border: 1px solid var(--vo-line); box-shadow: 0 30px 80px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.04);
}
.vo[open] { display: flex; flex-direction: column; animation: vo-in 0.18s ease-out; }
.vo::backdrop { background: rgba(0, 0, 0, 0.78); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
@keyframes vo-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.vo-sheet { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.vo [hidden] { display: none !important; }
.vo button, .vo input, .vo select, .vo textarea { font: inherit; color: inherit; }
.vo :focus-visible { outline: 2px solid var(--vo-focus); outline-offset: 2px; }
.vo-sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; margin: -1px; padding: 0; border: 0; }

.vo-head { flex: none; display: flex; gap: 14px; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--vo-line); background: var(--vo-surface); }
.vo-cover { flex: none; width: 52px; height: auto; aspect-ratio: 240 / 378; border-radius: 3px 6px 6px 3px; background: #000; object-fit: cover; box-shadow: 0 6px 16px rgba(10, 12, 20, 0.25); }
.vo-head-text { min-width: 0; flex: 1; }
.vo-kicker { margin: 0; font-size: 11px; font-weight: 400; letter-spacing: 0.24em; text-transform: uppercase; color: var(--vo-muted); }
.vo-title { margin: 0; font: 400 20px/1.2 "Rubik Glitch", var(--vo-display); text-transform: uppercase; letter-spacing: -0.01em; outline: none; }
.vo-meta { margin: 1px 0 0; font-size: 13px; color: var(--vo-muted); line-height: 1.35; }
.vo-unit { margin: 3px 0 0; font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }
.vo-close { flex: none; align-self: flex-start; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--vo-line); background: transparent; cursor: pointer; }
.vo-close svg { width: 20px; height: 20px; stroke: currentColor; stroke-width: 2; stroke-linecap: round; fill: none; }
@media (hover: hover) { .vo-close:hover { border-color: var(--vo-ink); } }

.vo-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.vo-pane { padding: 18px 20px 22px; }
.vo-pane:focus { outline: none; }
.vo-pane h3 { margin: 0 0 8px; font: 500 20px/1.3 var(--vo-display); }
.vo-h4 { margin: 22px 0 10px; font-size: 15px; font-weight: 600; }
.vo-center { text-align: center; padding-block: 32px; }
.vo-center p { max-width: 44ch; margin-inline: auto; }
.vo-muted { color: var(--vo-muted); }
.vo-hint { margin: 6px 0 0; font-size: 13px; color: var(--vo-muted); }
.vo-link { color: inherit; font-weight: 600; }
.vo a[data-vo-tel]:not(.btn) { color: inherit; font-weight: 600; white-space: nowrap; }
.vo-linkbtn { background: none; border: 0; padding: 4px 0; font-weight: 600; text-decoration: underline; cursor: pointer; min-height: 32px; }
.vo-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; margin-top: 16px; }
.vo-actions-center { justify-content: center; }
.vo-loading { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 180px; margin: 0; color: var(--vo-muted); }

/* ---------- Маягт ---------- */
.vo-facts { list-style: none; margin: 0 0 14px; padding: 12px 14px; border-radius: var(--vo-radius); background: var(--vo-soft); display: grid; gap: 4px; font-size: 14px; }
.vo-facts li { display: flex; gap: 8px; }
.vo-facts li::before { content: "✓"; color: var(--vo-ok); font-weight: 600; }
.vo-facts li:empty { display: none; }
.vo-last, .vo-draft { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 12px; margin: 0 0 12px; padding: 8px 14px; border-radius: var(--vo-radius); border: 1px dashed var(--vo-line); font-size: 14px; }
.vo-alert { margin: 0 0 14px; padding: 12px 14px; border-radius: var(--vo-radius); background: var(--vo-err-bg); color: var(--vo-err); font-weight: 600; font-size: 15px; outline: none; }
.vo-alert p { margin: 0; }
.vo-alert .vo-retry { margin-top: 10px; padding: 10px 18px; color: var(--vo-ink); background: var(--vo-surface); }

.vo-group { margin: 0 0 18px; padding: 0; border: 0; min-width: 0; }
.vo-group legend { padding: 0; margin: 0 0 10px; font-size: 15px; font-weight: 600; }
.vo-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 14px; }
.vo-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.vo-full { grid-column: 1 / -1; }
.vo-field > label, .vo-label { font-size: 14px; font-weight: 600; }
.vo-opt { font-weight: 400; color: var(--vo-muted); }
.vo-field input, .vo-field select, .vo-field textarea {
  width: 100%; min-width: 0; min-height: 48px; font-size: 16px; /* iOS zoom-гүй */
  color: var(--vo-ink); background: var(--vo-field); border: 1px solid var(--vo-field-line); border-radius: 10px; padding: 11px 12px;
  transition: border-color 0.12s, background 0.12s;
}
@media (hover: hover) { .vo-field input:hover, .vo-field select:hover, .vo-field textarea:hover { border-color: #6c6c79; } }
.vo-field input::placeholder, .vo-field textarea::placeholder { color: #8a8a96; }
.vo-field textarea { resize: vertical; min-height: 72px; }
.vo-field input:focus-visible, .vo-field select:focus-visible, .vo-field textarea:focus-visible { outline: 2px solid var(--vo-focus); outline-offset: 0; border-color: transparent; }
.vo-field [aria-invalid="true"] { border-color: var(--vo-err); border-width: 2px; padding: 10px 11px; }
.vo-readonly { margin: 0; min-height: 48px; padding: 11px 12px; border-radius: 10px; border: 1px dashed var(--vo-line); color: var(--vo-muted); }
.vo-err { margin: 0; color: var(--vo-err); font-size: 14px; font-weight: 500; }
.vo-err:empty { display: none; }
.vo-err:not(:empty)::before { content: "! "; font-weight: 600; }
.vo-err-block { margin-top: 12px; }

.vo-qty-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; }
.vo-stepper { display: grid; grid-template-columns: 48px 56px 48px; align-items: stretch; border: 1px solid var(--vo-field-line); border-radius: 12px; overflow: hidden; background: var(--vo-field); }
.vo-stepper button { height: 48px; border: 0; background: transparent; font-size: 22px; line-height: 1; cursor: pointer; touch-action: manipulation; }
.vo-stepper button:focus-visible { outline-offset: -3px; }
@media (hover: hover) { .vo-stepper button:hover:not(:disabled) { background: var(--vo-soft); } }
.vo-stepper button:disabled { color: var(--vo-muted); opacity: 0.45; cursor: default; }
.vo-stepper output { display: grid; place-items: center; font: 600 18px var(--vo-display); font-variant-numeric: tabular-nums; border-inline: 1px solid var(--vo-line); }
.vo-qty-note { margin: 0; display: flex; flex-direction: column; font-size: 14px; color: var(--vo-muted); }
.vo-low { color: var(--vo-warn); font-weight: 600; }

.vo-breakdown { margin: 4px 0 16px; padding: 12px 14px; border-radius: var(--vo-radius); border: 1px solid var(--vo-line); display: grid; gap: 4px; font-variant-numeric: tabular-nums; }
.vo-breakdown div { display: flex; justify-content: space-between; gap: 12px; }
.vo-breakdown dt { color: var(--vo-muted); }
.vo-breakdown dd { margin: 0; font-weight: 600; }
.vo-bd-total { margin-top: 4px; padding-top: 8px; border-top: 1px solid var(--vo-line); }
.vo-bd-total dt { color: var(--vo-ink); font-weight: 600; }
.vo-bd-total dd { font: 600 18px var(--vo-display); }

.vo-consent { display: flex; gap: 12px; align-items: flex-start; font-size: 14px; }
.vo-consent input { width: 22px; height: 22px; margin: 1px 0 0; flex: none; accent-color: var(--vo-ink); cursor: pointer; }
.vo-consent label { cursor: pointer; }
.vo-consent.vo-invalid input { outline: 2px solid var(--vo-err); outline-offset: 2px; }
.vo-consent + .vo-err { margin: 6px 0 0 34px; }
.vo-alt { margin: 14px 0 0; font-size: 14px; color: var(--vo-muted); }

/* Нийт дүн + товч — маягтын доод талд үргэлж харагдана (sticky) */
.vo-foot {
  position: sticky; bottom: 0; z-index: 1; display: flex; align-items: center; gap: 12px;
  margin: 18px -20px -22px; padding: 12px 20px calc(12px + env(safe-area-inset-bottom, 0px));
  background: var(--vo-surface); border-top: 1px solid var(--vo-line); box-shadow: 0 -8px 20px rgba(10, 12, 20, 0.06);
}
.vo-foot-sum { margin: 0; flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.vo-foot-label { font-size: 13px; color: var(--vo-muted); }
.vo-foot-sum b { font: 600 20px var(--vo-display); font-variant-numeric: tabular-nums; }
.vo-submit { flex: none; min-width: 148px; min-height: 50px; }

.vo-spin { display: none; width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: vo-spin 0.8s linear infinite; }
.vo-loading .vo-spin, .vo-loading-btn .vo-spin { display: inline-block; }
.vo-loading-btn { cursor: progress !important; }
@keyframes vo-spin { to { transform: rotate(360deg); } }

/* ---------- Дууссан ---------- */
.vo-badge { display: inline-block; margin: 0 0 14px; padding: 6px 16px; border-radius: 99px; transform: rotate(-3deg); font: 600 13px var(--vo-display); letter-spacing: 0.08em; text-transform: uppercase; border: 2px solid var(--vo-ink); }

/* ---------- Баталгаажуулалт ---------- */
.vo-success { display: flex; gap: 14px; align-items: center; margin-bottom: 10px; }
.vo-success h3 { margin: 0; }
.vo-success p { margin: 2px 0 0; }
.vo-check { flex: none; width: 44px; height: 44px; border-radius: 50%; background: var(--vo-ok); position: relative; }
.vo-check::after { content: ""; position: absolute; left: 15px; top: 10px; width: 10px; height: 18px; border: solid #000; border-width: 0 3px 3px 0; transform: rotate(45deg); }
.vo-code { font: 600 18px var(--vo-display); letter-spacing: 0.04em; }
.vo-mono { font-variant-numeric: tabular-nums; letter-spacing: 0.02em; }
.vo-deadline { margin: 12px 0 0; padding: 10px 14px; border-radius: var(--vo-radius); background: var(--vo-warn-bg); color: var(--vo-warn); font-size: 14px; font-weight: 600; }
.vo-deadline:empty { display: none; }

.vo-paylist { list-style: none; counter-reset: vo; margin: 0; padding: 0; border-radius: 14px; background: var(--vo-soft); }
.vo-paylist li { counter-increment: vo; position: relative; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 2px 12px; padding: 12px 14px 12px 50px; border-bottom: 1px solid var(--vo-line); }
.vo-paylist li:last-child { border-bottom: 0; }
.vo-paylist li::before { content: counter(vo); position: absolute; left: 14px; top: 12px; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 600; background: var(--vo-ink); color: var(--vo-ink-inv); }
.vo-paylist small { flex-basis: 100%; font-size: 13px; }
.vo-pl-label { font-size: 14px; color: var(--vo-muted); }
.vo-pl-val { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font-weight: 600; overflow-wrap: anywhere; }
.vo-pl-val b { font-size: 17px; }
.vo-paylist .vo-key { background: var(--vo-key-bg); border-radius: 0 0 14px 14px; }
.vo-paylist .vo-key b { font: 600 18px var(--vo-display); letter-spacing: 0.04em; }
.vo-copy { min-height: 36px; padding: 6px 14px; border-radius: 99px; border: 1px solid var(--vo-line); background: var(--vo-surface); font-size: 14px; font-weight: 600; cursor: pointer; white-space: nowrap; }
@media (hover: hover) { .vo-copy:hover { border-color: var(--vo-ink); } }
.vo-copy.vo-copied, .vo-copy-all.vo-copied { border-color: var(--vo-ok); color: var(--vo-ok); }
.vo-warn { margin: 12px 0 0; padding: 10px 14px; border-radius: var(--vo-radius); background: var(--vo-warn-bg); color: var(--vo-warn); font-size: 14px; }
.vo-next { margin: 0; padding-left: 22px; display: grid; gap: 6px; font-size: 15px; }

/* ---------- Төлөв ---------- */
.vo-status-result { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--vo-line); }
.vo-pill { display: inline-block; margin: 0 0 8px; padding: 5px 14px; border-radius: 99px; font-weight: 600; background: var(--vo-ink); color: var(--vo-ink-inv); }
.vo-pill[data-status="delivered"], .vo-pill[data-status="paid"], .vo-pill[data-status="shipping"] { background: var(--vo-ok); color: #000; }
.vo-pill[data-status="cancelled"], .vo-pill[data-status="expired"] { background: var(--vo-err-bg); color: var(--vo-err); }
.vo-status-hint { margin: 0 0 14px; }
.vo-timeline { list-style: none; margin: 0 0 16px; padding: 0; }
.vo-timeline li { position: relative; display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 10px; padding: 0 0 16px 32px; }
.vo-timeline li::before { content: ""; position: absolute; left: 9px; top: 18px; bottom: -2px; width: 2px; background: var(--vo-line); }
.vo-timeline li:last-child { padding-bottom: 0; }
.vo-timeline li:last-child::before { display: none; }
.vo-tl-dot { position: absolute; left: 0; top: 3px; width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--vo-line); background: var(--vo-surface); }
.vo-tl-done .vo-tl-dot, .vo-tl-current .vo-tl-dot { border-color: var(--vo-ok); background: var(--vo-ok); }
.vo-tl-done::before { background: var(--vo-ok) !important; }
.vo-tl-current .vo-tl-dot { box-shadow: 0 0 0 4px color-mix(in srgb, var(--vo-ok) 25%, transparent); }
.vo-tl-stopped .vo-tl-dot { border-color: var(--vo-err); background: var(--vo-err); }
.vo-tl-label { font-weight: 600; }
.vo-tl-todo .vo-tl-label { color: var(--vo-muted); font-weight: 500; }
.vo-tl-current .vo-tl-label, .vo-tl-stopped .vo-tl-label { font-weight: 600; }
.vo-timeline time { font-size: 13px; color: var(--vo-muted); font-variant-numeric: tabular-nums; }
.vo-summary { margin: 0; padding: 4px 14px; border-radius: var(--vo-radius); background: var(--vo-soft); }
.vo-summary div { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 4px 12px; padding: 9px 0; border-bottom: 1px solid var(--vo-line); }
.vo-summary div:last-child { border-bottom: 0; }
.vo-summary dt { color: var(--vo-muted); font-size: 14px; }
.vo-summary dd { margin: 0; font-weight: 600; display: flex; align-items: center; gap: 8px; overflow-wrap: anywhere; }
.vo-status-actions { justify-content: space-between; font-size: 14px; }

/* ---------- Гар утас: бүтэн дэлгэц ---------- */
@media (max-width: 560px) {
  .vo { width: 100%; max-height: 100dvh; height: 100dvh; margin: 0; border-radius: 0; }
  .vo[open] { animation-name: vo-up; }
  .vo-head { padding: 10px 16px; padding-top: calc(10px + env(safe-area-inset-top, 0px)); gap: 12px; }
  .vo-cover { width: 40px; }
  .vo-title { font-size: 17px; }
  .vo-meta { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .vo-close { width: 40px; height: 40px; }
  .vo-pane { padding: 16px 16px 20px; }
  .vo-foot { margin: 16px -16px -20px; padding-inline: 16px; }
  .vo-grid { grid-template-columns: 1fr; }
  .vo-actions .btn { flex: 1 1 100%; }
  .vo-foot .vo-submit { min-width: 0; flex: 0 1 170px; }
  .vo-paylist li { padding-left: 46px; }
}
@media (max-width: 360px) {
  .vo-meta { display: none; }
}
@keyframes vo-up { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  .vo[open] { animation: none; }
  .vo-spin { animation-duration: 2.4s; }
}

/* Статик горимд (Worker-гүй) зөвхөн захиалгын API-тай үед утга учиртай элементүүдийг нуух: <span data-order-only> */
html:not([data-order-api="1"]) [data-order-only] { display: none !important; }

@media print { .vo { display: none !important; } }
