/* =============================================================================
   Fluxology Office Scout — app-specific styling
   -----------------------------------------------------------------------------
   The shell, cards, badges, controls and dialog all come from the shared
   design-system layer (ds-tokens.css + ds-dashboard.css). Only what is unique
   to Office Scout lives here: the verification queue, the insight row, the
   at-a-glance metric strips, meters, pagination, the comparison table, price
   history sparklines and the wider workspace panel.

   ds-tokens.css and ds-dashboard.css are byte-identical across all four
   dashboards and are verified by `node tools/check-dashboard-ds.mjs`. Nothing
   here may be promoted into them without copying the change to the other three
   and re-running that check, so every new component below is Office Scout's
   own and is written against --dash-* semantic tokens only.
   ============================================================================= */

.shell { max-width: 1540px; }

/* Office Scout carries eight summary tiles rather than the design system's
   four, in two rows of four. The one .stats element always also carries
   .wide-stats, so every rule below targets .wide-stats — a bare .stats rule
   here would be shadowed by it at equal specificity and never apply. */
.wide-stats { grid-template-columns: repeat(4, 1fr); }

/* The design system's .controls is a fixed nine-track grid. Office Scout runs
   nine controls of quite different natural widths (a search box, five selects,
   two buttons and a checkbox), and any fixed track list either overflows the
   shell horizontally or strands a control on its own row. A wrapping flex row
   sizes each control to its own content and reflows instead of overflowing, so
   adding a tenth control later cannot reintroduce a sideways scrollbar. */
.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
}

.controls .search { flex: 1 1 260px; min-width: 190px; }
.controls select { flex: 1 1 158px; min-width: 148px; }
.controls .filter-button,
.controls .check,
.controls .btn { flex: 0 0 auto; }

.actions { justify-content: flex-end; }

/* Version chip beside the product name. */
.version {
  display: inline-block;
  margin-left: var(--spacing-xs);
  padding: 0.125rem 0.5rem;
  vertical-align: middle;
  font-family: var(--current-font-technical);
  font-size: var(--font-size-xs);
  letter-spacing: var(--letter-spacing-wide);
  color: var(--dash-accent-text);
  background: var(--dash-accent-soft);
  border-radius: var(--radius-full);
}

.warn-text { color: var(--dash-warn-text); }

.muted {
  font-size: var(--font-size-xs);
  line-height: var(--line-height-normal);
  color: var(--dash-muted);
}

/* A feed older than STALE_AFTER, or one that could not be loaded, must not look
   the same as a live one. */
.live.stale { color: var(--dash-warn-text); font-weight: var(--font-weight-semibold); }
.live.stale .dot {
  background: var(--dash-warn);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--dash-warn) 20%, transparent);
}

/* Blocked-storage banner — the operator's workflow state is at risk, so this
   carries full danger weight. */
.storage-warning {
  margin: var(--spacing-md) 0 0;
  padding: var(--spacing-md);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-normal);
  color: var(--dash-danger-text);
  background: var(--dash-danger-soft);
  border: var(--border-width-hairline) solid var(--dash-danger);
  border-radius: var(--radius-md);
}

/* --- Filtering stat tiles ---------------------------------------------------
   Six of the eight tiles are buttons that toggle their own filter. They keep
   the .stat surface exactly so the row still reads as one instrument panel;
   only the affordances are added. */

button.stat {
  display: block;
  width: 100%;
  text-align: left;
  cursor: pointer;
  transition: border-color var(--transition-fast) var(--ease-out-cubic),
              background var(--transition-fast) var(--ease-out-cubic);
}

button.stat:hover { background: var(--dash-surface-hover); border-color: var(--dash-border-strong); }

button.stat[aria-pressed="true"] {
  border-color: var(--dash-accent);
  background: var(--dash-accent-soft);
}

button.stat[aria-pressed="true"] b { color: var(--dash-accent-text); }

/* --- Insight row ------------------------------------------------------------ */

.insight-row {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: var(--spacing-sm);
  margin-bottom: var(--spacing-md);
}

.signal-panel,
.market-panel { padding: var(--spacing-lg); }

