/* Compass dashboard. Theme tokens (docs/widgets.md) override the defaults below.
   The default look follows the Revive Our Hearts portfolio report: navy header band, white tab bar,
   cool grey page, white cards with colored top borders. */

:root {
  color-scheme: light;
  /* themeable: light */
  --accent: #3575aa;
  --accent-strong: #2b6293;
  --on-accent: #ffffff;
  --accent-soft: #e7f2fa;
  --surface: #ffffff;
  --page: #eef4f8;
  --ink: #213047;
  --ink-2: #45566b;
  --muted: #5f6e80;
  --title: #233f68;
  --grid: #e5ecf2;
  --axis: #c5d1dc;
  --border: #dfe7ef;
  --good: #0f6a5f;
  --bad: #a3392b;
  --header-bg: #213d65;
  --header-bg-2: #315b84;
  --header-ink: #ffffff;
  --header-muted: #d7e6f3;
  /* themeable: common */
  --radius: 10px;
  --radius-sm: 6px;
  --space: 1rem;
  --font-body: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-heading: var(--font-body);
  --font-numbers: var(--font-body);

  /* fixed: series colors (first five follow the report palette: blue, gold, teal, coral, violet) and status */
  --series-1: #1d5282;
  --series-2: #bd8528;
  --series-3: #13a49d;
  --series-4: #cc6f58;
  --series-5: #8b67c6;
  --series-6: #008300;
  --series-7: #4a3aa7;
  --series-8: #e34948;
  --other: #b6c2ce;
  --prev-line: #c9962c;
  --pill-good-bg: #e0f4ef;
  --pill-good-ink: #0f5f57;
  --pill-bad-bg: #fce9e5;
  --pill-bad-ink: #973a2c;
  --pill-neutral-bg: #eef2f5;
  --pill-neutral-ink: #4f5e6f;
  --tip-bg: #1c3048;
  --tip-border: rgba(255, 255, 255, 0.16);
  --tip-ink: #ffffff;
  --tip-muted: #cfdbe7;
  --tip-other: #8fb8d6;
  --status-good: #0ca30c;
  --status-warn: #c98500;
  --status-bad: #d03b3b;
  --status-info: #3575aa;
  --shadow: 0 6px 22px rgba(39, 65, 91, 0.08);
  --skeleton: rgba(33, 48, 71, 0.07);
}

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

:root[data-scheme="dark"] {
  color-scheme: dark;
  --accent: #6fa8dc;
  --accent-strong: #8dbbe5;
  --on-accent: #0b1726;
  --accent-soft: rgba(111, 168, 220, 0.16);
  --surface: #162231;
  --page: #0d1620;
  --ink: #e8eef5;
  --ink-2: #c3cfdc;
  --muted: #9fb0c2;
  --title: #f0f5fb;
  --grid: #253345;
  --axis: #3a4a5e;
  --border: rgba(255, 255, 255, 0.1);
  --good: #6fd6c8;
  --bad: #f3a597;
  --header-bg: #10213a;
  --header-bg-2: #1c3a5c;
  --header-ink: #ffffff;
  --header-muted: #c9d9e8;
  --series-1: #3f7eb6;
  --series-2: #deb757;
  --series-3: #42afa8;
  --series-4: #f29681;
  --series-5: #bca3e7;
  --series-6: #3cbf3c;
  --series-7: #9085e9;
  --series-8: #e66767;
  --other: #5a6676;
  --prev-line: #e0b754;
  --pill-good-bg: rgba(63, 179, 166, 0.2);
  --pill-good-ink: #8fe3d8;
  --pill-bad-bg: rgba(229, 140, 123, 0.2);
  --pill-bad-ink: #f6b3a7;
  --pill-neutral-bg: rgba(255, 255, 255, 0.08);
  --pill-neutral-ink: #c3cfdc;
  --tip-bg: #0a1420;
  --tip-border: rgba(255, 255, 255, 0.18);
  --status-warn: #fab219;
  --status-info: #5b9bd5;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  --skeleton: rgba(255, 255, 255, 0.07);
}

