/* Mesa performance marketing dashboard. Look follows docs/reference/design-spec.md. */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }

:root {
  color-scheme: light;
  --bg: #f6f8f5;
  --surface: #ffffff;
  --surface-2: #f0f5f0;
  --line: #dbe5dc;
  --line-strong: #a9b9ac;
  --ink: #192820;
  --muted: #52665a;
  --accent: #1d6542;
  --accent-weak: #e2f0e6;
  --on-accent: #ffffff;
  --brand: #173c2a;
  --warn: #8b4918;
  --sans: Manrope, system-ui, -apple-system, sans-serif;
  --fs-label: .75rem;
  --fs-report: .875rem;
  --fs-heading: 1.125rem;
  --r: 8px;
  --r-sm: 6px;
  --max: 82rem;
}

body {
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.5;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}
button, input, select { font-family: inherit; }
button { font: inherit; color: inherit; cursor: pointer; }
h1, h2 { line-height: 1.25; letter-spacing: -.02em; }
a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* ---------- header ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .85rem max(1.25rem, calc((100vw - 82rem) / 2));
  border-bottom: 1px solid var(--line); background: var(--surface);
}
.brand { color: var(--brand); font-size: .875rem; font-weight: 800; letter-spacing: .09em; }
.topbar-note { color: var(--muted); font-size: var(--fs-label); }
.shell { max-width: var(--max); margin: auto; padding: 1.6rem 1.25rem 3rem; }
.title { font-size: clamp(1.5rem, 3vw, 2rem); font-weight: 750; margin-bottom: 1rem; overflow-wrap: anywhere; }

.top-controls { display: flex; align-items: flex-end; gap: 1.2rem; flex-wrap: wrap; }
.date-group { display: flex; align-items: flex-end; gap: .65rem; flex-wrap: wrap; max-width: 100%; }
.date-group > .field { width: 11.25rem; max-width: 100%; }

