/* Track Your Order pop-up (track-order.js). Canonical copy: order-tracking/frontend/. Everything is scoped to .to so it can run
   on any site. Colours come from the store's own tokens (--brand, --ink, --line ... in styles.css); embed brands set --to-* from
   their theme. Same structure as the policy pop-up (.pm): backdrop, centred dialog, header with close button. */
.to {
  --to-accent: var(--brand, #1f4fd8); --to-accent-ink: var(--brand-ink, #ffffff); --to-ink: var(--ink, #1d1d1f); --to-muted: var(--muted, #5f6368);
  --to-line: var(--line, #e3e3e6); --to-soft: var(--soft, #f6f6f7); --to-card: var(--card, #ffffff); --to-radius: var(--radius, 10px);
  --to-font: var(--font, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif);
  --to-ok: var(--accent, #0a7a3d); --to-warn: var(--danger, #b3261e);
  position: fixed; inset: 0; z-index: 2147483000; display: flex; align-items: center; justify-content: center; padding: 16px;
  font: 16px/1.5 var(--to-font); color: var(--to-ink); text-align: left;
}
.to[hidden] { display: none !important; }
.to *, .to *::before, .to *::after { box-sizing: border-box; }
.to-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, .45); }
.to-dialog { position: relative; background: var(--to-card); border-radius: var(--to-radius); width: min(640px, 100%); max-height: 90vh; display: flex; flex-direction: column;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .18); outline: none; }
.to-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 12px 14px 24px; border-bottom: 1px solid var(--to-line); }
.to-title { margin: 0; font-size: 22px; line-height: 1.25; font-weight: 700; color: var(--to-ink); }
.to-close { width: 44px; height: 44px; border: 0; background: transparent; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; border-radius: 8px; padding: 0; }
.to-close:hover { background: var(--to-soft); }
.to-close svg { width: 22px; height: 22px; stroke: var(--to-ink); stroke-width: 2; fill: none; }
.to-body { padding: 20px 24px 24px; overflow: auto; overscroll-behavior: contain; }
.to-intro { margin: 0 0 16px; color: var(--to-muted); }
.to-label { display: block; font-weight: 600; font-size: 14px; margin: 0 0 6px; }
.to-row { display: flex; gap: 10px; }
.to-input { flex: 1 1 auto; min-width: 0; height: 50px; padding: 0 14px; border: 1px solid var(--to-line); border-radius: var(--to-radius); background: #fff; color: var(--to-ink);
  font: inherit; font-size: 16px; letter-spacing: .02em; }