@media (prefers-color-scheme: dark) {
  :root[data-scheme="auto"] {
    --accent: #6fa8dc;
    --accent-strong: #8dbbe5;
    --on-accent: #0b1726;
    --accent-soft: rgba(111, 168, 220, 0.16);
    --surface: #162231;
    --page: #0d1620;
    --ink: #e8eef5;
    --ink-2: #c3cfdc;
    --muted: #9fb0c2;
    --title: #f0f5fb;
    --grid: #253345;
    --axis: #3a4a5e;
    --border: rgba(255, 255, 255, 0.1);
    --good: #6fd6c8;
    --bad: #f3a597;
    --header-bg: #10213a;
    --header-bg-2: #1c3a5c;
    --header-ink: #ffffff;
    --header-muted: #c9d9e8;
    --series-1: #3f7eb6;
    --series-2: #deb757;
    --series-3: #42afa8;
    --series-4: #f29681;
    --series-5: #bca3e7;
    --series-6: #3cbf3c;
    --series-7: #9085e9;
    --series-8: #e66767;
    --other: #5a6676;
    --prev-line: #e0b754;
    --pill-good-bg: rgba(63, 179, 166, 0.2);
    --pill-good-ink: #8fe3d8;
    --pill-bad-bg: rgba(229, 140, 123, 0.2);
    --pill-bad-ink: #f6b3a7;
    --pill-neutral-bg: rgba(255, 255, 255, 0.08);
    --pill-neutral-ink: #c3cfdc;
    --tip-bg: #0a1420;
    --tip-border: rgba(255, 255, 255, 0.18);
    --status-warn: #fab219;
    --status-info: #5b9bd5;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    --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;
}

/* ------------------------------------------------------------------ header band */

.appbar {
  position: relative;
  z-index: 20;
  color: var(--header-ink);
  background: linear-gradient(108deg, var(--header-bg), var(--header-bg-2) 65%, var(--header-bg));
  box-shadow: 0 4px 16px rgba(25, 50, 80, 0.22);
}

.appbar-inner {
  display: flex;
  align-items: stretch;
  gap: 1rem;
  max-width: 1480px;
  min-height: 92px;
  margin: 0 auto;
  padding-left: clamp(1rem, 3vw, 2rem);
}

.appbar :focus-visible {
  outline-color: var(--header-ink);
}

.brand {
  display: flex;
  align-items: center;
  flex: 1 1 auto;
  min-width: 0;
  padding: 1rem 0;
}

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

.brand-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.15rem 0.45rem;
  margin-bottom: 0.3rem;
  color: var(--header-muted);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.beta-pill {
  display: inline-block;
  padding: 2px 7px;
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: 999px;
  color: var(--header-ink);
  background: rgba(255, 255, 255, 0.13);
  font-size: 0.62rem;
  line-height: 1.2;
  letter-spacing: 0.08em;
}

.brand-sep {
  opacity: 0.75;
}

.dash-title {
  color: var(--header-ink);
  font-size: 1.75rem;
  font-weight: 750;
  letter-spacing: -0.025em;
  line-height: 1.15;
}

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

.appbar-right .field-label {
  color: var(--header-muted);
}

.appbar-right select {
  color: var(--header-ink);
  background-color: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.35);
  background-image: linear-gradient(45deg, transparent 50%, var(--header-ink) 50%), linear-gradient(135deg, var(--header-ink) 50%, transparent 50%);
}

.appbar-right select option {
  color: #213047;
  background: #ffffff;
}

.brand-tile {
  display: grid;
  place-items: center;
  flex: none;
  width: 58px;
  height: 58px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.12);
  box-shadow: 0 4px 14px rgba(8, 26, 47, 0.2);
  color: var(--header-ink);
}

.brand-logo {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.brand-mark {
  width: 34px;
  height: 34px;
}

.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: rgba(255, 255, 255, 0.16);
  color: var(--header-ink);
  border: 1px solid rgba(255, 255, 255, 0.35);
}

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

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