.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--spacing-md);
  margin-bottom: var(--spacing-sm);
}

.signal-head {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  margin-bottom: var(--spacing-sm);
}

.signal-head h3 { margin: 0; font-size: var(--font-size-md); }

.score-orb {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 52px;
  height: 52px;
  font-family: var(--current-font-technical);
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-bold);
  font-variant-numeric: tabular-nums;
  color: var(--dash-accent-text);
  background: var(--dash-accent-soft);
  border: var(--border-width-hairline) solid var(--dash-accent);
  border-radius: var(--radius-full);
}

.signal-facts {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-xs);
  margin-top: var(--spacing-sm);
}

.signal-facts span {
  padding: var(--spacing-xs) var(--spacing-sm);
  font-family: var(--current-font-technical);
  font-size: var(--font-size-xs);
  color: var(--dash-body);
  background: var(--dash-sunken);
  border-radius: var(--radius-full);
}

.market-panel h3 { margin: 0 0 var(--spacing-xs); font-size: var(--font-size-md); }

.bands { margin-top: var(--spacing-md); }

.band {
  display: grid;
  grid-template-columns: 92px 1fr 28px;
  gap: var(--spacing-sm);
  align-items: center;
  margin-bottom: var(--spacing-xs);
}

.band-label,
.band b {
  font-family: var(--current-font-technical);
  font-size: var(--font-size-xs);
  font-variant-numeric: tabular-nums;
  color: var(--dash-muted);
}

.band b { text-align: right; font-weight: var(--font-weight-bold); color: var(--dash-heading); }

/* --- Meter ------------------------------------------------------------------
   One bar primitive for every proportion in the app: Fit, the Fit breakdown,
   the cost-band histogram and the managed-provider value score. */

.meter {
  display: block;
  height: 6px;
  overflow: hidden;
  background: var(--dash-sunken);
  border-radius: var(--radius-full);
}

.meter i {
  display: block;
  height: 100%;
  background: var(--dash-accent);
  border-radius: var(--radius-full);
}

.meter.warn i { background: var(--dash-warn); }

/* --- At-a-glance metric strip ------------------------------------------------
   Used on the listing card, in the detail header and on each managed-provider
   card, so all three read the same way. */

.metrics,
.detail-metrics,
.managed-metrics {
  display: grid;
  /* Label / value / footnote, so every cell in the strip keeps its three parts
     on the same three baselines however far a label wraps. Same subgrid trick
     the design system uses for .facts, and with the same fallback. */
  grid-template-rows: auto auto auto;
  gap: var(--spacing-xs) var(--spacing-sm);
  margin-top: var(--spacing-md);
  padding: var(--spacing-sm);
  background: var(--dash-sunken);
  border-radius: var(--radius-sm);
}

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

.metric {
  display: grid;
  grid-row: span 3;
  grid-template-rows: subgrid;
  align-content: start;
  gap: var(--spacing-xs);
  min-width: 0;
}

@supports not (grid-template-rows: subgrid) {
  .metric { display: block; }
  .metric small { min-height: 2.4em; }
  .metric b { margin-top: var(--spacing-xs); }
}

.metric small {
  font-family: var(--current-font-technical);
  font-size: var(--font-size-xs);
  line-height: var(--line-height-tight);
  letter-spacing: var(--letter-spacing-wide);
  text-transform: uppercase;
  overflow-wrap: anywhere;
  color: var(--dash-muted);
}

.metric b {
  overflow: hidden;
  font-family: var(--current-font-technical);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-tight);
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--dash-heading);
}

.metric b span {
  margin-left: 0.15em;
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-regular);
  color: var(--dash-muted);
}

.metric > span {
  font-size: var(--font-size-xs);
  line-height: var(--line-height-tight);
  overflow-wrap: anywhere;
  color: var(--dash-muted);
}

/* The meter occupies the footnote row, so it lines up with the captions in the
   neighbouring cells instead of floating against the value. */
.metric .meter { align-self: center; }

.metric b.tone-gated { color: var(--dash-muted); }
.metric b.tone-unverified { color: var(--dash-warn-text); }
.metric b.tone-cited { color: var(--dash-success-text); }

