:root {
  color-scheme: light;
  --canvas: #fafaf9;
  --paper: #fff;
  --ink: #262626;
  --muted: #545d58;
  --line: #d6d3d1;
  --light-line: #e9e7e2;
  --accent: #205c46;
  --active: #e7efeb;
  --warning: #79490e;
  --warning-bg: #fff4e2;
  --sidebar-width: 240px;
  font: 16px/1.5 system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: var(--canvas);
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; }
a { color: var(--accent); }
button, input, select { font: inherit; }
button { cursor: pointer; }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(1.75rem, 3vw, 2.4rem); line-height: 1.17; font-weight: 690; letter-spacing: -.035em; }
h2 { line-height: 1.3; font-size: 1.1rem; letter-spacing: -.012em; }
summary { cursor: pointer; color: var(--accent); font-weight: 600; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
[hidden] { display: none !important; }

.layout { display: grid; grid-template-columns: var(--sidebar-width) minmax(0, 1fr); min-height: 100dvh; }
.layout.compact { --sidebar-width: 64px; }
.sidebar {
  position: sticky;
  inset-block-start: 0;
  display: flex;
  flex-direction: column;
  align-self: start;
  height: 100dvh;
  background: #f5f6f3;
  border-inline-end: 1px solid var(--line);
  padding: 16px 12px;
  z-index: 4;
  overflow-y: auto;
}
.sidebar-head { display: flex; align-items: center; justify-content: space-between; gap: 4px; padding: 2px 0 20px; }
.brand { display: inline-flex; align-items: center; gap: 10px; white-space: nowrap; text-decoration: none; color: var(--ink); }
.brand-mark {
  display: inline-grid;
  place-items: center;
  inline-size: 34px;
  block-size: 34px;
  border-radius: 8px;
  font-size: 18px;
  font-weight: 750;
  color: #fff;
  background: var(--accent);
}
.wordmark { font-weight: 720; letter-spacing: -.025em; }
.icon-button { border: 0; background: transparent; color: var(--accent); font-weight: 700; min-width: 44px; min-height: 44px; border-radius: 7px; }
.icon-button:hover { background: var(--active); }
.collapse { font-size: 25px; padding: 0; }
.nav-group { margin: 17px 12px 4px; color: var(--muted); font-size: .73rem; font-weight: 650; }
.nav-link {
  display: flex;
  align-items: center;
  width: 100%;
  gap: 10px;
  min-height: 38px;
  border-radius: 6px;
  background: none;
  border: 0;
  text-align: start;
  text-decoration: none;
  color: var(--ink);
  padding: 6px 12px;
  font-size: .875rem;
  white-space: nowrap;
}
.nav-link:hover, .nav-link[aria-current] { background: var(--active); color: var(--accent); }
.nav-link[aria-current] { font-weight: 730; }
.nav-icon { display: grid; place-items: center; flex: 0 0 20px; width: 20px; height: 20px; font-size: .82rem; font-weight: 670; color: var(--accent); }
.sidebar-foot { margin-top: auto; padding-top: 16px; }
.sidebar-foot form { margin-top: 4px; }
.compact .sidebar { padding-inline: 8px; overflow: visible; }
.compact .sidebar-head { flex-direction: column; padding: 2px 0; }
.compact .sidebar-head button { min-width: 40px; }
.compact .nav-group { height: 0; overflow: hidden; margin: 9px 0 0; }
.compact .nav-label, .compact .wordmark { display: none; }
.compact .nav-link { position: relative; justify-content: center; padding-inline: 0; }
.compact .nav-link:is(:hover, :focus-visible)::after {
  content: attr(data-label);
  position: absolute;
  inset-inline-start: calc(100% + 6px);
  background: var(--accent);
  color: #fff;
  padding: 5px 9px;
  border-radius: 5px;
  z-index: 5;
}
.skip { position: fixed; left: 12px; top: -60px; z-index: 20; background: #fff; padding: 12px; }
.skip:focus { top: 12px; }
.mobile-nav, .drawer-backdrop { display: none; }
.topbar { background: var(--paper); border-bottom: 1px solid var(--light-line); }
.topbar-inner { display: flex; align-items: center; gap: 12px; padding: 11px 24px; min-height: 54px; }
.location { color: var(--muted); font-weight: 650; font-size: .85rem; }
.environment {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
  font-size: .78rem;
  color: var(--accent);
  background: var(--active);
  border-radius: 4px;
  padding: 4px 8px;
}
.environment span, .status-dot { height: 7px; width: 7px; border-radius: 50%; background: currentColor; flex: 0 0 auto; }

.content { width: min(100%, 1500px); margin-inline: auto; padding: 28px 24px 48px; }
.page-head { margin-bottom: 24px; }
.page-head p { margin-top: 7px; color: var(--muted); }
.filters { margin-bottom: 14px; padding: 15px 16px; background: var(--paper); border: 1px solid var(--light-line); border-radius: 9px; }
.filter-row, .compare-dates { display: flex; flex-wrap: wrap; align-items: end; gap: 10px 12px; }
.filters label, .enrollment label { display: grid; gap: 4px; color: var(--muted); font-size: .78rem; font-weight: 650; }
input, select { background: var(--paper); color: var(--ink); border: 1px solid #afafaa; border-radius: 6px; min-height: 40px; padding: 5px 9px; }
.filters input, .filters select { font-size: .88rem; max-width: 100%; }
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 7px 13px;
  border: 1px solid #aeb8b2;
  border-radius: 6px;
  background: #fff;
  color: var(--accent);
  font-weight: 680;
  font-size: .88rem;
}
.button:hover { background: var(--active); }
.button.primary { color: #fff; background: var(--accent); border-color: var(--accent); }
.button.primary:hover { background: #184a37; }
.button:disabled { opacity: .7; cursor: wait; }
.wide { width: 100%; }
.filter-caption, .subnote { color: var(--muted); font-size: .84rem; margin-top: 8px; }
.notice { padding: 11px 14px; border-radius: 6px; margin: 8px 0 14px; font-size: .9rem; }
.tone-warning { color: var(--warning) !important; background: var(--warning-bg) !important; }
.health-strip { display: flex; gap: 7px; flex-wrap: wrap; margin: 15px 0; }
.status-chip, .pill {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  gap: 6px;
  background: var(--active);
  color: var(--accent);
  font-weight: 620;
  border-radius: 5px;
  font-size: .75rem;
  padding: 5px 8px;
  line-height: 1.15;
  text-decoration: none;
}
a.status-chip:hover { text-decoration: underline; }

.metric-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 171px), 1fr)); gap: 12px; margin-bottom: 16px; }
.metric, .panel { background: var(--paper); border: 1px solid var(--light-line); border-radius: 9px; min-width: 0; }
.metric { padding: 15px 16px; }
.metric h2 { font-size: .84rem; font-weight: 670; color: var(--muted); }
.metric-value { display: block; font-size: clamp(1.35rem, 2.6vw, 1.93rem); letter-spacing: -.035em; margin: 4px 0 1px; overflow-wrap: anywhere; }
.metric-value, .numeric { font-variant-numeric: tabular-nums; }
.metric-coverage { color: var(--accent); font-size: .77rem; }
.metric-compare, .metric-note { color: var(--muted); font-size: .75rem; margin-top: 5px; }
.panel { margin-bottom: 16px; overflow: hidden; }
.panel-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; padding: 16px 18px 12px; }
.panel-head p, .table-coverage, .empty-state { color: var(--muted); font-size: .85rem; margin-top: 4px; }
.table-coverage, .empty-state { padding: 1px 18px 12px; }
.chart { margin: 0 14px; min-width: 0; }
.chart-empty { padding: 34px 18px; color: var(--muted); }
.chart-data { border-top: 1px solid var(--light-line); }
.chart-data summary { padding: 10px 18px; font-size: .85rem; }
.u-legend { font-size: .75rem !important; margin-bottom: 6px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { padding: 10px 16px; text-align: start; border-top: 1px solid var(--light-line); vertical-align: top; }
thead th { background: #f6f7f4; color: var(--muted); font-size: .79rem; white-space: nowrap; }
tbody th { font-weight: 600; overflow-wrap: anywhere; }
table small { display: block; color: var(--muted); font-weight: 400; }
.numeric { text-align: end; min-width: 95px; }
.source-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 290px), 1fr)); gap: 15px; }
.source-card { padding: 15px 16px; margin: 0; scroll-margin-top: 12px; }
.source-card:target { outline: 2px solid var(--accent); }
.source-card .panel-head { padding: 0 0 12px; }
.source-card dl { margin: 0 0 12px; }
.source-card dl div { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; padding: 5px 0; border-top: 1px solid var(--light-line); font-size: .85rem; }
.source-card dt { color: var(--muted); }
.source-card dd { margin: 0; text-align: end; }
.source-card form, .queue-label { margin-top: 12px; }
.queue-label { color: var(--accent); font-size: .85rem; }
.settings-panel { padding: 18px; max-width: 680px; }
.settings-panel p { margin: 8px 0; color: var(--muted); }
.key-list { padding-inline-start: 22px; }
.key-list span { color: var(--muted); margin-left: 8px; font-size: .83rem; }