/* date range control in the header */
.period {
  position: relative;
  display: flex;
  flex: none;
  border-left: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(12, 31, 55, 0.18);
}

.period-btn {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.3rem;
  min-width: 300px;
  padding: 0.9rem clamp(1rem, 2vw, 1.6rem);
  border: 0;
  background: none;
  color: var(--header-ink);
  text-align: left;
  cursor: pointer;
}

.period-btn:hover {
  background: rgba(255, 255, 255, 0.06);
}

.period-btn:focus-visible {
  outline-offset: -4px;
}

.period-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.period-cal .uicon {
  width: 20px;
  height: 20px;
}

.period-text {
  font-size: 1.12rem;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.period-chev .uicon {
  width: 16px;
  height: 16px;
  transition: transform 0.15s ease;
}

.period-btn[aria-expanded="true"] .period-chev .uicon,
.filter-btn[aria-expanded="true"] .filter-btn-chev .uicon {
  transform: rotate(180deg);
}

.period-cap {
  padding-left: 1.75rem;
  color: var(--header-muted);
  font-size: 0.84rem;
}

/* popovers (date range, filters) */
.popover {
  position: absolute;
  z-index: 40;
  top: calc(100% + 6px);
  right: 0;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 14px 40px rgba(20, 38, 58, 0.22);
}

.period-pop {
  right: clamp(0.5rem, 2vw, 1rem);
  width: min(380px, calc(100vw - 1rem));
  padding: 1rem;
}

.period-pop .filters {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.8rem;
}

.period-pop select,
.period-pop input[type="date"] {
  width: 100%;
}

/* ------------------------------------------------------------------ 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;
}

.draft-banner:has(.banner-quiet) {
  background: var(--surface);
  border-bottom-color: var(--border);
  color: var(--muted);
}

/* ------------------------------------------------------------------ tab bar */

.tabbar {
  position: relative;
  z-index: 10;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.tabbar-inner {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  max-width: 1480px;
  margin: 0 auto;
  padding: 0.55rem clamp(1rem, 3vw, 2rem);
}

.tabs-wrap {
  flex: 1 1 auto;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: thin;
}

.tabs {
  display: flex;
  gap: 0.25rem;
  padding: 3px;
}

.tabs [role="tab"] {
  min-height: 2.6rem;
  padding: 0.5rem 1rem;
  border: 1px solid transparent;
  border-radius: 9px;
  background: none;
  color: var(--ink-2);
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
}

.tabs [role="tab"]:hover {
  color: var(--title);
  background: var(--accent-soft);
}

.tabs [role="tab"][aria-selected="true"] {
  color: var(--on-accent);
  background: var(--accent);
  box-shadow: 0 2px 8px color-mix(in srgb, var(--accent) 30%, transparent);
}

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

.tabbar-tools {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex: none;
  margin-left: auto;
}

.filter-anchor {
  position: relative;
}

.filter-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 2.6rem;
  padding: 0.4rem 0.85rem;
  border: 1px solid color-mix(in srgb, var(--ink) 18%, transparent);
  border-radius: 8px;
  background: var(--surface);
  color: var(--title);
  font-size: 0.86rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
}

.filter-btn:hover {
  border-color: var(--accent);
}

.filter-btn.is-active {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.filter-btn .uicon {
  width: 16px;
  height: 16px;
}

.filter-btn-chev .uicon {
  width: 14px;
  height: 14px;
  transition: transform 0.15s ease;
}

.filter-btn-icon,
.filter-btn-chev,
.period-cal,
.period-chev {
  display: inline-flex;
}

.filter-chip-wrap:empty {
  display: none;
}

.filter-chip {
  display: inline-flex;
  align-items: stretch;
  max-width: 22rem;
  border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--title);
  font-size: 0.84rem;
}

.chip-text {
  min-width: 0;
  overflow: hidden;
  padding: 0.35rem 0.4rem 0.35rem 0.8rem;
  border: 0;
  border-radius: 999px 0 0 999px;
  background: none;
  color: inherit;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}

.chip-dim {
  font-weight: 750;
}

.chip-x {
  display: grid;
  place-items: center;
  flex: none;
  width: 2rem;
  border: 0;
  border-radius: 0 999px 999px 0;
  background: none;
  color: inherit;
  cursor: pointer;
}

.chip-x:hover,
.chip-text:hover {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
}

.chip-x .uicon {
  width: 14px;
  height: 14px;
}

/* filter panel */
.filter-panel {
  width: min(400px, calc(100vw - 1rem));
  padding: 1rem;
}

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

.fp-title {
  color: var(--title);
  font-size: 1rem;
  font-weight: 750;
}

.fp-close {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--ink-2);
  cursor: pointer;
}

