/* ==========================================================================
   App metrics — admin_metrics (prefix .mx-), ported from Dulles 2.0.3 to the STG design system.
   Pure SVG/CSS charts in the STG palette only (emerald / blue-violet / gold / navy; no pink).
   Series: platform = iOS (emerald) / Android (blue-violet) / Desktop (gold); New (violet) vs Returning (emerald).
   Light default + navy dark theme via tokens. No hover-only affordances, no springy animations.
   ========================================================================== */
:root {
  --mx-ios: var(--teal);          /* #27805F emerald */
  --mx-android: var(--violet);    /* #4A4FC0 blue-violet */
  --mx-desktop: #B57A12;          /* STG gold, deepened for 3:1 on white */
  --mx-other: #8A90A8;
  --mx-new: var(--violet);
  --mx-ret: var(--teal);
  --mx-neutral: var(--ink-2);     /* STG navy */
  --mx-accent: var(--teal);
  --mx-tip-bg: var(--ink);
  --mx-tip-fg: #fff;
  --mx-seg-on: var(--surface);
  --mx-good: var(--green); --mx-good-bg: var(--green-soft);
  --mx-bad: var(--amber); --mx-bad-bg: var(--amber-soft);
}
:root[data-theme="dark"] {
  --mx-ios: #4CC196;
  --mx-android: #A9ACF5;
  --mx-desktop: #F5C25C;
  --mx-other: #7C86AE;
  --mx-new: #A9ACF5;
  --mx-ret: #4CC196;
  --mx-neutral: #9AA3C6;
  --mx-accent: #4CC196;
  --mx-tip-bg: #EEF1FA;
  --mx-tip-fg: #17224A;
  --mx-seg-on: rgba(255, 255, 255, .12);
}
.t-ios { --c: var(--mx-ios); } .t-android { --c: var(--mx-android); } .t-desktop { --c: var(--mx-desktop); }
.t-other { --c: var(--mx-other); } .t-neutral { --c: var(--mx-neutral); } .t-new { --c: var(--mx-new); } .t-ret { --c: var(--mx-ret); }

