/* Compass dashboard. Theme tokens (docs/widgets.md) override the defaults below. */

:root {
  color-scheme: light;
  /* themeable: light */
  --accent: #1c5cab;
  --accent-strong: #184f95;
  --on-accent: #ffffff;
  --accent-soft: #e8f0fb;
  --surface: #fcfcfb;
  --page: #f4f4f1;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #6b6a65;
  --grid: #e7e6e0;
  --axis: #c3c2b7;
  --border: rgba(11, 11, 11, 0.1);
  --good: #006300;
  --bad: #b3261e;
  /* themeable: common */
  --radius: 10px;
  --radius-sm: 6px;
  --space: 1rem;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-heading: var(--font-body);
  --font-numbers: var(--font-body);

  /* fixed: series colors (validated categorical order) and status */
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --series-3: #1baf7a;
  --series-4: #eda100;
  --series-5: #e87ba4;
  --series-6: #008300;
  --series-7: #4a3aa7;
  --series-8: #e34948;
  --other: #b9b8b1;
  --status-good: #0ca30c;
  --status-warn: #c98500;
  --status-bad: #d03b3b;
  --status-info: #2a78d6;
  --shadow: 0 1px 2px rgba(11, 11, 11, 0.04), 0 4px 16px rgba(11, 11, 11, 0.04);
  --skeleton: rgba(11, 11, 11, 0.06);
}

:root[data-scheme="auto"] {
  color-scheme: light dark;
}

:root[data-scheme="dark"] {
  color-scheme: dark;
  --accent: #6da7ec;
  --accent-strong: #86b6ef;
  --on-accent: #0b0b0b;
  --accent-soft: rgba(109, 167, 236, 0.16);
  --surface: #1a1a19;
  --page: #0f0f0e;
  --ink: #ffffff;
  --ink-2: #c3c2b7;
  --muted: #9a9890;
  --grid: #2c2c2a;
  --axis: #47473f;
  --border: rgba(255, 255, 255, 0.1);
  --good: #3cbf3c;
  --bad: #f07a7a;
  --series-1: #3987e5;
  --series-2: #d95926;
  --series-3: #199e70;
  --series-4: #c98500;
  --series-5: #d55181;
  --series-6: #008300;
  --series-7: #9085e9;
  --series-8: #e66767;
  --other: #5a5953;
  --status-warn: #fab219;
  --status-info: #3987e5;
  --shadow: none;
  --skeleton: rgba(255, 255, 255, 0.07);
}

@media (prefers-color-scheme: dark) {
  :root[data-scheme="auto"] {
    --accent: #6da7ec;
    --accent-strong: #86b6ef;
    --on-accent: #0b0b0b;
    --accent-soft: rgba(109, 167, 236, 0.16);
    --surface: #1a1a19;
    --page: #0f0f0e;
    --ink: #ffffff;
    --ink-2: #c3c2b7;
    --muted: #9a9890;
    --grid: #2c2c2a;
    --axis: #47473f;
    --border: rgba(255, 255, 255, 0.1);
    --good: #3cbf3c;
    --bad: #f07a7a;
    --series-1: #3987e5;
    --series-2: #d95926;
    --series-3: #199e70;
    --series-4: #c98500;
    --series-5: #d55181;
    --series-6: #008300;
    --series-7: #9085e9;
    --series-8: #e66767;
    --other: #5a5953;
    --status-warn: #fab219;
    --status-info: #3987e5;
    --shadow: none;
    --skeleton: rgba(255, 255, 255, 0.07);
  }
}

/* ------------------------------------------------------------------ base */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: var(--page);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4 {
  font-family: var(--font-heading);
  margin: 0;
  line-height: 1.25;
}

p {
  margin: 0;
}

button,
input,
select {
  font: inherit;
  color: inherit;
}

a {
  color: var(--accent);
  text-underline-offset: 2px;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 3px;
}

