:root {
  color-scheme: dark;
  --bg: #080b11;
  --bg-soft: #0c111a;
  --panel: rgba(16, 22, 33, 0.88);
  --panel-solid: #101621;
  --panel-hover: #151d2a;
  --line: rgba(143, 163, 191, 0.14);
  --line-strong: rgba(143, 163, 191, 0.24);
  --text: #f5f8fc;
  --text-soft: #c2cbd9;
  --muted: #7f8c9e;
  --blue: #4d9bff;
  --blue-soft: rgba(77, 155, 255, 0.13);
  --cyan: #4ad9c4;
  --cyan-soft: rgba(74, 217, 196, 0.12);
  --green: #54d99f;
  --green-soft: rgba(84, 217, 159, 0.12);
  --amber: #f4bd62;
  --amber-soft: rgba(244, 189, 98, 0.12);
  --red: #ff7887;
  --red-soft: rgba(255, 120, 135, 0.12);
  --radius-lg: 22px;
  --radius-md: 15px;
  --shadow: 0 22px 70px rgba(0, 0, 0, 0.26);
  --font-sans: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 18% -8%, rgba(40, 114, 210, 0.18), transparent 31rem),
    radial-gradient(circle at 92% 18%, rgba(45, 174, 154, 0.1), transparent 28rem),
    linear-gradient(180deg, #090d14 0%, #080b11 55%, #070a0f 100%);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  font: inherit;
}

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 100;
  padding: 9px 13px;
  color: var(--text);
  background: #172130;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  transform: translateY(-150%);
  transition: transform 160ms ease;
}

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

