/* ==========================================================================
   Orbit Ledger — orders.php only (Appily Seventythree / Aira)
   Independent of Frost Meridian, Helix Folio, Cobalt Manifest, Grove Ladder,
   Orchard Fan, and prior Appily order-history UIs.
   Metaphor: constellation ticket reel — calendar spines, orbit nodes, stubs.
   ========================================================================== */

:root {
  --ol-ink: #0b1220;
  --ol-slate: #243047;
  --ol-mist: #e8eef6;
  --ol-paper: #f4f7fb;
  --ol-ice: #38bdf8;
  --ol-ice-deep: #0ea5e9;
  --ol-amber: #fbbf24;
  --ol-amber-deep: #f59e0b;
  --ol-mute: #64748b;
  --ol-line: rgba(11, 18, 32, 0.1);
  --ol-ok: #10b981;
  --ol-warn: #f97316;
  --ol-bad: #ef4444;
  --font-ol: "Epilogue", system-ui, sans-serif;
  --font-ol-mono: "Oxanium", ui-monospace, monospace;
  --ol-ease: cubic-bezier(0.22, 1, 0.36, 1);
  --ol-snap: cubic-bezier(0.34, 1.45, 0.64, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body.ol-body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-ol);
  color: var(--ol-ink);
  background:
    radial-gradient(70% 50% at 95% 0%, rgba(56, 189, 248, 0.16), transparent 55%),
    radial-gradient(55% 40% at 0% 100%, rgba(251, 191, 36, 0.12), transparent 50%),
    linear-gradient(170deg, #d5dee9 0%, var(--ol-mist) 42%, var(--ol-paper) 100%);
}
body.ol-body > main {
  display: block;
  margin: 0;
  padding: 0;
  max-width: none;
}

.ol-app {
  width: min(100% - 1.5rem, 58rem);
  margin: 0 auto;
  padding: 1.15rem 0 3.25rem;
}

.ol-escape {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.4rem;
}
.ol-escape__brand {
  font-family: var(--font-ol-mono);
  font-weight: 700;
  font-size: 0.88rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--ol-ink);
}
.ol-escape__brand span { color: var(--ol-ice-deep); }
.ol-escape__links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
}
.ol-escape__links a {
  font-size: 0.74rem;
  font-weight: 650;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--ol-mute);
  transition: color 0.25s var(--ol-ease);
}
.ol-escape__links a:hover { color: var(--ol-ice-deep); }

.ol-mast {
  display: grid;
  gap: 1rem;
  margin-bottom: 1.35rem;
}
@media (min-width: 760px) {
  .ol-mast {
    grid-template-columns: 1.4fr auto;
    align-items: end;
  }
}
.ol-mast__kicker {
  margin: 0 0 0.35rem;
  font-family: var(--font-ol-mono);
  font-size: 0.68rem;
  font-weight: 650;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ol-ice-deep);
}
.ol-mast h1 {
  margin: 0;
  font-size: clamp(2rem, 5vw, 3.1rem);
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1.05;
}
.ol-mast__lede {
  margin: 0.55rem 0 0;
  max-width: 40ch;
  font-size: 1.02rem;
  line-height: 1.45;
  color: var(--ol-mute);
}
.ol-mast__count {
  justify-self: start;
  min-width: 7.5rem;
  padding: 0.9rem 1rem;
  background: var(--ol-ink);
  color: #eef4fb;
  text-align: center;
}
@media (min-width: 760px) {
  .ol-mast__count { justify-self: end; }
}
.ol-mast__count span {
  display: block;
  font-family: var(--font-ol-mono);
  font-size: 0.65rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ol-amber);
}
.ol-mast__count strong {
  display: block;
  margin-top: 0.25rem;
  font-family: var(--font-ol-mono);
  font-size: 2.1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1;
}

.ol-loading {
  padding: 0.9rem 1rem;
  margin-bottom: 1rem;
  border-left: 3px solid var(--ol-ice);
  background: rgba(56, 189, 248, 0.12);
  font-size: 0.9rem;
}