.auth-wrap { display: grid; place-items: center; min-height: 100dvh; padding: 24px; }
.auth-card { width: min(100%, 410px); padding: 28px; border: 1px solid var(--line); background: var(--paper); border-radius: 12px; }
.auth-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 22px; }
.auth-card h1 { font-size: 1.85rem; }
.auth-card p { color: var(--muted); margin: 8px 0 16px; }
.enrollment { border-top: 1px solid var(--light-line); margin-top: 18px; padding-top: 12px; font-size: .88rem; }
.enrollment input { width: 100%; margin: 4px 0 10px; }
.form-message { margin-top: 10px; color: var(--warning); font-size: .86rem; }
.form-message:empty { display: none; }

@media (max-width: 767px) {
  .layout, .layout.compact { grid-template-columns: minmax(0, 1fr); }
  .sidebar, .compact .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(85vw, 280px);
    padding: 16px 12px;
    visibility: hidden;
    overflow-y: auto;
    transform: translateX(-100%);
  }
  .sidebar-open .sidebar { visibility: visible; transform: none; }
  .sidebar-open .drawer-backdrop { position: fixed; display: block; z-index: 3; inset: 0; border: 0; background: #161a1770; }
  .mobile-nav { display: inline-grid; place-items: center; font-size: 1.12rem; margin-left: -6px; }
  .sidebar .collapse { display: none; }
  .compact .sidebar-head { flex-direction: row; padding-bottom: 16px; }
  .compact .nav-label, .compact .wordmark { display: inline; }
  .compact .nav-group { height: auto; margin: 17px 12px 4px; }
  .compact .nav-link { justify-content: start; padding-inline: 12px; }
  .compact .nav-link:is(:hover, :focus-visible)::after { content: none; }
  .topbar-inner { padding: 5px 14px; min-height: 54px; }
  .nav-link, .button, input, select { min-height: 44px; }
  .content { padding: 20px 14px 36px; }
  .page-head { margin-bottom: 16px; }
  .panel-head { flex-wrap: wrap; }
  .chart-data summary { min-height: 44px; }
  .source-card dl div { flex-wrap: wrap; }
}

