:root {
  --sidebar-width: 240px;
  --evergreen: #102f25;
  --evergreen-deep: #0b281f;
  --green: #08734d;
  --green-strong: #056641;
  --mint: #e4f6ed;
  --canvas: #f4f7f5;
  --ink: #142821;
  --muted: #5f6d66;
  --white: #ffffff;
  --line: rgba(20, 40, 33, 0.13);
  --line-strong: rgba(20, 40, 33, 0.22);
  --green-line: rgba(8, 115, 77, 0.28);
  --red: #b94d47;
  --red-soft: #f9ebe9;
  --amber: #a56d16;
  --amber-soft: #fbf3df;
  --blue: #426f9f;
  --purple: #7b609b;
  --shadow-panel: 0 1px 2px rgba(16, 47, 37, 0.04), 0 8px 28px rgba(16, 47, 37, 0.045);
  --shadow-float: 0 20px 60px rgba(6, 31, 23, 0.2);
  --radius: 8px;
  --radius-small: 6px;
  --font-ui: "DM Sans", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-display: "Manrope", "DM Sans", ui-sans-serif, system-ui, sans-serif;
  color-scheme: light;
}

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

html {
  min-width: 320px;
  min-height: 100%;
  background: var(--canvas);
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background: var(--canvas);
  color: var(--ink);
  font: 400 14px/1.5 var(--font-ui);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

body.drawer-open,
body.nav-open,
body.menu-open,
body.modal-open {
  overflow: hidden;
}

[hidden] {
  display: none !important;
}

button,
input,
select,
textarea {
  margin: 0;
  color: inherit;
  font: inherit;
}

button,
select {
  cursor: pointer;
}

button:disabled,
input:disabled,
select:disabled {
  cursor: not-allowed;
}

a {
  color: var(--green);
  text-underline-offset: 3px;
}

h1,
h2,
h3,
h4,
p {
  margin-top: 0;
}

h1,
h2,
h3,
h4 {
  color: var(--ink);
  font-family: var(--font-display);
  line-height: 1.2;
  letter-spacing: -0.025em;
}

svg {
  display: block;
  flex: 0 0 auto;
}

button svg,
a svg,
.kpi-icon svg,
.empty-state svg,
.callout svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

::selection {
  background: var(--mint);
  color: var(--evergreen);
}

:focus-visible {
  outline: 3px solid rgba(8, 115, 77, 0.28);
  outline-offset: 2px;
}

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

.skip-link {
  position: fixed;
  top: 10px;
  left: 12px;
  z-index: 1000;
  padding: 9px 13px;
  transform: translateY(-160%);
  border-radius: var(--radius-small);
  background: var(--white);
  box-shadow: var(--shadow-float);
  color: var(--evergreen);
  font-weight: 700;
  text-decoration: none;
  transition: transform 160ms ease;
}

.skip-link:focus {
  transform: translateY(0);
}

.app-shell {
  min-height: 100vh;
}

/* Sidebar */

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 50;
  display: flex;
  width: var(--sidebar-width);
  min-height: 100vh;
  flex-direction: column;
  overflow: hidden;
  background: var(--evergreen);
  color: var(--white);
}

.brand {
  display: flex;
  min-height: 82px;
  align-items: center;
  padding: 22px 24px 19px;
  color: var(--white);
  font-family: var(--font-display);
  font-size: 27px;
  font-weight: 800;
  letter-spacing: -0.065em;
  line-height: 1;
  user-select: none;
}

.brand-boss {
  display: inline-flex;
  align-items: center;
}

.brand-target {
  position: relative;
  display: inline-block;
  width: 0.76em;
  height: 0.76em;
  margin: 0 0.025em 0 0.015em;
  border: 2.5px solid #65d6a7;
  border-radius: 50%;
}

.brand-target::before,
.brand-target::after {
  position: absolute;
  content: "";
}

.brand-target::before {
  inset: 3px;
  border: 1.5px solid #65d6a7;
  border-radius: 50%;
}

.brand-target::after {
  top: -3px;
  left: 50%;
  width: 2px;
  height: calc(100% + 6px);
  transform: translateX(-50%) rotate(45deg);
  background: #65d6a7;
}

.primary-nav {
  display: flex;
  min-height: 0;
  flex: 1;
  flex-direction: column;
  gap: 15px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0 10px 18px;
  scrollbar-color: rgba(255, 255, 255, 0.22) transparent;
  scrollbar-width: thin;
}

.nav-group {
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  gap: 3px;
}

.nav-group-label {
  display: block;
  padding: 0 12px 4px;
  color: rgba(228, 246, 237, 0.44);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.105em;
  line-height: 1.3;
  text-transform: uppercase;
  user-select: none;
}

.nav-link {
  position: relative;
  display: grid;
  min-height: 43px;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border: 1px solid transparent;
  border-radius: var(--radius-small);
  color: rgba(255, 255, 255, 0.84);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  transition: color 150ms ease, background 150ms ease, border-color 150ms ease;
}

.nav-link::before {
  position: absolute;
  inset: 9px auto 9px -1px;
  width: 3px;
  border-radius: 0 2px 2px 0;
  background: #55cfa0;
  content: "";
  opacity: 0;
  transform: scaleY(0.55);
  transition: opacity 150ms ease, transform 150ms ease;
}

.nav-link svg {
  width: 22px;
  height: 22px;
  stroke-width: 1.75;
}

.nav-link:hover {
  background: rgba(255, 255, 255, 0.065);
  color: var(--white);
}

.nav-link.active,
.nav-link[aria-current="page"] {
  border-color: rgba(255, 255, 255, 0.06);
  background: rgba(228, 246, 237, 0.12);
  color: var(--white);
  font-weight: 600;
}

.nav-link.active::before,
.nav-link[aria-current="page"]::before {
  opacity: 1;
  transform: scaleY(1);
}

.nav-link:focus-visible {
  outline-color: rgba(228, 246, 237, 0.65);
  outline-offset: -1px;
}

