:root {
  color-scheme: light;
  --ink: #102a43;
  --muted: #5a738c;
  --line: rgba(16, 42, 67, 0.12);
  --paper: #ffffff;
  --bg: #eef5fc;
  --soft: #f8fbff;
  --blue: #1565c0;
  --blue-dark: #0f4f93;
  --blue-soft: rgba(21, 101, 192, 0.1);
  --coral: #b93838;
  --coral-soft: rgba(185, 56, 56, 0.12);
  --gold: #b67817;
  --gold-soft: rgba(249, 168, 37, 0.18);
  --green: #146a3d;
  --green-soft: rgba(20, 106, 61, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(180deg, var(--bg) 0%, #f8fbff 38%, #ffffff 100%);
  font-family: Tahoma, Geneva, sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  min-height: 40px;
  border: 0;
  border-radius: 6px;
  background: var(--blue);
  color: #fff;
  padding: 0 14px;
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid var(--gold-soft);
  outline-offset: 2px;
}

.shell {
  width: min(1440px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 28px 0;
}

.login-panel,
.panel,
.metric {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 10px 26px rgba(16, 42, 67, 0.06);
}

.login-panel {
  width: min(420px, 100%);
  margin: 12vh auto 0;
  padding: 28px;
}

.login-logo {
  display: block;
  width: min(260px, 100%);
  height: auto;
  margin-bottom: 18px;
}

.login-panel h1,
.topbar h1 {
  margin: 0;
  font-size: 30px;
  line-height: 1.1;
}

label {
  display: block;
  margin: 18px 0 6px;
  color: var(--muted);
  font-size: 13px;
}

input,
select {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 0 12px;
}

input {
  width: 100%;
  margin-bottom: 12px;
}

.error,
.stale,
.critical {
  color: var(--coral);
}

.warning {
  color: var(--gold);
}

.healthy {
  color: var(--green);
}

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

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

.topbar h1 {
  padding-bottom: 2px;
}

.brand-logo {
  display: block;
  width: clamp(150px, 20vw, 230px);
  height: auto;
  flex: 0 1 auto;
}

.topbar-actions,
.filters,
.pager {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.topbar-issue-select {
  margin: 0;
  min-width: 150px;
}

.eyebrow,
.timestamp,
.muted {
  color: var(--muted);
  font-size: 13px;
}

.eyebrow {
  margin: 0 0 4px;
  text-transform: uppercase;
  letter-spacing: 0;
  font-weight: 700;
}

.timestamp[data-state="stale"] {
  color: var(--coral);
  font-weight: 700;
}

.timestamp[data-state="stale"]::before {
  content: '●';
  display: inline-block;
  margin-right: 6px;
  color: var(--coral);
}

.timestamp[data-state="ok"]::before {
  content: '●';
  display: inline-block;
  margin-right: 6px;
  color: var(--green);
}

.alerts-strip {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

.alert {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
}

.alert-warning {
  background: var(--gold-soft);
  color: var(--gold);
  border: 1px solid rgba(182, 120, 23, 0.32);
}

.alert-critical {
  background: var(--coral-soft);
  color: var(--coral);
  border: 1px solid rgba(185, 56, 56, 0.32);
}

.alert strong {
  font-size: 16px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.metric {
  padding: 16px;
}

.metric strong {
  display: block;
  margin-bottom: 8px;
  font-size: 28px;
  line-height: 1;
}

.metric span {
  color: var(--muted);
  font-size: 13px;
}

.metric span small {
  margin-left: 4px;
}

.metric-primary {
  background: linear-gradient(180deg, #ffffff 0%, var(--blue-soft) 130%);
  border-color: rgba(21, 101, 192, 0.4);
}

.metric-primary strong {
  color: var(--blue-dark);
  font-size: 30px;
}

.metric-secondary {
  background: var(--soft);
}

.metric-secondary strong {
  color: var(--muted);
  font-size: 22px;
}

.list-health-panel {
  margin-bottom: 14px;
  padding: 16px 18px;
}

.list-health-panel[hidden] {
  display: none;
}

.health-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.health-cell {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--soft);
  padding: 12px;
}

.health-cell strong {
  display: block;
  margin-bottom: 4px;
  font-size: 22px;
  line-height: 1;
}

.health-cell span {
  color: var(--muted);
  font-size: 12px;
}

.health-healthy strong { color: var(--green); }
.health-warning {
  background: var(--gold-soft);
  border-color: rgba(182, 120, 23, 0.32);
}
.health-warning strong { color: var(--gold); }
.health-critical {
  background: var(--coral-soft);
  border-color: rgba(185, 56, 56, 0.32);
}
.health-critical strong { color: var(--coral); }
.health-unknown strong { color: var(--muted); }
.health-neutral strong { color: var(--ink); }

.panel-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 14px;
  margin-bottom: 14px;
}

.panel {
  min-height: 260px;
  padding: 18px;
}

.section-heading,
.chart-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.section-heading {
  margin-bottom: 12px;
}

.section-heading h2 {
  margin: 0;
}

.kit-deep-link {
  font-size: 12px;
  font-weight: 700;
  color: var(--blue-dark);
  text-decoration: none;
  border: 1px solid rgba(21, 101, 192, 0.32);
  padding: 4px 10px;
  border-radius: 6px;
}

.kit-deep-link:hover {
  background: var(--blue-soft);
}

.analytics-panel {
  min-height: 0;
  margin-bottom: 14px;
}

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

.chart-card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
  padding: 12px;
}

.chart-card h3 {
  margin: 0;
  font-size: 13px;
}

.chart-heading strong {
  color: var(--blue-dark);
  font-size: 14px;
}

.line-chart {
  display: block;
  width: 100%;
  height: 92px;
  margin-top: 8px;
}

.chart-axis {
  stroke: rgba(16, 42, 67, 0.16);
  stroke-width: 1;
}

.chart-hit {
  cursor: pointer;
  fill: transparent;
  pointer-events: all;
}

.chart-point:focus {
  outline: none;
}

.chart-point:focus .chart-dot {
  stroke: var(--ink);
  stroke-width: 1.5px;
}

.chart-tooltip {
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms ease;
}

.chart-point:hover .chart-tooltip,
.chart-point:focus .chart-tooltip,
.chart-hit:hover ~ .chart-tooltip,
.chart-dot:hover ~ .chart-tooltip {
  opacity: 1;
}

.chart-tooltip rect {
  fill: var(--ink);
  opacity: 0.94;
}

.chart-tooltip text {
  fill: #fff;
  font-size: 8.5px;
  font-weight: 700;
}

.chart-foot,
.sentiment-row,
.edition-bar-row,
.edition-bar-head {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.chart-foot {
  justify-content: space-between;
  color: var(--muted);
  font-size: 11px;
}

.chart-empty {
  min-height: 92px;
  display: grid;
  place-items: center;
  margin: 0;
  text-align: center;
  padding: 12px;
}

.edition-bars,
.sentiment-bars {
  display: grid;
  gap: 7px;
  margin-top: 10px;
}

.edition-bar-head,
.edition-bar-row {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) 44px 44px 44px;
  font-size: 12px;
}

.edition-bar-head {
  color: var(--muted);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.edition-bar-row span {
  color: var(--blue-dark);
  font-weight: 700;
}

.edition-bar-row strong,
.edition-bar-row em,
.edition-bar-row b {
  color: var(--ink);
  font-size: 11px;
  font-style: normal;
  text-align: right;
}

.edition-bar-row em {
  color: var(--gold);
}

.edition-bar-row b {
  color: var(--green);
  font-weight: 700;
}

.edition-bar-head i {
  color: var(--blue-dark);
  font-style: normal;
  font-weight: 700;
}

.bar-svg,
.sentiment-svg {
  display: block;
  width: 100%;
  min-width: 0;
  height: 8px;
}

.bar-bg {
  fill: rgba(16, 42, 67, 0.1);
}

.bar-fill {
  fill: var(--blue);
}

.sentiment-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 70px;
  font-size: 12px;
}

.sentiment-row span,
.sentiment-row strong {
  color: var(--muted);
  font-size: 11px;
}

.sentiment-row strong {
  text-align: right;
}

.sentiment-svg .love {
  background: var(--green);
  fill: var(--green);
}

.sentiment-svg .okay {
  background: var(--gold);
  fill: var(--gold);
}

.sentiment-svg .not {
  background: var(--coral);
  fill: var(--coral);
}

.split-totals,
.momentum-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.split-totals {
  margin-top: 10px;
  color: var(--muted);
  font-size: 11px;
}

.split-totals strong {
  color: var(--ink);
}

.source-split-bars {
  display: grid;
  grid-template-columns: repeat(14, minmax(0, 1fr));
  align-items: end;
  gap: 4px;
  height: 76px;
  margin-top: 8px;
}

.source-split-day {
  display: flex;
  align-items: end;
  justify-content: center;
  height: 70px;
  min-width: 0;
}

.source-split-column {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  width: 100%;
  max-width: 16px;
  overflow: hidden;
  border-radius: 4px 4px 2px 2px;
  background: rgba(16, 42, 67, 0.08);
}

.source-split-column span {
  display: block;
  width: 100%;
}

.source-facebook {
  background: #2f855a;
}

.source-website {
  background: #0f766e;
}

.momentum-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.momentum-row {
  border-top: 1px solid var(--line);
  padding-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

.momentum-row:first-child {
  border-top: 0;
  padding-top: 0;
}

.momentum-row strong {
  min-width: 30px;
  color: var(--blue-dark);
}

.momentum-row span {
  color: var(--ink);
  font-weight: 800;
}

.momentum-row span.positive {
  color: var(--green);
}

.momentum-row span.negative {
  color: var(--coral);
}

.momentum-row em {
  margin-left: auto;
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
}

.small-caption {
  font-size: 11px;
  margin: 0 0 6px;
}

.links-panel {
  margin-bottom: 14px;
  padding: 14px;
}

.panel h2 {
  margin: 0 0 12px;
  font-size: 18px;
}

.list {
  display: grid;
  gap: 8px;
}

.row {
  border-top: 1px solid var(--line);
  padding-top: 8px;
  color: var(--muted);
}

.row.divider {
  margin-top: 8px;
  border-top-color: rgba(21, 101, 192, 0.28);
}

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

.click-list {
  margin: 0;
  padding-left: 16px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
  margin-top: 4px;
}

.data-table th,
.data-table td {
  text-align: left;
  padding: 6px 8px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
}

.data-table th {
  font-weight: 600;
  color: var(--muted);
  background: rgba(21, 101, 192, 0.04);
}

.data-table td:nth-child(n+2),
.data-table th:nth-child(n+2) {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.row.warning {
  color: #b56e00;
}

.row.warning strong {
  color: #8a4f00;
}

.data-table tr.warning td {
  background: rgba(181, 110, 0, 0.06);
  color: #8a4f00;
}

.stalled-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  background: rgba(181, 110, 0, 0.18);
  color: #8a4f00;
  border-radius: 4px;
  vertical-align: middle;
}

.click-list a {
  display: block;
  color: var(--blue-dark);
  font-weight: 700;
  text-decoration: none;
}

.click-list a:hover .link-label {
  text-decoration: underline;
}

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

.link-caption {
  display: block;
  font-size: 10px;
  font-weight: 400;
}

.edition-links-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  gap: 8px;
  font-size: 12px;
}

.edition-links {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--soft);
  padding: 8px;
}

.edition-links h3 {
  margin: 0 0 5px;
  color: var(--ink);
  font-size: 12px;
}

.edition-links li {
  margin-bottom: 6px;
  overflow-wrap: anywhere;
  line-height: 1.25;
}

.link-board {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 8px;
  font-size: 13px;
}

.link-edition-block {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
  padding: 10px 12px 6px;
}

.link-edition-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 4px;
}

.link-edition-head strong {
  color: var(--blue-dark);
  font-size: 14px;
  letter-spacing: 0.04em;
}

.link-edition-head .muted {
  margin-left: auto;
  font-size: 11px;
}

.link-row {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) 160px 60px;
  align-items: center;
  gap: 12px;
  padding: 8px 4px;
  border-bottom: 1px solid var(--line);
}

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

.link-rank {
  color: var(--muted);
  font-weight: 700;
  font-size: 12px;
  text-align: center;
}

.link-body {
  min-width: 0;
}

.link-body a {
  display: block;
  color: var(--blue-dark);
  font-weight: 600;
  text-decoration: none;
  line-height: 1.3;
  overflow: hidden;
}

.link-body a:hover .link-label {
  text-decoration: underline;
}

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

.link-caption {
  display: block;
  font-size: 11px;
  font-weight: 400;
  margin-top: 2px;
  color: var(--muted);
  /* Wide screens: keep on a single line with ellipsis. CSS below switches
     to wrapping when the panel narrows. */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.link-bar {
  display: block;
  height: 8px;
  background: rgba(16, 42, 67, 0.08);
  border-radius: 4px;
  overflow: hidden;
}

.link-bar > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--blue) 0%, var(--blue-dark) 100%);
  border-radius: 4px;
}

