/* orders.css — order tracking inside #ordersModal (the list of orders, one order's tracker, the admin "Update status"
   panel and the "Find an order" form), all driven by orders.js. Every class is .kmo- prefixed so nothing here can
   collide with styles.css; colours come from its :root tokens.

   Status colours are text-on-tint pairs, each checked at >= 4.5:1 on the darkest and lightest surface they sit on
   (--bg #131317 cards, --bg-alt #1a1a1f modal) — --brand-red itself is only ~3:1 there, fine for a button fill but
   too dim for small text, so anything that has to be read uses the lighter shades below. */
:root{
  --kmo-neutral:#c3c7cf;  --kmo-neutral-bg:rgba(195,199,207,.14);
  --kmo-amber:#f3b74f;    --kmo-amber-bg:rgba(243,183,79,.14);
  --kmo-blue:#6db3ff;     --kmo-blue-bg:rgba(109,179,255,.15);
  --kmo-violet:#b3a6ff;   --kmo-violet-bg:rgba(179,166,255,.15);
  --kmo-green:#38c996;    --kmo-green-bg:rgba(56,201,150,.15);
  --kmo-red:#f58a9a;      --kmo-red-bg:rgba(200,16,46,.2);
  --kmo-err:#ff7f92;
  --kmo-grey:#6b6f78;     /* "reached, then cancelled" steps */
}

/* One class per status sets the accent (--kmo-c) and its tint (--kmo-tint); pills, the banner, the tracker and the
   admin panel all read those two, so a status looks the same everywhere. */
.kmo-s-placed{ --kmo-c:var(--kmo-neutral); --kmo-tint:var(--kmo-neutral-bg); }
.kmo-s-processing{ --kmo-c:var(--kmo-amber); --kmo-tint:var(--kmo-amber-bg); }
.kmo-s-shipped{ --kmo-c:var(--kmo-blue); --kmo-tint:var(--kmo-blue-bg); }
.kmo-s-out_for_delivery{ --kmo-c:var(--kmo-violet); --kmo-tint:var(--kmo-violet-bg); }
.kmo-s-delivered{ --kmo-c:var(--kmo-green); --kmo-tint:var(--kmo-green-bg); }
.kmo-s-cancelled{ --kmo-c:var(--kmo-red); --kmo-tint:var(--kmo-red-bg); }

/* ================= MODAL SHELL ================= */
/* Same panel as .orders-modal in styles.css; the id selector just makes these win regardless of stylesheet order. */
#ordersModal.orders-modal{
  overflow-x:hidden; overscroll-behavior:contain; font-size:14px; line-height:1.45;
}
#ordersModal.orders-modal.kmo-wide{ max-width:760px; }
#ordersModal:focus{ outline:none; }

/* The header sticks to the top of the scrolling panel so Close (and Back) stay reachable on a long order. */
.kmo-head{
  position:sticky; top:0; z-index:3; display:flex; align-items:center; gap:6px;
  min-height:66px; padding:10px 68px 10px 24px;
  background:var(--bg-alt); border-bottom:1px solid var(--line);
}
.kmo-head.has-back{ padding-left:12px; }
.kmo-title{ margin:0; min-width:0; font-size:19px; font-weight:800; line-height:1.25; overflow-wrap:anywhere; }
.kmo-title:focus{ outline:none; }
#ordersModal .kmo-close{ top:11px; right:12px; width:44px; height:44px; font-size:24px; line-height:1; }
.kmo-back{
  flex:0 0 auto; width:44px; height:44px; padding:0; display:flex; align-items:center; justify-content:center;
  background:none; border:none; border-radius:50%; color:var(--ink); cursor:pointer;
}
.kmo-back:hover{ background:var(--line); }
.kmo-body{ padding:18px 24px 28px; }

#ordersModal button:focus-visible,
#ordersModal select:focus-visible{ outline:2px solid #fff; outline-offset:2px; }
#ordersModal input:focus-visible,
#ordersModal textarea:focus-visible{ outline:2px solid #ffffff; outline-offset:1px; }

.kmo-sr{
  position:absolute; width:1px; height:1px; margin:-1px; padding:0; overflow:hidden;
  clip:rect(0 0 0 0); clip-path:inset(50%); white-space:nowrap; border:0;
}
.kmo-muted{ margin:0; color:var(--muted); font-size:13.5px; line-height:1.5; }
.kmo-scope{ margin-bottom:12px; }
.kmo-h{ margin:0 0 10px; font-size:12px; font-weight:800; letter-spacing:.07em; text-transform:uppercase; color:var(--muted); }