.dashboard-shell {
  width: min(1480px, calc(100% - 48px));
  margin: 0 auto;
  padding: 34px 0 28px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  margin-bottom: 30px;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.brand-mark {
  display: grid;
  flex: 0 0 auto;
  width: 50px;
  height: 50px;
  place-items: center;
  color: white;
  background: linear-gradient(145deg, #2787f5, #176bd0);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 16px;
  box-shadow: 0 12px 35px rgba(39, 135, 245, 0.25);
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.05em;
}

.eyebrow,
.panel-kicker,
.metric-label,
.page-lead,
.topbar h1,
.panel-header h2,
.chart-toolbar p,
.page-footer p,
.metric-value,
.metric-caption,
.trend-note,
.database-status,
.table-hint {
  margin: 0;
}

.eyebrow,
.panel-kicker {
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.topbar h1 {
  margin-top: 1px;
  font-size: clamp(25px, 3vw, 34px);
  font-weight: 760;
  letter-spacing: -0.035em;
  line-height: 1.12;
}

.page-lead {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

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

.database-status {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-soft);
  font-size: 13px;
  white-space: nowrap;
}

.status-dot {
  width: 7px;
  height: 7px;
  background: var(--green);
  border-radius: 50%;
  box-shadow: 0 0 0 5px rgba(84, 217, 159, 0.08), 0 0 18px rgba(84, 217, 159, 0.55);
}

.database-status.is-warning .status-dot {
  background: var(--amber);
  box-shadow: 0 0 0 5px rgba(244, 189, 98, 0.08), 0 0 18px rgba(244, 189, 98, 0.45);
}

.database-status.is-error .status-dot {
  background: var(--red);
  box-shadow: 0 0 0 5px rgba(255, 120, 135, 0.08), 0 0 18px rgba(255, 120, 135, 0.45);
}

.database-status.is-loading .status-dot {
  background: var(--blue);
  animation: status-pulse 1.2s ease-in-out infinite;
}

.button {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 14px;
  color: var(--text-soft);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 11px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 680;
  transition: color 150ms ease, background 150ms ease, border-color 150ms ease, transform 150ms ease;
}

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

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

.button:focus-visible,
.segmented-control button:focus-visible,
.channel-row:focus-visible,
.channel-link:focus-visible,
.table-scroll:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

.button:disabled {
  cursor: wait;
  opacity: 0.72;
}

.button-primary {
  color: #f7fbff;
  background: linear-gradient(180deg, #2e8cf2, #2479da);
  border-color: rgba(111, 178, 255, 0.32);
  box-shadow: 0 10px 28px rgba(39, 135, 245, 0.2);
}

.button-primary:hover:not(:disabled) {
  background: linear-gradient(180deg, #3895fa, #2881e5);
}

.button-quiet {
  background: rgba(128, 148, 177, 0.07);
  border-color: var(--line);
}

.button-quiet:hover:not(:disabled) {
  color: var(--text);
  background: rgba(128, 148, 177, 0.12);
  border-color: var(--line-strong);
}

.refresh-icon {
  display: inline-block;
  font-size: 18px;
  font-weight: 400;
  line-height: 1;
}

.button.is-loading .refresh-icon {
  animation: spin 850ms linear infinite;
}

.is-hidden {
  display: none !important;
}

.state-banner {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 13px;
  min-height: 62px;
  margin-bottom: 18px;
  padding: 12px 14px;
  background: var(--blue-soft);
  border: 1px solid rgba(77, 155, 255, 0.22);
  border-radius: var(--radius-md);
}

.state-banner.is-warning {
  background: var(--amber-soft);
  border-color: rgba(244, 189, 98, 0.22);
}

.state-banner.is-error {
  background: var(--red-soft);
  border-color: rgba(255, 120, 135, 0.24);
}

.state-banner-icon {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  color: var(--blue);
  background: rgba(77, 155, 255, 0.12);
  border: 1px solid rgba(77, 155, 255, 0.18);
  border-radius: 10px;
  font-size: 13px;
  font-weight: 800;
}

.state-banner.is-warning .state-banner-icon {
  color: var(--amber);
  background: rgba(244, 189, 98, 0.1);
  border-color: rgba(244, 189, 98, 0.18);
}

.state-banner.is-error .state-banner-icon {
  color: var(--red);
  background: rgba(255, 120, 135, 0.1);
  border-color: rgba(255, 120, 135, 0.18);
}

.state-banner-copy {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 10px;
  min-width: 0;
}

.state-banner-copy strong {
  font-size: 13px;
}

.state-banner-copy span {
  color: var(--text-soft);
  font-size: 13px;
}

.summary-grid {
  display: grid;
  grid-template-columns: minmax(290px, 1.65fr) repeat(3, minmax(170px, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}

.metric-card,
.panel {
  position: relative;
  overflow: hidden;
  background: linear-gradient(145deg, rgba(17, 24, 36, 0.95), rgba(13, 18, 28, 0.92));
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.metric-card {
  min-height: 152px;
  padding: 20px;
}

.metric-card::after {
  position: absolute;
  right: -42px;
  bottom: -58px;
  width: 125px;
  height: 125px;
  background: radial-gradient(circle, rgba(77, 155, 255, 0.08), transparent 67%);
  border-radius: 50%;
  content: "";
  pointer-events: none;
}

.metric-card-total {
  background:
    linear-gradient(110deg, rgba(27, 75, 129, 0.21), transparent 58%),
    linear-gradient(145deg, rgba(17, 25, 38, 0.98), rgba(13, 18, 28, 0.94));
  border-color: rgba(77, 155, 255, 0.2);
}

.metric-card-heading,
.metric-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.metric-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 690;
}

.metric-value {
  margin-top: 21px;
  font-size: clamp(27px, 3vw, 36px);
  font-variant-numeric: tabular-nums;
  font-weight: 730;
  letter-spacing: -0.04em;
  line-height: 1;
}

.metric-value-large {
  margin-top: 16px;
  font-size: clamp(38px, 4.4vw, 54px);
}

.metric-caption {
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
}

.metric-card-footer {
  margin-top: 15px;
  color: var(--muted);
  font-size: 11px;
}

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

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

.value-neutral {
  color: var(--text-soft) !important;
}

.trend-pill {
  display: inline-flex;
  min-height: 25px;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 720;
  line-height: 1.2;
  white-space: nowrap;
}

.trend-pill::before {
  font-size: 12px;
}

.trend-pill-growing {
  color: var(--green);
  background: var(--green-soft);
  border-color: rgba(84, 217, 159, 0.17);
}

.trend-pill-growing::before {
  content: "↗";
}

.trend-pill-flat {
  color: var(--amber);
  background: var(--amber-soft);
  border-color: rgba(244, 189, 98, 0.17);
}

.trend-pill-flat::before {
  content: "→";
}

.trend-pill-declining {
  color: var(--red);
  background: var(--red-soft);
  border-color: rgba(255, 120, 135, 0.17);
}

.trend-pill-declining::before {
  content: "↘";
}

.trend-pill-no-data {
  color: var(--muted);
  background: rgba(128, 148, 177, 0.08);
  border-color: var(--line);
}

.trend-pill-no-data::before {
  content: "·";
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 270px;
  gap: 14px;
  margin-bottom: 14px;
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 21px 22px 17px;
}

.panel-header h2 {
  margin-top: 3px;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.3;
}

.chart-title-row,
.channels-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.chart-selection-label,
.channels-count {
  display: inline-flex;
  min-height: 23px;
  align-items: center;
  padding: 2px 8px;
  color: var(--blue);
  background: var(--blue-soft);
  border: 1px solid rgba(77, 155, 255, 0.17);
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}

.channels-count {
  color: var(--muted);
  background: rgba(128, 148, 177, 0.07);
  border-color: var(--line);
}

.chart-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 0 22px 13px;
}

.chart-toolbar p {
  color: var(--muted);
  font-size: 12px;
}

.segmented-control {
  display: flex;
  gap: 3px;
  padding: 3px;
  background: rgba(7, 10, 15, 0.48);
  border: 1px solid var(--line);
  border-radius: 11px;
}

.segmented-control button {
  min-height: 30px;
  padding: 4px 10px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 670;
  white-space: nowrap;
  transition: color 150ms ease, background 150ms ease, box-shadow 150ms ease;
}

.segmented-control button:hover {
  color: var(--text-soft);
}

.segmented-control button.is-active {
  color: var(--text);
  background: #1a2433;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.chart-wrap {
  position: relative;
  min-height: 310px;
  margin: 0 12px;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(77, 155, 255, 0.025), transparent 58%),
    rgba(7, 10, 15, 0.24);
  border: 1px solid rgba(143, 163, 191, 0.08);
  border-radius: 15px;
}

#growth-chart {
  display: block;
  width: 100%;
  height: 310px;
  overflow: visible;
}

.chart-grid-line {
  stroke: rgba(143, 163, 191, 0.11);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.chart-grid-line-vertical {
  stroke-dasharray: 3 7;
}

.chart-axis-label {
  fill: #708095;
  font-family: var(--font-sans);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.chart-area {
  fill: url("#chart-area-gradient");
}

.chart-line-glow {
  fill: none;
  stroke: rgba(77, 155, 255, 0.18);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 11;
  vector-effect: non-scaling-stroke;
}

.chart-line {
  fill: none;
  stroke: #5da7ff;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.4;
  vector-effect: non-scaling-stroke;
}

.chart-point {
  fill: #83baff;
  stroke: #101621;
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
}

.chart-point-last {
  fill: var(--cyan);
  stroke: rgba(74, 217, 196, 0.18);
  stroke-width: 7;
}

.chart-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: 28px;
  text-align: center;
}

.chart-empty-mark {
  display: grid;
  width: 45px;
  height: 45px;
  margin-bottom: 12px;
  place-items: center;
  color: var(--blue);
  background: var(--blue-soft);
  border: 1px solid rgba(77, 155, 255, 0.16);
  border-radius: 14px;
  font-size: 22px;
}

.chart-empty strong {
  font-size: 14px;
}

.chart-empty span:last-child {
  max-width: 390px;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.chart-footer {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  min-height: 45px;
  padding: 8px 22px;
  color: var(--muted);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

.chart-footer > span:last-child {
  text-align: right;
}

.chart-range-summary {
  color: var(--text-soft);
  font-size: 11px;
  text-align: center;
}

.trend-panel {
  min-height: 100%;
}

.trend-breakdown {
  display: grid;
  gap: 3px;
  padding: 0 14px;
}

.trend-count-row {
  display: grid;
  grid-template-columns: 32px 1fr auto;
  align-items: center;
  gap: 10px;
  min-height: 53px;
  padding: 7px 8px;
  border-bottom: 1px solid rgba(143, 163, 191, 0.08);
}

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

.trend-count-icon {
  display: grid;
  width: 31px;
  height: 31px;
  place-items: center;
  border-radius: 10px;
  font-size: 16px;
}

.trend-count-growing {
  color: var(--green);
  background: var(--green-soft);
}

.trend-count-flat {
  color: var(--amber);
  background: var(--amber-soft);
}

.trend-count-declining {
  color: var(--red);
  background: var(--red-soft);
}

.trend-count-no-data {
  color: var(--muted);
  background: rgba(128, 148, 177, 0.08);
}

.trend-count-label {
  color: var(--text-soft);
  font-size: 12px;
}

.trend-count-row strong {
  font-size: 20px;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
}

.trend-count-muted strong,
.trend-count-muted .trend-count-label {
  color: var(--muted);
}

.trend-note {
  margin: 16px 21px 20px;
  padding-top: 15px;
  color: var(--muted);
  border-top: 1px solid rgba(143, 163, 191, 0.09);
  font-size: 11px;
  line-height: 1.55;
}

.channels-panel {
  margin-bottom: 14px;
}

.channels-header {
  align-items: center;
}

.table-hint {
  color: var(--muted);
  font-size: 11px;
}

.table-scroll {
  overflow-x: auto;
  border-top: 1px solid var(--line);
  scrollbar-color: #263448 transparent;
  scrollbar-width: thin;
}

table {
  width: 100%;
  min-width: 990px;
  border-collapse: collapse;
  table-layout: fixed;
}

th,
td {
  height: 61px;
  padding: 9px 13px;
  border-bottom: 1px solid rgba(143, 163, 191, 0.075);
  text-align: left;
  vertical-align: middle;
}

th:first-child,
td:first-child {
  width: 27%;
  padding-left: 22px;
}

th:nth-child(2),
td:nth-child(2) {
  width: 13%;
}

th:nth-child(3),
td:nth-child(3),
th:nth-child(4),
td:nth-child(4),
th:nth-child(5),
td:nth-child(5) {
  width: 10%;
}

th:nth-child(6),
td:nth-child(6) {
  width: 12%;
}

th:nth-child(7),
td:nth-child(7) {
  width: 18%;
}

th {
  height: 42px;
  color: var(--muted);
  background: rgba(8, 11, 17, 0.3);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

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

.numeric-column,
.numeric-cell {
  text-align: right;
}

.channel-row {
  position: relative;
  cursor: pointer;
  transition: background 130ms ease;
}

.channel-row:hover {
  background: rgba(77, 155, 255, 0.045);
}

.channel-row.is-selected {
  background: rgba(77, 155, 255, 0.085);
}

.channel-row.is-selected td:first-child {
  box-shadow: inset 2px 0 0 var(--blue);
}

.channel-row.is-placeholder {
  cursor: default;
  opacity: 0.54;
}

.channel-row.is-placeholder:hover {
  background: transparent;
}

.channel-cell {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 11px;
}

.channel-index {
  appearance: none;
  display: grid;
  flex: 0 0 auto;
  width: 31px;
  height: 31px;
  place-items: center;
  color: var(--muted);
  background: rgba(128, 148, 177, 0.07);
  border: 1px solid rgba(143, 163, 191, 0.1);
  border-radius: 10px;
  cursor: pointer;
  font-family: inherit;
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.channel-index:disabled {
  cursor: default;
  opacity: 0.55;
}

.channel-index:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

.channel-row.is-selected .channel-index {
  color: var(--blue);
  background: var(--blue-soft);
  border-color: rgba(77, 155, 255, 0.18);
}

.channel-identity {
  min-width: 0;
}

.channel-link,
.channel-name {
  display: block;
  max-width: 100%;
  overflow: hidden;
  color: var(--text);
  font-size: 12px;
  font-weight: 650;
  line-height: 1.35;
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.channel-link:hover {
  color: #80baff;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.channel-link::after {
  content: "↗";
  margin-left: 5px;
  color: #6daeff;
  font-size: 10px;
  font-weight: 800;
}

.channel-id,
.freshness-line,
.trend-basis,
.delta-percent {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.3;
}

.member-count,
.delta-value {
  color: var(--text-soft);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  font-weight: 650;
}

.delta-percent {
  font-variant-numeric: tabular-nums;
}

.freshness-cell {
  color: var(--text-soft);
  font-size: 11px;
}

.freshness-status {
  display: flex;
  align-items: center;
  gap: 7px;
}

.freshness-status::before {
  flex: 0 0 auto;
  width: 6px;
  height: 6px;
  background: var(--green);
  border-radius: 50%;
  content: "";
}

.freshness-status-stale::before {
  background: var(--amber);
}

.freshness-status-missing::before {
  background: var(--muted);
}

.freshness-line-stale {
  color: var(--amber);
}

.page-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 4px 3px;
  color: #637084;
  font-size: 10px;
}

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

noscript {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 10;
  padding: 12px 16px;
  color: var(--text);
  background: #25151a;
  border: 1px solid rgba(255, 120, 135, 0.25);
  border-radius: 12px;
  font-family: var(--font-sans);
  font-size: 13px;
}

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

@keyframes status-pulse {
  0%, 100% {
    opacity: 0.55;
    transform: scale(0.82);
  }

  50% {
    opacity: 1;
    transform: scale(1);
  }
}

@media (max-width: 1120px) {
  .summary-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .metric-card-total {
    grid-column: 1 / -1;
  }

  .metric-card-total .metric-value-large {
    font-size: 46px;
  }

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

@media (max-width: 860px) {
  .dashboard-shell {
    width: min(100% - 28px, 720px);
    padding-top: 24px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 18px;
  }

  .topbar-actions {
    width: 100%;
    justify-content: space-between;
  }

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

  .trend-breakdown {
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    padding-bottom: 18px;
  }

  .trend-count-row {
    grid-template-columns: auto 1fr;
    grid-template-rows: auto auto;
    gap: 2px 8px;
    border: 1px solid rgba(143, 163, 191, 0.08);
    border-radius: 13px;
  }

  .trend-count-icon {
    grid-row: 1 / 3;
  }

  .trend-count-row strong {
    font-size: 17px;
  }

  .trend-note {
    display: none;
  }

  .table-hint {
    display: none;
  }
}

@media (max-width: 620px) {
  .dashboard-shell {
    width: min(100% - 20px, 560px);
    padding-top: 16px;
  }

  .brand-mark {
    width: 43px;
    height: 43px;
    border-radius: 14px;
  }

  .page-lead {
    display: none;
  }

  .topbar-actions {
    align-items: stretch;
    flex-direction: column-reverse;
    gap: 12px;
  }

  .button-primary {
    width: 100%;
  }

  .database-status {
    justify-content: center;
  }

  .state-banner {
    grid-template-columns: auto 1fr;
  }

  .state-banner .button {
    grid-column: 1 / -1;
    width: 100%;
  }

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

  .metric-card {
    min-height: 126px;
    padding: 15px 12px;
    border-radius: 17px;
  }

  .metric-card-total {
    min-height: 145px;
    padding: 18px;
  }

  .metric-value {
    margin-top: 18px;
    font-size: clamp(21px, 7vw, 29px);
  }

  .metric-card-total .metric-value-large {
    margin-top: 14px;
    font-size: 40px;
  }

  .metric-label {
    font-size: 10px;
  }

  .metric-caption {
    margin-top: 10px;
    font-size: 9px;
  }

  .metric-card-footer {
    font-size: 9px;
  }

  .metric-card-footer span:last-child {
    text-align: right;
  }

  .panel {
    border-radius: 18px;
  }

  .panel-header {
    padding: 18px 16px 14px;
  }

  .chart-header {
    align-items: center;
  }

  .chart-selection-label {
    display: none !important;
  }

  .chart-toolbar {
    align-items: stretch;
    flex-direction: column;
    gap: 9px;
    padding: 0 12px 11px;
  }

  .chart-toolbar > p {
    display: none;
  }

  .segmented-control {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
  }

  .segmented-control button {
    padding-inline: 5px;
  }

  .chart-wrap {
    min-height: 260px;
    margin: 0 7px;
  }

  #growth-chart {
    height: 260px;
  }

  .chart-footer {
    padding-inline: 15px;
  }

  .chart-range-summary {
    display: none;
  }

  .chart-footer {
    grid-template-columns: 1fr 1fr;
  }

  .trend-breakdown {
    grid-template-columns: repeat(2, 1fr);
    padding: 0 10px 14px;
  }

  .channels-header {
    padding-bottom: 16px;
  }

  .channels-count {
    display: none;
  }

  .page-footer {
    align-items: flex-start;
    flex-direction: column;
    gap: 3px;
    padding-inline: 4px;
  }
}

@media (max-width: 390px) {
  .summary-grid {
    grid-template-columns: 1fr;
  }

  .metric-card-total {
    grid-column: auto;
  }

  .metric-card:not(.metric-card-total) {
    display: grid;
    min-height: 84px;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 4px 12px;
  }

  .metric-card:not(.metric-card-total) .metric-value {
    grid-column: 2;
    grid-row: 1 / 3;
    margin-top: 0;
  }

  .metric-card:not(.metric-card-total) .metric-caption {
    margin-top: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