.fp-close:hover {
  background: var(--accent-soft);
}

.fp-close .uicon {
  width: 18px;
  height: 18px;
}

.fp-dims {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0.35rem 0 0.9rem;
}

.fp-dim {
  position: relative;
  display: inline-flex;
}

.fp-dim input {
  position: absolute;
  opacity: 0;
  inset: 0;
  margin: 0;
  cursor: pointer;
}

.fp-dim span {
  padding: 0.35rem 0.75rem;
  border: 1px solid color-mix(in srgb, var(--ink) 16%, transparent);
  border-radius: 999px;
  color: var(--ink-2);
  font-size: 0.84rem;
  font-weight: 650;
}

.fp-dim input:checked + span {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--on-accent);
}

.fp-dim input:focus-visible + span {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.fp-search {
  width: 100%;
  min-height: 2.4rem;
  padding: 0.4rem 0.65rem;
  border: 1px solid color-mix(in srgb, var(--ink) 18%, transparent);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.fp-status {
  margin: 0.5rem 0 0.35rem;
  color: var(--muted);
  font-size: 0.8rem;
}

.fp-values {
  max-height: min(320px, 45vh);
  margin: 0;
  padding: 0;
  overflow-y: auto;
  list-style: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.fp-values:empty {
  display: none;
}

.fp-value {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.55rem;
  padding: 0.45rem 0.65rem;
  border-bottom: 1px solid var(--grid);
  font-size: 0.88rem;
  cursor: pointer;
}

.fp-values li:last-child .fp-value {
  border-bottom: 0;
}

.fp-value:hover {
  background: color-mix(in srgb, var(--accent) 6%, transparent);
}

.fp-value.is-on {
  background: var(--accent-soft);
}

.fp-value input {
  width: 1rem;
  height: 1rem;
  margin: 0;
  accent-color: var(--accent);
}

.fp-value input:disabled + .fp-value-label {
  color: var(--muted);
}

.fp-value-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fp-value-amount {
  color: var(--muted);
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
}

.fp-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 0.9rem;
}

/* ------------------------------------------------------------------ form fields */

.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: 700;
}

select,
input[type="date"] {
  min-height: 2.25rem;
  padding: 0.35rem 0.6rem;
  background-color: 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;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  border: 0;
}

.custom-range .field {
  flex: 1 1 8rem;
}

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

.range-caption {
  color: var(--muted);
  font-size: 0.82rem;
}

.range-caption:empty {
  display: none;
}

.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: 650;
  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: 1480px;
  margin: 0 auto;
  padding: 0.75rem clamp(1rem, 3vw, 2rem) 3rem;
}

.main:focus {
  outline: none;
}

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

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

.section-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
  align-items: end;
  column-gap: 1.75rem;
}

.section-head:not(:has(.section-intro)) {
  grid-template-columns: 1fr;
}

.section-title {
  color: var(--title);
  font-size: 1.2rem;
  font-weight: 750;
  letter-spacing: -0.015em;
}

.section-intro {
  max-width: 70ch;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
}

.section-head .section-title + .section-intro {
  justify-self: end;
  text-align: right;
}