.link-count {
  color: var(--ink);
  font-size: 14px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 1100px) {
  .link-board {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .link-row {
    grid-template-columns: 22px minmax(0, 1fr) 50px;
    gap: 8px;
  }

  .link-bar { display: none; }

  .link-caption {
    white-space: normal;
    overflow-wrap: anywhere;
    text-overflow: clip;
  }
}

.country-bars {
  display: grid;
  gap: 6px;
  padding: 6px 0 4px;
}

.country-row {
  display: grid;
  grid-template-columns: 22px 30px 1fr auto;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}

.country-row strong small {
  font-weight: 400;
  margin-left: 2px;
}

.country-row .country-code {
  color: var(--blue-dark);
  font-weight: 700;
}

.country-bar {
  display: block;
  height: 8px;
  background: rgba(16, 42, 67, 0.08);
  border-radius: 4px;
  overflow: hidden;
}

.country-bar > span {
  display: block;
  height: 100%;
  background: var(--blue);
}

.country-row strong {
  color: var(--ink);
  text-align: right;
  font-size: 11px;
}

.flag {
  width: 22px;
  height: 16px;
  border-radius: 2px;
  object-fit: cover;
  display: block;
}

.flag-placeholder {
  font-size: 14px;
  color: var(--muted);
  text-align: center;
}

.cohort-grid,
.tenure-grid {
  display: grid;
  gap: 4px;
  font-size: 11px;
  margin-top: 8px;
}

.cohort-row {
  display: grid;
  grid-template-columns: 100px repeat(12, minmax(0, 1fr));
  gap: 2px;
  align-items: center;
}

.cohort-row.cohort-head {
  color: var(--muted);
  font-size: 10px;
}

.cohort-row > span {
  text-align: center;
  padding: 4px 2px;
  background: var(--soft);
  border-radius: 2px;
}

.cohort-cell {
  color: var(--ink);
  font-weight: 700;
}

.tenure-row {
  display: grid;
  grid-template-columns: 130px 1fr 50px;
  gap: 8px;
  align-items: center;
  font-size: 12px;
}

.tenure-bar {
  display: block;
  height: 8px;
  background: rgba(16, 42, 67, 0.08);
  border-radius: 4px;
  overflow: hidden;
}

.tenure-bar > span {
  display: block;
  height: 100%;
  background: var(--green);
}

.acq-section {
  margin-top: 14px;
}

.acq-section:first-child {
  margin-top: 8px;
}

.acq-section h3 {
  margin: 0 0 8px;
  font-size: 13px;
  color: var(--blue-dark);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.channel-mix {
  display: grid;
  gap: 8px;
}

.channel-row {
  display: grid;
  grid-template-columns: 130px 1fr 36px 50px;
  gap: 10px;
  align-items: center;
  font-size: 13px;
}

.channel-row strong {
  color: var(--ink);
  font-weight: 600;
}

.channel-bar {
  display: block;
  height: 10px;
  background: rgba(16, 42, 67, 0.08);
  border-radius: 5px;
  overflow: hidden;
}

.channel-bar > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #2f855a 0%, #0f766e 100%);
  border-radius: 5px;
}

.channel-row em {
  color: var(--ink);
  font-style: normal;
  font-weight: 700;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.channel-row small {
  color: var(--muted);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.geo-board {
  display: grid;
  gap: 6px;
}

.geo-row {
  display: grid;
  grid-template-columns: 22px 32px 1fr 48px 70px;
  gap: 8px;
  align-items: center;
  font-size: 13px;
}

.geo-row strong {
  color: var(--blue-dark);
  font-weight: 700;
}

.geo-bar {
  display: block;
  height: 8px;
  background: rgba(16, 42, 67, 0.08);
  border-radius: 4px;
  overflow: hidden;
}

.geo-bar > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--gold) 0%, var(--coral) 100%);
  border-radius: 4px;
}