/* ================= BUTTONS / FIELDS ================= */
/* .btn-primary / .btn-secondary are full-width block buttons; these overrides turn them into inline, 44px-tall ones. */
#ordersModal .kmo-btn{
  width:auto; min-height:44px; margin:0; padding:0 18px;
  display:inline-flex; align-items:center; justify-content:center; gap:8px;
  font:inherit; font-size:14.5px; font-weight:700; line-height:1.2; border-radius:6px;
}
#ordersModal .kmo-btn[disabled]{ opacity:.55; cursor:not-allowed; }
#ordersModal .kmo-btn[aria-disabled="true"]{ opacity:.55; cursor:progress; }
#ordersModal .kmo-btn-danger{ color:#ff9aa8; border-color:rgba(255,127,146,.45); }
#ordersModal .kmo-btn-sm{ min-height:44px; padding:0 14px; font-size:13.5px; }
.kmo-actions{ display:flex; flex-wrap:wrap; gap:10px; margin-top:18px; }

/* 16px, not the site's 14px: iOS Safari zooms the whole page into any smaller input on focus. */
#ordersModal .form-row input,
#ordersModal .kmo-select,
#ordersModal textarea{ font-size:16px; }
#ordersModal .form-row input{ min-height:46px; }
.kmo-select{
  width:100%; min-height:46px; padding:10px 36px 10px 12px;
  border:1px solid var(--line-strong); border-radius:6px; background-color:var(--line); color:var(--ink);
  font:inherit; font-size:16px; cursor:pointer;
  -webkit-appearance:none; appearance:none;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239a9fa8' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat:no-repeat; background-position:right 11px center; background-size:16px;
}
.kmo-select option{ background:#111111; color:var(--ink); }
#ordersModal textarea{ min-height:64px; line-height:1.45; resize:vertical; }
.kmo-err{ margin:8px 0 0; font-size:13px; font-weight:600; color:var(--kmo-err); overflow-wrap:anywhere; }
.kmo-err[hidden]{ display:none; }
.kmo-opt{ font-weight:400; }

.kmo-msg{ margin-top:14px; padding:10px 12px; border:1px solid; border-radius:8px; font-size:13.5px; line-height:1.45; overflow-wrap:anywhere; }
.kmo-msg-err{ color:var(--kmo-err); background:rgba(255,127,146,.08); border-color:rgba(255,127,146,.35); }
.kmo-msg-ok{ color:var(--kmo-green); background:var(--kmo-green-bg); border-color:rgba(56,201,150,.35); }
.kmo-msg-info{ color:var(--ink); background:var(--line); border-color:var(--line-strong); }
.kmo-msg .kmo-btn{ margin-top:10px; }
.kmo-stale{ margin:8px 0 0; font-size:12.5px; color:var(--kmo-amber); }
.kmo-stale[hidden]{ display:none; }

/* ================= LIST ================= */
.kmo-seg{ display:inline-flex; gap:3px; padding:3px; margin-bottom:14px; background:var(--line); border-radius:999px; }
.kmo-seg-btn{
  min-height:44px; padding:0 20px; border:none; border-radius:999px; background:transparent;
  color:#b9bdc6; font:inherit; font-size:13.5px; font-weight:700; cursor:pointer;
}
.kmo-seg-btn:hover{ color:#fff; }
.kmo-seg-btn[aria-pressed="true"]{ background:var(--btn-bg); color:var(--btn-ink); }

.kmo-chips{ display:flex; flex-wrap:wrap; gap:8px; margin-bottom:16px; }
.kmo-chip{
  display:inline-flex; align-items:center; gap:7px; min-height:44px; padding:0 14px;
  background:var(--line); color:var(--ink); border:1px solid var(--line-strong); border-radius:999px;
  font:inherit; font-size:13px; font-weight:600; cursor:pointer;
}
.kmo-chip:hover{ border-color:var(--muted); }
.kmo-chip[aria-pressed="true"]{ background:var(--btn-bg); border-color:var(--btn-bg); color:var(--btn-ink); }
.kmo-count{ font-size:12px; font-weight:700; font-variant-numeric:tabular-nums; opacity:.85; }

.kmo-list{ list-style:none; margin:0; padding:0; display:flex; flex-direction:column; gap:12px; }
.kmo-list.is-loading{ opacity:.5; pointer-events:none; }
.kmo-card{
  display:block; width:100%; margin:0; padding:14px 16px; text-align:left;
  font:inherit; color:var(--ink); background:var(--bg); border:1px solid var(--line); border-radius:10px;
  cursor:pointer; transition:border-color .12s ease, background-color .12s ease;
}
.kmo-card:hover{ border-color:var(--line-strong); background:#0a0a0a; }
.kmo-card-top{ display:flex; align-items:center; justify-content:space-between; gap:10px; }
.kmo-num{ font-size:15px; font-weight:800; min-width:0; overflow-wrap:anywhere; }
.kmo-eta{ display:block; margin-top:4px; font-size:13.5px; color:var(--ink); }
.kmo-eta.kmo-s-cancelled{ color:var(--muted); }
.kmo-card-row{ display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:10px 14px; margin-top:12px; }
.kmo-thumbs{ display:flex; align-items:center; gap:6px; min-width:0; }
.kmo-more{ font-size:12.5px; font-weight:700; color:var(--muted); padding-left:2px; }
.kmo-card-meta{ flex:0 0 auto; margin-left:auto; text-align:right; }
.kmo-total{ display:block; font-size:16px; font-weight:800; }
.kmo-sub{ display:block; font-size:12px; color:var(--muted); }
.kmo-cust{ display:block; margin-top:10px; padding-top:10px; border-top:1px solid var(--line); font-size:12.5px; color:var(--muted); overflow-wrap:anywhere; }
.kmo-cust strong{ color:var(--ink); font-weight:700; }

.kmo-thumb{
  width:44px; height:44px; flex:0 0 auto; display:flex; align-items:center; justify-content:center;
  border-radius:6px; overflow:hidden; background:var(--line); color:var(--muted);
}
.kmo-thumb img{ width:100%; height:100%; object-fit:cover; display:block; }

.kmo-pill{
  display:inline-flex; align-items:center; gap:6px; flex:0 0 auto; padding:4px 10px; border-radius:999px;
  font-size:12px; font-weight:700; line-height:1.3; white-space:nowrap; color:var(--kmo-c); background:var(--kmo-tint);
}
.kmo-pill::before{ content:''; width:7px; height:7px; border-radius:50%; background:currentColor; }

.kmo-empty{ padding:34px 10px 10px; text-align:center; color:var(--muted); }
.kmo-empty svg{ color:var(--line-strong); margin-bottom:8px; }
.kmo-empty strong{ display:block; margin-bottom:4px; font-size:16px; color:var(--ink); }
.kmo-empty p{ margin:0 auto; max-width:380px; font-size:13.5px; line-height:1.5; }
.kmo-error{ padding:26px 10px; text-align:center; }
.kmo-error p{ margin:0 0 4px; color:var(--kmo-err); font-weight:600; overflow-wrap:anywhere; }
.kmo-error .kmo-actions{ justify-content:center; margin-top:14px; }

/* ================= SKELETONS ================= */
.kmo-skel{
  border-radius:8px; background:linear-gradient(90deg, var(--line) 0%, var(--line-strong) 50%, var(--line) 100%);
  background-size:200% 100%; animation:kmoShimmer 1.3s linear infinite;
}
@keyframes kmoShimmer{ from{ background-position:200% 0; } to{ background-position:-200% 0; } }
.kmo-skel-card{ height:104px; border-radius:10px; }
.kmo-skel-banner{ height:82px; border-radius:12px; }
.kmo-skel-steps{ height:62px; margin-top:18px; }
.kmo-skel-box{ height:120px; margin-top:18px; border-radius:10px; }

/* ================= LOOKUP ================= */
.kmo-lookup{ margin-top:26px; padding-top:20px; border-top:1px solid var(--line); }
.kmo-lookup .kmo-muted{ margin-bottom:14px; }
.kmo-lookup-row{ display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1.5fr) auto; gap:12px; align-items:end; }
.kmo-lookup-row .form-row{ margin-bottom:0; }
.kmo-lookup input[aria-invalid="true"]{ border-color:var(--kmo-err); }

/* ================= DETAIL ================= */
.kmo-placed{ margin:0; color:var(--muted); font-size:13px; }

.kmo-banner{
  display:flex; align-items:center; gap:14px; margin-top:12px; padding:16px 18px;
  background:var(--kmo-tint); border-left:4px solid var(--kmo-c); border-radius:12px;
}
.kmo-b-icon{
  flex:0 0 auto; width:48px; height:48px; display:flex; align-items:center; justify-content:center;
  border-radius:50%; background:rgba(0,0,0,.28); color:var(--kmo-c);
}
.kmo-b-text{ min-width:0; }
.kmo-b-h{ font-size:19px; font-weight:800; line-height:1.25; color:var(--kmo-c); }
.kmo-b-eta{ margin-top:2px; font-size:15px; font-weight:700; overflow-wrap:anywhere; }
.kmo-b-sub{ margin-top:2px; font-size:13px; color:var(--muted); overflow-wrap:anywhere; }

/* ---- progress tracker (horizontal on desktop, vertical on a phone) ---- */
.kmo-steps{ list-style:none; margin:22px 0 4px; padding:0; display:flex; }
.kmo-step{ position:relative; flex:1 1 0; min-width:0; padding:0 4px; text-align:center; }
.kmo-dot{
  position:relative; z-index:1; width:28px; height:28px; margin:0 auto 8px;
  display:flex; align-items:center; justify-content:center; border-radius:50%;
  border:2px solid var(--line-strong); background:var(--bg-alt); color:#101014;
}
.kmo-step.is-done .kmo-dot{ background:var(--kmo-c); border-color:var(--kmo-c); }
.kmo-step.is-current .kmo-dot{ border-color:var(--kmo-c); }
.kmo-step.is-current .kmo-dot::after{ content:''; width:10px; height:10px; border-radius:50%; background:var(--kmo-c); }
.kmo-step.is-cancelled .kmo-dot{ background:var(--kmo-c); border-color:var(--kmo-c); }
.kmo-steps.kmo-s-cancelled .kmo-step.is-done .kmo-dot{ background:var(--kmo-grey); border-color:var(--kmo-grey); color:#fff; }
.kmo-step-text{ display:block; min-width:0; }
.kmo-step-label{ display:block; font-size:12.5px; font-weight:700; color:var(--ink); overflow-wrap:anywhere; }
.kmo-step.is-todo .kmo-step-label{ color:var(--muted); font-weight:600; }
.kmo-step.is-cancelled .kmo-step-label{ color:var(--kmo-c); }
.kmo-step-at{ display:block; margin-top:2px; font-size:11.5px; color:var(--muted); }
/* The connector runs from this step's dot to the next one's, and is coloured once progress has reached that next step. */
.kmo-step:not(:last-child)::after{
  content:''; position:absolute; top:13px; left:50%; width:100%; height:3px; border-radius:2px; background:var(--line-strong);
}
.kmo-step.link::after{ background:var(--kmo-c); }
.kmo-steps.kmo-s-cancelled .kmo-step.link::after{ background:var(--kmo-grey); }
.kmo-steps.kmo-s-cancelled .kmo-step.link-x::after{ background:var(--kmo-c); }
@media (prefers-reduced-motion:no-preference){
  .kmo-step.is-current .kmo-dot{ animation:kmoPulse 2s ease-out infinite; }
  @keyframes kmoPulse{ 0%{ box-shadow:0 0 0 0 var(--kmo-tint); } 70%{ box-shadow:0 0 0 8px transparent; } 100%{ box-shadow:0 0 0 0 transparent; } }
}

/* ---- confirm + messages ---- */
.kmo-confirm{ margin-top:18px; padding:14px 16px; background:var(--bg); border:1px solid rgba(255,127,146,.4); border-radius:10px; }
.kmo-confirm p{ margin:0; overflow-wrap:anywhere; }
.kmo-confirm .kmo-actions{ margin-top:12px; }

/* ---- admin panel ---- */
.kmo-adm{
  margin-top:22px; padding:14px 16px 16px; background:var(--bg);
  border:1px solid var(--line-strong); border-left:4px solid #ffffff; border-radius:10px;
}
.kmo-adm-head{ display:flex; align-items:center; gap:10px; margin-bottom:12px; }
.kmo-adm-head .kmo-h{ margin:0; }
.kmo-badge{ padding:2px 8px; border-radius:4px; background:var(--brand-red); color:#fff; font-size:10.5px; font-weight:800; letter-spacing:.06em; text-transform:uppercase; }
.kmo-adm-steps{ list-style:none; margin:0 0 14px; padding:0; display:flex; flex-wrap:wrap; gap:6px; }
.kmo-adm-step{ padding:5px 11px; border:1px solid var(--line-strong); border-radius:999px; font-size:12.5px; font-weight:600; color:var(--muted); }
.kmo-adm-step.is-past::before{ content:'\2713\00a0'; }
.kmo-adm-step.is-current{ color:var(--kmo-c); background:var(--kmo-tint); border-color:var(--kmo-c); font-weight:800; }
.kmo-adm-row{ display:flex; gap:10px; align-items:flex-end; margin-bottom:12px; }
.kmo-adm-row .form-row{ flex:1 1 auto; min-width:0; margin-bottom:0; }
.kmo-adm .form-row label{ margin-bottom:5px; }
.kmo-adm-done{ margin:0; }

/* ---- detail sections ---- */
.kmo-grid{ display:grid; grid-template-columns:1fr 1fr; gap:14px; margin-top:22px; }
.kmo-box{ min-width:0; padding:14px 16px; background:var(--bg); border:1px solid var(--line); border-radius:10px; }
.kmo-sec{ margin-top:22px; }
.kmo-dl{ margin:0; display:grid; gap:10px; }
.kmo-dl dt{ margin-bottom:1px; font-size:12px; color:var(--muted); }
.kmo-dl dd{ margin:0; overflow-wrap:anywhere; }
.kmo-track-row{ display:flex; flex-wrap:wrap; align-items:center; gap:8px 12px; }
.kmo-track{ font-weight:800; letter-spacing:.03em; font-variant-numeric:tabular-nums; user-select:all; -webkit-user-select:all; }

.kmo-items{ list-style:none; margin:0; padding:0; }
.kmo-item{ display:flex; align-items:center; gap:12px; padding:10px 0; border-bottom:1px solid var(--line); }
.kmo-item:first-child{ padding-top:0; }
.kmo-item:last-child{ border-bottom:none; }
.kmo-item .kmo-thumb{ width:56px; height:56px; }
.kmo-item-main{ flex:1 1 auto; min-width:0; }
.kmo-item-name{ font-weight:600; overflow-wrap:anywhere; }
.kmo-item-sub{ font-size:12.5px; color:var(--muted); }
.kmo-item-total{ flex:0 0 auto; font-weight:700; font-variant-numeric:tabular-nums; }
.kmo-totals{ margin-top:6px; padding-top:10px; border-top:1px solid var(--line-strong); }
.kmo-trow{ display:flex; justify-content:space-between; gap:12px; padding:3px 0; font-size:13.5px; color:var(--muted); font-variant-numeric:tabular-nums; }
.kmo-trow.is-total{ margin-top:6px; padding-top:9px; border-top:1px solid var(--line); font-size:16px; font-weight:800; color:var(--ink); }

.kmo-tl{ list-style:none; margin:0; padding:0; }
.kmo-tl-item{ position:relative; display:grid; grid-template-columns:14px minmax(0,1fr) auto; gap:0 12px; padding-bottom:16px; }
.kmo-tl-item:last-child{ padding-bottom:0; }
.kmo-tl-item:not(:last-child)::before{ content:''; position:absolute; left:6px; top:18px; bottom:0; width:2px; background:var(--line-strong); }
.kmo-tl-dot{ width:14px; height:14px; margin-top:3px; border-radius:50%; background:var(--kmo-c); }
.kmo-tl-title{ font-weight:700; }
.kmo-tl-note{ font-size:13px; color:var(--muted); overflow-wrap:anywhere; }
.kmo-tl-time{ font-size:12.5px; color:var(--muted); text-align:right; }

/* ================= PHONE ================= */
@media (max-width:560px){
  #ordersOverlay{ padding:10px; }
  #ordersModal.orders-modal{ max-height:calc(100vh - 20px); max-height:calc(100dvh - 20px); }
  .kmo-head{ min-height:62px; padding:8px 62px 8px 16px; }
  .kmo-head.has-back{ padding-left:6px; }
  .kmo-body{ padding:14px 16px 22px; }
  .kmo-seg{ display:flex; }
  .kmo-seg-btn{ flex:1 1 0; padding:0 10px; }
  .kmo-card-meta{ margin-left:0; text-align:left; width:100%; }
  .kmo-banner{ padding:14px; gap:12px; }
  .kmo-b-icon{ width:42px; height:42px; }
  .kmo-b-h{ font-size:17px; }
  .kmo-steps{ flex-direction:column; }
  .kmo-step{ display:grid; grid-template-columns:28px minmax(0,1fr); column-gap:12px; padding:0 0 14px; text-align:left; }
  .kmo-step:last-child{ padding-bottom:0; }
  .kmo-dot{ margin:0; }
  .kmo-step:not(:last-child)::after{ top:30px; bottom:0; left:13px; width:3px; height:auto; }
  .kmo-step-text{ padding-top:3px; }
  .kmo-grid{ grid-template-columns:1fr; }
  .kmo-lookup-row{ grid-template-columns:1fr; }
  .kmo-lookup-row .kmo-btn{ width:100%; }
  .kmo-adm-row{ flex-direction:column; align-items:stretch; }
  .kmo-adm-row .kmo-btn,
  .kmo-actions .kmo-btn{ flex:1 1 100%; }
  .kmo-tl-item{ grid-template-columns:14px minmax(0,1fr); }
  .kmo-tl-time{ grid-column:2; text-align:left; }
}

@media (prefers-reduced-motion:reduce){
  .kmo-skel{ animation:none; }
  .kmo-card{ transition:none; }
}