/* sections with an eyebrow or icon: one card, tinted heading row, 4px top border in the section tone */
.section.is-panel {
  --sec-soft: color-mix(in srgb, var(--sec-tone) 13%, var(--surface));
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 4px solid var(--sec-tone);
  border-radius: 11px;
  box-shadow: var(--shadow);
}

.panel-head {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  min-height: 72px;
  padding: 0.9rem 1.15rem;
  border-bottom: 1px solid var(--border);
  border-radius: 7px 7px 0 0;
  background: linear-gradient(100deg, var(--sec-soft), var(--surface) 72%);
}

.panel-titles {
  min-width: 0;
}

.panel-eyebrow,
.w-eyebrow {
  margin-bottom: 0.2rem;
  color: color-mix(in srgb, var(--sec-tone, var(--tone)) 55%, var(--ink));
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.panel-title {
  color: var(--title);
  font-size: 1.15rem;
  font-weight: 750;
}

.panel-intro {
  max-width: 46ch;
  margin-left: auto;
  color: var(--muted);
  font-size: 0.86rem;
  text-align: right;
}

.panel-body {
  padding: 1.1rem;
}

.panel-body > .grid {
  margin-top: 0;
}

.icon-tile {
  display: grid;
  place-items: center;
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  color: #ffffff;
  background: var(--sec-tone, var(--tone, var(--accent)));
  box-shadow: 0 3px 9px rgba(39, 65, 91, 0.18);
}

.icon-tile .uicon {
  width: 20px;
  height: 20px;
}

.uicon {
  flex: none;
}

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

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

/* inside a panel, chart/table widgets sit flat on the panel; KPI tiles and insight cards keep their card look */
.is-panel .widget:not(.w-insight):not(.w-kpi):not(.is-tiles) {
  padding: 0;
  border: 0;
  box-shadow: none;
}

.is-panel .widget.w-kpi,
.is-panel .widget.w-insight,
.is-panel .is-tiles .kpi {
  box-shadow: none;
}

.widget.is-bare,
.widget.is-tiles {
  padding: 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) 6%, var(--surface));
  border-color: color-mix(in srgb, var(--accent) 28%, transparent);
  border-left: 4px solid var(--accent);
}

.w-heading {
  color: var(--title);
  font-size: 1.15rem;
  font-weight: 750;
}

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

.w-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  margin-bottom: 0.85rem;
}

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

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

.w-head-text {
  min-width: 0;
}

.w-title {
  color: var(--title);
  font-size: 1rem;
  font-weight: 750;
}

.w-head.has-icon .w-title {
  font-size: 1.1rem;
}

.w-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-left: auto;
}

.w-badges {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.w-badges:empty {
  display: none;
}

.is-tiles .w-head {
  margin-bottom: 0.6rem;
}

.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);
}

/* "Not filtered" badge: focusable; the reason shows on hover/focus and is read as part of the badge */
.fbadge {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.18rem 0.55rem;
  border: 1px solid color-mix(in srgb, var(--status-warn) 55%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--status-warn) 12%, var(--surface));
  color: var(--ink);
  font-size: 0.74rem;
  font-weight: 700;
  white-space: nowrap;
  cursor: help;
}

.fbadge .uicon {
  width: 12px;
  height: 12px;
}