/* --- Verification queue ----------------------------------------------------- */

.queue {
  padding: var(--spacing-md) var(--spacing-lg);
  margin-bottom: var(--spacing-md);
}

.queue-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--spacing-lg);
  margin-bottom: var(--spacing-md);
}

.queue-head h3 { margin: var(--spacing-xs) 0 0; font-size: var(--font-size-md); }

/* Reserved height so the panel does not jump when the queue populates. */
.queue-items {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--spacing-sm);
  min-height: 96px;
}

.queue-item {
  padding: var(--spacing-md);
  background: var(--dash-surface);
  border: var(--border-width-hairline) solid var(--dash-border);
  border-left: 3px solid var(--dash-warn);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.queue-item:hover { border-color: var(--dash-warn); }

.queue-title {
  font-family: var(--current-font-heading);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  color: var(--dash-heading);
}

.queue-meta {
  margin-top: var(--spacing-xs);
  font-family: var(--current-font-technical);
  font-size: var(--font-size-xs);
  color: var(--dash-warn-text);
}

.queue-missing {
  margin-top: var(--spacing-xs);
  font-size: var(--font-size-xs);
  line-height: var(--line-height-normal);
  color: var(--dash-muted);
}

/* --- Search help + advanced filter panel ------------------------------------ */

.search-help {
  flex: 1 1 100%;
  margin: 0;
  font-family: var(--current-font-technical);
  font-size: var(--font-size-xs);
  line-height: var(--line-height-normal);
  color: var(--dash-muted);
}

.filter-button {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-xs);
  min-height: 44px;
  white-space: nowrap;
}

.filter-button svg { width: 15px; height: 15px; stroke-width: 1.5; }

.feature-panel {
  padding: var(--spacing-md) var(--spacing-lg);
  margin: calc(-1 * var(--spacing-xs)) 0 var(--spacing-md);
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: var(--spacing-sm);
}

.feature-grid .check { white-space: normal; }

.range-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 220px));
  gap: var(--spacing-sm);
  margin-top: var(--spacing-md);
  padding-top: var(--spacing-md);
  border-top: var(--border-width-hairline) solid var(--dash-border);
}

/* --- Feed actions, result summary, pagination ------------------------------- */

.feed-actions {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--spacing-md);
  margin: var(--spacing-sm) 0 var(--spacing-md);
}

.summary-strip {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  flex: 1 1 auto;
  gap: var(--spacing-sm);
  padding: var(--spacing-sm) var(--spacing-md);
  background: var(--dash-panel);
  border: var(--border-width-hairline) solid var(--dash-border);
  border-radius: var(--radius-md);
}

.summary-cell { min-width: 0; }

.summary-cell small {
  display: block;
  font-family: var(--current-font-technical);
  font-size: var(--font-size-xs);
  line-height: var(--line-height-tight);
  letter-spacing: var(--letter-spacing-wider);
  text-transform: uppercase;
  color: var(--dash-muted);
}

.summary-cell b {
  display: block;
  margin-top: var(--spacing-xs);
  font-family: var(--current-font-technical);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-tight);
  font-variant-numeric: tabular-nums;
  color: var(--dash-heading);
}

.summary-cell span {
  display: block;
  margin-top: var(--spacing-xs);
  font-size: var(--font-size-xs);
  line-height: var(--line-height-tight);
  color: var(--dash-muted);
}

.feed-tools {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: var(--spacing-sm);
}

.feed-tools select { min-width: 130px; }

.pager { margin: var(--spacing-md) 0 var(--spacing-lg); }

.pager-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--spacing-sm);
}

.pager-range {
  font-family: var(--current-font-technical);
  font-size: var(--font-size-xs);
  font-variant-numeric: tabular-nums;
  color: var(--dash-muted);
}

.pager-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--spacing-xs);
}

.pager-page { min-width: 40px; text-align: center; }

.pager-page.current {
  color: var(--dash-on-accent);
  background: var(--dash-accent);
  border-color: var(--dash-accent);
}

.pager-page.current:hover { background: var(--dash-accent); border-color: var(--dash-accent); }