/* Spectrum filters */
.ol-spectrum {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1.1rem;
  padding: 0.45rem;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid var(--ol-line);
}
.ol-spectrum__label {
  width: 100%;
  margin: 0 0 0.15rem 0.25rem;
  font-family: var(--font-ol-mono);
  font-size: 0.62rem;
  font-weight: 650;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ol-mute);
}
.ol-chip {
  min-height: 2.35rem;
  padding: 0.35rem 0.85rem;
  border: 1.5px solid transparent;
  background: transparent;
  font-family: var(--font-ol);
  font-size: 0.78rem;
  font-weight: 650;
  color: var(--ol-mute);
  cursor: pointer;
  transition: color 0.25s var(--ol-ease), background 0.25s var(--ol-ease), transform 0.3s var(--ol-snap), box-shadow 0.3s var(--ol-ease);
}
.ol-chip:hover {
  color: var(--ol-ink);
  transform: translateY(-1px);
}
.ol-chip.is-active {
  background: var(--ol-ink);
  color: #fff;
  box-shadow: 0 8px 18px rgba(11, 18, 32, 0.16);
}
.ol-chip[data-hf-filter="placed"].is-active { background: var(--ol-ice-deep); }
.ol-chip[data-hf-filter="packed"].is-active { background: #6366f1; }
.ol-chip[data-hf-filter="shipped"].is-active { background: var(--ol-amber-deep); color: var(--ol-ink); }
.ol-chip[data-hf-filter="delivered"].is-active { background: var(--ol-ok); }

.ol-meta {
  margin: 0 0 0.85rem;
  font-size: 0.8rem;
  color: var(--ol-mute);
}
.ol-meta strong { color: var(--ol-ink); }

/* Ticket reel */
.ol-reel {
  display: grid;
  gap: 0.75rem;
}

.ol-ticket {
  display: grid;
  grid-template-columns: 5.25rem 1fr;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid var(--ol-line);
  overflow: hidden;
  position: relative;
  opacity: 0;
  transform: translateY(14px);
  animation: ol-in 0.5s var(--ol-ease) forwards;
  transition: border-color 0.3s var(--ol-ease), box-shadow 0.35s var(--ol-ease), transform 0.35s var(--ol-ease);
}
.ol-ticket:nth-child(1) { animation-delay: 0.04s; }
.ol-ticket:nth-child(2) { animation-delay: 0.09s; }
.ol-ticket:nth-child(3) { animation-delay: 0.14s; }
.ol-ticket:nth-child(4) { animation-delay: 0.19s; }
.ol-ticket:nth-child(n + 5) { animation-delay: 0.24s; }
@keyframes ol-in {
  to { opacity: 1; transform: none; }
}
.ol-ticket:hover {
  border-color: rgba(56, 189, 248, 0.45);
  box-shadow: 0 14px 32px rgba(11, 18, 32, 0.08);
  transform: translateY(-2px);
}
.ol-ticket.is-filtered-out {
  display: none;
}

@media (min-width: 720px) {
  .ol-ticket {
    grid-template-columns: 5.75rem 1fr 8.5rem;
  }
}

.ol-ticket__cal {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 0.1rem;
  padding: 0.85rem 0.4rem;
  background: var(--ol-ink);
  color: #eef4fb;
  text-align: center;
}
.ol-ticket__dow {
  font-family: var(--font-ol-mono);
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ol-ice);
}
.ol-ticket__day {
  font-family: var(--font-ol-mono);
  font-size: 1.85rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.03em;
}
.ol-ticket__monyr {
  font-size: 0.68rem;
  color: rgba(238, 244, 251, 0.65);
}

.ol-ticket__core {
  padding: 0.9rem 1rem;
  min-width: 0;
}
.ol-ticket__head {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.35rem;
}
.ol-ticket__status {
  font-family: var(--font-ol-mono);
  font-size: 0.68rem;
  font-weight: 650;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ol-ice-deep);
}
.ol-ticket.tone-packed .ol-ticket__status { color: #6366f1; }
.ol-ticket.tone-shipped .ol-ticket__status { color: var(--ol-amber-deep); }
.ol-ticket.tone-delivered .ol-ticket__status { color: var(--ol-ok); }
.ol-ticket.tone-cancelled .ol-ticket__status { color: var(--ol-bad); }
.ol-ticket__idx {
  font-family: var(--font-ol-mono);
  font-size: 0.68rem;
  color: var(--ol-mute);
}
.ol-ticket__id {
  margin: 0 0 0.55rem;
  font-family: var(--font-ol-mono);
  font-size: 1.05rem;
  font-weight: 650;
  letter-spacing: -0.01em;
  word-break: break-all;
}

.ol-orbit {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 0.7rem;
  max-width: 11rem;
}
.ol-orbit__node {
  position: relative;
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 50%;
  border: 2px solid rgba(11, 18, 32, 0.18);
  background: transparent;
  flex-shrink: 0;
  transition: background 0.3s var(--ol-ease), border-color 0.3s var(--ol-ease), transform 0.35s var(--ol-snap), box-shadow 0.3s var(--ol-ease);
}
.ol-orbit__node + .ol-orbit__node {
  margin-left: 1.15rem;
}
.ol-orbit__node + .ol-orbit__node::before {
  content: "";
  position: absolute;
  right: 100%;
  top: 50%;
  width: 1.15rem;
  height: 2px;
  background: rgba(11, 18, 32, 0.12);
  transform: translateY(-50%);
}
.ol-orbit__node.is-done {
  background: var(--ol-ok);
  border-color: var(--ol-ok);
}
.ol-orbit__node.is-done + .ol-orbit__node.is-done::before,
.ol-orbit__node.is-done + .ol-orbit__node.is-now::before {
  background: linear-gradient(90deg, var(--ol-ok), var(--ol-ice));
}
.ol-orbit__node.is-now {
  background: var(--ol-ice);
  border-color: var(--ol-ice);
  transform: scale(1.25);
  box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.25);
  animation: ol-pulse 1.6s ease-in-out infinite;
}
.ol-orbit__node.is-cancel {
  border-color: var(--ol-bad);
  background: rgba(239, 68, 68, 0.2);
}
@keyframes ol-pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.2); }
  50% { box-shadow: 0 0 0 7px rgba(56, 189, 248, 0.08); }
}