.nav-count {
  display: inline-flex;
  min-width: 23px;
  height: 21px;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.85);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.sidebar-footer {
  flex: 0 0 auto;
  padding: 14px 16px 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.source-status {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 12px;
  border: 1px solid rgba(228, 246, 237, 0.18);
  border-radius: var(--radius);
  color: rgba(255, 255, 255, 0.72);
  font-size: 11.5px;
  text-decoration: none;
  transition: border-color 150ms ease, background 150ms ease;
}

.source-status:hover {
  border-color: rgba(228, 246, 237, 0.34);
  background: rgba(255, 255, 255, 0.035);
}

.source-status-line {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 3px;
  color: var(--white);
  font-size: 12.5px;
}

.source-status-line strong {
  overflow: hidden;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.source-indicator {
  width: 9px;
  height: 9px;
  flex: 0 0 auto;
  border: 2px solid rgba(255, 255, 255, 0.26);
  border-radius: 50%;
  background: transparent;
}

.source-indicator.connected,
.source-status.connected .source-indicator,
.source-status[data-state="connected"] .source-indicator {
  border-color: #57d2a1;
  background: #57d2a1;
  box-shadow: 0 0 0 3px rgba(87, 210, 161, 0.12);
}

.source-indicator.warning,
.source-status.warning .source-indicator,
.source-status[data-state="warning"] .source-indicator {
  border-color: #e6bb63;
  background: #e6bb63;
}

.source-name,
.source-meta {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.source-name {
  color: rgba(255, 255, 255, 0.86);
}

.source-details {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 7px;
  color: #7dddb7;
  font-weight: 600;
}

.source-details svg {
  width: 15px;
  height: 15px;
}

.nav-backdrop {
  position: fixed;
  inset: 0;
  z-index: 45;
  display: none;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: rgba(5, 26, 20, 0.48);
  opacity: 0;
}

/* Main header and actions */

.main-shell {
  width: calc(100% - var(--sidebar-width));
  min-width: 0;
  min-height: 100vh;
  margin-left: var(--sidebar-width);
}

.page-header {
  position: relative;
  z-index: 15;
  display: flex;
  min-height: 108px;
  align-items: flex-start;
  gap: 24px;
  padding: 27px 32px 18px;
  background: var(--canvas);
}

.page-heading {
  min-width: 0;
  flex: 1 1 auto;
}

.page-heading h1 {
  margin-bottom: 5px;
  font-size: clamp(25px, 2.2vw, 32px);
  font-weight: 700;
  letter-spacing: -0.045em;
}

.page-heading p {
  max-width: 670px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 14.5px;
}

.header-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 10px;
  padding-top: 7px;
}

.button,
.icon-button,
.chip,
.pagination button,
.pagination a {
  border: 1px solid transparent;
  border-radius: var(--radius-small);
  background: transparent;
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease, box-shadow 150ms ease, transform 150ms ease;
}

.button {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 13px;
  white-space: nowrap;
}

.button svg {
  width: 18px;
  height: 18px;
}

.button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.button:active:not(:disabled) {
  transform: translateY(0);
}

.button-primary {
  border-color: var(--green);
  background: var(--green);
  color: var(--white);
  box-shadow: 0 4px 12px rgba(8, 115, 77, 0.14);
}

.button-primary:hover:not(:disabled) {
  border-color: var(--green-strong);
  background: var(--green-strong);
  box-shadow: 0 7px 18px rgba(8, 115, 77, 0.2);
}

.button-secondary {
  border-color: var(--green-line);
  background: rgba(255, 255, 255, 0.7);
  color: var(--green-strong);
}

.button-secondary:hover:not(:disabled) {
  border-color: var(--green);
  background: var(--white);
}

.button-quiet {
  border-color: var(--line);
  background: var(--white);
}

.button-quiet:hover:not(:disabled) {
  border-color: var(--line-strong);
  background: var(--canvas);
}

.button-danger {
  border-color: rgba(185, 77, 71, 0.35);
  background: var(--white);
  color: var(--red);
}

.button:disabled,
.icon-button:disabled,
.chip:disabled {
  opacity: 0.42;
  box-shadow: none;
  transform: none;
}

.icon-button {
  display: inline-flex;
  width: 38px;
  height: 38px;
  align-items: center;
  justify-content: center;
  padding: 0;
  border-color: var(--line);
  background: var(--white);
}

.icon-button:hover:not(:disabled) {
  border-color: var(--green-line);
  background: var(--mint);
  color: var(--green);
}

.menu-toggle {
  display: none;
  margin-top: 1px;
}

/* Renderer-compatible button and icon aliases */

.btn {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 7px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-small);
  background: var(--white);
  color: var(--ink);
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease, box-shadow 150ms ease, transform 150ms ease;
}

.btn:hover:not(:disabled) {
  border-color: var(--green-line);
  background: var(--mint);
  color: var(--green-strong);
  transform: translateY(-1px);
}

.btn:active:not(:disabled) {
  transform: translateY(0);
}

.btn.primary {
  border-color: var(--green);
  background: var(--green);
  color: var(--white);
  box-shadow: 0 4px 12px rgba(8, 115, 77, 0.14);
}

.btn.primary:hover:not(:disabled) {
  border-color: var(--green-strong);
  background: var(--green-strong);
  color: var(--white);
}

.btn.subtle {
  border-color: var(--line);
  background: #f8faf9;
  color: var(--muted);
}

.btn.danger-subtle {
  border-color: rgba(185, 77, 71, 0.28);
  background: var(--white);
  color: var(--red);
}

.btn.danger-subtle:hover:not(:disabled) {
  border-color: rgba(185, 77, 71, 0.45);
  background: var(--red-soft);
  color: #843b36;
}

.btn.full-width {
  width: calc(100% - 32px);
  margin: 0 16px 16px;
}

.btn.selected {
  border-color: var(--green);
  background: var(--mint);
  color: var(--green-strong);
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.42;
  transform: none;
}

.icon {
  display: block;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.text-link {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 5px;
  padding-top: 2px;
  color: var(--green);
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}

.text-link:hover {
  text-decoration: underline;
}

button.text-link {
  min-height: 0;
  padding: 2px 0 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  font-family: inherit;
  cursor: pointer;
}

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

/* Dynamic view and dashboard primitives */

.view {
  width: 100%;
  max-width: 1680px;
  margin: 0 auto;
  padding: 0 32px 42px;
}

.view:focus {
  outline: 3px solid rgba(8, 115, 77, 0.45);
  outline-offset: -3px;
}

.view > * + * {
  margin-top: 16px;
}

.view-stack {
  display: grid;
  gap: 14px;
}

.view-stack > * {
  min-width: 0;
}

.section-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 14px;
}

.section-header h2,
.section-header h3 {
  margin-bottom: 3px;
  font-size: 18px;
  font-weight: 700;
}

.section-header p {
  max-width: 680px;
  margin-bottom: 0;
  color: var(--muted);
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.kpi-grid.four-up {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.kpi-card {
  display: grid;
  min-width: 0;
  min-height: 116px;
  grid-template-columns: 46px minmax(0, 1fr);
  grid-template-rows: auto auto 1fr;
  column-gap: 12px;
  align-items: center;
  padding: 17px 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
  box-shadow: var(--shadow-panel);
}

.kpi-card.accent {
  border-color: var(--green-line);
}

.kpi-icon {
  display: inline-flex;
  width: 44px;
  height: 44px;
  grid-row: 1 / span 3;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--mint);
  color: var(--evergreen);
}

.kpi-card:nth-child(3n) .kpi-icon {
  background: var(--canvas);
}

.kpi-icon svg {
  width: 24px;
  height: 24px;
}

.kpi-label {
  overflow: hidden;
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kpi-value {
  overflow: hidden;
  margin-top: 1px;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: clamp(21px, 2vw, 28px);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  letter-spacing: -0.045em;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kpi-note {
  align-self: end;
  margin-top: 4px;
  overflow: hidden;
  color: var(--muted);
  font-size: 11.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kpi-note strong,
.kpi-note .positive {
  color: var(--green);
  font-weight: 700;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.dashboard-grid.wide-left {
  grid-template-columns: minmax(0, 1.75fr) minmax(285px, 0.85fr);
}

.panel {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
  box-shadow: var(--shadow-panel);
}

.panel-head {
  display: flex;
  min-height: 56px;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 15px 16px 11px;
}

.panel-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.025em;
}

.panel-copy {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12.5px;
}

.panel-stat {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.panel-body {
  padding: 4px 16px 16px;
}

.panel > .data-toolbar:first-child,
.panel > .filter-grid:first-child {
  border-top: 0;
}

.metric-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: rgba(244, 247, 245, 0.65);
}

.metric-strip > * {
  min-width: 0;
  padding: 13px 16px;
  border-right: 1px solid var(--line);
}

.metric-strip > *:last-child {
  border-right: 0;
}

.metric-strip .label,
.metric-strip > div > span:first-child,
.stat-label,
.detail-label {
  display: block;
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.015em;
}

.metric-strip strong,
.stat-value {
  font-family: var(--font-display);
  font-size: 18px;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

/* Charts, legends, and trend graphics */

.chart-stage {
  position: relative;
  min-height: 270px;
  overflow: hidden;
  padding: 6px 15px 15px;
}

.chart-stage.compact {
  min-height: 190px;
}

.chart-stage svg {
  width: 100%;
  height: auto;
  max-height: 390px;
  overflow: visible;
}

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

.chart__title {
  fill: var(--ink) !important;
  font-family: var(--font-display) !important;
  font-size: 13px !important;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.chart__grid {
  stroke: rgba(20, 40, 33, 0.1);
  stroke-dasharray: 3 4;
  stroke-width: 1;
}

.chart__axis {
  fill: none;
  stroke: rgba(20, 40, 33, 0.2);
  stroke-width: 1;
}

.chart__axis-label,
.chart__legend-title {
  fill: var(--ink) !important;
  font-size: 10.5px !important;
  font-weight: 600;
}

.chart__tick-label,
.chart__legend-item text,
.chart__legend-more,
.chart__empty,
.horizontal-bars__label,
.horizontal-bars__value {
  fill: var(--muted) !important;
  font-family: var(--font-ui) !important;
  font-size: 10.5px !important;
}

.chart__line {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chart__point,
.bubble-chart__point,
.donut-chart__segment,
.horizontal-bars__bar {
  transition: opacity 140ms ease, filter 140ms ease;
}

.chart__point:hover,
.chart__point:focus,
.bubble-chart__point:hover,
.bubble-chart__point:focus,
.donut-chart__segment:hover,
.donut-chart__segment:focus,
.horizontal-bars__bar:hover,
.horizontal-bars__bar:focus {
  filter: brightness(0.92) saturate(1.08);
  outline: none;
  opacity: 1;
}

.chart-stage svg text {
  fill: var(--muted);
  font-family: var(--font-ui);
  font-size: 11px;
}

.chart-stage .grid-line,
.chart-stage .chart-grid line,
.chart-stage .chart-axis line {
  stroke: rgba(20, 40, 33, 0.1);
  stroke-dasharray: 3 4;
  stroke-width: 1;
}

.chart-stage .axis-line,
.chart-stage .chart-axis path {
  fill: none;
  stroke: rgba(20, 40, 33, 0.18);
  stroke-width: 1;
}

.chart-stage .trend-line,
.chart-stage .line-series {
  fill: none;
  stroke: var(--green);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.5;
}

.chart-stage .trend-area,
.chart-stage .area-series {
  fill: var(--mint);
  opacity: 0.72;
}

.chart-stage .data-point {
  fill: var(--green);
  stroke: var(--white);
  stroke-width: 1.5;
}

.chart-stage .threshold {
  stroke: var(--green);
  stroke-dasharray: 5 4;
  stroke-width: 1.25;
}

.chart-empty {
  display: flex;
  min-height: 250px;
  align-items: center;
  justify-content: center;
  padding: 28px;
  color: var(--muted);
  text-align: center;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  padding: 5px 16px 14px;
  color: var(--muted);
  font-size: 11.5px;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend-item::before,
.legend-swatch {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--legend-color, var(--green));
  content: "";
}

.legend-item::before {
  display: none;
}

.legend-item > i,
.legend-swatch {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--legend-color, var(--green));
}

.legend-item strong {
  margin-left: auto;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.donut-layout {
  display: grid;
  grid-template-columns: minmax(150px, 0.9fr) minmax(180px, 1.1fr);
  align-items: center;
  gap: 18px;
  padding: 7px 18px 20px;
}

.donut-chart {
  position: relative;
  display: grid;
  width: min(100%, 190px);
  aspect-ratio: 1;
  place-items: center;
  justify-self: center;
  border-radius: 50%;
}

.donut-chart svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.donut-chart__track {
  stroke: #edf2ef;
}

.donut-chart__center {
  fill: var(--ink) !important;
  font-family: var(--font-display) !important;
  font-size: 17px !important;
  font-weight: 700;
}

.donut-chart__center-label {
  fill: var(--muted) !important;
  font-size: 10px !important;
}

.donut-center {
  position: absolute;
  display: grid;
  inset: 25%;
  place-content: center;
  border-radius: 50%;
  background: var(--white);
  text-align: center;
}

.donut-center strong {
  font-family: var(--font-display);
  font-size: 18px;
  font-variant-numeric: tabular-nums;
}

.donut-center span {
  color: var(--muted);
  font-size: 10px;
}

.sparkline {
  display: inline-block;
  width: auto;
  max-width: 100%;
  height: 28px;
  vertical-align: middle;
}

.sparkline path,
.sparkline polyline {
  fill: none;
  stroke: var(--green);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.6;
}

.sparkline .spark-area {
  fill: var(--mint);
  stroke: none;
}

.sparkline.negative path,
.sparkline.negative polyline,
.sparkline path.negative {
  stroke: var(--red);
}

.sparkline.negative .spark-area {
  fill: var(--red-soft);
}

.sparkline__empty {
  stroke: rgba(20, 40, 33, 0.2);
  stroke-dasharray: 2 3;
}

.sparkline__line {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Filters and control bars */

.data-toolbar {
  display: flex;
  min-height: 54px;
  flex-wrap: wrap;
  align-items: center;
  gap: 9px;
  padding: 10px 12px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: rgba(244, 247, 245, 0.45);
}

.filters-panel {
  overflow: visible;
}

.filters-panel .data-toolbar:first-child {
  border-top: 0;
  border-radius: var(--radius) var(--radius) 0 0;
}

.toolbar-spacer {
  flex: 1 1 auto;
}

.filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(148px, 1fr));
  gap: 11px;
  padding: 14px 16px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: rgba(244, 247, 245, 0.45);
}

.field {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 6px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
}

.field > span,
.field > label {
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
}

.field input,
.field select,
.field textarea,
.search-input,
.data-toolbar input,
.data-toolbar select {
  width: 100%;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-small);
  outline: 0;
  background-color: var(--white);
  color: var(--ink);
  font-size: 13px;
  font-weight: 400;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.field select,
.data-toolbar select {
  padding-right: 31px;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%236c7b75' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.7'%3E%3Cpath d='m6 8 4 4 4-4'/%3E%3C/svg%3E");
  background-position: right 8px center;
  background-repeat: no-repeat;
  background-size: 18px;
}

.field textarea {
  min-height: 90px;
  resize: vertical;
}

.field input:hover,
.field select:hover,
.field textarea:hover,
.search-input:hover,
.data-toolbar input:hover,
.data-toolbar select:hover {
  border-color: var(--green-line);
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.search-input:focus,
.data-toolbar input:focus,
.data-toolbar select:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(8, 115, 77, 0.1);
}

.field input::placeholder,
.field textarea::placeholder,
.search-input::placeholder,
.data-toolbar input::placeholder {
  color: #8c9893;
  opacity: 1;
}

.search-field {
  position: relative;
  min-width: 210px;
}

.search-field svg {
  position: absolute;
  top: 50%;
  left: 10px;
  width: 17px;
  height: 17px;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}

.search-field input {
  padding-left: 34px;
}

.input-with-icon {
  position: relative;
  display: block;
  min-width: 0;
}

.input-with-icon > .icon {
  position: absolute;
  top: 50%;
  left: 10px;
  z-index: 1;
  width: 17px;
  height: 17px;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}

.input-with-icon > input,
.input-with-icon > select {
  padding-left: 34px;
}

.field-search {
  min-width: 220px;
  flex: 1 1 260px;
}

.inline-field {
  min-width: 88px;
  flex-direction: row;
  align-items: center;
}

.inline-field > span {
  flex: 0 0 auto;
}

.inline-field select {
  min-width: 68px;
}

.inline-checkbox {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  align-self: flex-end;
  min-height: 38px;
  cursor: pointer;
  user-select: none;
}

.inline-checkbox > input[type='checkbox'] {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--green);
  cursor: pointer;
}

.inline-checkbox > span {
  flex: 0 0 auto;
  cursor: pointer;
}

.filter-result {
  display: flex;
  min-height: 62px;
  align-items: flex-start;
  justify-content: center;
  flex-direction: column;
  padding: 7px 12px;
  border-left: 1px solid var(--line);
}

.filter-result strong {
  font-family: var(--font-display);
  font-size: 18px;
  font-variant-numeric: tabular-nums;
}

.filter-result span {
  color: var(--muted);
  font-size: 11px;
}

.exclude-filter-builder {
  display: flex;
  gap: 8px;
  align-items: center;
}

.exclude-filter-builder input {
  flex: 1;
}

.filter-tag-list {
  margin-top: 6px;
}

.filter-tag-list .chip {
  padding: 5px 8px;
  min-height: 28px;
}

.chip-group {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 10px;
  border-color: var(--line);
  background: var(--white);
  color: var(--muted);
  font-size: 12px;
}

.chip:hover:not(:disabled) {
  border-color: var(--green-line);
  color: var(--green);
}

.chip.active,
.chip[aria-pressed="true"] {
  border-color: var(--green);
  background: var(--mint);
  color: var(--green-strong);
}

/* Tables and row states */

.table-wrap {
  width: 100%;
  overflow: auto;
  overscroll-behavior-inline: contain;
  scrollbar-color: rgba(20, 40, 33, 0.24) transparent;
  scrollbar-width: thin;
}

.data-table {
  width: 100%;
  min-width: 920px;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.data-table th,
.data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}

.data-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f8faf9;
  color: #52625c;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.015em;
}

.data-table th:first-child,
.data-table td:first-child {
  padding-left: 16px;
}

.data-table th:last-child,
.data-table td:last-child {
  padding-right: 16px;
}

.data-table tbody tr {
  background: var(--white);
  transition: background-color 120ms ease;
}

.data-table tbody tr:hover {
  background: rgba(228, 246, 237, 0.38);
}

.data-table tbody tr.selected,
.data-table tbody tr[aria-selected="true"] {
  background: rgba(228, 246, 237, 0.66);
}

.data-table tbody tr:last-child td {
  border-bottom: 0;
}

.data-table th button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font-size: inherit;
  font-weight: inherit;
}

.sort-button.active {
  color: var(--green-strong);
}

.select-cell,
.shortlist-cell,
.row-number {
  width: 46px;
  text-align: center !important;
}

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

.all-fields-table .sticky-keyword {
  position: sticky;
  left: 0;
  z-index: 1;
  border-right: 1px solid var(--line);
  background: inherit;
}

.all-fields-table th.sticky-keyword {
  z-index: 4;
  background: #f8faf9;
}

.all-fields-table td.sticky-keyword {
  background: var(--white);
}

.all-fields-table tr:hover td.sticky-keyword {
  background: #f3faf6;
}

.compact-table td,
.compact-table th {
  padding-top: 9px;
  padding-bottom: 9px;
}

.table-select,
.rationale-cell input {
  min-height: 32px;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 5px;
  outline: none;
  background: var(--white);
  font-size: 11.5px;
}

.table-select:focus,
.rationale-cell input:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 2px rgba(8, 115, 77, 0.1);
}

.rationale-cell input {
  width: 230px;
}

.missing {
  color: #64716b;
  font-style: italic;
}

.intent-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.intent-label > i {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--intent-color, var(--green));
}

.shortlist-toggle {
  width: 31px;
  height: 31px;
  border-color: transparent;
  background: transparent;
  color: #84918c;
}

.shortlist-toggle:hover,
.shortlist-toggle.selected,
.shortlist-toggle[aria-pressed="true"] {
  border-color: transparent;
  background: var(--mint);
  color: var(--green);
}

.shortlist-toggle.selected svg,
.shortlist-toggle[aria-pressed="true"] svg {
  fill: currentColor;
}

.data-table th button:hover {
  color: var(--green);
}

.data-table th[aria-sort="ascending"],
.data-table th[aria-sort="descending"] {
  color: var(--green-strong);
}

.data-table input[type="checkbox"],
.cluster-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--green);
}

