/* Mystique Ops — visual dashboard layer: KPI cards, tasks, flows, tiles,
   charts. Loaded after ops.css. Status colour always comes with a word. */

:root { --c-green: #2f9e5b; --c-red: #d64545; --c-amber: #d9922e; --c-blue: #3b7dd8; --c-violet: #7c5cbf; --c-teal: #2a9d8f; --c-grey: #b9b1bd; }
@media (prefers-color-scheme: dark) { :root:not([data-theme='light']) { --c-green: #4cc47d; --c-red: #f07171; --c-amber: #f0b35a; --c-blue: #6ea5f0; --c-violet: #a58bf0; --c-teal: #4fc2b3; --c-grey: #6d6570; } }
.tone-green, .tone-ok { --tone: var(--c-green); }
.tone-red, .tone-bad { --tone: var(--c-red); }
.tone-amber, .tone-warn { --tone: var(--c-amber); }
.tone-blue, .tone-info { --tone: var(--c-blue); }
.tone-violet { --tone: var(--c-violet); }
.tone-teal { --tone: var(--c-teal); }
.tone-grey { --tone: var(--c-grey); }

/* ------------------------------------------------ shell: dark side, light page */
:root { --page: #f5f6f8; --card-shadow: 0 1px 2px rgba(20, 16, 24, 0.05); }
@media (prefers-color-scheme: dark) { :root:not([data-theme='light']) { --page: oklch(0.16 0.006 320); --card-shadow: none; } }
html, body { background: var(--page); }
.o-top { background: color-mix(in srgb, var(--page) 88%, transparent); backdrop-filter: blur(8px); }
.o-content { max-width: 1320px; }
.o-top-in, .o-demo-banner div { max-width: 1320px; }
.o-page-head h1 { font-size: 1.6rem; font-weight: 720; letter-spacing: -0.02em; }
.o-page-head { margin-bottom: 20px; }
@media (min-width: 900px) {
  .o-app { grid-template-columns: 240px 1fr; }
  .o-side { background: #16121a; border-right: 0; padding: 18px 12px; }
  .o-side .o-brand { color: #fff; padding: 4px 10px 22px; }
  .o-side .o-brand-mark { background: var(--lime); color: #1b2a0e; }
  .o-nav { color: #b9b1bf; font-weight: 540; padding: 9px 12px; }
  .o-nav svg { color: #8d8492; }
  .o-nav:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }
  .o-nav[aria-current='page'] { background: rgba(197, 255, 137, 0.12); color: var(--lime); }
  .o-nav[aria-current='page'] svg { color: var(--lime); }
  .o-nav-group { color: #7d7482; text-transform: none; padding: 18px 12px 6px; }
  .o-side-foot { margin-top: auto; padding: 12px; border-top: 1px solid rgba(255, 255, 255, 0.08); color: #b9b1bf; font-size: 0.8rem; display: flex; gap: 10px; align-items: center; }
  .o-side-foot .o-avatar { background: var(--lime); color: #1b2a0e; }
}
.o-panel, .o-card { box-shadow: var(--card-shadow); }

/* KPI cards */
.o-kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 900px) { .o-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; } }
.o-kpi { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px 16px 0; min-width: 0; display: flex; flex-direction: column; overflow: hidden; box-shadow: var(--card-shadow); }
.o-kpi-top { display: flex; align-items: flex-start; gap: 6px; justify-content: space-between; }
.o-kpi-label { font-size: 0.82rem; color: var(--ink-2); font-weight: 560; }
.o-kpi-icon { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: color-mix(in srgb, var(--tone) 13%, transparent); color: var(--tone); flex: 0 0 auto; }
.o-kpi-icon svg { width: 19px; height: 19px; }
.o-kpi-value { font-size: 1.6rem; font-weight: 740; letter-spacing: -0.025em; font-variant-numeric: tabular-nums; margin-top: -4px; white-space: normal; overflow-wrap: anywhere; }
.o-kpi-sub { font-size: 0.76rem; color: var(--ink-3); white-space: normal; overflow-wrap: anywhere; display: flex; flex-wrap: wrap; gap: 2px 6px; align-items: center; margin-top: 2px; }
.o-kpi .o-spark { margin: 10px -16px 0; width: calc(100% + 32px); max-width: none; }
@media (max-width: 599px) { .o-kpi { padding: 12px 12px 0; } .o-kpi-value { font-size: 1.25rem; } .o-kpi-icon { width: 30px; height: 30px; } .o-kpi .o-spark { margin: 8px -12px 0; width: calc(100% + 24px); } }
.o-spark { width: 100%; display: block; margin-top: 6px; }
.o-trend { font-size: 0.74rem; font-weight: 700; white-space: nowrap; }
.o-trend.up { color: var(--c-green); }
.o-trend.down { color: var(--c-red); }

/* Task cards */
.o-tasks { display: grid; grid-template-columns: 1fr; gap: 10px; }
@media (min-width: 700px) { .o-tasks { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .o-tasks { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.o-task { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; text-decoration: none; color: var(--ink); background: color-mix(in srgb, var(--tone) 11%, var(--surface)); border: 1px solid color-mix(in srgb, var(--tone) 28%, transparent); transition: transform 150ms var(--ease); }
.o-task:hover { transform: translateY(-1px); }
.o-task-n { font-size: 1.6rem; font-weight: 760; letter-spacing: -0.02em; color: var(--tone); min-width: 2.2ch; font-variant-numeric: tabular-nums; }
.o-task-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.o-task-text strong { font-size: 0.92rem; }
.o-task-text small { color: var(--ink-3); font-size: 0.78rem; white-space: normal; overflow-wrap: anywhere; }
.o-task svg { color: var(--ink-3); width: 18px; height: 18px; }

/* Flow of an order */
.o-flow { position: relative; display: flex; align-items: stretch; gap: 4px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }
.o-flow-step { all: unset; box-sizing: border-box; cursor: pointer; flex: 1 0 auto; min-width: 104px; display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: 12px; background: color-mix(in srgb, var(--tone) 10%, var(--surface)); border: 1px solid color-mix(in srgb, var(--tone) 25%, transparent); text-decoration: none; color: var(--ink); }
.o-flow-step:hover { background: color-mix(in srgb, var(--tone) 18%, var(--surface)); }
.o-flow-step.is-current { background: var(--tone); border-color: var(--tone); }
.o-flow-step.is-current .o-flow-n, .o-flow-step.is-current .o-flow-label { color: #fff; }
.o-flow-step:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.o-flow-n { font-size: 1.35rem; font-weight: 750; color: var(--tone); line-height: 1.1; font-variant-numeric: tabular-nums; }
.o-flow-label { font-size: 0.76rem; font-weight: 600; color: var(--ink-2); white-space: nowrap; }
.o-flow-arrow { display: flex; align-items: center; color: var(--ink-3); flex: 0 0 auto; }

/* Cards and charts */
.o-card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 18px 20px; min-width: 0; }
@media (max-width: 599px) { .o-card { padding: 14px; } }
.o-card-head { display: flex; align-items: flex-start; gap: 8px 12px; margin-bottom: 14px; flex-wrap: wrap; }
.o-card-head h2, .o-card-head h3 { font-size: 1.02rem; font-weight: 680; margin: 0; letter-spacing: -0.01em; }
.o-card-sub { margin: 2px 0 0; font-size: 0.8rem; color: var(--ink-3); }
.o-card-head .o-seg-lite { margin-left: auto; }
.o-card-head .o-hint { color: var(--ink-3); font-size: 0.8rem; }
.o-card-head .o-more { margin-left: auto; font-size: 0.82rem; font-weight: 600; color: var(--ink-2); text-decoration: none; }
.o-card-head .o-more:hover { text-decoration: underline; }
.o-cards { display: grid; gap: 14px; grid-template-columns: 1fr; margin-top: 14px; }
.o-cards > * { min-width: 0; }
@media (min-width: 900px) { .o-cards-2 { grid-template-columns: 1fr 1fr; } .o-cards-3 { grid-template-columns: repeat(3, 1fr); } .o-cards-21 { grid-template-columns: 2fr 1fr; } .o-cards-12 { grid-template-columns: 1fr 2fr; } }
.o-chartbox { position: relative; width: 100%; }
.o-legend-inline { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 0.78rem; color: var(--ink-3); margin-top: 8px; }
.o-legend-inline i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }

.o-donut { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.o-donut-chart { position: relative; flex: 0 0 auto; }
.o-donut-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; pointer-events: none; text-align: center; }
.o-donut-center strong { font-size: 1.1rem; font-weight: 740; font-variant-numeric: tabular-nums; }
.o-donut-center span { font-size: 0.72rem; color: var(--ink-3); }
.o-legend-list { list-style: none; margin: 0; padding: 0; flex: 1; min-width: 160px; display: flex; flex-direction: column; gap: 6px; font-size: 0.85rem; }
.o-legend-list li { display: grid; grid-template-columns: 12px 1fr auto; gap: 8px; align-items: center; }
.o-legend-list i { width: 12px; height: 12px; border-radius: 4px; }
.o-legend-list b { font-variant-numeric: tabular-nums; font-weight: 650; }

.o-level { display: block; height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; min-width: 60px; }
.o-level > span { display: block; height: 100%; border-radius: 99px; background: var(--tone, var(--ink-3)); }
.o-hbar { display: grid; grid-template-columns: minmax(120px, 1.2fr) 2fr auto; gap: 10px; align-items: center; font-size: 0.86rem; padding: 5px 0; }
.o-hbar > span:first-child { white-space: normal; overflow-wrap: anywhere; }
.o-hbar .o-level { height: 10px; }
.o-bigvalue { font-size: 2rem; font-weight: 760; letter-spacing: -0.025em; font-variant-numeric: tabular-nums; line-height: 1.1; }

/* Colour tiles (one per scent) */
.o-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(27px, 1fr)); gap: 3px; }
.o-tiletile { all: unset; box-sizing: border-box; cursor: pointer; aspect-ratio: 1; border-radius: 5px; display: grid; place-items: center; font-size: 0.6rem; font-weight: 700; font-variant-numeric: tabular-nums; background: color-mix(in srgb, var(--tone) 22%, var(--surface)); color: color-mix(in srgb, var(--tone) 70%, var(--ink)); border: 1px solid color-mix(in srgb, var(--tone) 35%, transparent); }
.o-tiletile:hover { background: var(--tone); color: #fff; }
.o-tiletile:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.o-counts { display: flex; gap: 6px; flex-wrap: wrap; }
.o-count-pill { display: inline-flex; align-items: center; gap: 6px; font-size: 0.78rem; font-weight: 650; padding: 3px 10px; border-radius: 99px; background: color-mix(in srgb, var(--tone) 14%, transparent); color: color-mix(in srgb, var(--tone) 80%, var(--ink)); }
.o-count-pill i { width: 8px; height: 8px; border-radius: 99px; background: var(--tone); }

.o-status { display: inline-flex; align-items: center; gap: 6px; font-size: 0.76rem; font-weight: 650; padding: 2px 9px; border-radius: 99px; background: color-mix(in srgb, var(--tone) 14%, transparent); color: color-mix(in srgb, var(--tone) 80%, var(--ink)); white-space: nowrap; }
.o-status::before { content: ''; width: 7px; height: 7px; border-radius: 99px; background: var(--tone); }

/* Preparation steps */
.o-steps { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 1000px) { .o-steps { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.o-step { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; display: flex; flex-direction: column; min-width: 0; }
.o-step-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--tone) 9%, var(--surface)); }
.o-step-num { width: 28px; height: 28px; border-radius: 99px; display: grid; place-items: center; font-weight: 750; font-size: 0.85rem; background: var(--tone); color: #fff; flex: 0 0 auto; }
.o-step-head strong { display: block; font-size: 0.95rem; }
.o-step-head small { color: var(--ink-3); font-size: 0.78rem; }
.o-step-body { padding: 4px 14px 10px; flex: 1; max-height: 360px; overflow-y: auto; }
.o-step-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 3px 10px; align-items: center; padding: 7px 0; border-bottom: 1px dashed var(--line); font-size: 0.86rem; }
.o-step-row:last-child { border-bottom: 0; }
.o-step-row .o-level { grid-column: 1 / -1; height: 6px; }
.o-step-foot { padding: 10px 14px; border-top: 1px solid var(--line); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* Order cards to prepare */
.o-order-cards { display: grid; gap: 8px; grid-template-columns: 1fr; }
@media (min-width: 760px) { .o-order-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1200px) { .o-order-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.o-ocard { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; }
.o-ocard.is-on { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.o-ocard input { width: 18px; height: 18px; accent-color: var(--ink); margin-top: 2px; }
.o-ocard-main { flex: 1; min-width: 0; }
.o-ocard-title { display: flex; justify-content: space-between; gap: 8px; font-weight: 640; font-size: 0.9rem; }
.o-chips { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 5px; }
.o-mini { font-size: 0.72rem; font-weight: 600; padding: 1px 7px; border-radius: 6px; background: var(--surface-2); color: var(--ink-2); white-space: nowrap; }
.o-mini.gift { background: color-mix(in srgb, var(--c-violet) 14%, transparent); color: var(--c-violet); }
.o-mini.bad { background: color-mix(in srgb, var(--c-red) 14%, transparent); color: var(--c-red); }
.o-sticky-bar { position: sticky; bottom: calc(var(--tab-h) + env(safe-area-inset-bottom) + 8px); z-index: 5; margin-top: 12px; display: flex; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 14px; background: var(--ink); color: var(--bg); box-shadow: var(--shadow-pop); }
.o-sticky-bar .o-btn { background: var(--lime); color: #1b2a0e; border-color: var(--lime); }
@media (min-width: 900px) { .o-sticky-bar { bottom: 16px; } }

/* Insights */
.o-insights { display: grid; gap: 10px; grid-template-columns: 1fr; }
@media (min-width: 900px) { .o-insights { grid-template-columns: 1fr 1fr; } }
.o-insight { display: flex; gap: 12px; padding: 12px 14px; border-radius: 12px; background: color-mix(in srgb, var(--tone) 9%, var(--surface)); border: 1px solid color-mix(in srgb, var(--tone) 24%, transparent); }
.o-insight-icon { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: color-mix(in srgb, var(--tone) 20%, transparent); color: var(--tone); flex: 0 0 auto; }
.o-insight-icon svg { width: 18px; height: 18px; }
.o-insight strong { display: block; font-size: 0.93rem; }
.o-insight p { margin: 2px 0 0; font-size: 0.84rem; color: var(--ink-2); }

.o-seg-lite { display: inline-flex; background: var(--surface-2); border-radius: 10px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.o-seg-lite button { all: unset; cursor: pointer; padding: 6px 12px; border-radius: 8px; font-size: 0.82rem; font-weight: 600; color: var(--ink-2); }
.o-seg-lite button[aria-pressed='true'] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px oklch(0.2 0.02 320 / 0.12); }
.o-seg-lite button:focus-visible { outline: 2px solid var(--focus); }
.o-table-compact td, .o-table-compact th { padding: 8px 10px; }
.o-headrow { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 18px 0 10px; }
.o-headrow h2 { font-size: 1.02rem; font-weight: 680; margin: 0; }
.o-headrow .o-spacer { flex: 1; }

/* Stock runway */
.o-runway { display: flex; flex-direction: column; }
.o-runway-row { all: unset; box-sizing: border-box; display: grid; grid-template-columns: minmax(96px, 1.1fr) 3fr 52px; gap: 12px; align-items: center; padding: 7px 0; cursor: pointer; font-size: 0.85rem; }
.o-runway-row:hover .o-runway-name { text-decoration: underline; }
.o-runway-row:focus-visible { outline: 2px solid var(--focus); border-radius: 6px; }
.o-runway-axis { cursor: default; padding: 0 0 4px; }
.o-runway-scale { position: relative; height: 14px; font-size: 0.7rem; color: var(--ink-3); }
.o-runway-scale i { position: absolute; font-style: normal; transform: translateX(-50%); white-space: nowrap; }
.o-runway-scale i:first-child { transform: none; }
.o-runway-name { white-space: normal; overflow-wrap: anywhere; }
.o-runway-track { position: relative; height: 12px; background: var(--surface-2); border-radius: 99px; }
.o-runway-fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 99px; background: var(--tone); }
.o-runway-lead { position: absolute; top: -4px; bottom: -4px; width: 2px; margin-left: -1px; background: var(--ink); border-radius: 2px; }
.o-runway-in { position: absolute; top: 50%; width: 10px; height: 10px; margin: -5px 0 0 -5px; border-radius: 99px; background: var(--surface); border: 2.5px solid var(--c-blue); }
.o-runway-days { font-weight: 700; text-align: right; color: color-mix(in srgb, var(--tone) 85%, var(--ink)); font-variant-numeric: tabular-nums; }
.o-lg-tick { width: 2px !important; height: 12px !important; background: var(--ink); border-radius: 1px !important; }
.o-lg-dot { border-radius: 99px !important; border: 2.5px solid var(--c-blue); background: transparent; box-sizing: border-box; }

/* Big figure rows inside cards */
.o-figline { display: flex; gap: 10px 26px; flex-wrap: wrap; }
.o-figline > div { min-width: 0; }
.o-figline .o-fl-label { font-size: 0.78rem; color: var(--ink-3); }
.o-figline .o-fl-value { font-size: 1.2rem; font-weight: 720; letter-spacing: -0.015em; font-variant-numeric: tabular-nums; }
.o-list { display: flex; flex-direction: column; }
.o-list-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 0.88rem; }
.o-list-row:last-child { border-bottom: 0; }
.o-list-row .o-lr-main { flex: 1; min-width: 0; }
.o-list-row .o-lr-sub { font-size: 0.76rem; color: var(--ink-3); }
.o-list-row b { font-variant-numeric: tabular-nums; }
.o-dot { width: 9px; height: 9px; border-radius: 99px; background: var(--tone); flex: 0 0 auto; }
.o-good-bg { background: color-mix(in srgb, var(--c-green) 10%, var(--surface)); }
.o-bad-bg { background: color-mix(in srgb, var(--c-red) 9%, var(--surface)); }
.o-vtable { width: 100%; border-collapse: collapse; font-size: 0.87rem; }
.o-vtable th { text-align: left; font-weight: 560; color: var(--ink-3); font-size: 0.78rem; padding: 0 10px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.o-vtable td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.o-vtable tr:last-child td { border-bottom: 0; }
.o-vtable .r { text-align: right; font-variant-numeric: tabular-nums; }
.o-vtable tbody tr.click { cursor: pointer; }
.o-vtable tbody tr.click:hover td { background: var(--surface-2); }
.o-vtable th:first-child, .o-vtable td:first-child { padding-left: 0; }
.o-vtable th:last-child, .o-vtable td:last-child { padding-right: 0; }
.o-scroll-x { overflow-x: auto; }
.o-who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.o-who .o-avatar { flex: 0 0 auto; }
.o-who b { display: block; font-weight: 620; }
.o-who small { color: var(--ink-3); font-size: 0.75rem; }
.o-tasks-col { grid-template-columns: 1fr !important; }
a.o-hbar:hover span:first-child { text-decoration: underline; }

@media (min-width: 900px) { .o-app { background: linear-gradient(to right, #16121a 240px, transparent 240px); } }
.o-cards.o-top-align { align-items: start; }
/* Compact runway for narrow cards: name and days on one line, bar below. */
.o-runway.compact .o-runway-row { grid-template-columns: 1fr auto; gap: 4px 10px; padding: 6px 0; }
.o-runway.compact .o-runway-track { grid-column: 1 / -1; grid-row: 2; }
.o-runway.compact .o-runway-axis { display: none; }
/* Alerts as one quiet card */
.o-alerts { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 4px 16px; margin-bottom: 16px; box-shadow: var(--card-shadow); }
.o-alert { display: flex; gap: 10px; align-items: center; padding: 9px 0; font-size: 0.86rem; border-bottom: 1px solid var(--line); }
.o-alert:last-child { border-bottom: 0; }
.o-alert svg { width: 17px; height: 17px; color: var(--tone); flex: 0 0 auto; }
.o-diverge { display: grid; grid-template-columns: 60px 60px auto; align-items: center; }
.o-diverge > span:nth-child(1) { display: flex; justify-content: flex-end; }
.o-diverge > span:nth-child(2) { display: flex; border-left: 1px solid var(--line-strong); }
.o-diverge i { display: block; height: 10px; }
.o-diverge b { padding-left: 10px; text-align: right; min-width: 84px; font-variant-numeric: tabular-nums; }
@media (max-width: 599px) {
  .o-runway .o-runway-row { grid-template-columns: 1fr auto; gap: 4px 10px; padding: 6px 0; }
  .o-runway .o-runway-track { grid-column: 1 / -1; grid-row: 2; }
  .o-runway .o-runway-axis { display: none; }
  .o-page-actions { width: 100%; }
}