/* ---------- Sticky range bar ---------- */
.page-mx .page-body { padding-top: 0; }
.mx-bar {
  position: sticky; top: 0; z-index: 6; display: flex; align-items: center; gap: 8px;
  margin: 0 calc(-1 * var(--gutter)); padding: 4px var(--gutter) 10px;
  background: linear-gradient(var(--paper) 82%, transparent);
  transition: background .2s, box-shadow .2s;
}
.page-mx.is-scrolled .mx-bar {
  background: var(--glass); -webkit-backdrop-filter: saturate(180%) blur(18px); backdrop-filter: saturate(180%) blur(18px);
  box-shadow: 0 1px 0 var(--line);
}
.page-mx.is-scrolled .pg-head::before { border-bottom-color: transparent; }
.mx-range-wrap { position: relative; flex: 1; min-width: 0; border-radius: 14px; background: var(--surface-3); overflow: hidden; }
.mx-range-wrap::after { content: ""; position: absolute; top: 0; right: 0; bottom: 0; width: 26px; pointer-events: none; background: linear-gradient(90deg, transparent, var(--surface-3) 85%); transition: opacity .2s; }
.mx-range-wrap.at-end::after { opacity: 0; }
/* Horizontal strip: scrolls sideways only inside itself and never rubber-bands (overscroll none). */
.mx-range { display: flex; gap: 2px; padding: 4px; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; -webkit-overflow-scrolling: touch; overscroll-behavior: none; touch-action: pan-x pan-y; }
.mx-range::-webkit-scrollbar { display: none; }
.mx-range button {
  flex: none; display: inline-flex; align-items: center; gap: 5px; height: 34px; padding: 0 12px; border-radius: 10px;
  font-weight: 700; font-size: var(--fs-sm); color: var(--text-2); white-space: nowrap;
  transition: background .2s, color .2s, box-shadow .2s, transform .15s;
}
.mx-range button:active { background: var(--mx-seg-on); }
.mx-range button.active { background: var(--mx-seg-on); color: var(--text); box-shadow: var(--shadow-1); }
.mx-range .ico { opacity: .8; }
.mx-filter-btn {
  position: relative; flex: none; width: 46px; height: 42px; border-radius: 13px; display: grid; place-items: center;
  background: var(--surface-3); color: var(--text-2); transition: background .15s, color .15s, transform .15s;
}
.mx-filter-btn:active { background: var(--line-2); }
.mx-filter-btn.on { background: var(--ink); color: #fff; }
:root[data-theme="dark"] .mx-filter-btn.on { background: var(--teal); color: var(--on-teal); }
.mx-badge {
  position: absolute; top: -5px; right: -5px; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 10px;
  background: var(--gold); color: #1B2159; font-size: 11px; font-weight: 800; line-height: 19px; text-align: center;
  box-shadow: 0 0 0 2px var(--paper);
}
.mx-progress { position: absolute; left: var(--gutter); right: var(--gutter); bottom: 3px; height: 2px; border-radius: 2px; overflow: hidden; opacity: 0; transition: opacity .2s; }
.mx-progress::after { content: ""; position: absolute; top: 0; bottom: 0; width: 34%; border-radius: inherit; background: var(--mx-accent); animation: mxSlide 1s var(--ease) infinite; }
.mx-bar.busy .mx-progress { opacity: 1; }
@keyframes mxSlide { from { left: -34%; } to { left: 100%; } }

.mx-context { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin: 0 4px; min-height: 26px; font-size: var(--fs-sm); color: var(--muted); font-weight: 600; }
.mx-ctx-date { display: inline-flex; align-items: center; gap: 6px; font-variant-numeric: tabular-nums; }
.mx-ctx-date .ico { color: var(--teal-strong); }
.mx-fchip {
  display: inline-flex; align-items: center; gap: 4px; height: 26px; padding: 0 8px 0 10px; border-radius: var(--r-pill);
  background: var(--teal-soft); color: var(--teal-strong); font-size: var(--fs-xs); font-weight: 800;
}
.mx-fchip:active { opacity: .7; }

.mx-body { transition: opacity .2s; }
.mx-body.is-loading { opacity: .5; pointer-events: none; }
.mx-skel { margin-top: 14px; }
.mx-skel .mx-kpis { margin-bottom: 12px; }
.mx-kpi-skel { height: 118px; border-radius: var(--r-card); }

/* ---------- Sections & cards ---------- */
.mx-sec { margin-top: 26px; }
.mx-sec:first-child { margin-top: 12px; }
.mx-sh { margin-bottom: 10px; }
.mx-sh h2 { font-size: var(--fs-xl); }
.mx-sh-note { font-size: var(--fs-xs); font-weight: 600; color: var(--faint); text-align: right; }
.mx-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.mx-grid .card + .card, .mx-grid > * + .card { margin-top: 0; }
.mx-card { padding: 16px; min-width: 0; }
.mx-ch { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 14px; }
.mx-ch h3 { font-size: var(--fs-lg); font-weight: 800; line-height: 1.2; }
.mx-ch-sub { margin: 3px 0 0; font-size: var(--fs-xs); color: var(--muted); line-height: 1.4; }
.mx-ch-sub b { color: var(--text); font-weight: 800; font-variant-numeric: tabular-nums; }
.mx-sub-h { display: flex; align-items: baseline; gap: 6px; margin: 18px 2px 8px; font-size: var(--fs-xs); font-weight: 800; color: var(--text-2); }
.mx-sub-h span { font-weight: 600; color: var(--faint); }
.mx-none { margin: 4px 0 0; color: var(--muted); font-size: var(--fs-sm); }
.mx-note { display: flex; align-items: center; gap: 6px; margin: 10px 0 0; font-size: var(--fs-xs); color: var(--muted); }
.mx-sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; flex: none; background: var(--c); }
.mx-seg { margin-bottom: 12px; }
.mx-seg button { height: 32px; font-size: var(--fs-sm); }
.mx-seg button.active { background: var(--mx-seg-on); }
.mx-seg button[disabled] { opacity: .38; }