.fbadge-tip {
  position: absolute;
  z-index: 30;
  top: calc(100% + 6px);
  right: 0;
  width: max-content;
  max-width: min(260px, 70vw);
  padding: 0.5rem 0.65rem;
  border-radius: 8px;
  color: var(--tip-ink);
  background: var(--tip-bg);
  border: 1px solid var(--tip-border);
  box-shadow: 0 6px 18px rgba(20, 38, 58, 0.24);
  font-size: 0.78rem;
  font-weight: 500;
  line-height: 1.4;
  white-space: normal;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.fbadge:hover .fbadge-tip,
.fbadge:focus .fbadge-tip {
  opacity: 1;
  visibility: visible;
}

.kpi .fbadge-tip {
  right: auto;
  left: 0;
}

.fbadge-sm {
  padding: 0.1rem 0.45rem;
  font-size: 0.68rem;
}

.fmark {
  display: inline-flex;
  color: var(--muted);
}

.fmark .uicon {
  width: 14px;
  height: 14px;
}

/* time grain toggle */
.grain {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.35rem;
}

.grain-caption {
  color: var(--muted);
  font-size: 0.78rem;
}

.grain-caption:empty {
  display: none;
}

.seg {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: color-mix(in srgb, var(--accent) 5%, var(--surface));
}

.seg-btn {
  min-height: 2rem;
  padding: 0.25rem 0.75rem;
  border: 0;
  border-radius: 7px;
  background: none;
  color: var(--ink-2);
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
}

.seg-btn:hover {
  color: var(--title);
  background: var(--accent-soft);
}

.seg-btn[aria-pressed="true"] {
  color: var(--on-accent);
  background: var(--accent);
}

/* insight cards */
.widget.w-insight {
  position: relative;
  overflow: hidden;
  min-height: 165px;
  padding: 1.3rem;
}

.widget.w-insight::after {
  content: "";
  position: absolute;
  right: -30px;
  bottom: -44px;
  width: 130px;
  height: 130px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--tone) 14%, var(--surface));
  pointer-events: none;
}

.w-insight .w-head,
.w-insight .w-body,
.w-insight .w-foot {
  position: relative;
  z-index: 1;
}

.insight-icon {
  background: var(--tone);
}

.insight-title {
  margin: 0.8rem 0 0.45rem;
  color: var(--title);
  font-size: 1.08rem;
  font-weight: 750;
}

.insight-text {
  color: var(--muted);
  font-size: 0.93rem;
  line-height: 1.55;
}

.insight-text strong,
.insight-title strong,
.kpi-sub strong {
  color: var(--ink);
  font-weight: 750;
}

strong.txt-good,
.txt-good {
  color: var(--good);
}

strong.txt-bad,
.txt-bad {
  color: var(--bad);
}

.sk-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
}

.sk-title {
  height: 1.1rem;
  margin-top: 0.4rem;
}

/* 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;
  }

  .appbar-inner {
    flex-wrap: wrap;
    padding-right: 0;
  }

  .period-btn {
    min-width: 0;
  }
}

/* Narrow screens: everything stacks; the header stacks, tabs scroll, the filter panel becomes a sheet. */
@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-inner {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    min-height: 0;
    gap: 0;
    padding: 0;
  }

  .brand {
    padding: 0.85rem 0 0.7rem 1rem;
  }

  .appbar-right {
    padding: 0.75rem 1rem 0.7rem 0.5rem;
    gap: 0.5rem;
  }

  .appbar-right .field-inline .field-label {
    display: none;
  }

  .brand-tile {
    width: 44px;
    height: 44px;
  }

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

  .brand-line {
    font-size: 0.7rem;
  }

  .period {
    grid-column: 1 / -1;
    border-left: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.14);
  }

  .period-btn {
    width: 100%;
    padding: 0.7rem 1rem;
  }

  .period-text {
    font-size: 1rem;
  }

  .period-pop {
    left: 0.5rem;
    right: 0.5rem;
    width: auto;
  }

  .tabbar-inner {
    flex-wrap: wrap;
    gap: 0.4rem 0.6rem;
    padding: 0.45rem 0.75rem;
  }

  .tabs-wrap {
    flex-basis: 100%;
  }

  .tabbar-tools {
    flex: 1 1 100%;
    justify-content: space-between;
    margin-left: 0;
  }

  .tabs-wrap[hidden] + .tabbar-tools {
    flex-basis: auto;
  }

  .filter-anchor {
    margin-left: auto;
  }

  .filter-chip {
    max-width: calc(100vw - 9.5rem);
  }

  /* filter panel: bottom sheet */
  .filter-panel {
    position: fixed;
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    width: auto;
    max-height: 85vh;
    overflow-y: auto;
    border-radius: 14px 14px 0 0;
    box-shadow: 0 -10px 40px rgba(20, 38, 58, 0.3);
  }

  .section-head {
    grid-template-columns: 1fr;
  }

  .section-head .section-title + .section-intro {
    justify-self: start;
    margin-top: 0.25rem;
    text-align: left;
  }

  .panel-head {
    flex-wrap: wrap;
    align-items: flex-start;
    padding: 0.8rem 0.9rem;
  }

  .panel-intro {
    flex-basis: 100%;
    margin-left: 0;
    text-align: left;
  }

  .panel-body {
    padding: 0.9rem;
  }

  .w-tools,
  .grain {
    align-items: flex-start;
    margin-left: 0;
  }

  .w-head:has(.grain) .w-tools {
    flex-basis: 100%;
    justify-content: flex-start;
  }
}

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;
}