.geo-row em {
  color: var(--ink);
  font-style: normal;
  font-weight: 700;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.geo-row small {
  color: var(--muted);
  text-align: right;
  white-space: nowrap;
}

.ttfc-bars {
  display: grid;
  gap: 6px;
  margin-top: 8px;
}

.ttfc-row {
  display: grid;
  grid-template-columns: 90px 1fr 50px;
  gap: 8px;
  align-items: center;
  font-size: 12px;
}

.ttfc-bar {
  display: block;
  height: 8px;
  background: rgba(16, 42, 67, 0.08);
  border-radius: 4px;
}

.ttfc-bar > span {
  display: block;
  height: 100%;
  background: var(--blue-dark);
  border-radius: 4px;
}

.slot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin-top: 8px;
}

.slot-cell {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
  padding: 12px;
}

.slot-cell h3 {
  margin: 0 0 6px;
  font-size: 12px;
  color: var(--blue-dark);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.slot-cell strong {
  display: block;
  font-size: 22px;
  margin-bottom: 6px;
}

.slot-bar {
  display: block;
  height: 6px;
  background: rgba(16, 42, 67, 0.08);
  border-radius: 4px;
  margin-bottom: 6px;
}

.slot-bar > span {
  display: block;
  height: 100%;
  background: var(--blue);
  border-radius: 4px;
}

.toolbar {
  margin-bottom: 12px;
}

.inline-label {
  display: inline-grid;
  gap: 4px;
  margin: 0;
  min-width: 150px;
}

.inline-label span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.comments-panel {
  display: flex;
  flex-direction: column;
  height: 560px;
  min-height: 560px;
}

.comments-list {
  display: grid;
  flex: 1;
  min-height: 0;
  overflow: auto;
  align-content: start;
  gap: 10px;
  padding-right: 4px;
}

.comment {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--soft);
  padding: 10px;
}

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