.keyword-cell {
  display: flex;
  min-width: 190px;
  max-width: 360px;
  align-items: center;
  gap: 7px;
}

.keyword-cell button,
.keyword-cell a {
  overflow: hidden;
  border: 0;
  background: transparent;
  color: var(--green-strong);
  font-weight: 500;
  text-align: left;
  text-decoration: underline;
  text-decoration-color: rgba(8, 115, 77, 0.35);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.keyword-cell button:hover,
.keyword-cell a:hover {
  text-decoration-color: currentColor;
}

.num,
.numeric {
  text-align: right !important;
  font-variant-numeric: tabular-nums;
}

.score-meter {
  display: inline-flex;
  min-width: 88px;
  align-items: center;
  gap: 7px;
}

.score-meter > span:first-child,
.score-value {
  width: 25px;
  color: var(--ink);
  font-weight: 600;
  text-align: right;
}

.score-track {
  width: 52px;
  height: 5px;
  overflow: hidden;
  border-radius: 3px;
  background: rgba(20, 40, 33, 0.1);
}

.score-bar {
  display: block;
  width: var(--score, 0%);
  max-width: 100%;
  height: 100%;
  border-radius: inherit;
  background: var(--green);
}

.intent-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 6px;
  border-radius: 50%;
  background: var(--intent-color, var(--green));
}