.pager-controls [disabled] { opacity: 0.45; cursor: not-allowed; }

.pager-gap {
  padding: 0 var(--spacing-xs);
  font-family: var(--current-font-technical);
  font-size: var(--font-size-xs);
  color: var(--dash-muted);
}

.empty .smallbtn { margin-top: var(--spacing-md); }

/* --- Listing card extras ---------------------------------------------------- */

.card { position: relative; }
.card.inactive { opacity: 0.67; }

/* Workflow stripe down the leading edge — an at-a-glance state marker on the
   card, kept from the pre-overhaul dashboard. */
.card.workflow-rejected { box-shadow: inset 3px 0 0 var(--dash-danger); }
.card.workflow-leased { box-shadow: inset 3px 0 0 var(--dash-success); }
.card.workflow-contacted,
.card.workflow-tour_booked { box-shadow: inset 3px 0 0 var(--dash-accent); }

.card.workflow-rejected:hover,
.card.workflow-leased:hover,
.card.workflow-contacted:hover,
.card.workflow-tour_booked:hover { box-shadow: inset 3px 0 0 currentColor, var(--dash-shadow); }

.card.workflow-rejected:hover { color: var(--dash-danger); }
.card.workflow-leased:hover { color: var(--dash-success); }
.card.workflow-contacted:hover,
.card.workflow-tour_booked:hover { color: var(--dash-accent); }

.city { font-size: var(--font-size-xs); color: var(--dash-muted); }

/* The card is itself a button, so the compare toggle has to stop its own click
   from opening the dialog; app.js does that, and this only keeps it clear of
   the badge row. */
.compare-pick {
  position: absolute;
  top: var(--spacing-sm);
  left: var(--spacing-sm);
  z-index: var(--z-content);
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  font-family: var(--current-font-technical);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-bold);
  color: var(--dash-muted);
  background: var(--dash-page);
  border: var(--border-width-hairline) solid var(--dash-border);
  border-radius: var(--radius-full);
  cursor: pointer;
  opacity: 0;
  transition: opacity var(--transition-fast) var(--ease-out-cubic);
}

/* Never opacity-hide it from the keyboard: :focus-visible and the selected
   state both force it back. */
.card:hover .compare-pick,
.compare-pick:focus-visible,
.compare-pick.selected { opacity: 1; }

.compare-pick.selected {
  color: var(--dash-on-accent);
  background: var(--dash-accent);
  border-color: var(--dash-accent);
}

.cost-line {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--spacing-sm);
}

.cost-line > div:first-child { min-width: 0; }

.budget-state {
  flex: 0 0 auto;
  padding: var(--spacing-xs) var(--spacing-sm);
  font-family: var(--current-font-technical);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  white-space: nowrap;
  border-radius: var(--radius-sm);
}

.budget-state.in,
.badge.budget-badge.in { color: var(--dash-success-text); background: var(--dash-success-soft); }
.budget-state.near,
.badge.budget-badge.near { color: var(--dash-warn-text); background: var(--dash-warn-soft); }
.budget-state.over,
.badge.budget-badge.over { color: var(--dash-danger-text); background: var(--dash-danger-soft); }
.budget-state.unknown,
.badge.budget-badge.unknown { color: var(--dash-muted); background: var(--dash-sunken); }

.badge.budget-badge.in { border-color: var(--dash-success); }
.badge.budget-badge.near { border-color: var(--dash-warn); }
.badge.budget-badge.over { border-color: var(--dash-danger); }
.badge.budget-badge.unknown { border-color: var(--dash-border); }

.asking {
  margin-top: var(--spacing-xs);
  font-family: var(--current-font-technical);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-regular);
  letter-spacing: var(--letter-spacing-normal);
  color: var(--dash-muted);
}

.delta { font-weight: var(--font-weight-semibold); }
.delta.down { color: var(--dash-success-text); }
.delta.up { color: var(--dash-danger-text); }

.chips { display: flex; flex-wrap: wrap; gap: var(--spacing-xs); }

.card-bottom {
  display: grid;
  grid-template-columns: 1fr 112px;
  gap: var(--spacing-sm);
  align-items: end;
}