.filters {
  margin-bottom: 10px;
}

.filters button,
.secondary-button,
.pager button {
  min-height: 32px;
  background: var(--blue-soft);
  color: var(--blue-dark);
}

.filters button.active,
.pager button:not(:disabled):hover,
.secondary-button:hover {
  background: var(--blue);
  color: #fff;
}

.pager {
  justify-content: space-between;
  margin-top: 10px;
}

.pager button:disabled {
  opacity: 0.45;
  cursor: default;
}

@media (max-width: 700px) {
  .metric-grid,
  .health-grid,
  .panel-grid,
  .analytics-grid {
    grid-template-columns: 1fr;
  }

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

  .brand-block {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .brand-logo {
    width: min(230px, 80vw);
  }

  .comments-panel {
    height: 620px;
    min-height: 620px;
  }

  .geo-engagement {
    grid-template-columns: 1fr;
  }

  .cohort-row {
    grid-template-columns: 80px repeat(6, minmax(0, 1fr));
  }
}

@media (min-width: 701px) and (max-width: 900px) {
  .metric-grid,
  .health-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

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

@media (min-width: 901px) and (max-width: 1100px) {
  .metric-grid,
  .health-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

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

/* Plan 10, Section 3 — Cockpit panel. */
.cockpit-panel {
  padding: 18px 22px;
  margin-bottom: 14px;
}

.cockpit-heading {
  align-items: center;
}

.cockpit-stale-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 6px;
  background: var(--gold-soft);
  color: var(--gold);
  font-size: 12px;
  font-weight: 700;
}

.cockpit-list {
  list-style: none;
  padding: 0;
  margin: 0 0 14px;
  display: grid;
  gap: 4px;
}

.cockpit-step {
  display: grid;
  grid-template-columns: auto auto 1fr auto;
  align-items: baseline;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 6px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
}

.cockpit-step[data-state="ok"] {
  color: var(--green);
}

.cockpit-step[data-state="current"] {
  color: var(--blue-dark);
  background: var(--blue-soft);
  font-weight: 600;
}

.cockpit-step[data-state="todo"] {
  color: var(--muted);
}

.cockpit-step[data-state="warning"] {
  color: var(--gold);
  background: var(--gold-soft);
}

.cockpit-step[data-state="blocked"] {
  color: var(--coral);
  background: var(--coral-soft);
}

.cockpit-icon {
  font-weight: 700;
}

.cockpit-id {
  opacity: 0.7;
}

.cockpit-note {
  font-size: 12px;
  text-align: right;
}

.cockpit-detail {
  grid-column: 1 / -1;
  margin-top: 4px;
  font-family: inherit;
}

.cockpit-detail summary {
  cursor: pointer;
  font-size: 12px;
  color: var(--muted);
}

.cockpit-detail pre {
  max-height: 240px;
  overflow: auto;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px;
  font-size: 11px;
}

.cockpit-apify {
  margin-top: 6px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
}

.cockpit-apify h3 {
  margin: 0 0 6px;
  font-size: 14px;
}

.cockpit-warn {
  display: inline-block;
  background: var(--gold-soft);
  color: var(--gold);
  padding: 1px 8px;
  border-radius: 6px;
  font-size: 11px;
  margin-left: 6px;
}

.cockpit-critical {
  display: inline-block;
  background: var(--coral-soft);
  color: var(--coral);
  padding: 1px 8px;
  border-radius: 6px;
  font-size: 11px;
  margin-left: 6px;
}

/* Plan 10, Section 5 — Per-source freshness tags. */
.freshness {
  display: inline-block;
  margin-left: 8px;
  font-size: 12px;
  color: var(--muted);
}

.freshness.stale {
  color: var(--coral);
  font-weight: 600;
}

/* Plan 10, Section 1 — Refresh-now dialog. */
.refresh-dialog {
  width: min(800px, calc(100vw - 32px));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

.refresh-dialog::backdrop {
  background: rgba(16, 42, 67, 0.42);
}

.refresh-dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.refresh-dialog-header h2 {
  margin: 0;
  font-size: 18px;
}

#refresh-log {
  max-height: 60vh;
  overflow: auto;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  white-space: pre-wrap;
  word-break: break-word;
}