.intent-dot.informational,
.intent-informational .intent-dot {
  --intent-color: #5a93d6;
}

.intent-dot.commercial,
.intent-commercial .intent-dot {
  --intent-color: #daa03f;
}

.intent-dot.transactional,
.intent-transactional .intent-dot {
  --intent-color: #2baa7b;
}

.intent-dot.navigational,
.intent-navigational .intent-dot {
  --intent-color: #8a68b7;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-weight: 600;
}

.status::before {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: currentColor;
  content: "";
}

.status-positive,
.positive {
  color: var(--green) !important;
}

.status-negative,
.negative {
  color: var(--red) !important;
}

.status-unknown,
.unknown {
  color: var(--muted) !important;
}

.pagination {
  display: flex;
  min-height: 52px;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
  padding: 9px 14px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

.table-footer {
  display: flex;
  min-height: 46px;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 9px 14px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 11.5px;
}

.page-controls {
  display: flex;
  align-items: center;
  gap: 4px;
}

.page-gap {
  padding: 0 4px;
  color: var(--muted);
}

.pagination .page-summary {
  margin-right: auto;
}

.pagination button,
.pagination a {
  display: inline-flex;
  min-width: 32px;
  height: 32px;
  align-items: center;
  justify-content: center;
  padding: 0 8px;
  border-color: transparent;
  color: var(--muted);
  font-size: 12px;
}

.pagination button:hover:not(:disabled),
.pagination a:hover {
  border-color: var(--line);
  background: var(--canvas);
  color: var(--green);
}

.pagination button.active,
.pagination a.active,
.pagination [aria-current="page"] {
  border-color: var(--green);
  background: var(--mint);
  color: var(--green-strong);
}

/* Ranked lists, clusters, source signals, and schema */

.insight-list,
.rank-list,
.stat-list {
  margin: 0;
  padding: 0 16px 14px;
  list-style: none;
}

.insight-list > li,
.rank-list > li,
.stat-list > li,
.stat-list > div {
  display: grid;
  min-height: 44px;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  border-bottom: 1px solid var(--line);
}

.insight-list > li:last-child,
.rank-list > li:last-child,
.stat-list > li:last-child,
.stat-list > div:last-child {
  border-bottom: 0;
}

.rank-list .rank {
  display: inline-flex;
  width: 23px;
  height: 23px;
  align-items: center;
  justify-content: center;
  margin-right: 8px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.cluster-grid,
.source-grid,
.health-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.cluster-row {
  display: grid;
  min-width: 0;
  min-height: 88px;
  grid-template-columns: minmax(0, 1fr) auto;
  align-content: center;
  gap: 5px 14px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
  text-align: left;
  transition: border-color 150ms ease, background-color 150ms ease, transform 150ms ease;
}

button.cluster-row:hover,
a.cluster-row:hover {
  border-color: var(--green-line);
  background: rgba(228, 246, 237, 0.3);
  transform: translateY(-1px);
}

.cluster-row h3,
.cluster-row strong {
  overflow: hidden;
  margin: 0;
  font-size: 13.5px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cluster-row p,
.cluster-row small {
  margin: 0;
  color: var(--muted);
  font-size: 11.5px;
}

.cluster-row .cluster-score {
  grid-row: 1 / span 2;
  grid-column: 2;
  align-self: center;
  color: var(--green);
  font-family: var(--font-display);
  font-size: 20px;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.source-grid > *,
.health-summary > * {
  min-width: 0;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
  box-shadow: var(--shadow-panel);
}

.trend-controls {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto;
  align-items: end;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
}

.trend-picker {
  display: grid;
  min-width: 0;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 10px;
}

.selected-keyword-title {
  width: calc(100% - 32px);
  margin: 0 16px 8px;
  padding: 11px 0;
  overflow: hidden;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--green-strong);
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stat-list dt {
  color: var(--muted);
}

.stat-list dd {
  margin: 0;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.metric-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
}

.type-label {
  display: inline-block;
  padding: 2px 6px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--canvas);
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}

.coverage-cell {
  min-width: 155px;
}

.coverage-cell > span {
  display: inline-block;
  width: 46px;
  margin-right: 8px;
  text-align: right;
}

.coverage-cell .coverage-track {
  display: inline-block;
  width: 80px;
  vertical-align: middle;
}

.sample-cell {
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.health-summary > div > span,
.health-summary > div > small {
  display: block;
}

.health-summary > div > span {
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
}

.health-summary > div > strong {
  display: block;
  margin: 3px 0 6px;
  font-family: var(--font-display);
  font-size: 23px;
  font-variant-numeric: tabular-nums;
}

.health-summary > div > small {
  color: var(--muted);
  font-size: 10.5px;
}

.health-ranks {
  display: grid;
  gap: 14px;
  padding-top: 4px;
}

.rank-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 5px 12px;
}

.rank-row > strong {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.rank-row > i {
  display: block;
  height: 5px;
  grid-column: 1 / -1;
  max-width: 100%;
  border-radius: 3px;
  background: var(--green);
}

.rank-row > small {
  grid-column: 1 / -1;
  color: var(--muted);
}

.source-grid h3,
.health-summary h3 {
  margin-bottom: 5px;
  font-size: 14px;
  font-weight: 700;
}

.source-grid p,
.health-summary p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 12px;
}

.schema-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.schema-table th,
.schema-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

.schema-table th {
  background: #f8faf9;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 700;
}

.schema-table tr:last-child td {
  border-bottom: 0;
}

.coverage-track {
  width: min(160px, 100%);
  height: 6px;
  overflow: hidden;
  border-radius: 3px;
  background: rgba(20, 40, 33, 0.1);
}

.coverage-fill {
  display: block;
  width: var(--coverage, 0%);
  max-width: 100%;
  height: 100%;
  border-radius: inherit;
  background: var(--green);
}

/* Details, callouts, empty states */

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.detail-content .detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 15px;
  border-bottom: 1px solid var(--line);
}

.detail-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 7px;
}

.detail-header h2 {
  margin: 2px 0 4px;
  font-size: 21px;
}

.detail-header p {
  margin: 0;
  color: var(--muted);
  font-size: 11.5px;
}

.detail-kicker {
  color: var(--green);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.detail-content .detail-grid > div {
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
  background: var(--canvas);
}

.detail-content .detail-grid > div > span {
  display: block;
  color: var(--muted);
  font-size: 10.5px;
}

.detail-content .detail-grid > div > strong {
  display: block;
  margin-top: 2px;
  overflow: hidden;
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.detail-chart {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.detail-chart .chart {
  width: 100%;
  height: auto;
  padding: 0 8px 8px;
}

.decision-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.decision-grid .field-wide {
  grid-column: 1 / -1;
}

.detail-rows {
  margin: 0;
}

.detail-rows dt,
.detail-rows dd {
  margin: 0;
}

.detail-rows .detail-row {
  grid-template-columns: minmax(120px, 0.8fr) minmax(0, 1.2fr);
}

/* Methodology view */

.methodology-lead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  padding: 24px;
  border: 1px solid var(--green-line);
  border-radius: var(--radius);
  background: var(--mint);
}

.methodology-lead h2 {
  margin-bottom: 6px;
  font-size: 22px;
}

.methodology-lead p {
  max-width: 760px;
  margin: 0;
  color: #466057;
}

.method-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.method-grid .panel {
  position: relative;
  min-height: 150px;
  padding: 19px;
}

.method-grid h3 {
  margin: 22px 0 5px;
  font-size: 15px;
}

.method-grid p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.step-number {
  position: absolute;
  top: 14px;
  right: 15px;
  color: rgba(8, 115, 77, 0.28);
  font-family: var(--font-display);
  font-size: 23px;
  font-weight: 800;
}

.workflow-list {
  margin: 0;
  padding: 0 18px 16px 48px;
}

.workflow-list li {
  padding: 9px 0 9px 4px;
  border-bottom: 1px solid var(--line);
}

.workflow-list li:last-child {
  border-bottom: 0;
}

.workflow-list strong,
.workflow-list span {
  display: block;
}

.workflow-list strong {
  font-size: 12.5px;
}

.workflow-list span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11.5px;
}

.mapping-list {
  padding: 0 16px 16px;
}

.mapping-list > div {
  display: grid;
  min-height: 40px;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--line);
}

.mapping-list > div:last-child {
  border-bottom: 0;
}

.mapping-list code {
  overflow: hidden;
  color: var(--muted);
  font-size: 10.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mapping-list strong {
  overflow: hidden;
  font-size: 11.5px;
  text-overflow: ellipsis;
  text-transform: capitalize;
  white-space: nowrap;
}

.detail-group {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.detail-group h3 {
  margin-bottom: 8px;
  font-size: 13.5px;
}

.detail-row {
  display: grid;
  min-height: 36px;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
}

.detail-row:last-child {
  border-bottom: 0;
}

.detail-row > :first-child {
  color: var(--muted);
}

.detail-row > :last-child {
  max-width: 240px;
  overflow-wrap: anywhere;
  font-weight: 600;
  text-align: right;
}

.callout {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 11px;
  padding: 13px 14px;
  border: 1px solid var(--green-line);
  border-radius: var(--radius);
  background: var(--mint);
  color: var(--evergreen);
}

.callout.warning {
  border-color: rgba(165, 109, 22, 0.27);
  background: var(--amber-soft);
  color: #755019;
}

.callout.danger,
.callout.error {
  border-color: rgba(185, 77, 71, 0.3);
  background: var(--red-soft);
  color: #843b36;
}

.callout h3,
.callout strong {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
}

.callout p {
  margin: 3px 0 0;
  font-size: 12px;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

/* Data context and optional evidence */

.context-badges {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.context-badge {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border: 1px solid var(--green-line);
  border-radius: 999px;
  background: rgba(228, 246, 237, 0.72);
  color: var(--green-strong);
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  line-height: 1.3;
}

.context-badge.warning {
  border-color: rgba(165, 109, 22, 0.27);
  background: var(--amber-soft);
  color: #755019;
}

.context-badge.muted {
  border-color: var(--line);
  background: var(--canvas);
  color: var(--muted);
}

.context-badge.positive {
  color: var(--green-strong) !important;
}

.coverage-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 9px 11px;
  border-left: 3px solid var(--green);
  border-radius: 0 var(--radius-small) var(--radius-small) 0;
  background: rgba(228, 246, 237, 0.52);
  color: #466057;
  font-size: 11.5px;
}

.coverage-note.warning {
  border-left-color: var(--amber);
  background: rgba(251, 243, 223, 0.74);
  color: #755019;
}

.serp-action-row {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 9px 14px;
  padding: 10px 12px;
  border-top: 1px solid var(--line);
  background: rgba(244, 247, 245, 0.45);
}

.serp-query {
  min-width: 0;
  flex: 1 1 220px;
  overflow: hidden;
  color: var(--muted);
  font-size: 11.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.serp-action-row .btn,
.serp-action-row .button {
  flex: 0 0 auto;
}

.optional-panel-empty {
  display: grid;
  min-height: 112px;
  place-content: center;
  gap: 5px;
  padding: 20px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: rgba(244, 247, 245, 0.48);
  color: var(--muted);
  text-align: center;
}

.optional-panel-empty strong {
  color: var(--ink);
  font-size: 12.5px;
}

.optional-panel-empty p {
  max-width: 480px;
  margin: 0;
  font-size: 11.5px;
}

.empty-state {
  display: flex;
  min-height: 290px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: 38px 22px;
  color: var(--muted);
  text-align: center;
}

.empty-state .empty-icon,
.empty-state > svg {
  display: inline-flex;
  width: 48px;
  height: 48px;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
  padding: 11px;
  border-radius: 50%;
  background: var(--mint);
  color: var(--green);
}

.empty-state h2,
.empty-state h3 {
  margin-bottom: 6px;
  color: var(--ink);
  font-size: 17px;
}

.empty-state p {
  max-width: 460px;
  margin-bottom: 16px;
}

.error-state .empty-icon,
.error-state > svg {
  background: var(--red-soft);
  color: var(--red);
}

/* Initial and incremental loading */

.skeleton-view {
  display: grid;
  gap: 14px;
}

.skeleton {
  border-radius: var(--radius);
  background: rgba(20, 40, 33, 0.085);
  animation: skeleton-pulse 1.35s ease-in-out infinite alternate;
}

.skeleton-heading {
  width: 230px;
  height: 20px;
}

.skeleton-card {
  min-height: 116px;
}

.skeleton-panel {
  min-height: 390px;
}

@keyframes skeleton-pulse {
  from { opacity: 0.52; }
  to { opacity: 1; }
}

/* Dialog */

.dialog {
  width: min(540px, calc(100vw - 32px));
  max-width: none;
  max-height: calc(100vh - 36px);
  padding: 0;
  overflow: visible;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--ink);
}

.dialog::backdrop {
  background: rgba(7, 30, 23, 0.56);
  backdrop-filter: blur(2px);
}

.dialog[open] {
  animation: dialog-in 170ms ease-out;
}

.dialog-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--white);
  box-shadow: var(--shadow-float);
}

.dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 22px 22px 16px;
}

.dialog-head h2 {
  margin-bottom: 5px;
  font-size: 20px;
  font-weight: 700;
}

.dialog-head p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 12.5px;
}