.to-input:focus { outline: 2px solid var(--to-accent); outline-offset: 1px; border-color: var(--to-accent); }
.to-btn { flex: 0 0 auto; min-width: 150px; height: 50px; padding: 0 22px; border: 0; border-radius: var(--to-radius); background: var(--to-accent); color: var(--to-accent-ink);
  font: inherit; font-weight: 700; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.to-btn:hover { filter: brightness(.94); }
.to-btn:focus-visible { outline: 2px solid var(--to-ink); outline-offset: 2px; }
.to-btn[disabled] { cursor: progress; opacity: .85; }
.to-btn-ghost { background: transparent; color: var(--to-accent); border: 1px solid var(--to-accent); min-width: 130px; }
.to-spinner { display: none; width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: to-spin .8s linear infinite; }
.to-btn.is-loading .to-spinner { display: inline-block; }
@keyframes to-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .to-spinner { animation-duration: 2s; } }
.to-error { margin: 10px 0 0; padding: 10px 12px; border-radius: 8px; background: #fdecea; color: #8a1c13; font-size: 14px; }
.to-error[hidden] { display: none; }
.to-result { margin-top: 20px; display: grid; gap: 18px; }
.to-result[hidden] { display: none; }
.to-card { border: 1px solid var(--to-line); border-left: 4px solid var(--to-accent); border-radius: var(--to-radius); padding: 16px 18px; background: var(--to-soft); }
.to-tone-ok { border-left-color: var(--to-ok); }
.to-tone-warn { border-left-color: var(--to-warn); }
.to-kicker { margin: 0; font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--to-muted); }
.to-status { margin: 2px 0 4px; font-size: 22px; font-weight: 700; line-height: 1.25; }
.to-tone-ok .to-status { color: var(--to-ok); }
.to-tone-warn .to-status { color: var(--to-warn); }
.to-status-text { margin: 0; color: var(--to-ink); }
.to-delivered { margin: 8px 0 0; font-weight: 600; color: var(--to-ok); }
.to-meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px 16px; margin: 14px 0 0; }
.to-meta dt { font-size: 12px; color: var(--to-muted); }
.to-meta dd { margin: 0; font-weight: 600; word-break: break-all; }
.to-progress { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); position: relative; }
.to-step { position: relative; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; font-size: 13px; color: var(--to-muted); padding: 0 4px; }
.to-step::before { content: ""; position: absolute; top: 8px; right: 50%; width: 100%; height: 3px; background: var(--to-line); }
.to-step:first-child::before { display: none; }
.to-step.is-reached::before { background: var(--to-accent); }
.to-dot { position: relative; z-index: 1; width: 19px; height: 19px; border-radius: 50%; background: var(--to-card); border: 3px solid var(--to-line); }
.to-step.is-reached .to-dot { background: var(--to-accent); border-color: var(--to-accent); }
.to-step.is-current .to-dot { box-shadow: 0 0 0 4px color-mix(in srgb, var(--to-accent) 22%, transparent); }
.to-step.is-reached .to-step-label { color: var(--to-ink); font-weight: 600; }
.to-step-time { font-size: 12px; }
.to-h3 { margin: 0 0 8px; font-size: 17px; font-weight: 700; }
.to-muted { margin: 0; color: var(--to-muted); font-size: 14px; }
.to-events { list-style: none; margin: 0; padding: 0 0 0 18px; border-left: 2px solid var(--to-line); display: grid; gap: 14px; }
.to-event { position: relative; display: grid; gap: 2px; }
.to-event::before { content: ""; position: absolute; left: -24px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--to-line); }
.to-event:first-child::before { background: var(--to-accent); }
.to-event-time { font-size: 12px; color: var(--to-muted); }
.to-event-desc { font-weight: 500; }
.to-event-loc { font-size: 13px; color: var(--to-muted); }
.to-provider-row { margin: 0; }
.to-provider, .to-support { color: var(--to-accent); font-weight: 600; }
.to-details { border-top: 1px solid var(--to-line); padding-top: 16px; display: grid; gap: 8px; }
.to-zip { display: grid; gap: 6px; }
.to-zip .to-label { margin: 0; }
.to-items { margin: 0; padding-left: 20px; }
.to-help { margin: 20px 0 0; font-size: 14px; color: var(--to-muted); }
html.to-open { overflow: hidden; }
/* "Track Your Order" in the site's menu bar beside the logo (site/index.html .header-track). Full label on wider screens;
   on phones a truck icon with a small "Track Order" under it, so it never runs into a wide logo. The accessible name is always
   "Track Your Order". */
.header-track { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; min-width: 0; max-width: 100%; padding: 0 4px; color: var(--ink, #1d1d1f);
  text-decoration: none; font-size: 14px; font-weight: 600; white-space: nowrap; }
.header-track:hover { color: var(--brand, #1f4fd8); }
.header-track[hidden] { display: none !important; }
.header-track svg { width: 22px; height: 22px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linejoin: round; }
.header-track-short { display: none; }
@media (max-width: 600px) {
  .header-track { flex-direction: column; justify-content: center; gap: 1px; padding: 2px 0; font-size: 10px; line-height: 1.1; letter-spacing: .01em; }
  .header-track svg { width: 20px; height: 20px; }
  .header-track-long { display: none; }
  .header-track-short { display: inline; }
}
@media (max-width: 600px) {
  .to { padding: 0; align-items: flex-end; }
  .to-dialog { width: 100%; max-height: 92vh; border-radius: var(--to-radius) var(--to-radius) 0 0; }
  .to-head { padding: 10px 8px 10px 16px; }
  .to-title { font-size: 20px; }
  .to-body { padding: 16px 16px 24px; }
  .to-row { flex-direction: column; }
  .to-btn { width: 100%; }
  .to-step { font-size: 12px; }
}