.ol-ticket__meta {
  display: grid;
  gap: 0.35rem;
  margin: 0;
  font-size: 0.82rem;
}
.ol-ticket__meta div {
  display: grid;
  grid-template-columns: 4.5rem 1fr;
  gap: 0.35rem;
}
.ol-ticket__meta dt {
  font-family: var(--font-ol-mono);
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ol-mute);
  align-self: center;
}
.ol-ticket__meta dd {
  margin: 0;
  font-weight: 600;
  color: var(--ol-slate);
}
.ol-ticket__span dd {
  font-weight: 500;
  font-size: 0.8rem;
  line-height: 1.35;
}

.ol-ticket__stub {
  display: grid;
  gap: 0.45rem;
  align-content: center;
  justify-items: stretch;
  padding: 0.9rem;
  background:
    linear-gradient(90deg, transparent 0 6px, var(--ol-line) 6px 7px, transparent 7px),
    rgba(11, 18, 32, 0.03);
  border-left: 1px dashed rgba(11, 18, 32, 0.18);
}
@media (max-width: 719px) {
  .ol-ticket__stub {
    grid-column: 1 / -1;
    grid-template-columns: 1fr auto auto;
    align-items: center;
    border-left: 0;
    border-top: 1px dashed rgba(11, 18, 32, 0.18);
    background: rgba(11, 18, 32, 0.03);
  }
}
.ol-ticket__total {
  font-family: var(--font-ol-mono);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ol-ink);
}
.ol-ticket__invoice {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.2rem;
  padding: 0.3rem 0.65rem;
  border: 1.5px dashed rgba(11, 18, 32, 0.25);
  font-family: var(--font-ol-mono);
  font-size: 0.68rem;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--ol-ink);
  transition: background 0.25s var(--ol-ease), color 0.25s var(--ol-ease), border-color 0.25s var(--ol-ease);
}
.ol-ticket__invoice:hover {
  background: var(--ol-amber);
  border-color: var(--ol-amber);
  border-style: solid;
}
.ol-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.2rem;
  padding: 0.35rem 0.75rem;
  border: 1.5px solid transparent;
  font-family: var(--font-ol);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.3s var(--ol-ease), background 0.3s var(--ol-ease), color 0.3s var(--ol-ease), border-color 0.3s var(--ol-ease);
}
.ol-btn:hover { transform: translateY(-2px); }
.ol-btn--ice {
  background: var(--ol-ice-deep);
  color: #fff;
}
.ol-btn--ice:hover { background: #0284c7; }
.ol-btn--ghost {
  background: transparent;
  color: var(--ol-ink);
  border-color: rgba(11, 18, 32, 0.22);
}
.ol-btn--ghost:hover {
  background: var(--ol-ink);
  color: #fff;
}
.ol-btn--amber {
  background: var(--ol-amber);
  color: var(--ol-ink);
}
.ol-ticket__stub .ol-btn,
.ol-ticket__stub .ol-btn--ghost {
  min-height: 2.2rem;
}

.ol-gate,
.ol-empty {
  padding: 1.5rem 1.25rem;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--ol-line);
}
.ol-gate h2,
.ol-empty h2 {
  margin: 0 0 0.4rem;
  font-size: 1.45rem;
  letter-spacing: -0.02em;
}
.ol-gate p,
.ol-empty p {
  margin: 0 0 1rem;
  color: var(--ol-mute);
  line-height: 1.45;
}
.ol-gate__actions,
.ol-empty__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}
.ol-kicker {
  margin: 0 0 0.35rem;
  font-family: var(--font-ol-mono);
  font-size: 0.65rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ol-ice-deep);
}

.ol-foot {
  margin-top: 2rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--ol-line);
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--ol-mute);
}
.ol-foot a {
  color: var(--ol-ice-deep);
  font-weight: 650;
  text-decoration: none;
}
.ol-foot a:hover { color: var(--ol-amber-deep); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition-duration: 0.01ms !important;
  }
  .ol-ticket { opacity: 1; transform: none; }
}