.dialog-close {
  width: 34px;
  height: 34px;
  margin-top: -5px;
  margin-right: -5px;
  flex: 0 0 auto;
  border-color: transparent;
}

.dialog-card > .field {
  padding: 4px 22px 0;
}

.dialog-card > .field input {
  min-height: 44px;
}

.form-note,
.form-error {
  margin: 9px 22px 0;
  font-size: 11.5px;
}

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

.form-error {
  color: var(--red);
  font-weight: 600;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 20px;
  padding: 14px 22px 20px;
  border-top: 1px solid var(--line);
}

@keyframes dialog-in {
  from { opacity: 0; transform: translateY(9px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Detail drawer */

.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 70;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: rgba(7, 30, 23, 0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
}

.detail-drawer {
  position: fixed;
  inset: 0 0 0 auto;
  z-index: 75;
  display: flex;
  width: min(500px, calc(100vw - 28px));
  flex-direction: column;
  overflow: hidden;
  border-left: 1px solid var(--line);
  background: var(--white);
  box-shadow: -20px 0 60px rgba(7, 30, 23, 0.18);
  opacity: 0;
  transform: translateX(102%);
  transition: opacity 180ms ease, transform 220ms ease;
  visibility: hidden;
}

.detail-drawer.open,
.detail-drawer.is-open,
.detail-drawer[aria-hidden="false"] {
  opacity: 1;
  transform: translateX(0);
  visibility: visible;
}

body.drawer-open .drawer-backdrop,
body.detail-open .drawer-backdrop,
.drawer-backdrop.open,
.drawer-backdrop.is-open {
  opacity: 1;
  pointer-events: auto;
}

.drawer-head {
  display: flex;
  min-height: 83px;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 17px 20px;
  border-bottom: 1px solid var(--line);
}

.drawer-head h2 {
  max-width: 390px;
  margin: 2px 0 0;
  overflow: hidden;
  font-size: 19px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.drawer-label {
  color: var(--green);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.detail-content {
  min-height: 0;
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 20px;
}

.detail-content > * + * {
  margin-top: 14px;
}

/* Drag/drop, progress, and toast feedback */

.drop-overlay {
  position: fixed;
  inset: 12px;
  z-index: 110;
  display: grid;
  place-items: center;
  border: 2px dashed rgba(87, 210, 161, 0.85);
  border-radius: 12px;
  background: rgba(16, 47, 37, 0.95);
  color: var(--white);
  pointer-events: none;
}

.drop-overlay.active,
.drop-overlay.is-active {
  display: grid !important;
}

.drop-message {
  display: flex;
  max-width: 520px;
  align-items: center;
  flex-direction: column;
  padding: 36px;
  text-align: center;
}

.drop-message svg {
  width: 54px;
  height: 54px;
  margin-bottom: 16px;
  color: #78dcb5;
  stroke-width: 1.4;
}

.drop-message strong {
  font-family: var(--font-display);
  font-size: 23px;
}

.drop-message span {
  margin-top: 6px;
  color: rgba(255, 255, 255, 0.68);
}

.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 105;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(244, 247, 245, 0.84);
  backdrop-filter: blur(3px);
}

.loading-card {
  display: grid;
  width: min(430px, 100%);
  grid-template-columns: 40px minmax(0, 1fr);
  gap: 12px 14px;
  align-items: center;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--white);
  box-shadow: var(--shadow-float);
}

.loading-mark {
  position: relative;
  width: 36px;
  height: 36px;
  grid-row: 1;
  border: 3px solid var(--mint);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin 800ms linear infinite;
}

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

.loading-copy strong {
  font-family: var(--font-display);
  font-size: 14px;
}

.loading-copy span {
  overflow: hidden;
  color: var(--muted);
  font-size: 11.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.loading-progress {
  height: 5px;
  grid-column: 1 / -1;
  overflow: hidden;
  border-radius: 3px;
  background: rgba(20, 40, 33, 0.1);
}

.loading-progress > span {
  display: block;
  width: 34%;
  height: 100%;
  border-radius: inherit;
  background: var(--green);
  animation: loading-sweep 1.25s ease-in-out infinite;
}

@keyframes loading-sweep {
  0% { transform: translateX(-120%); }
  55% { transform: translateX(120%); }
  100% { transform: translateX(300%); }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.toast-region {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 130;
  display: flex;
  width: min(380px, calc(100vw - 32px));
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  pointer-events: none;
}

.toast,
.toast-message {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: start;
  gap: 10px;
  padding: 12px 13px;
  border: 1px solid rgba(228, 246, 237, 0.14);
  border-radius: var(--radius);
  background: var(--evergreen);
  box-shadow: var(--shadow-float);
  color: var(--white);
  font-size: 12.5px;
  pointer-events: auto;
  animation: toast-in 180ms ease-out;
}

.toast {
  opacity: 0;
  transform: translateY(8px);
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast.success,
.toast-message.success {
  border-left: 3px solid #57d2a1;
}

.toast.error,
.toast-message.error,
.toast-error {
  border-left: 3px solid #e08b83;
}

.toast-success {
  border-left: 3px solid #57d2a1;
}

.toast button,
.toast-message button {
  padding: 0;
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.72);
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.noscript-message {
  position: fixed;
  inset: auto 0 0;
  z-index: 200;
  padding: 12px 20px;
  background: var(--red);
  color: var(--white);
  font-weight: 600;
  text-align: center;
}

/* Responsive layout */

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

  .kpi-card:nth-child(n + 4) {
    min-height: 104px;
  }

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

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

@media (max-width: 1120px) {
  .page-header {
    flex-wrap: wrap;
  }

  .page-heading {
    flex-basis: calc(100% - 62px);
  }

  .header-actions {
    width: 100%;
    padding-top: 0;
  }

  .dashboard-grid,
  .dashboard-grid.wide-left {
    grid-template-columns: minmax(0, 1fr);
  }

  .chart-stage {
    min-height: 240px;
  }

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

@media (max-width: 880px) {
  .sidebar {
    width: min(282px, calc(100vw - 54px));
    box-shadow: 18px 0 50px rgba(7, 30, 23, 0.18);
    transform: translateX(-103%);
    transition: transform 210ms ease, visibility 210ms step-end;
    visibility: hidden;
  }

  .sidebar.open,
  .sidebar.is-open,
  .sidebar[aria-hidden="false"],
  body.nav-open .sidebar,
  body.menu-open .sidebar,
  body.sidebar-open .sidebar {
    transform: translateX(0);
    transition: transform 210ms ease, visibility 0ms;
    visibility: visible;
  }

  .nav-backdrop {
    display: block;
    pointer-events: none;
    transition: opacity 180ms ease;
  }

  .nav-backdrop.open,
  .nav-backdrop.is-open,
  body.nav-open .nav-backdrop,
  body.menu-open .nav-backdrop,
  body.sidebar-open .nav-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  .main-shell {
    width: 100%;
    margin-left: 0;
  }

  .menu-toggle {
    display: inline-flex;
    flex: 0 0 auto;
  }

  .page-header {
    min-height: 0;
    padding: 21px 24px 18px;
  }

  .view {
    padding-right: 24px;
    padding-left: 24px;
  }

  .page-heading h1 {
    font-size: 26px;
  }
}

@media (max-width: 680px) {
  .page-header {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr);
    gap: 16px 12px;
    padding: 16px 16px 15px;
  }

  .page-heading {
    min-width: 0;
  }

  .page-heading h1 {
    margin-top: 1px;
    margin-bottom: 4px;
    font-size: 23px;
  }

  .page-heading p {
    display: -webkit-box;
    overflow: hidden;
    font-size: 13px;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .header-actions {
    display: grid;
    width: 100%;
    grid-column: 1 / -1;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .header-actions .button {
    width: 100%;
  }

  .header-actions #export-trigger {
    grid-column: 1 / -1;
  }

  .view {
    padding: 0 16px 28px;
  }

  .view > * + * {
    margin-top: 12px;
  }

  .section-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 9px;
  }

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

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

  .kpi-card,
  .kpi-card:nth-child(n + 4) {
    min-height: 112px;
    grid-template-columns: 36px minmax(0, 1fr);
    column-gap: 9px;
    padding: 13px 11px;
  }

  .kpi-icon {
    width: 35px;
    height: 35px;
  }

  .kpi-icon svg {
    width: 20px;
    height: 20px;
  }

  .kpi-label {
    font-size: 11px;
  }

  .kpi-value {
    font-size: 20px;
  }

  .kpi-note {
    font-size: 10px;
  }

  .panel-head {
    min-height: 0;
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
    padding: 14px;
  }

  .panel-body {
    padding-right: 14px;
    padding-left: 14px;
  }

  .data-toolbar {
    align-items: stretch;
    padding: 10px;
  }

  .trend-controls {
    grid-template-columns: minmax(0, 1fr);
    align-items: stretch;
  }

  .trend-controls .field-search {
    width: 100%;
  }

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

  .data-toolbar > .field,
  .data-toolbar > .search-field,
  .data-toolbar > input,
  .data-toolbar > select {
    width: 100%;
    flex: 1 1 100%;
  }

  .toolbar-spacer {
    display: none;
  }

  .filter-grid {
    grid-template-columns: minmax(0, 1fr);
    padding: 12px;
  }

  .chip-group {
    width: 100%;
  }

  .chip-group .chip {
    flex: 1 1 auto;
  }

  .chart-stage {
    min-height: 210px;
    overflow-x: auto;
    padding-right: 10px;
    padding-left: 10px;
  }

  .chart-stage svg[data-wide="true"] {
    min-width: 600px;
  }

  .legend {
    gap: 6px 12px;
    padding-right: 12px;
    padding-left: 12px;
  }

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

  .donut-chart {
    width: 165px;
  }

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

  .metric-strip > *:nth-child(even) {
    border-right: 0;
  }

  .metric-strip > *:nth-child(n + 3) {
    border-top: 1px solid var(--line);
  }

  .cluster-grid,
  .source-grid,
  .health-summary,
  .detail-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .health-summary.health-grid,
  .method-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .methodology-lead {
    align-items: flex-start;
    flex-direction: column;
    gap: 14px;
    padding: 18px;
  }

  .methodology-lead h2 {
    font-size: 19px;
  }

  .table-footer {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  .serp-action-row {
    align-items: stretch;
    flex-direction: column;
  }

  .serp-query {
    width: 100%;
    flex-basis: auto;
  }

  .serp-action-row .btn,
  .serp-action-row .button {
    width: 100%;
  }

  .pagination {
    justify-content: center;
    flex-wrap: wrap;
  }

  .pagination .page-summary {
    width: 100%;
    margin: 0 0 4px;
    text-align: center;
  }

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

  .dialog-actions .button {
    width: 100%;
  }

  .drawer-head,
  .detail-content {
    padding-right: 16px;
    padding-left: 16px;
  }

  .toast-region {
    right: 16px;
    bottom: 16px;
    left: 16px;
    width: auto;
  }
}

@media (max-width: 400px) {
  .brand {
    min-height: 74px;
    padding-top: 19px;
    padding-bottom: 16px;
  }

  .page-header {
    padding-right: 14px;
    padding-left: 14px;
  }

  .view {
    padding-right: 14px;
    padding-left: 14px;
  }

  .button {
    padding-right: 9px;
    padding-left: 9px;
    font-size: 12.5px;
  }

  .btn {
    padding-right: 9px;
    padding-left: 9px;
    font-size: 12.5px;
  }

  .kpi-card,
  .kpi-card:nth-child(n + 4) {
    min-height: 106px;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto auto;
    align-content: start;
  }

  .kpi-icon {
    display: none;
  }

  .kpi-label,
  .kpi-value,
  .kpi-note {
    grid-column: 1;
  }

  .kpi-value {
    margin-top: 4px;
    font-size: 21px;
  }

  .kpi-note {
    margin-top: 7px;
  }

  .source-grid > *,
  .health-summary > * {
    padding: 14px;
  }

  .detail-drawer {
    width: 100vw;
  }

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

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media print {
  body {
    background: var(--white);
  }

  .sidebar,
  .header-actions,
  .menu-toggle,
  .data-toolbar,
  .filter-grid,
  .pagination,
  .toast-region {
    display: none !important;
  }

  .main-shell {
    width: 100%;
    margin: 0;
  }

  .page-header,
  .view {
    padding-right: 0;
    padding-left: 0;
  }

  .panel,
  .kpi-card {
    break-inside: avoid;
    box-shadow: none;
  }
}