.date { display: block; }
.date div + div { margin-top: var(--spacing-xs); }

/* --- Office Scout badge tones ---------------------------------------------- */

.badge.pipeline-badge,
.badge.saved-badge {
  color: var(--dash-accent-text);
  border-color: var(--dash-accent);
  background: var(--dash-accent-soft);
}

.badge.rejected-badge {
  color: var(--dash-danger-text);
  border-color: var(--dash-danger);
  background: var(--dash-danger-soft);
}

.badge.leased-badge {
  color: var(--dash-success-text);
  border-color: var(--dash-success);
  background: var(--dash-success-soft);
}

/* --- Price-history sparkline ------------------------------------------------ */

.spark-wrap { position: relative; height: 45px; }
.spark { display: block; width: 100%; height: 45px; overflow: visible; }

.spark-line {
  fill: none;
  stroke: var(--dash-spark-line);
  stroke-width: 2.5;
  vector-effect: non-scaling-stroke;
}

.spark-area { fill: color-mix(in srgb, var(--dash-spark-line) 12%, transparent); }
.spark-dot { fill: var(--dash-spark-line); }

.spark-baseline {
  stroke: var(--dash-border);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.spark-label {
  position: absolute;
  right: 0;
  top: -4px;
  font-family: var(--current-font-technical);
  font-size: var(--font-size-xs);
  color: var(--dash-muted);
}

.big-spark { height: 96px; }
.big-spark .spark { height: 96px; }

.history-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--spacing-sm);
  margin-bottom: var(--spacing-sm);
}

.history-summary,
.history-list {
  font-family: var(--current-font-technical);
  font-size: var(--font-size-xs);
  color: var(--dash-muted);
}

.history-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-sm) var(--spacing-md);
  margin-top: var(--spacing-sm);
}

/* --- Fit breakdown ---------------------------------------------------------- */

.score-bars { display: grid; gap: var(--spacing-xs); }

.score-line {
  display: grid;
  grid-template-columns: 130px 1fr 26px;
  gap: var(--spacing-sm);
  align-items: center;
  font-size: var(--font-size-xs);
  color: var(--dash-muted);
}

.score-line b {
  font-family: var(--current-font-technical);
  font-variant-numeric: tabular-nums;
  text-align: right;
  color: var(--dash-heading);
}

/* A component can score below zero (over budget), and it must not read as a
   normal contribution. */
.score-line b.score-penalty { color: var(--dash-danger-text); }

/* --- Dialog specifics -------------------------------------------------------- */

dialog { width: min(980px, calc(100vw - 1.75rem)); max-height: 92vh; }
.dialog-shell { max-height: 92vh; }

.compare-dialog { width: min(1240px, calc(100vw - 1.75rem)); }

.compare-scroll { overflow-x: auto; }

.compare-table {
  width: 100%;
  font-size: var(--font-size-xs);
  border-collapse: collapse;
}

.compare-table th,
.compare-table td {
  padding: var(--spacing-sm);
  text-align: left;
  vertical-align: top;
  border-bottom: var(--border-width-hairline) solid var(--dash-border);
}

.compare-table thead th {
  font-family: var(--current-font-heading);
  font-size: var(--font-size-xs);
  color: var(--dash-heading);
  background: var(--dash-panel);
}

.compare-table thead th .muted { display: block; font-weight: var(--font-weight-regular); }

.compare-table tbody th {
  font-family: var(--current-font-technical);
  font-weight: var(--font-weight-medium);
  letter-spacing: var(--letter-spacing-wide);
  white-space: nowrap;
  color: var(--dash-muted);
}

/* The measure column has to stay readable while the candidate columns scroll
   under it, so it is pinned and opaque. */
.compare-table th:first-child {
  position: sticky;
  left: 0;
  z-index: var(--z-content);
  background: var(--dash-page);
}

.compare-table tbody td { color: var(--dash-body); }

.dh-badges {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-xs);
  margin-top: var(--spacing-sm);
}

.sec { min-width: 0; }
.line span:last-child { max-width: 65%; }