@media (max-width: 430px) {
  .location { display: none; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .metric { padding: 11px; }
  .filters label { min-width: 130px; }
  .chart { margin-inline: 4px; }
}

/* Report layouts */
.content { max-width: 1376px; padding-top: 24px; }
.page-head { margin-bottom: 17px; }
.page-head p { max-width: 75ch; }
.period-summary { display: flex; align-items: end; gap: 12px; flex-wrap: wrap; }
.period-summary label { min-width: min(100%, 220px); }
.period-interval { align-self: center; padding-top: 8px; font-size: .9rem; }
.period-interval .filter-caption { margin: 0; }
.period-options { margin-top: 11px; }
.period-options summary, .optional > summary { font-size: .84rem; }
.period-options[open] .filter-row { margin-top: 9px; }
.metric-grid { gap: 10px; }
.metric { border-top: 2px solid #d6e5dc; padding-block: 12px; }
.metric-coverage[data-qualified] { color: #79490e; }
.fact-band { border-inline-start: 3px solid #9db8a9; padding-inline-start: 13px; margin-bottom: 16px; }
.fact-band > h2 { margin-bottom: 9px; font-size: 1rem; }
.chart-grid, .detail-grid { display: grid; min-width: 0; }
.chart-pair, .detail-pair { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.panel-head { padding-bottom: 9px; }
.panel-note { padding: 0 18px 10px; color: var(--muted); font-size: .85rem; }
.optional > summary { padding: 13px 18px; }
.optional > .panel { margin: 0; border: 0; border-top: 1px solid var(--light-line); border-radius: 0; }
.optional > .panel > .panel-head { display: none; }
.bar-list { display: grid; gap: 10px; padding: 7px 18px 14px; }
.bar-item > strong { display: block; font-size: .84rem; overflow-wrap: anywhere; }
.bar-item small { font-size: .76rem; }
.bar-line { display: flex; align-items: center; gap: 8px; font-size: .8rem; }
.bar-line > span:first-child:not(.bar-value) { min-width: 4.7rem; }
.bar-line svg { width: 0; flex: 1; height: 8px; }
.bar-value { min-width: 3.2rem; text-align: end; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bar-track { fill: #edf0ec; }
.bar-fill, .segment-1 { fill: #205c46; background-color: #205c46; }
.bar-previous .bar-fill, .segment-2 { fill: #8e765a; background-color: #8e765a; }
.segment-3 { fill: #546a87; background-color: #546a87; }
.segment-4 { fill: #72968a; background-color: #72968a; }
.segment-5 { fill: #796782; background-color: #796782; }
.segment-6 { fill: #a4a69e; background-color: #a4a69e; }
.mini-comparison { display: grid; gap: 3px; margin: 5px 0; }
.mini-comparison svg { width: 100%; height: 4px; display: block; }
.distribution { margin: 1px 18px 10px; padding: 9px 10px; background: #f5f7f4; border-radius: 6px; }
.distribution h3 { margin: 0 0 5px; font-size: .85rem; }
.distribution svg { width: 100%; height: 12px; display: block; border-radius: 4px; }
.distribution ul { display: flex; gap: 4px 13px; flex-wrap: wrap; list-style: none; padding: 0; margin: 7px 0 0; font-size: .78rem; }
.distribution li span, .legend-dot { display: inline-block; flex: 0 0 8px; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; }
.distribution li strong { margin-left: 4px; }
.composition-body { display: flex; gap: 15px; align-items: center; padding: 0 18px 10px; flex-wrap: wrap; }
.donut { width: 106px; height: 106px; flex: 0 0 106px; }
.donut-base, .donut-value { fill: none; }
.donut-base { stroke: #8e765a; }
.donut-value { stroke: var(--accent); }
.composition-legend { font-size: .87rem; }
.legend-dot { background: var(--accent); }
.legend-dot.second { background: #8e765a; }
.composition-legend strong { margin-left: 8px; }
.sort-button { padding: 0; border: 0; background: none; color: inherit; font: inherit; text-align: inherit; }
.sort-button::after { content: " ↕"; color: var(--muted); }
[aria-sort="ascending"] .sort-button::after { content: " ↑"; }
[aria-sort="descending"] .sort-button::after { content: " ↓"; }
.coverage-list { font-size: .82rem; padding-inline-end: 14px; }
.coverage-list:empty { display: none; }
@media (max-width: 1000px) {
  .chart-pair, .detail-pair { grid-template-columns: minmax(0, 1fr); gap: 0; }
}
@media (max-width: 767px) {
  .content { padding-top: 18px; }
  .period-summary { gap: 4px 10px; }
  .period-interval { padding-top: 1px; }
  .period-options summary, .optional > summary { min-height: 44px; align-content: center; }
  .sort-button { min-height: 44px; }
  .bar-list, .panel-note { padding-inline: 13px; }
}
@media (max-width: 600px) {
  .fact-band .metric-grid { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .fact-band .metric { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 1px 9px; }
  .fact-band .metric-value { margin: 0; }
  .fact-band .metric-note, .fact-band .metric-coverage, .fact-band .mini-comparison,
  .fact-band .metric-compare { grid-column: 1 / -1; }
  .fact-band .metric-note { margin-top: 0; }
}