/* ---------- KPI tiles ---------- */
.mx-kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.mx-kpi {
  min-width: 0; display: flex; flex-direction: column; gap: 10px; padding: 14px 14px 13px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); box-shadow: var(--shadow-1);
}
.mx-kpi-top { display: flex; align-items: center; gap: 8px; min-width: 0; }
.mx-ti { width: 26px; height: 26px; flex: none; border-radius: 8px; display: grid; place-items: center; background: var(--teal-soft); color: var(--teal-strong); }
.mx-ti .ico { width: 15px; height: 15px; }
.mx-ti.violet { background: var(--violet-soft); color: var(--violet); }
.mx-ti.ink { background: rgba(27, 33, 89, .08); color: var(--ink); }
:root[data-theme="dark"] .mx-ti.ink { background: rgba(238, 241, 250, .1); color: var(--text); }
.mx-ti.slate { background: var(--surface-3); color: var(--text-2); }
.mx-ti.gold { background: var(--gold-soft); color: var(--amber); }
.mx-ti.green { background: var(--green-soft); color: var(--green); }
.mx-kpi-l { font-size: 12.5px; font-weight: 700; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mx-kpi-v { font-family: var(--font-display); font-weight: 700; letter-spacing: -.02em; line-height: 1; font-size: clamp(25px, 8.3vw, 34px); color: var(--text); white-space: nowrap; }
.mx-kpi-foot { display: flex; flex-direction: column; align-items: flex-start; gap: 5px; min-width: 0; }
.mx-kpi-sub { max-width: 100%; font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mx-delta {
  display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: var(--r-pill);
  font-size: 11.5px; font-weight: 800; white-space: nowrap; font-variant-numeric: tabular-nums;
  background: var(--surface-3); color: var(--muted);
}
.mx-delta b { font-size: 8.5px; line-height: 1; }
.mx-delta .ico { width: 12px; height: 12px; stroke-width: 2.6; }
.mx-delta.good { background: var(--mx-good-bg); color: var(--mx-good); }
.mx-delta.bad { background: var(--mx-bad-bg); color: var(--mx-bad); }
.mx-delta.new { background: var(--violet-soft); color: var(--violet); }

/* ---------- Live strip ---------- */
.mx-live {
  position: relative; overflow: hidden; display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px; margin-top: 12px;
  padding: 13px 16px; border-radius: var(--r-group); color: #fff; font-size: var(--fs-sm);
  background: radial-gradient(120% 160% at 100% 0%, rgba(47, 143, 110, .34), transparent 55%), radial-gradient(90% 140% at 0% 100%, rgba(74, 79, 192, .32), transparent 60%), linear-gradient(140deg, #1B2159, #182A63);
  box-shadow: var(--shadow-2);
}
.mx-live b { font-family: var(--font-display); font-weight: 700; font-size: 19px; font-variant-numeric: tabular-nums; margin-right: 3px; }
.mx-live-a { display: inline-flex; align-items: center; gap: 10px; flex: none; }
.mx-live-b { order: 2; flex-basis: 100%; display: inline-flex; align-items: center; gap: 10px; min-width: 0; }
.mx-live-tag { order: 1; margin-left: auto; height: 22px; padding: 0 9px; border-radius: var(--r-pill); background: rgba(255, 255, 255, .12); font-size: 11px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; line-height: 22px; color: rgba(255, 255, 255, .8); }
.mx-live-main { font-weight: 700; }
.mx-live-main b { color: #6FD8AE; }
.mx-live-sub { color: rgba(255, 255, 255, .74); font-weight: 600; }
.mx-live-sub b { color: #fff; }
.mx-live-sep { width: 4px; height: 4px; border-radius: 50%; background: rgba(255, 255, 255, .3); }
.mx-live-dot { position: relative; width: 10px; height: 10px; flex: none; }
.mx-live-dot i { position: absolute; inset: 0; border-radius: 50%; background: #4CC196; animation: mxPing 2.4s ease-out infinite; }
@keyframes mxPing { 0% { box-shadow: 0 0 0 0 rgba(76, 193, 150, .5); } 70% { box-shadow: 0 0 0 8px rgba(76, 193, 150, 0); } 100% { box-shadow: 0 0 0 0 rgba(76, 193, 150, 0); } }

/* ---------- Trend chart ---------- */
.mx-trend .mx-ch { align-items: center; margin-bottom: 2px; min-height: 36px; }
.mx-trend-sub { margin: 0 0 12px; }
.mx-seg-group { flex: none; padding: 3px; gap: 2px; border-radius: 12px; }
.mx-seg-group button { height: 30px; padding: 0 10px; font-size: var(--fs-xs); border-radius: 9px; }
.mx-chart { position: relative; margin-top: 2px; touch-action: pan-y; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; outline: none; }
.mx-chart:focus-visible { outline: 2.5px solid var(--teal); outline-offset: 6px; border-radius: 10px; }
.mx-chart-ph { height: 196px; }
.mx-svg { display: block; overflow: visible; max-width: none; }
.mx-gl { stroke: var(--line); stroke-width: 1; }
.mx-base { stroke: var(--line-2); stroke-width: 1; }
.mx-yl, .mx-xl, .mx-cap { font-family: var(--font-ui); font-size: 10.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
.mx-yl { fill: var(--faint); paint-order: stroke; stroke: var(--surface); stroke-width: 3px; stroke-linejoin: round; }
.mx-xl { fill: var(--muted); }
.mx-cap { fill: var(--text-2); font-weight: 800; text-anchor: middle; }
.mx-line { fill: none; stroke: var(--mx-accent); stroke-width: 2.25; stroke-linecap: round; stroke-linejoin: round; }
.mx-line.anim { stroke-dasharray: 1; stroke-dashoffset: 1; animation: mxDraw .8s var(--ease-out) .05s forwards; }
.mx-line-partial { fill: none; stroke: var(--mx-accent); stroke-width: 2.25; stroke-linecap: round; stroke-dasharray: 2 5; }
.mx-line-partial.anim { animation: mxFade .3s var(--ease) .75s both; }
.mx-col.partial .mx-colbar { opacity: .55; }
.mx-area.anim { animation: mxFade .6s var(--ease) .15s both; }
.mx-end { fill: var(--mx-accent); stroke: var(--surface); stroke-width: 2.5; }
.mx-peak { fill: var(--surface); stroke: var(--mx-accent); stroke-width: 2; }
.mx-cross line { stroke: var(--text-2); stroke-opacity: .4; stroke-width: 1; }
.mx-cross circle { fill: var(--mx-accent); stroke: var(--surface); stroke-width: 3; }
.mx-colbar { fill: var(--mx-accent); transition: opacity .15s; }
.mx-colbar.anim { transform-box: fill-box; transform-origin: 50% 100%; animation: mxGrowY .55s var(--ease-out) both; animation-delay: calc(var(--i) * 16ms); }
.mx-colzero { fill: var(--line-2); }
.mx-col.future .mx-colzero { fill: var(--line); }
.mx-svg:has(.mx-col.on) .mx-col:not(.on) .mx-colbar { opacity: .38; }
@keyframes mxDraw { to { stroke-dashoffset: 0; } }
@keyframes mxFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes mxGrowY { from { transform: scaleY(0); } to { transform: none; } }
@keyframes mxGrowX { from { transform: scaleX(0); } to { transform: none; } }
@keyframes mxRise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.mx-tip {
  position: absolute; top: 0; left: 0; z-index: 2; min-width: 136px; max-width: 200px; padding: 9px 12px 10px; border-radius: 13px;
  background: var(--mx-tip-bg); color: var(--mx-tip-fg); box-shadow: var(--shadow-3); pointer-events: none; font-size: var(--fs-xs);
  animation: mxFade .12s ease both;
}
.mx-tip-h { font-weight: 700; opacity: .7; white-space: nowrap; }
.mx-tip-main { margin: 2px 0 4px; font-weight: 600; white-space: nowrap; }
.mx-tip-main b { font-family: var(--font-display); font-weight: 700; font-size: 22px; margin-right: 2px; font-variant-numeric: tabular-nums; }
.mx-tip-r { display: flex; justify-content: space-between; gap: 14px; line-height: 1.55; opacity: .86; white-space: nowrap; }
.mx-tip-r b { font-weight: 800; font-variant-numeric: tabular-nums; }

/* ---------- Donut ---------- */
.mx-donut-wrap { display: flex; align-items: center; gap: 18px; }
.mx-donut { position: relative; width: 136px; height: 136px; flex: none; }
.mx-donut svg { width: 100%; height: 100%; transform: rotate(-90deg); overflow: visible; }
.mx-arc-track { fill: none; stroke: var(--surface-3); stroke-width: 16; }
.mx-arc { fill: none; stroke: var(--c); stroke-width: 16; cursor: pointer; transition: opacity .2s, stroke-width .2s; }
.mx-arc.dim { opacity: .25; }
.mx-arc.anim { animation: mxSweep .9s var(--ease-out) both; animation-delay: calc(var(--i) * 90ms); }
@keyframes mxSweep { from { stroke-dasharray: 0 400; } }
.mx-donut-c { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; pointer-events: none; text-align: center; }
.mx-donut-c b { font-family: var(--font-display); font-weight: 700; font-size: 28px; line-height: 1; letter-spacing: -.02em; }
.mx-donut-c span { margin-top: 3px; font-size: var(--fs-xs); font-weight: 700; color: var(--muted); }
.mx-legend { flex: 1; min-width: 0; margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 2px; }
.mx-leg { width: 100%; display: flex; align-items: center; gap: 9px; padding: 9px 8px; border-radius: 11px; text-align: left; transition: background .15s, opacity .15s; }
.mx-leg:active { background: var(--surface-3); }
.mx-leg.on { background: var(--surface-3); }
.mx-leg.dim { opacity: .5; }
.mx-leg-l { flex: 1; min-width: 0; font-weight: 700; font-size: var(--fs-sm); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mx-leg-p { font-weight: 800; font-size: var(--fs-sm); font-variant-numeric: tabular-nums; }
.mx-leg-n { min-width: 34px; text-align: right; font-size: var(--fs-xs); color: var(--faint); font-variant-numeric: tabular-nums; }

/* ---------- Stat chips (container / device type) ---------- */
.mx-chips { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.mx-chip {
  position: relative; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 10px 10px 16px;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px;
}
.mx-chip.zero { opacity: .55; }
.mx-chip-i { width: 26px; height: 26px; margin-bottom: 4px; border-radius: 8px; display: grid; place-items: center; background: var(--surface); color: var(--text-2); box-shadow: inset 0 0 0 1px var(--line); }
.mx-chip-i .ico { width: 15px; height: 15px; }
.mx-chip-p { font-family: var(--font-display); font-weight: 700; font-size: 21px; line-height: 1.05; }
.mx-chip-l { font-size: 11.5px; font-weight: 700; color: var(--text-2); line-height: 1.25; }
.mx-chip-n { font-size: 11px; color: var(--faint); font-variant-numeric: tabular-nums; }
.mx-chip-bar { position: absolute; left: 10px; right: 10px; bottom: 7px; height: 3px; border-radius: 2px; background: var(--line); overflow: hidden; }
.mx-chip-bar::after { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: var(--w); border-radius: inherit; background: var(--mx-neutral); }
.mx-anim .mx-chip-bar::after { transform-origin: left; animation: mxGrowX .6s var(--ease-out) .1s both; }

/* ---------- Horizontal bars ---------- */
.mx-dots { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px 10px; max-width: 46%; padding-top: 3px; font-size: 11px; font-weight: 700; color: var(--muted); }
.mx-dots span { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.mx-dots .mx-sw { width: 8px; height: 8px; border-radius: 2px; }
.mx-bars { margin: 0; padding: 0; list-style: none; }
.mx-bar-row + .mx-bar-row { margin-top: 11px; }
.mx-bar-top { display: flex; align-items: center; gap: 8px; min-width: 0; }
.mx-bar-l { flex: 1; min-width: 0; font-size: 13.5px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mx-bar-v { flex: none; display: inline-flex; align-items: baseline; gap: 6px; font-variant-numeric: tabular-nums; }
.mx-bar-v b { font-weight: 800; font-size: 13.5px; }
.mx-bar-v span { min-width: 30px; text-align: right; font-size: 11.5px; font-weight: 600; color: var(--faint); }
.mx-track { margin-top: 5px; height: 8px; border-radius: 4px; background: var(--surface-3); overflow: hidden; }
.mx-fill { display: block; height: 100%; border-radius: 0 4px 4px 0; background: var(--c); }
.mx-anim .mx-fill { transform-origin: left; animation: mxGrowX .6s var(--ease-out) both; animation-delay: calc(var(--i) * 30ms); }
.mx-glyph { width: 20px; height: 20px; flex: none; display: grid; place-items: center; }
.mx-glyph i { display: block; border: 1.5px solid var(--muted); border-radius: 3px; }

.mx-theme { display: flex; align-items: center; gap: 10px; }
.mx-theme-l { display: inline-flex; align-items: center; gap: 5px; flex: none; font-size: var(--fs-xs); font-weight: 700; color: var(--text-2); }
.mx-theme-l b { font-weight: 800; color: var(--text); font-variant-numeric: tabular-nums; }
.mx-theme-bar { flex: 1; height: 8px; border-radius: 4px; overflow: hidden; background: var(--gold-soft); box-shadow: inset 0 0 0 1px var(--line); }
.mx-theme-bar i { display: block; height: 100%; background: var(--mx-neutral); border-radius: 4px 0 0 4px; }
.mx-vers { display: flex; flex-wrap: wrap; gap: 6px; }
.mx-ver { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 11px; border-radius: var(--r-pill); background: var(--surface-3); color: var(--muted); font-size: var(--fs-xs); font-weight: 700; font-variant-numeric: tabular-nums; }
.mx-ver b { color: var(--text); font-weight: 800; }
.mx-ver.latest { background: var(--teal-soft); color: var(--teal-strong); }
.mx-ver.latest b { color: var(--teal-strong); }

/* ---------- Engagement ---------- */
.mx-trio { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.mx-trio > div { min-width: 0; overflow: hidden; padding: 10px 11px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line); }
.mx-trio-v { display: block; font-family: var(--font-display); font-weight: 700; font-size: clamp(14px, 4.4vw, 22px); line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.mx-trio-l { display: block; margin-top: 3px; font-size: 11px; font-weight: 600; color: var(--muted); line-height: 1.25; }
.mx-hist { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; height: 150px; margin-top: 18px; }
.mx-hcol { min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 5px; }
.mx-hcap { font-size: 11px; font-weight: 800; color: var(--text-2); font-variant-numeric: tabular-nums; }
.mx-htrack { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; border-bottom: 1px solid var(--line-2); }
.mx-htrack i { display: block; width: min(24px, 72%); border-radius: 4px 4px 0 0; background: var(--mx-accent); }
.mx-anim .mx-htrack i { transform-origin: bottom; animation: mxGrowY .55s var(--ease-out) both; animation-delay: calc(var(--i) * 40ms); }
.mx-hl { font-size: 10.5px; font-weight: 600; color: var(--muted); white-space: nowrap; }

.mx-split { display: flex; gap: 2px; height: 28px; }
.mx-split-seg { min-width: 4px; display: flex; align-items: center; padding-left: 8px; border-radius: 4px; background: var(--c); color: #fff; font-style: normal; font-size: var(--fs-xs); font-weight: 800; font-variant-numeric: tabular-nums; overflow: visible; white-space: nowrap; }
.mx-split-seg.new { --c: var(--mx-new); }
.mx-split-seg.ret { --c: var(--mx-ret); }
:root[data-theme="dark"] .mx-split-seg.ret { color: #062220; }
.mx-anim .mx-split { transform-origin: left; animation: mxGrowX .6s var(--ease-out) both; }
.mx-split-leg { display: grid; gap: 8px; margin-top: 14px; }
.mx-split-leg > div { display: flex; align-items: center; gap: 9px; font-size: var(--fs-sm); }
.mx-split-leg > div > span:not(.mx-delta) { flex: 1; font-weight: 700; }
.mx-split-leg > div > b { font-weight: 800; font-variant-numeric: tabular-nums; }
.mx-mini { margin-top: 16px; border-top: 1px solid var(--line); }
.mx-mini > div { display: flex; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: var(--fs-sm); }
.mx-mini > div:last-child { border-bottom: 0; padding-bottom: 0; }
.mx-mini span { color: var(--muted); font-weight: 600; }
.mx-mini b { font-weight: 800; font-variant-numeric: tabular-nums; }

/* ---------- Top screens table ---------- */
.mx-board .mx-seg { margin-bottom: 4px; }
.mx-table { font-size: var(--fs-sm); }
.mx-tr { display: grid; grid-template-columns: minmax(0, 1fr) 52px 52px; gap: 8px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.mx-tr:first-child { border-top: 0; }
.mx-thead { padding: 8px 0 6px; font-size: 11px; font-weight: 800; color: var(--faint); letter-spacing: .02em; }
.mx-thead span:not(:first-child) { text-align: right; }
.mx-c-vis { display: none; }
.mx-td-name { display: flex; align-items: flex-start; gap: 10px; min-width: 0; }
.mx-rank { width: 22px; height: 22px; flex: none; margin-top: 1px; border-radius: 7px; display: grid; place-items: center; background: var(--surface-3); color: var(--muted); font-size: 11px; font-weight: 800; font-variant-numeric: tabular-nums; }
.mx-rt { display: block; font-weight: 700; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mx-rk { display: block; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 10.5px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mx-rbar { display: block; height: 3px; margin-top: 6px; border-radius: 2px; background: var(--surface-3); overflow: hidden; }
.mx-rbar i { display: block; height: 100%; border-radius: 0 2px 2px 0; background: var(--mx-neutral); opacity: .7; }
.mx-anim .mx-rbar i { transform-origin: left; animation: mxGrowX .6s var(--ease-out) both; animation-delay: calc(var(--i) * 25ms); }
.mx-more { display: flex; align-items: center; justify-content: center; gap: 6px; width: 100%; height: 42px; margin-top: 6px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); color: var(--teal-strong); font-weight: 700; font-size: var(--fs-sm); }
.mx-more:active { background: var(--surface-3); }
.mx-num { text-align: right; color: var(--text-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.mx-num b { color: var(--text); font-weight: 800; }

/* ---------- Heatmap ---------- */
.mx-peak { display: flex; align-items: center; gap: 11px; margin-bottom: 16px; padding: 11px 12px; border-radius: 14px; background: var(--gold-soft); box-shadow: inset 0 0 0 1px rgba(181, 122, 18, .14); }
.mx-peak-i { width: 32px; height: 32px; flex: none; border-radius: 10px; display: grid; place-items: center; background: var(--gold); color: #1B2159; }
.mx-peak .grow > b { display: block; font-size: var(--fs-sm); font-weight: 800; line-height: 1.3; }
.mx-peak .grow > span { display: block; margin-top: 1px; font-size: var(--fs-xs); color: var(--text-2); line-height: 1.35; }
.mx-heat { display: grid; grid-template-columns: 22px repeat(24, minmax(0, 1fr)); gap: 2px; align-items: center; }
.mx-hm-top { height: 26px; display: flex; align-items: flex-end; margin-bottom: 3px; }
.mx-hm-top i { display: block; width: 100%; min-height: 1px; border-radius: 2px 2px 0 0; background: var(--mx-accent); opacity: .32; }
.mx-hm-top i.pk { opacity: 1; }
.mx-hm-day { font-size: 10px; font-weight: 800; color: var(--muted); line-height: 1; }
.mx-cell { position: relative; aspect-ratio: 1; width: 100%; padding: 0; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.mx-cell::after { content: ""; position: absolute; inset: 0; background: var(--mx-accent); opacity: var(--a, 0); }
.mx-cell.on { overflow: visible; z-index: 1; box-shadow: 0 0 0 2px var(--surface), 0 0 0 3.5px var(--text); }
.mx-cell.on::after { border-radius: 3px; }
.mx-anim .mx-cell { animation: mxFade .4s var(--ease) both; }
.mx-hm-x { position: relative; height: 16px; margin-top: 2px; font-size: 10px; font-weight: 600; color: var(--muted); white-space: nowrap; overflow: visible; }
.mx-readout { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 22px; margin-top: 10px; font-size: var(--fs-xs); color: var(--muted); font-weight: 600; }
.mx-ro-v b { font-size: var(--fs-sm); font-weight: 800; color: var(--text); font-variant-numeric: tabular-nums; }
.mx-ro-k { color: var(--text-2); font-weight: 700; }
.mx-scale { display: inline-flex; align-items: center; gap: 3px; }
.mx-scale i { position: relative; width: 11px; height: 11px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.mx-scale i::after { content: ""; position: absolute; inset: 0; background: var(--mx-accent); opacity: var(--a); }
.mx-scale i:first-of-type { margin-left: 3px; } .mx-scale i:last-of-type { margin-right: 3px; }

/* ---------- Members ---------- */
.mx-mlist { margin: 0; padding: 0; list-style: none; }
.mx-m { display: flex; align-items: center; gap: 11px; padding: 10px 0; border-top: 1px solid var(--line); }
.mx-m:first-child { border-top: 0; padding-top: 2px; }
.mx-m-rank { width: 16px; flex: none; text-align: center; font-size: 12px; font-weight: 800; color: var(--faint); font-variant-numeric: tabular-nums; }
.mx-m-rank.r0 { color: var(--amber); }
.mx-m-rank.r1, .mx-m-rank.r2 { color: var(--text-2); }
.mx-m-main { min-width: 0; }
.mx-m-name { display: block; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mx-m-sub { display: block; font-size: var(--fs-xs); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mx-m-t { flex: none; min-width: 62px; text-align: right; font-weight: 800; font-size: var(--fs-md); font-variant-numeric: tabular-nums; }
.mx-m .mx-rbar { margin-top: 5px; }
.mx-m .mx-rbar i { background: var(--mx-accent); opacity: .65; }

/* ---------- Footer, empty, guard ---------- */
.mx-foot { display: flex; align-items: flex-start; gap: 7px; margin: 22px 6px 0; font-size: var(--fs-xs); color: var(--faint); line-height: 1.5; }
.mx-foot .ico { margin-top: 2px; }
.mx-empty, .mx-guard { margin-top: 14px; padding: 34px 22px 28px; text-align: center; }
.mx-empty-art, .mx-guard-i {
  width: 80px; height: 80px; margin: 0 auto 16px; border-radius: 26px; display: grid; place-items: center;
  background: linear-gradient(150deg, var(--teal-soft), var(--violet-soft)); color: var(--teal-strong);
}
.mx-guard-i { width: 64px; height: 64px; border-radius: 20px; background: var(--gold-soft); color: var(--amber); }
.mx-empty h3, .mx-guard h3 { font-size: var(--fs-xl); margin-bottom: 8px; }
.mx-empty p, .mx-guard p { max-width: 34ch; margin: 0 auto; color: var(--muted); font-size: var(--fs-sm); line-height: 1.55; }
.mx-guard p b { color: var(--text); }
.mx-empty-acts { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 18px; }
.mx-empty-acts:empty { display: none; }
.mx-guard .btn { margin-top: 18px; }

/* ---------- Sheets ---------- */
.mx-chipwrap { display: flex; flex-wrap: wrap; gap: 8px; }
.mx-switch-row { display: flex; align-items: center; gap: 14px; padding: 14px; border-radius: var(--r-input); background: var(--surface-2); border: 1px solid var(--line); cursor: pointer; }
.mx-sw-t { display: block; font-weight: 700; }
.mx-sw-s { display: block; margin-top: 2px; font-size: var(--fs-xs); color: var(--muted); line-height: 1.4; }
.mx-sheet-note { display: flex; gap: 7px; align-items: flex-start; margin: 16px 2px 0; font-size: var(--fs-xs); color: var(--muted); line-height: 1.45; }
.mx-sheet-note .ico { margin-top: 2px; flex: none; }
.mx-err { margin: 12px 2px 0; padding: 10px 12px; border-radius: 12px; background: var(--amber-soft); color: var(--amber); font-size: var(--fs-sm); font-weight: 700; }
.sheet input[type="date"].input { min-width: 0; }

/* ---------- Entrance (fresh data only; app.css neutralises it for reduced motion) ---------- */
.mx-anim .mx-kpi { animation: mxRise .5s var(--ease-out) both; animation-delay: calc(var(--i) * 35ms); }
.mx-anim .mx-sec:nth-child(n+2) { animation: mxRise .5s var(--ease-out) both; }
.mx-anim .mx-sec:nth-child(2) { animation-delay: .06s; }
.mx-anim .mx-sec:nth-child(3) { animation-delay: .1s; }
.mx-anim .mx-sec:nth-child(n+4) { animation-delay: .14s; }

/* ---------- Narrow phones (≤ 360px) ---------- */
@media (max-width: 360px) {
  .mx-card { padding: 14px; }
  .mx-kpis { gap: 8px; }
  .mx-kpi { padding: 12px 12px 11px; }
  .mx-range button { padding: 0 10px; }
  .mx-donut { width: 116px; height: 116px; }
  .mx-donut-c b { font-size: 24px; }
  .mx-donut-wrap { gap: 12px; }
  .mx-leg { padding: 8px 6px; gap: 7px; }
  .mx-leg-n { display: none; }
  .mx-chips { gap: 6px; }
  .mx-chip { padding: 9px 8px 15px; }
  .mx-chip-p { font-size: 18px; }
  .mx-heat { grid-template-columns: 20px repeat(24, minmax(0, 1fr)); gap: 1.5px; }
  .mx-seg-group button { padding: 0 8px; }
  .mx-dots { display: none; }
  .mx-ti { display: none; }
}

/* ---------- Tablets (≥ 720px): 3-up tiles, 2-column cards ---------- */
@media (min-width: 720px) {
  .mx-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
  .mx-kpi { padding: 16px 16px 14px; }
  .mx-kpi-v { font-size: 36px; }
  .mx-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
  .mx-grid > [data-mx-donut] > .card { height: 100%; }
  .mx-donut-wrap { flex-direction: column; align-items: stretch; gap: 18px; }
  .mx-donut { width: 164px; height: 164px; margin: 6px auto 0; }
  .mx-donut-c b { font-size: 32px; }
  .mx-legend { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 10px; }
  .mx-legend .mx-leg-n { display: none; }
  .mx-seg-metric { max-width: 420px; }
  .mx-card { padding: 18px; }
  .mx-tr { grid-template-columns: minmax(0, 1fr) 72px 72px 72px; }
  .mx-table.two .mx-tr { grid-template-columns: minmax(0, 1fr) 80px 72px; }
  .mx-c-vis { display: block; }
  .mx-chart-ph { height: 236px; }
  .mx-heat { gap: 3px; grid-template-columns: 26px repeat(24, minmax(0, 1fr)); }
  .mx-live { font-size: var(--fs-md); padding: 14px 18px; flex-wrap: nowrap; gap: 18px; }
  .mx-live-b { order: 1; flex-basis: auto; }
  .mx-live-tag { order: 2; }
}
@media (min-width: 370px) and (max-width: 719px) {
  .mx-tr { grid-template-columns: minmax(0, 1fr) 50px 52px 54px; }
  .mx-table.two .mx-tr { grid-template-columns: minmax(0, 1fr) 62px 52px; }
  .mx-c-vis { display: block; }
}