/* Office Scout's workspace is a two-column panel rather than the stacked form
   the other two dashboards use. */
.workspace {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: var(--spacing-md);
  margin: 0 0 var(--spacing-lg);
  padding: var(--spacing-md);
  background: var(--dash-panel);
  border: var(--border-width-hairline) solid var(--dash-border);
  border-radius: var(--radius-md);
  border-top: var(--border-width-hairline) solid var(--dash-border);
}

.workspace label {
  font-family: var(--current-font-technical);
  font-size: var(--font-size-xs);
  letter-spacing: var(--letter-spacing-wider);
  text-transform: uppercase;
  color: var(--dash-muted);
}

.workspace select,
.workspace textarea { width: 100%; margin-top: var(--spacing-sm); }
.workspace textarea { min-height: 96px; resize: vertical; }

/* Sits inside .workspace label, so it would otherwise inherit that label's
   uppercasing and shout a full sentence at the operator. */
.save-state {
  margin-top: var(--spacing-xs);
  font-family: var(--current-font-technical);
  font-size: var(--font-size-xs);
  text-transform: none;
  letter-spacing: var(--letter-spacing-normal);
  color: var(--dash-accent-text);
}

.save-state.save-error {
  color: var(--dash-danger-text);
  font-weight: var(--font-weight-semibold);
}

/* --- Responsive -------------------------------------------------------------
   Office Scout runs its own breakpoint ladder (1220 / 1050 / 760 / 520), which
   is deliberately not the design system's (1180 / 900 / 670): the controls row
   carries three more tracks than the shared one. Every new responsive rule
   belongs on this ladder. */

@media (max-width: 1220px) {
  .wide-stats { grid-template-columns: repeat(4, 1fr); }
  .queue-items { grid-template-columns: repeat(2, 1fr); }
  .metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .summary-strip { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .feature-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .managed-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 1050px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero { grid-template-columns: 1fr; }
  .insight-row { grid-template-columns: 1fr; }
  .detail-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .feed-actions { flex-direction: column; }
  .summary-strip { width: 100%; }
}

@media (max-width: 760px) {
  .actions { max-width: 58%; }
  .wide-stats { grid-template-columns: 1fr 1fr; }
  .queue-head, .feedhead { align-items: flex-start; flex-direction: column; }
  .queue-items { grid-template-columns: 1fr; }
  .controls .search,
  .controls select { flex: 1 1 100%; }
  .grid { grid-template-columns: 1fr; }
  .dg, .workspace { grid-template-columns: 1fr; }
  .metrics,
  .detail-metrics,
  .summary-strip,
  .managed-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .feature-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .range-row { grid-template-columns: 1fr; }
  .score-line { grid-template-columns: 110px 1fr 26px; }
  .feed-tools { flex-wrap: wrap; }

  /* Hidden visually but kept in the accessibility tree: #live is the status
     region that announces "Feed unavailable" / "Stale". display:none would
     silence it on exactly the devices that cannot see the date either. */
  .live {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
}

@media (max-width: 520px) {
  .top { flex-direction: column; align-items: flex-start; }
  .actions { max-width: none; justify-content: flex-start; }
  .stat { padding: var(--spacing-sm); }
  .stat b { font-size: var(--font-size-lg); }
  .card-bottom { grid-template-columns: 1fr 96px; }
  .dp { font-size: var(--font-size-xl); }
  .cost-line { flex-direction: column; align-items: flex-start; }
  .pager-inner { flex-direction: column; align-items: flex-start; }

  /* Below about 360px the only things left that can push the page sideways are
     the deliberately unbreakable ones: a nowrap badge such as "NEEDS
     VERIFICATION", the provider link, and long unbroken tokens inside a fact or
     a metric. Let all of them wrap here rather than scroll the whole document,
     and drop the metric's desktop single-line truncation, which has room to
     wrap once the strip is two columns wide. */
  .badge,
  .managed-link,
  .budget-state,
  .pager-range { white-space: normal; }

  .metric b { white-space: normal; text-overflow: clip; }

  .fact div,
  .queue-missing,
  .metric b,
  .summary-cell b { overflow-wrap: anywhere; }
}