.field {
  display: grid; grid-template-columns: minmax(0, 1fr); gap: .3rem; min-width: 0; max-width: 100%;
  font-size: var(--fs-label); font-weight: 600; color: var(--muted);
}
.field-title { display: block; }
.select-wrap { position: relative; display: block; width: 100%; min-width: 0; max-width: 100%; }
.select-wrap select {
  appearance: none; -webkit-appearance: none; width: 100%; min-width: 0; max-width: 100%; min-height: 44px;
  padding: .5rem 40px .5rem 14px; border: 1px solid var(--line-strong); border-radius: var(--r);
  background: var(--surface); color: var(--ink); font-size: 1rem; font-weight: 600; line-height: 1.5;
}
.select-wrap .chev { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.select-wrap:focus-within .chev { color: var(--accent); }

.status-line { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; min-height: 44px; font-size: var(--fs-label); color: var(--muted); }
.status-line .running { color: var(--ink); font-weight: 600; }
.status-line .partial-note { color: #8a4b00; background: #fdf3e3; border: 1px solid #f0d9b0; border-radius: 6px; padding: 2px 8px; }
.refresh-btn {
  min-height: 44px; padding: .45rem .7rem; border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  background: var(--surface); font-size: var(--fs-report); color: var(--muted);
}
.refresh-btn:hover { background: var(--accent-weak); }
.refresh-btn:disabled { opacity: .5; cursor: default; }
.refresh-note { font-size: var(--fs-label); color: var(--muted); }
.error-line { padding: .5rem 0; color: var(--warn); font-size: var(--fs-report); }
.error-line button { border: 0; background: none; padding: 0 .25rem; color: var(--accent); text-decoration: underline; font-size: inherit; }

/* ---------- program tabs and section switch ---------- */
.tabs { display: flex; flex-wrap: wrap; gap: .25rem; margin-top: 1.4rem; border-bottom: 1px solid var(--line); }
.tab {
  flex: 0 0 auto; min-height: 48px; padding: .7rem 1rem; white-space: nowrap; border: 0;
  border-bottom: 3px solid transparent; background: none; color: var(--muted); font-size: 1rem; font-weight: 700;
}
.tab[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); }
#sectionNav { margin: 1rem 0; }
#sectionNav:empty { display: none; }

.seg {
  display: inline-flex; align-items: center; max-width: 100%; min-height: 44px; padding: 3px;
  border: 1px solid var(--line-strong); border-radius: var(--r); background: var(--surface);
}
.seg button {
  min-height: 36px; white-space: nowrap; border: 0; border-radius: 5px; background: none;
  color: var(--muted); font-size: var(--fs-report); font-weight: 600; line-height: 1.5;
}
.seg button:focus-visible { outline-offset: -2px; }
.seg-period { flex: 0 0 auto; width: max-content; gap: .25rem; }
.seg-period button { flex: 0 0 auto; min-width: max-content; padding: .5rem .8rem; }
.seg-period button[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }
.seg-nav { overflow-x: auto; background: var(--surface-2); border-color: transparent; border-radius: 10px; }
.seg-nav button { flex: 1 0 auto; min-width: max-content; padding: .5rem .85rem; border-radius: 7px; font-weight: 500; }
.seg-nav button[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(36, 36, 36, .10); }

/* ---------- filter row ---------- */
.filters { display: flex; align-items: flex-end; flex-wrap: wrap; gap: .8rem; margin: 1.2rem 0; }
.filters:empty { display: none; }
.spend-field { width: 280px; max-width: 100%; }
.pending {
  display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; min-height: 44px; padding: .5rem .8rem;
  border: 1px solid var(--line); border-radius: var(--r); font-size: var(--fs-label); color: var(--muted);
}
.pending strong { font-size: var(--fs-report); color: var(--ink); }
.cohort-box { min-width: 0; max-width: 100%; padding: .3rem .8rem .5rem; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
.cohort-box legend { padding: 0 .25rem; font-size: var(--fs-label); font-weight: 600; color: var(--muted); }
.cohort-options { display: flex; flex-wrap: wrap; gap: .2rem 1.2rem; }
.cohort-options label { display: flex; align-items: center; gap: .4rem; min-height: 44px; font-size: var(--fs-report); cursor: pointer; }
.cohort-options input { width: 18px; height: 18px; accent-color: var(--accent); margin: 0; }

/* ---------- headings, notes, cards ---------- */
.sec-head { display: flex; align-items: flex-end; justify-content: space-between; gap: .75rem; margin: 1.6rem 0 .75rem; }
.sec-head h2 { font-size: var(--fs-heading); font-weight: 700; }
.sec-head.wrap { flex-wrap: wrap; }
.sec-head.wrap h2 { flex-shrink: 0; }
.rank-field { width: 10.5rem; }
.rank-field select { padding-left: 10px; padding-right: 32px; }
.rank-tools { display: flex; gap: .25rem; margin: .5rem 0 .75rem; }
.text-btn {
  min-height: 44px; padding: .35rem .5rem; border: 0; border-radius: var(--r-sm); background: none;
  font-size: var(--fs-report); font-weight: 500; color: var(--muted);
}
.text-btn:hover { background: var(--surface-2); color: var(--ink); }

.note { color: var(--muted); font-size: var(--fs-report); line-height: 1.5; margin: 0 0 1rem; max-width: 72rem; }
.note strong { color: var(--ink); font-weight: 600; }
.note.tight { margin-top: 0; }
.note.after-table { margin-top: .1rem; }

.stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: .7rem; }
.stat { display: grid; align-content: start; gap: .3rem; min-width: 0; padding: 1rem; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
.stat-label { font-size: var(--fs-label); font-weight: 500; color: var(--muted); }
.stat-value { font-size: 1.5rem; font-weight: 700; line-height: 1.3; letter-spacing: -.02em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }

.web-filters { display: grid; grid-template-columns: minmax(220px, 1fr) 168px; gap: .75rem; max-width: 720px; margin-bottom: 1rem; }

.box {
  padding: 1rem; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface);
  color: var(--muted); font-size: var(--fs-report);
}
.box .text-btn { min-height: 0; padding: 0 .25rem; color: var(--accent); text-decoration: underline; }
.scroll-hint { display: none; margin: .5rem 0; color: var(--muted); font-size: var(--fs-label); }

/* ---------- tables ---------- */
.tbl-wrap { isolation: isolate; overflow: auto; max-width: 100%; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
.tbl {
  width: 100%; min-width: 66.5rem; border-collapse: separate; border-spacing: 0; table-layout: fixed; font-size: var(--fs-report);
}
.tbl th, .tbl td {
  min-width: 6.5rem; padding: .7rem .8rem; border-bottom: 1px solid var(--line); vertical-align: middle;
  text-align: right; white-space: nowrap; line-height: 1.5; font-variant-numeric: tabular-nums;
}
.tbl td { font-weight: 400; }
.tbl thead th { background: var(--surface-2); color: var(--muted); font-size: var(--fs-label); font-weight: 600; }
.tbl tbody th { background: var(--surface); color: var(--ink); font-size: var(--fs-report); font-weight: 500; }
.tbl tbody th:first-child, .tbl thead tr:first-child > th:first-child {
  position: sticky; left: 0; z-index: 1; width: 11.875rem; min-width: 11.875rem; max-width: 11.875rem;
  text-align: left; white-space: normal; overflow-wrap: anywhere; box-shadow: 1px 0 0 var(--line);
}
.tbl thead tr:first-child > th:first-child { z-index: 2; background: var(--surface-2); }
.tbl .sub th { padding-left: 1.4rem; color: var(--muted); }
.tbl tbody tr:last-child th, .tbl tbody tr:last-child td { border-bottom: 0; }

.ov { min-width: 64.375rem; }
.ov thead th { text-align: center; white-space: normal; }
.ov th, .ov td { border-right: 1px solid var(--line); }
.ov tbody td { text-align: center; }
.ov-mobile { display: none; }

.landing { min-width: 0; }
.landing tbody th:first-child, .landing thead tr:first-child > th:first-child { width: auto; max-width: none; min-width: 0; overflow-wrap: anywhere; white-space: normal; }
.landing td:last-child, .landing thead th:last-child { text-align: right; width: 9rem; min-width: 6rem; }

/* ---------- ranking cards and mobile cohort cards ---------- */
.entries { display: grid; gap: .7rem; margin-top: .8rem; }
.entry { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
.disc {
  display: grid; grid-template-columns: 12px minmax(0, 1fr) auto; align-items: start; gap: .6rem; width: 100%;
  min-height: 52px; padding: .9rem; border: 0; background: var(--surface); text-align: left;
}
.disc:hover { background: var(--surface-2); }
.disc:focus-visible { outline-offset: -3px; }
.disc-arrow { padding-top: .12rem; color: var(--accent); font-size: var(--fs-report); line-height: 1.5; }
.disc-label { min-width: 0; white-space: normal; overflow-wrap: anywhere; font-size: var(--fs-report); line-height: 1.5; font-weight: 600; }
.disc-source { display: block; margin-bottom: .15rem; font-size: var(--fs-label); font-weight: 500; color: var(--muted); }
.disc-value { text-align: right; white-space: nowrap; font-size: var(--fs-report); line-height: 1.5; font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; }
.disc-date { display: block; font-size: var(--fs-label); font-weight: 400; color: var(--muted); }
.entry .tbl-wrap { border: 0; border-top: 1px solid var(--line); border-radius: 0; }
.cohort-list { margin: 0; padding: .25rem .9rem; border-top: 1px solid var(--line); }
.cohort-list > div { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .55rem 0; border-bottom: 1px solid var(--line); font-size: var(--fs-report); }
.cohort-list > div:last-child { border-bottom: 0; }
.cohort-list dt { font-weight: 500; }
.cohort-list dd { margin: 0; font-variant-numeric: tabular-nums; font-weight: 600; }

/* ---------- info button and popover ---------- */
.i-anchor { display: inline-block; position: relative; vertical-align: baseline; line-height: 0; width: 15px; height: 0; margin-left: 4px; }
.i-btn {
  position: absolute; left: 0; bottom: .35em; display: inline-flex; align-items: center; justify-content: center;
  width: 13px; height: 13px; padding: 0; border: 1px solid currentColor; border-radius: 50%; background: none;
  color: var(--muted); font-family: Georgia, serif; font-size: 10px; font-weight: 400; font-style: italic; line-height: 1;
}
.i-btn::after { content: ""; position: absolute; inset: -10px; }
.i-btn:hover, .i-btn:focus-visible { color: var(--accent); background: var(--accent-weak); }
.popover {
  position: fixed; z-index: 50; margin: 0; width: 340px; max-height: min(360px, 80vh); overflow: auto; padding: 1rem;
  border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface); color: var(--ink);
  box-shadow: 0 10px 28px rgba(20, 43, 29, .15); font-size: var(--fs-report); line-height: 1.55;
}
.popover-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: .4rem; }
.popover-head button {
  flex: 0 0 auto; width: 44px; height: 44px; margin: -.5rem -.5rem -.5rem 0; border: 0; border-radius: var(--r-sm);
  background: none; color: var(--muted); font-size: 1.25rem;
}

/* ---------- charts ---------- */
.charts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; margin: .75rem 0; }
.chart-card { min-width: 0; padding: .8rem; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
.chart-card h3 { font-size: 1rem; line-height: 1.5; }
.legend { display: flex; gap: .5rem 1rem; flex-wrap: wrap; font-size: var(--fs-label); margin: .4rem 0; }
.legend-key { display: inline-flex; align-items: center; gap: .35rem; }
.legend-key::before { content: ""; width: 1.1rem; border-top: 3px solid var(--c); }
.plot { position: relative; min-width: 0; min-height: 220px; outline: none; }
.plot:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.plot svg { display: block; width: 100%; height: auto; overflow: visible; }
.plot svg text { font: 12px var(--sans); fill: var(--muted); font-variant-numeric: tabular-nums; }
.grid-line { stroke: var(--line); stroke-width: 1; }
.guide { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; pointer-events: none; }
.tip {
  position: absolute; top: 6px; z-index: 4; width: max-content; max-width: min(260px, 100%); padding: .65rem .8rem;
  border: 1px solid var(--line-strong); border-radius: var(--r); background: var(--surface);
  box-shadow: 0 4px 16px rgba(20, 43, 29, .10); font-size: var(--fs-report); pointer-events: none; line-height: 1.5;
}
.tip > strong { display: block; margin-bottom: .3rem; font-size: var(--fs-label); }
.tip dl { margin: 0; }
.tip dl > div { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.tip dt { display: flex; align-items: center; gap: .4rem; color: var(--muted); }
.tip dd { margin: 0; font-weight: 700; font-variant-numeric: tabular-nums; }
.swatch { width: .5rem; height: .5rem; border-radius: 50%; background: var(--c); flex: none; }
.daily-values { margin-top: .5rem; font-size: var(--fs-label); color: var(--muted); }
.daily-values summary { cursor: pointer; min-height: 32px; }
.daily-values table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
.daily-values th, .daily-values td { padding: .35rem .25rem; text-align: right; border-bottom: 1px solid var(--line); }
.daily-values th:first-child { text-align: left; }
.daily-values th { font-weight: 600; }
.daily-values td { color: var(--ink); }

/* ---------- footer and data health ---------- */
.footer { margin-top: 2rem; padding-top: 1.25rem; border-top: 1px solid var(--line); color: var(--muted); font-size: var(--fs-label); }
.health { display: flex; flex-wrap: wrap; gap: .15rem 1rem; }
.health b { font-weight: 600; color: var(--ink); }
.health-issues { margin-top: .35rem; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) { .scroll-hint { display: block; } }
@media (max-width: 900px) { .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 760px) { .charts { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 640px) {
  .topbar-note { display: none; }
  .shell { padding: 1.2rem 1rem 3rem; }
  .top-controls { gap: .75rem; }
  .date-group { gap: .5rem; }
  .tab { padding: .7rem .8rem; }
  #sectionNav .seg { display: flex; width: 100%; }
  #sectionNav .seg button { padding: .5rem .65rem; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat { padding: .85rem; }
  .web-filters { grid-template-columns: minmax(0, 1fr); }
  .ov-mobile { display: grid; gap: .65rem; }
  .ov-desktop { display: none; }
  .tbl tbody th:first-child, .tbl thead tr:first-child > th:first-child { width: 128px; min-width: 128px; max-width: 128px; }
  .tbl-wrap { scroll-snap-type: x mandatory; scroll-padding-inline-start: 128px; }
  .tbl thead tr:first-child > th:not(:first-child) { scroll-snap-align: start; }
  .landing tbody th:first-child, .landing thead tr:first-child > th:first-child { width: auto; min-width: 0; max-width: none; }
  .disc { padding: .8rem; }
  .popover { width: calc(100vw - 32px); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

/* ================= UG report (Overall, Channels, Locations, Campaigns, Assets) =================
   Keeps the UG app's own look: system font, bordered buttons, money with paise. */
.ugx {
  margin: 0 0 1rem; border-radius: 12px; overflow: hidden; background: #f6f8f5;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif; font-size: 16px; line-height: 1.52; color: #192820;
  --ug-ink: #192820; --ug-muted: #52665a; --ug-accent: #1d6542; --ug-soft: #e2f0e6; --ug-line: #dbe5dc;
}
.ugx button, .ugx select, .ugx input { font: inherit; color: inherit; }
.ugx-head {
  display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--ug-line); background: #fff; font-size: .875rem;
}
.ugx-head .ugx-brand { font-weight: 800; letter-spacing: .06em; color: #173c2a; }
.ugx-body { padding: 2rem 1.25rem 2.5rem; }
.ugx h1 { font-size: clamp(1.7rem, 2.7vw, 2.15rem); line-height: 1.2; letter-spacing: -.025em; margin-bottom: .55rem; }
.ugx .muted { color: var(--ug-muted); }
.ugx-nav { display: flex; flex-wrap: wrap; gap: .35rem; max-width: 100%; margin: 0 0 1.1rem; border-bottom: 1px solid var(--ug-line); }
.ugx-btn {
  min-height: 44px; padding: .45rem .85rem; border: 1px solid #a9b9ac; border-radius: 8px; background: #fff;
  cursor: pointer; font-weight: 600; white-space: nowrap;
}
.ugx-btn:hover { background: #e2f0e6; }
.ugx-btn:active:not(:disabled) { background: var(--ug-soft); }
.ugx-btn:disabled { opacity: .55; cursor: default; }
.ugx-nav .ugx-btn {
  display: inline-flex; align-items: center; flex: 1 1 auto; padding: .45rem .75rem; border-bottom: 2px solid transparent;
  color: var(--ug-muted); font-size: .875rem; font-weight: 650;
}
.ugx-nav .ugx-btn:hover { color: var(--ug-accent); }
.ugx-nav .ugx-btn[aria-selected="true"] { background: var(--ug-soft); color: var(--ug-accent); border-bottom-color: var(--ug-accent); }
.ugx :focus-visible { outline: 3px solid var(--ug-accent); outline-offset: 3px; border-radius: 4px; }
.ugx-controls { display: flex; align-items: flex-end; flex-wrap: wrap; gap: .65rem; }
.ugx-field { display: grid; gap: .3rem; align-self: end; color: var(--ug-muted); font-size: .77rem; font-weight: 700; }
.ugx-field select {
  width: 12rem; max-width: 100%; height: 44px; min-height: 44px; padding: .5rem .75rem; border: 1px solid #a9b9ac;
  border-radius: 8px; background: #fff; font-size: .875rem; font-weight: 500; color: #192820;
}
.ugx-field select.month { width: 11rem; }
.ugx-field select.day { width: 6rem; }
.ugx-field input {
  min-height: 44px; max-width: 100%; border: 1px solid var(--ug-line); border-radius: 8px; padding: .45rem .6rem; background: #fff;
}
.ugx-status { min-height: 44px; max-width: 28rem; display: flex; align-items: center; font-size: .85rem; color: var(--ug-muted); }
.ugx-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; margin-top: 1.25rem; }
.ugx-card { padding: .9rem 1rem; border: 1px solid var(--ug-line); border-left: 3px solid var(--ug-accent); border-radius: 9px; background: #fff; }
.ugx-card h2 { font-size: .88rem; margin-bottom: .2rem; letter-spacing: 0; line-height: 1.5; }
.ugx-card p { font-size: .82rem; color: var(--ug-muted); line-height: 1.55; }
.ugx-section { margin-top: 2rem; }
.ugx-section h2 { font-size: 1.12rem; letter-spacing: -.012em; margin-bottom: .2rem; line-height: 1.25; }
.ugx-section h3 { font-size: 1rem; letter-spacing: -.01em; margin: .4rem 0 .5rem; }
.ugx-intro, .ugx-note { color: var(--ug-muted); font-size: .82rem; line-height: 1.5; }
.ugx-note { margin-top: .8rem; }
.ugx-note.flush { margin-top: 0; }
.ugx-boxnote { margin-top: .8rem; padding: .65rem .8rem; border-left: 3px solid var(--ug-line); background: #fff; color: var(--ug-muted); font-size: .82rem; line-height: 1.5; }
.ugx-notice { margin-top: 1rem; padding: .85rem 1rem; border: 1px solid var(--ug-line); border-left: 3px solid var(--ug-accent); border-radius: 9px; background: #fff; font-size: .82rem; line-height: 1.55; }
.ugx-notice p + p { margin-top: .5rem; }
.ugx-table-wrap {
  overflow: auto; max-width: 100%; margin-top: .75rem; border: 1px solid var(--ug-line); border-radius: 9px; background: #fff;
  overscroll-behavior-x: contain; scrollbar-width: thin; scrollbar-color: #a9b9ac #f0f5f0;
}
.ugx table { width: 100%; min-width: 760px; border-collapse: collapse; font-size: .875rem; table-layout: auto; }
.ugx th, .ugx td { padding: .72rem .8rem; border-bottom: 1px solid var(--ug-line); font-variant-numeric: tabular-nums; }
.ugx thead th {
  position: sticky; top: 0; background: #f0f5f0; color: var(--ug-muted); font-size: .75rem; font-weight: 700;
  letter-spacing: .01em; text-align: right; white-space: nowrap;
}
.ugx thead th:first-child, .ugx tbody th { text-align: left; position: sticky; left: 0; z-index: 1; background: #fff; box-shadow: 2px 0 0 var(--ug-line); }
.ugx thead th:first-child { background: #f0f5f0; z-index: 3; }
.ugx tbody th { font-weight: 650; }
.ugx td { text-align: right; white-space: nowrap; }
.ugx tbody tr:last-child th, .ugx tbody tr:last-child td { border-bottom: 0; }
.ugx tbody tr:nth-child(even) td, .ugx tbody tr:nth-child(even) th { background: #f6f8f5; }
.ugx thead th:nth-child(2), .ugx tbody td:nth-child(2), .ugx tbody tr:nth-child(even) td:nth-child(2) { background: #e2f0e6; }
.ugx thead th:last-child, .ugx tbody td:last-child { font-weight: 700; }
.ugx .metric-name { white-space: nowrap; }
.ugx .sub-row th { padding-left: 2rem; }
.ugx .names th { min-width: 12rem; max-width: 21rem; white-space: normal; overflow-wrap: anywhere; }
.ugx .names tr:last-child th { font-weight: 750; }
.ugx .names details { margin-top: .3rem; font-size: .75rem; font-weight: 400; color: var(--ug-muted); }
.ugx .names summary { cursor: pointer; min-height: 28px; }
.ugx .names code { display: block; overflow-wrap: anywhere; white-space: normal; }
.ugx .pill { display: inline-flex; align-items: center; margin-left: .4rem; padding: .1rem .45rem; border-radius: 999px; background: #fff2d7; color: #765000; font-size: .7rem; font-weight: 700; white-space: nowrap; }
.ugx-hint { display: block; margin-top: .55rem; color: var(--ug-muted); font-size: .78rem; }
.ugx-top { margin: 1rem 0 1.4rem; border-top: 1px solid var(--ug-line); padding-top: .8rem; }
.ugx-top h4, .ugx-all h4 { margin: .2rem 0 .6rem; font-size: 1rem; }
.ugx-all h4 { margin-bottom: 0; }
.ugx-list details { border: 1px solid var(--ug-line); border-radius: 8px; margin: .45rem 0; padding: .15rem .75rem; }
.ugx-list summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; gap: .5rem; font-weight: 650; overflow-wrap: anywhere; list-style: none; }
.ugx-list summary::-webkit-details-marker { display: none; }
.ugx-list summary::before { content: "\25B8"; flex: none; }
.ugx-list details[open] summary::before { content: "\25BE"; }
.ugx-list dl { display: grid; grid-template-columns: repeat(auto-fit, minmax(125px, 1fr)); gap: .65rem; margin: .35rem 0 .8rem; }
.ugx-list dt { color: var(--ug-muted); font-size: .75rem; }
.ugx-list dd { margin: 0; font-weight: 650; }
.ugx-rank-value { margin-left: auto; white-space: nowrap; }
.ugx-search { display: grid; gap: .3rem; margin: .9rem 0 .4rem; max-width: 30rem; color: var(--ug-muted); font-size: .875rem; font-weight: 700; }
.ugx-search input { width: 100%; min-height: 44px; border: 1px solid var(--ug-line); border-radius: 8px; padding: .6rem .75rem; background: #fff; font-weight: 400; color: #192820; }
.ugx-empty { margin-top: .75rem; padding: .85rem 1rem; border: 1px solid var(--ug-line); border-radius: 9px; background: #fff; color: var(--ug-muted); font-size: .875rem; }
@media (hover: hover) and (pointer: fine) {
  .ugx tbody tr:hover td:not(:nth-child(2)), .ugx tbody tr:hover th { background: #f0f5f0; }
  .ugx-btn:hover:not(:disabled) { border-color: var(--ug-accent); }
}
@media (max-width: 600px) {
  .ugx-head .muted { display: none; }
  .ugx-body { padding: 1.25rem 1rem 2.5rem; }
  .ugx-cards { grid-template-columns: 1fr; gap: .55rem; }
  .ugx-card { padding: .75rem .85rem; }
  .ugx-section { margin-top: 1.65rem; }
  .ugx th, .ugx td { padding: .65rem .65rem; }
  .ugx .names th { min-width: 10rem; max-width: 13rem; }
  .ugx-nav { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 .25rem; margin-bottom: .8rem; }
  .ugx-nav .ugx-btn { min-width: 0; padding: .45rem .35rem; }
  .ugx-controls { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .55rem; }
  .ugx-controls .ugx-field select, .ugx-field select.month, .ugx-field select.day { width: 100%; min-width: 0; }
  .ugx-controls .ugx-status { grid-column: 1 / -1; min-height: 0; padding: .25rem 0; }
}