.state-off {
  padding: 0.75rem 0.25rem;
  gap: 0.2rem;
}

.state-off .state-hint {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.kpi-off .kpi-prev {
  margin-top: 0.3rem;
}

/* ------------------------------------------------------------------ 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: each tile is its own card with a 4px top border cycling the series colors */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: calc(var(--space) * 0.9);
}

.kpi-row > .kpi,
.widget.w-kpi {
  --tone: var(--series-1);
  border-top: 4px solid var(--tone);
}

.kpi-row > .kpi {
  padding: 1.1rem 1.15rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 4px solid var(--tone);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.kpi-row > .kpi:nth-child(5n + 2) { --tone: var(--series-2); }
.kpi-row > .kpi:nth-child(5n + 3) { --tone: var(--series-3); }
.kpi-row > .kpi:nth-child(5n + 4) { --tone: var(--series-4); }
.kpi-row > .kpi:nth-child(5n + 5) { --tone: var(--series-5); }

/* six tiles: one row when wide enough, else three per row (never five plus an orphan) */
@media (min-width: 1081px) and (max-width: 1719px) {
  .kpi-row:has(> .kpi:nth-child(6):last-child) {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 1720px) {
  .kpi-row:has(> .kpi:nth-child(6):last-child) {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .kpi-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 370px) {
  .kpi-row {
    grid-template-columns: minmax(0, 1fr);
  }
}

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

.kpi-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.3rem 0.5rem;
}

.kpi-label {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.kpi-value {
  margin-top: 0.4rem;
  color: var(--title);
  font-family: var(--font-numbers);
  font-size: 1.75rem;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.015em;
  line-height: 1.05;
}

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

.kpi-sub {
  margin-top: 0.35rem;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.4;
}

.kpi-delta {
  margin-top: 0.6rem;
}

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

.kpi.is-unfiltered .kpi-value {
  color: var(--ink-2);
}

.pill {
  display: inline-block;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 800;
  line-height: 1.35;
}

.pill-good {
  color: var(--pill-good-ink);
  background: var(--pill-good-bg);
}

.pill-bad {
  color: var(--pill-bad-ink);
  background: var(--pill-bad-bg);
}

.pill-neutral {
  color: var(--pill-neutral-ink);
  background: var(--pill-neutral-bg);
}

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

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

.spark-dot {
  fill: none;
  stroke: var(--tone, 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;
  touch-action: pan-y;
}

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.5;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.line-prev {
  fill: none;
  stroke: var(--prev-line);
  stroke-width: 1.75;
  stroke-dasharray: 5 4;
  stroke-linecap: round;
}

.area-soft {
  stroke: none;
}

.fill-stop-top {
  stop-opacity: 0.16;
}

.fill-stop-bottom {
  stop-opacity: 0.01;
}

.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;
}

.hover .dot {
  r: 5.5px;
  fill: var(--surface) !important;
  stroke: var(--accent);
  stroke-width: 3;
}

.dot-prev {
  fill: var(--surface);
  stroke: var(--prev-line);
  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: dark navy panel */
.chart-tip {
  position: absolute;
  z-index: 25;
  width: max-content;
  min-width: 170px;
  max-width: min(300px, calc(100vw - 16px));
  padding: 0.65rem 0.8rem;
  color: var(--tip-ink);
  background: var(--tip-bg);
  border: 1px solid var(--tip-border);
  border-radius: 9px;
  box-shadow: 0 8px 24px rgba(20, 38, 58, 0.28);
  font-size: 0.8rem;
  line-height: 1.4;
  pointer-events: none;
}

.chart-tip:has(.tip-rich) {
  width: min(350px, calc(100vw - 16px));
  max-width: 350px;
  padding: 0.8rem 0.85rem;
}

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

.chart-tip .tip-head {
  margin-bottom: 0.3rem;
  font-weight: 750;
}

.tip-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.9rem;
}

.tip-date {
  font-size: 0.9rem;
  font-weight: 800;
}

.tip-total {
  color: var(--tip-muted);
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
}

.tip-rows {
  margin-top: 0.35rem;
}

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

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

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

.tip-sec {
  margin-top: 0.55rem;
  padding-top: 0.55rem;
  border-top: 1px solid var(--tip-border);
}

.tip-sec-head {
  margin-bottom: 0.3rem;
  color: var(--tip-muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.tip-bd-row {
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.5rem;
  padding: 0.18rem 0;
  font-weight: 650;
}

.tip-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--key);
}

.tip-bd-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.tip-small {
  margin-top: 0.4rem;
  color: var(--tip-muted);
  font-size: 0.7rem;
  line-height: 1.35;
}

.tip-foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.15rem 0.75rem;
  margin-top: 0.55rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--tip-border);
  color: var(--tip-muted);
  font-size: 0.75rem;
  font-weight: 650;
}

.tip-foot strong {
  color: var(--tip-ink);
}

.tip-change {
  flex-basis: 100%;
  font-weight: 750;
}

.chart-tip .txt-good {
  color: #8fe3d8;
}

.chart-tip .txt-bad {
  color: #f6b3a7;
}

.chart-tip .txt-neutral {
  color: var(--tip-muted);
}

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

.chart-tip .delta-good {
  color: #8fe3d8;
}

.chart-tip .delta-bad {
  color: #f6b3a7;
}

.chart-tip .delta-neutral {
  color: var(--tip-muted);
}

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

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

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

.chart-tip .ann-num {
  border-color: var(--tip-muted);
}

/* 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"],
  .seg-btn[aria-pressed="true"] {
    forced-color-adjust: none;
    background: Highlight;
    color: HighlightText;
  }

  .kpi-row > .kpi,
  .section.is-panel,
  .fbadge,
  .pill {
    border: 1px solid CanvasText;
  }

  .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: #1d5282;
    --series-2: #bd8528;
    --series-3: #13a49d;
    --series-4: #cc6f58;
  }

  body {
    font-size: 11pt;
  }

  .skip-link,
  .tabs-wrap,
  .tabbar-tools,
  .popover,
  .period-chev,
  .seg,
  .fbadge-tip,
  .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 {
    color: #000;
    background: none;
    box-shadow: none;
    border-bottom: 1px solid #999;
  }

  .appbar *,
  .dash-title {
    color: #000 !important;
  }

  .tabbar {
    border: 0;
  }

  .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;
}

/* An open filter sheet sits above the header band. */
.tabbar:has(.filter-panel:not([hidden])) {
  z-index: 30;
}

/* Light/dark switch in the header (app.js setupSchemeSwitch). */
.scheme-btn {
  display: grid;
  place-items: center;
  flex: none;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid color-mix(in srgb, var(--header-ink) 35%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--header-ink) 10%, transparent);
  color: var(--header-ink);
  cursor: pointer;
}

.scheme-btn:hover {
  background: color-mix(in srgb, var(--header-ink) 20%, transparent);
}

.scheme-btn:focus-visible {
  outline: 2px solid var(--header-ink);
  outline-offset: 2px;
}

.scheme-btn .uicon {
  width: 20px;
  height: 20px;
}

@media (max-width: 720px) {
  .scheme-btn {
    width: 36px;
    height: 36px;
  }
}

@media print {
  .scheme-btn {
    display: none;
  }
}