[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.muted {
  color: var(--muted);
}

.icon {
  flex: none;
  width: 1em;
  height: 1em;
  vertical-align: -0.125em;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 0.5rem;
  left: 0.5rem;
  padding: 0.6rem 1rem;
  background: var(--accent);
  color: var(--on-accent);
  border-radius: var(--radius-sm);
  font-weight: 600;
  text-decoration: none;
  transform: translateY(-160%);
}

.skip-link:focus {
  transform: none;
}

/* ------------------------------------------------------------------ app bar */

.appbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem clamp(1rem, 3vw, 2rem);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.brand-mark {
  flex: none;
  color: var(--accent);
}

.brand-logo {
  flex: none;
  max-height: 36px;
  max-width: 140px;
  object-fit: contain;
}

.brand-text {
  min-width: 0;
}

.brand-line {
  display: flex;
  gap: 0.4rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-sep {
  opacity: 0.6;
}

.dash-title {
  font-size: 1.2rem;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.appbar-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  white-space: nowrap;
}

.badge-fixture {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.badge-draft {
  background: var(--status-warn);
  color: #0b0b0b;
}

.badge-live {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

/* ------------------------------------------------------------------ draft banner */

.draft-banner {
  padding: 0.6rem clamp(1rem, 3vw, 2rem);
  background: color-mix(in srgb, var(--status-warn) 14%, var(--surface));
  border-bottom: 1px solid color-mix(in srgb, var(--status-warn) 40%, transparent);
}

.banner-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.9rem;
  max-width: 1440px;
  margin: 0 auto;
  font-size: 0.88rem;
}

.banner-inner p {
  flex: 1 1 18rem;
}

/* ------------------------------------------------------------------ controls */

.toolbar {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 clamp(1rem, 3vw, 2rem);
}

.tabs-wrap {
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: thin;
}

.tabs {
  display: flex;
  gap: 0.25rem;
}

.tabs [role="tab"] {
  position: relative;
  padding: 0.85rem 0.9rem 0.75rem;
  border: 0;
  background: none;
  color: var(--ink-2);
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

.tabs [role="tab"]:hover {
  color: var(--ink);
  background: color-mix(in srgb, var(--ink) 4%, transparent);
}

.tabs [role="tab"][aria-selected="true"] {
  color: var(--ink);
}

.tabs [role="tab"][aria-selected="true"]::after {
  content: "";
  position: absolute;
  left: 0.6rem;
  right: 0.6rem;
  bottom: -1px;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: var(--accent);
}

.tabs [role="tab"]:focus-visible {
  outline-offset: -2px;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem 1rem;
  padding: 1rem 0 0.25rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.field-inline {
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
}

.field-label {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
}

select,
input[type="date"] {
  min-height: 2.25rem;
  padding: 0.35rem 0.6rem;
  background: var(--surface);
  border: 1px solid color-mix(in srgb, var(--ink) 18%, transparent);
  border-radius: var(--radius-sm);
}

select {
  padding-right: 1.8rem;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-2) 50%), linear-gradient(135deg, var(--ink-2) 50%, transparent 50%);
  background-position: calc(100% - 13px) 55%, calc(100% - 9px) 55%;
  background-size: 4px 4px;
  background-repeat: no-repeat;
  cursor: pointer;
}

select:hover,
input[type="date"]:hover {
  border-color: color-mix(in srgb, var(--ink) 32%, transparent);
}

.custom-range {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  border: 0;
}

.custom-range[hidden] {
  display: none;
}

.range-caption {
  flex: 1 1 14rem;
  align-self: center;
  margin-top: 1.1rem;
  color: var(--muted);
  font-size: 0.85rem;
  text-align: right;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-height: 2.25rem;
  padding: 0.35rem 0.9rem;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
  cursor: pointer;
}

.btn:hover {
  background: var(--accent-strong);
}

.btn-quiet {
  background: var(--surface);
  color: var(--ink);
  border-color: color-mix(in srgb, var(--ink) 18%, transparent);
}

.btn-quiet:hover {
  background: color-mix(in srgb, var(--ink) 5%, var(--surface));
}

/* ------------------------------------------------------------------ page grid */

.main {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0.5rem clamp(1rem, 3vw, 2rem) 3rem;
}

.main:focus {
  outline: none;
}

.boot-msg {
  padding: 3rem 0;
  color: var(--muted);
}

.section {
  margin-top: calc(var(--space) * 1.75);
}

.section-title {
  font-size: 1.02rem;
  font-weight: 650;
}

.section-intro {
  max-width: 70ch;
  margin-top: 0.2rem;
  color: var(--ink-2);
  font-size: 0.9rem;
}

.grid {
  display: grid;
  grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
  gap: var(--space);
  margin-top: 0.75rem;
}

.widget {
  grid-column: span var(--span);
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding: calc(var(--space) * 1.1);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: opacity 0.2s ease;
}

.widget.is-bare {
  padding: 0.5rem 0 0;
  background: none;
  border: 0;
  box-shadow: none;
}

.widget.is-refreshing .w-body {
  opacity: 0.45;
}

.widget.is-callout {
  background: color-mix(in srgb, var(--accent) 7%, var(--surface));
  border-color: color-mix(in srgb, var(--accent) 28%, transparent);
  border-left: 4px solid var(--accent);
}

.w-heading {
  font-size: 1.1rem;
  font-weight: 650;
}

.w-heading.lvl-3 {
  font-size: 0.95rem;
  color: var(--ink-2);
}

.w-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.w-title {
  font-size: 0.92rem;
  font-weight: 650;
}

.w-body {
  flex: 1;
  min-width: 0;
  position: relative;
}

.w-foot {
  margin-top: 0.85rem;
  color: var(--muted);
  font-size: 0.8rem;
}

.w-foot[hidden] {
  display: none;
}

.w-note {
  color: var(--ink-2);
}

.caveats {
  margin: 0.35rem 0 0;
  padding: 0;
  list-style: none;
}

.caveats li {
  display: flex;
  gap: 0.35rem;
  align-items: flex-start;
  margin-top: 0.2rem;
}

.caveats .icon {
  margin-top: 0.2em;
  color: var(--muted);
}

/* Medium screens: 3-4 column sections fold to 2. */
@media (max-width: 1080px) {
  .grid.cols-3,
  .grid.cols-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .grid.cols-3 .widget[data-span="3"],
  .grid.cols-4 .widget[data-span="3"],
  .grid.cols-4 .widget[data-span="4"] {
    grid-column: span 2;
  }

  .grid.cols-3 .widget[data-span="2"] {
    grid-column: span 2;
  }
}

/* Narrow screens: everything stacks. */
@media (max-width: 720px) {
  body {
    font-size: 14px;
  }

  .grid,
  .grid.cols-3,
  .grid.cols-4 {
    grid-template-columns: minmax(0, 1fr);
  }

  .widget,
  .grid .widget[data-span] {
    grid-column: 1 / -1;
  }

  .appbar {
    flex-wrap: wrap;
    padding-block: 0.7rem;
  }

  .appbar-right:empty,
  .appbar-right:not(:has(> :not([hidden]))) {
    display: none;
  }

  .dash-title {
    font-size: 1.05rem;
  }

  .range-caption {
    flex-basis: 100%;
    margin-top: 0;
    text-align: left;
  }

  .filters .field:not(.custom-range .field) {
    flex: 1 1 9rem;
  }

  .filters select {
    width: 100%;
  }
}

body[data-density="compact"] {
  --space: 0.7rem;
  font-size: 14px;
}

body[data-corners="square"] {
  --radius: 0px;
  --radius-sm: 0px;
}

/* ------------------------------------------------------------------ states */

.state {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
  padding: 1.25rem 0.25rem;
}

.state-title {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 600;
}

.state-hint {
  color: var(--muted);
  font-size: 0.85rem;
}

.state-art {
  color: var(--axis);
  margin-bottom: 0.25rem;
}

.state-error .btn {
  margin-top: 0.5rem;
}

/* ------------------------------------------------------------------ custom widget */

.custom-frame {
  display: block;
  width: 100%;
  border: 0;
  background: transparent;
}

.custom-error {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0.5rem 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.custom-error[hidden] {
  display: none;
}

.page-state {
  margin-top: 2rem;
  padding: 2rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.tone-good {
  color: var(--status-good);
}

.tone-bad {
  color: var(--status-bad);
}

.tone-warn {
  color: var(--status-warn);
}

.tone-info {
  color: var(--status-info);
}

.tone-off {
  color: var(--muted);
}

/* skeleton */
.skeleton {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.sk {
  display: block;
  height: 0.8rem;
  border-radius: 4px;
  background: var(--skeleton);
  animation: pulse 1.4s ease-in-out infinite;
}

.sk-big {
  height: 1.9rem;
  width: 55%;
}

.sk-spark {
  height: 1.6rem;
}

.sk-chart {
  height: 248px;
}

.w40 { width: 40%; }
.w50 { width: 50%; }
.w60 { width: 60%; }
.w70 { width: 70%; }
.w80 { width: 80%; }

.skeleton .kpi-row .kpi {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

@keyframes pulse {
  50% {
    opacity: 0.45;
  }
}

/* ------------------------------------------------------------------ KPI */

.kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0;
  margin: calc(var(--space) * -0.25) calc(var(--space) * -1.1);
}

.kpi-row .kpi {
  padding: 0.35rem calc(var(--space) * 1.1) 0.5rem;
  border-left: 1px solid var(--border);
  margin-left: -1px;
}

.kpi {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.kpi-label {
  color: var(--ink-2);
  font-size: 0.82rem;
  font-weight: 600;
}

.kpi-value {
  margin-top: 0.15rem;
  font-family: var(--font-numbers);
  font-size: 1.75rem;
  font-weight: 650;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.kpi-large .kpi-value {
  font-size: 2.6rem;
}

.kpi-delta {
  margin-top: 0.3rem;
  font-size: 0.82rem;
}

.kpi-prev {
  color: var(--muted);
  font-size: 0.78rem;
}

.spark {
  display: block;
  width: 100%;
  height: 30px;
  margin-top: auto;
  padding-top: 0.5rem;
  overflow: visible;
}

.spark-line {
  stroke: var(--muted);
  stroke-width: 1.5;
  stroke-linejoin: round;
  stroke-linecap: round;
  opacity: 0.8;
}

.spark-dot {
  fill: none;
  stroke: var(--accent);
  stroke-width: 5;
  stroke-linecap: round;
}

.kpi-single .kpi {
  gap: 0;
}

.kpi-single .spark {
  height: 44px;
  margin-top: 0.75rem;
}

.delta {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-weight: 600;
  white-space: nowrap;
}

.delta-good {
  color: var(--good);
}

.delta-bad {
  color: var(--bad);
}

.delta-neutral {
  color: var(--ink-2);
}

.delta-vs {
  color: var(--muted);
  font-weight: 400;
}

.delta-sm {
  font-size: 0.78rem;
}

.delta-sm .icon {
  width: 0.9em;
  height: 0.9em;
}

/* target meter */
.target {
  margin-top: 0.85rem;
}

.meter {
  height: 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  overflow: hidden;
}

.meter-fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
}

.target-text {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  margin-top: 0.35rem;
  color: var(--ink-2);
  font-size: 0.82rem;
}

/* ------------------------------------------------------------------ charts */

.chart-box,
.breakdown-box {
  position: relative;
  min-width: 0;
}

.chart-box {
  min-height: 248px;
}

svg.chart {
  display: block;
  max-width: 100%;
  height: auto;
  overflow: visible;
}

svg.chart:focus-visible {
  outline-offset: 4px;
}

.gridline {
  stroke: var(--grid);
  stroke-width: 1;
  shape-rendering: crispEdges;
}

.baseline {
  stroke: var(--axis);
  stroke-width: 1;
  shape-rendering: crispEdges;
}

body[data-chart-style="minimal"] .gridline {
  stroke: transparent;
}

.tick {
  fill: var(--muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.line {
  fill: none;
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.line-prev {
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.5;
  stroke-dasharray: 4 4;
  stroke-linecap: round;
  opacity: 0.85;
}

.prev-tick {
  stroke: var(--ink);
  stroke-width: 2;
  stroke-dasharray: 3 3;
}

.area {
  fill-opacity: 0.1;
  stroke: none;
}

.bar {
  stroke: none;
}

.hit {
  fill: transparent;
  cursor: crosshair;
}

.crosshair {
  stroke: var(--ink-2);
  stroke-width: 1;
  opacity: 0.6;
}

.hover-band {
  fill: var(--ink);
  opacity: 0.05;
}

.dot,
.end-dot {
  stroke: var(--surface);
  stroke-width: 2;
}

.dot-prev {
  fill: var(--surface);
  stroke: var(--muted);
  stroke-width: 1.5;
}

.end-label {
  fill: var(--ink-2);
  font-size: 11.5px;
  font-weight: 600;
}

.ann-guide {
  stroke: var(--axis);
  stroke-width: 1;
  opacity: 0.8;
}

.ann-span {
  stroke: var(--ink-2);
  stroke-width: 2;
  opacity: 0.5;
}

.ann-mark {
  cursor: help;
}

.ann-mark circle {
  fill: var(--surface);
  stroke: var(--ink-2);
  stroke-width: 1.25;
}

.ann-mark text {
  fill: var(--ink);
  font-size: 9.5px;
  font-weight: 700;
}

.ann-mark:hover circle {
  fill: var(--ink);
}

.ann-mark:hover text {
  fill: var(--surface);
}

.ann-key {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
  margin: 0.6rem 0 0;
  padding: 0;
  list-style: none;
  color: var(--ink-2);
  font-size: 0.8rem;
}

.ann-key li {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.ann-key-date {
  color: var(--muted);
}

.ann-num {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 16px;
  height: 16px;
  border: 1.25px solid var(--ink-2);
  border-radius: 50%;
  font-size: 9.5px;
  font-weight: 700;
  line-height: 1;
}

/* legend */
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
  margin: -0.25rem 0 0.5rem;
  padding: 0;
  list-style: none;
  color: var(--ink-2);
  font-size: 0.8rem;
}

.legend li {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.key-line {
  display: inline-block;
  flex: none;
  width: 14px;
  height: 0;
  border-top: 2px solid var(--key);
  border-radius: 2px;
}

.key-dashed {
  height: 2px;
  border-top: 0;
  border-radius: 0;
  background: repeating-linear-gradient(90deg, var(--key) 0 4px, transparent 4px 7px);
}

.key-swatch {
  display: inline-block;
  flex: none;
  width: 10px;
  height: 10px;
  border-radius: 3px;
  background: var(--key);
}

.key-blank {
  display: inline-block;
  width: 14px;
}

/* tooltip */
.chart-tip {
  position: absolute;
  z-index: 5;
  min-width: 150px;
  max-width: 260px;
  padding: 0.55rem 0.7rem;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid color-mix(in srgb, var(--ink) 14%, transparent);
  border-radius: var(--radius-sm);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.14);
  font-size: 0.8rem;
  pointer-events: none;
}

.chart-tip[hidden] {
  display: none;
}

.tip-head {
  margin-bottom: 0.3rem;
  color: var(--ink-2);
  font-weight: 600;
}

.tip-row {
  display: grid;
  grid-template-columns: 14px auto 1fr;
  align-items: center;
  gap: 0.45rem;
  margin-top: 0.15rem;
}

.tip-value {
  font-variant-numeric: tabular-nums;
}

.tip-label {
  color: var(--ink-2);
  overflow: hidden;
  text-overflow: ellipsis;
}

.tip-note,
.tip-delta {
  margin-top: 0.3rem;
  color: var(--ink-2);
}

.tip-ann {
  display: flex;
  gap: 0.4rem;
  margin-top: 0.45rem;
  padding-top: 0.4rem;
  border-top: 1px solid var(--border);
}

.tip-ann > span:last-child {
  display: flex;
  flex-direction: column;
}

.tip-ann-body {
  color: var(--ink-2);
}

/* horizontal bars */
.hbars {
  margin: 0;
  padding: 0;
  list-style: none;
}

.hbar {
  display: grid;
  grid-template-columns: minmax(5.5rem, 34%) 1fr auto 4.6rem;
  align-items: center;
  gap: 0.6rem;
  padding: 0.3rem 0.25rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
}

.hbar:hover,
.hbar:focus-visible {
  background: color-mix(in srgb, var(--ink) 4%, transparent);
}

.hbar-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink-2);
}

.hbar-track {
  height: 14px;
}

.hbar-fill {
  display: block;
  height: 100%;
  min-width: 2px;
  border-radius: 0 4px 4px 0;
  background: var(--key);
}

.hbar-value {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  text-align: right;
}

.hbar .delta,
.delta-blank {
  justify-self: end;
}

.hbar.is-other .hbar-label {
  font-style: italic;
}

/* donut */
.donut-wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem 1.5rem;
}

.donut {
  flex: none;
  width: min(180px, 100%);
  height: auto;
}

.seg {
  stroke: var(--surface);
  stroke-width: 2;
  stroke-linejoin: round;
  transition: opacity 0.15s ease;
}

.seg.is-dim {
  opacity: 0.35;
}

.donut-total {
  fill: var(--ink);
  font-size: 22px;
  font-weight: 650;
}

.donut-caption {
  fill: var(--muted);
  font-size: 11px;
}

.donut-legend {
  flex: 1 1 10rem;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.85rem;
}

.donut-legend li {
  display: grid;
  grid-template-columns: 10px 1fr auto 2.6rem;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 0.25rem;
  border-radius: var(--radius-sm);
}

.donut-legend li:hover,
.donut-legend li:focus-visible {
  background: color-mix(in srgb, var(--ink) 4%, transparent);
}

.dl-label {
  color: var(--ink-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dl-value,
.dl-share {
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.dl-value {
  font-weight: 600;
}

.dl-share {
  color: var(--muted);
}

/* ------------------------------------------------------------------ tables */

.table-scroll {
  position: relative;
  overflow-x: auto;
  min-width: 0;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
}

.data-table th,
.data-table td {
  padding: 0.45rem 0.45rem;
  border-bottom: 1px solid var(--grid);
  text-align: left;
  vertical-align: middle;
}

.data-table thead th {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.25;
  border-bottom-color: var(--axis);
}

.data-table tbody th {
  font-weight: 500;
}

.data-table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.data-table tfoot th,
.data-table tfoot td {
  font-weight: 650;
  border-bottom: 0;
}

.data-table tr.is-other th {
  font-style: italic;
  color: var(--ink-2);
}

.visible-table tbody tr:hover {
  background: color-mix(in srgb, var(--ink) 3%, transparent);
}

.cell-label {
  min-width: 8rem;
  max-width: 22rem;
}

.cell-label span {
  display: block;
  overflow-wrap: anywhere;
}

.sort-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.sort-btn:hover {
  color: var(--ink);
}

.num .sort-btn {
  flex-direction: row;
}

.sort-ind {
  font-size: 0.65rem;
  opacity: 0.45;
}

.sort-ind.is-active {
  opacity: 1;
  color: var(--ink);
}

.table-view {
  margin-top: 0.6rem;
  font-size: 0.8rem;
}

.table-view summary {
  display: inline-block;
  color: var(--muted);
  cursor: pointer;
}

.table-view summary:hover {
  color: var(--ink);
}

.table-view[open] summary {
  margin-bottom: 0.4rem;
}

.table-view .table-scroll {
  max-height: 320px;
  overflow: auto;
}

/* ------------------------------------------------------------------ source status */

.sources {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 0.5rem 1.25rem;
}

.source {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.15rem 0.75rem;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--grid);
}

.source-name {
  font-weight: 600;
}

.source-acct {
  color: var(--muted);
  font-size: 0.8rem;
  overflow-wrap: anywhere;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  align-self: start;
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
}

.source-meta {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 0.15rem 1.1rem;
  margin: 0.25rem 0 0;
  font-size: 0.78rem;
}

.source-meta div {
  display: flex;
  gap: 0.3rem;
}

.source-meta dt {
  color: var(--muted);
}

.source-meta dd {
  margin: 0;
  font-variant-numeric: tabular-nums;
}

/* ------------------------------------------------------------------ annotations and text */

.ann-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.ann-list li {
  padding: 0.55rem 0 0.55rem 0.85rem;
  border-left: 2px solid var(--axis);
}

.ann-list li + li {
  margin-top: 0.25rem;
}

.ann-list time {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
}

.ann-title {
  font-weight: 600;
}

.ann-body {
  color: var(--ink-2);
  font-size: 0.86rem;
}

.prose {
  font-size: 0.92rem;
  color: var(--ink);
}

.prose p + p,
.prose p + ul,
.prose ul + p {
  margin-top: 0.6rem;
}

.prose ul {
  margin: 0.5rem 0 0;
  padding-left: 1.2rem;
}

.prose li + li {
  margin-top: 0.2rem;
}

/* ------------------------------------------------------------------ footer */

.appfoot {
  max-width: 1440px;
  margin: 0 auto;
  padding: 1rem clamp(1rem, 3vw, 2rem) 2rem;
  color: var(--muted);
  font-size: 0.78rem;
}

/* ------------------------------------------------------------------ motion, forced colors, print */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

@media (forced-colors: active) {
  .widget,
  .chart-tip,
  .page-state {
    border: 1px solid CanvasText;
  }

  .line,
  .line-prev {
    stroke: CanvasText;
  }

  .bar,
  .seg,
  .hbar-fill,
  .meter-fill,
  .key-swatch,
  .dot,
  .end-dot {
    forced-color-adjust: none;
    fill: CanvasText;
    background: CanvasText;
  }

  .tabs [role="tab"][aria-selected="true"]::after {
    background: Highlight;
  }

  .sk {
    background: GrayText;
  }
}

@media print {
  @page {
    margin: 12mm;
  }

  :root,
  :root[data-scheme] {
    color-scheme: light;
    --surface: #ffffff;
    --page: #ffffff;
    --ink: #000000;
    --ink-2: #333333;
    --muted: #555555;
    --grid: #dddddd;
    --axis: #999999;
    --shadow: none;
    --series-1: #2a78d6;
    --series-2: #eb6834;
    --series-3: #1baf7a;
    --series-4: #eda100;
  }

  body {
    font-size: 11pt;
  }

  .skip-link,
  .tabs-wrap,
  .filters .field,
  .custom-range,
  .draft-banner button,
  .layout-pick,
  .table-view,
  .chart-tip,
  .hover,
  .state-error .btn,
  .badge-fixture {
    display: none !important;
  }

  .filters {
    padding-top: 0.25rem;
  }

  .range-caption {
    margin: 0;
    text-align: left;
    color: #000;
  }

  .appbar {
    border-bottom: 1px solid #999;
  }

  .main {
    max-width: none;
    padding: 0;
  }

  .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .grid.cols-1 {
    grid-template-columns: 1fr;
  }

  .grid .widget[data-span="3"],
  .grid .widget[data-span="4"] {
    grid-column: span 2;
  }

  .widget {
    break-inside: avoid;
    page-break-inside: avoid;
    box-shadow: none;
    border-color: #ccc;
  }

  .grid.cols-1 .widget {
    grid-column: 1 / -1;
  }

  .section-title {
    break-after: avoid;
  }

  .area {
    fill-opacity: 0.15;
  }

  * {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}

/* KPI deltas may wrap their "vs ..." tail on narrow tiles. */
.kpi-delta .delta {
  flex-wrap: wrap;
  white-space: normal;
  column-gap: 0.25rem;
}

.data-table thead th.num {
  white-space: normal;
}
