/* ============================================================
   Benzostat dashboard — design tokens
   Palette per skill dataviz (references/palette.md), validated with
   scripts/validate_palette.js against these exact surfaces. See
   notes returned by the build for the validator output.
   ============================================================ */

:root {
  /* chrome & ink — light */
  --page-bg: #f9f9f7;
  --surface: #fcfcfb;
  --surface-2: #f2f2ef;
  --surface-hover: #eeede9;
  --text-primary: #0b0b0b;
  --text-secondary: #52514e;
  --text-muted: #898781;
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --border: rgba(11, 11, 11, 0.10);
  --focus-ring: #2a78d6;

  /* categorical pair — fixed identity for fuel grades, same on every chart */
  --series-92: #2a78d6;   /* blue  — categorical slot 1 */
  --series-95: #1baf7a;   /* aqua  — categorical slot 2 */
  --series-92-wash: rgba(42, 120, 214, 0.10);
  --series-95-wash: rgba(27, 175, 122, 0.10);

  /* sequential (blue) ramp anchors — V2 trend/heatmap. Distinct step from
     --series-92 so a bar over "any fuel" never reads as the 92-grade series
     (dataviz: color follows the entity, not the hue family). Steps below are
     from palette.md's blue sequential table; light = light→dark by magnitude,
     dark = dim→bright by magnitude (a literal dark repeat would vanish into
     the dark surface, so the same ramp is walked in reverse). */
  --trend-bar: #1c5cab;
  --heatmap-ramp-light: #cde2fb, #9ec5f4, #6da7ec, #2a78d6, #1c5cab, #0d366b;
  --heatmap-ramp-dark: #184f95, #256abf, #3987e5, #5598e7, #86b6ef, #cde2fb;

  /* diverging pair (V3, "% к тренду") — blue <-> red per palette.md's
     documented diverging section, NOT the status scale (status-no is
     already used elsewhere on this page for "no fuel"; reusing it here
     would let a single hue carry two different meanings at once). Neutral
     midpoint is the documented diverging gray, shared by both arms so the
     ramp reads "nothing" at the trend line. Positive/blue arm reuses the
     exact sequential blue steps from palette.md; the red arm has no
     documented multi-step table, so it is hand-built in the same hue
     family as the categorical red slot (#e34948/#e66767), stepped with the
     same light-theme light->dark / dark-theme dim->bright direction as the
     blue ramp above. These four tokens are theme-agnostic tables (like
     --heatmap-ramp-*) — JS picks the light/dark variant itself. */
  --diverging-pos-ramp-light: #f0efec, #9ec5f4, #2a78d6, #1c5cab, #0d366b;
  --diverging-neg-ramp-light: #f0efec, #f5bcba, #e34948, #a93634, #5e1e1d;
  --diverging-pos-ramp-dark: #383835, #184f95, #3987e5, #86b6ef, #cde2fb;
  --diverging-neg-ramp-dark: #383835, #7a2420, #b3221f, #e66767, #f4a8a6;

  /* status palette — fixed, never themed (skill: references/palette.md) */
  --status-yes: #0ca30c;
  --status-low: #fab219;
  --status-queue: #ec835a;
  --status-no: #d03b3b;
  --status-unknown: #898781;
  --status-yes-wash: rgba(12, 163, 12, 0.10);
  --status-low-wash: rgba(250, 178, 25, 0.14);
  --status-queue-wash: rgba(236, 131, 90, 0.12);
  --status-no-wash: rgba(208, 59, 59, 0.10);
  --status-unknown-wash: rgba(137, 135, 129, 0.14);

  --success-text: #006300;
  --danger-text: #b3221f;

  --radius-card: 14px;
  --radius-sm: 8px;
  --shadow-card: 0 1px 2px rgba(11, 11, 11, 0.04), 0 1px 1px rgba(11, 11, 11, 0.03);
}

@media (prefers-color-scheme: dark) {
  :root {
    --page-bg: #0d0d0d;
    --surface: #1a1a19;
    --surface-2: #232322;
    --surface-hover: #2a2a28;
    --text-primary: #ffffff;
    --text-secondary: #c3c2b7;
    --text-muted: #898781;
    --grid: #2c2c2a;
    --axis: #383835;
    --border: rgba(255, 255, 255, 0.10);
    --focus-ring: #3987e5;

    --series-92: #3987e5;
    --series-95: #199e70;
    --series-92-wash: rgba(57, 135, 229, 0.14);
    --series-95-wash: rgba(25, 158, 112, 0.16);
    --trend-bar: #5598e7;

    --status-yes: #0ca30c;
    --status-low: #fab219;
    --status-queue: #ec835a;
    --status-no: #d03b3b;
    --status-unknown: #898781;
    --status-yes-wash: rgba(12, 163, 12, 0.16);
    --status-low-wash: rgba(250, 178, 25, 0.16);
    --status-queue-wash: rgba(236, 131, 90, 0.16);
    --status-no-wash: rgba(208, 59, 59, 0.16);
    --status-unknown-wash: rgba(137, 135, 129, 0.18);

    --success-text: #4fd44f;
    --danger-text: #e88a88;

    --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.30), 0 1px 1px rgba(0, 0, 0, 0.20);
  }
}

/* manual theme toggle wins over prefers-color-scheme in both directions */
:root[data-theme="dark"] {
  --page-bg: #0d0d0d;
  --surface: #1a1a19;
  --surface-2: #232322;
  --surface-hover: #2a2a28;
  --text-primary: #ffffff;
  --text-secondary: #c3c2b7;
  --text-muted: #898781;
  --grid: #2c2c2a;
  --axis: #383835;
  --border: rgba(255, 255, 255, 0.10);
  --focus-ring: #3987e5;

  --series-92: #3987e5;
  --series-95: #199e70;
  --series-92-wash: rgba(57, 135, 229, 0.14);
  --series-95-wash: rgba(25, 158, 112, 0.16);
  --trend-bar: #5598e7;

  --status-yes-wash: rgba(12, 163, 12, 0.16);
  --status-low-wash: rgba(250, 178, 25, 0.16);
  --status-queue-wash: rgba(236, 131, 90, 0.16);
  --status-no-wash: rgba(208, 59, 59, 0.16);
  --status-unknown-wash: rgba(137, 135, 129, 0.18);

  --success-text: #4fd44f;
  --danger-text: #e88a88;

  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.30), 0 1px 1px rgba(0, 0, 0, 0.20);
}

:root[data-theme="light"] {
  --page-bg: #f9f9f7;
  --surface: #fcfcfb;
  --surface-2: #f2f2ef;
  --surface-hover: #eeede9;
  --text-primary: #0b0b0b;
  --text-secondary: #52514e;
  --text-muted: #898781;
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --border: rgba(11, 11, 11, 0.10);
  --focus-ring: #2a78d6;

  --series-92: #2a78d6;
  --series-95: #1baf7a;
  --series-92-wash: rgba(42, 120, 214, 0.10);
  --series-95-wash: rgba(27, 175, 122, 0.10);
  --trend-bar: #1c5cab;

  --status-yes-wash: rgba(12, 163, 12, 0.10);
  --status-low-wash: rgba(250, 178, 25, 0.14);
  --status-queue-wash: rgba(236, 131, 90, 0.12);
  --status-no-wash: rgba(208, 59, 59, 0.10);
  --status-unknown-wash: rgba(137, 135, 129, 0.14);

  --success-text: #006300;
  --danger-text: #b3221f;

  --shadow-card: 0 1px 2px rgba(11, 11, 11, 0.04), 0 1px 1px rgba(11, 11, 11, 0.03);
}

/* ============================================================
   Base
   ============================================================ */

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--page-bg);
  color: var(--text-primary);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0; font-weight: 600; }

a { color: var(--series-92); }

.skip-link {
  position: absolute;
  left: -999px;
  top: auto;
  background: var(--surface);
  color: var(--text-primary);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  z-index: 100;
}
.skip-link:focus {
  left: 12px;
  top: 12px;
}

:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

button, input, select {
  font: inherit;
  color: inherit;
}

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

/* ============================================================
   Topbar
   ============================================================ */

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 16px 24px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand h1 {
  font-size: 20px;
  letter-spacing: -0.01em;
}

.tagline {
  margin: 2px 0 0;
  font-size: 13px;
  color: var(--text-secondary);
}

.topbar-status {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.freshness-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  color: var(--text-secondary);
  background: var(--surface-2);
  padding: 6px 12px;
  border-radius: 999px;
  font-variant-numeric: tabular-nums;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--status-yes);
  flex: none;
}
.dot-loading {
  background: var(--text-muted);
  animation: pulse 1.4s ease-in-out infinite;
}
.dot-stale { background: var(--status-low); }
.dot-error { background: var(--status-no); }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

.blocked-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: #ffffff;
  background: var(--status-no);
  padding: 6px 12px;
  border-radius: 999px;
}
.blocked-badge::before {
  content: "\26A0";
}

.theme-toggle {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface-2);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: background-color 0.15s ease;
}
.theme-toggle:hover { background: var(--surface-hover); }

.api-error-banner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 10px 24px;
  background: var(--status-no-wash);
  color: var(--danger-text);
  font-size: 13.5px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid var(--border);
}
.api-error-banner button {
  border: 1px solid currentColor;
  background: transparent;
  color: inherit;
  padding: 4px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  flex: none;
  font-weight: 600;
}

/* ============================================================
   Layout
   ============================================================ */

main {
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px 24px 8px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.section { width: 100%; }

.card,
.chart-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 18px 20px 20px;
}

.chart-card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.chart-card-head h2 {
  font-size: 15.5px;
}

.muted-note {
  font-size: 12.5px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.table-toggle {
  font-size: 12.5px;
  color: var(--text-secondary);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 11px;
  cursor: pointer;
}
.table-toggle:hover { background: var(--surface-hover); }
.table-toggle.is-active {
  background: var(--series-92-wash);
  color: var(--series-92);
  border-color: var(--series-92);
}

/* ============================================================
   Stat tiles
   ============================================================ */

.stat-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}

.stat-tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 14px 16px 15px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.stat-label {
  font-size: 12.5px;
  color: var(--text-secondary);
}

.stat-value {
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stat-sub {
  font-size: 12.5px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

/* Identity comes from the colored dot beside the label, not the value's own
   ink — value text always stays in --text-primary (marks-and-anatomy.md). */
.stat-label-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-right: 5px;
  vertical-align: middle;
}
.stat-label-dot--92 { background: var(--series-92); }
.stat-label-dot--95 { background: var(--series-95); }
.stat-label-dot--queue { background: var(--status-queue); }

/* ============================================================
   Filter row / period switch
   ============================================================ */

.filter-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.filter-row-label {
  font-size: 13px;
  color: var(--text-secondary);
}

.segmented {
  display: inline-flex;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px;
  gap: 2px;
}

.segmented-btn {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  padding: 7px 16px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 500;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.segmented-btn:hover { color: var(--text-primary); }
.segmented-btn.is-active {
  background: var(--surface);
  color: var(--text-primary);
  box-shadow: var(--shadow-card);
  font-weight: 600;
}

/* ============================================================
   Charts
   ============================================================ */

.chart-wrap {
  position: relative;
  height: 320px;
}
.chart-wrap-medium { height: 260px; }

.chart-wrap.is-loading canvas { opacity: 0.45; transition: opacity 0.2s ease; }

.empty-state {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 14px;
  text-align: center;
  padding: 20px;
}

.table-view {
  margin-top: 12px;
  max-height: 320px;
  overflow: auto;
  border-top: 1px solid var(--border);
  padding-top: 10px;
}
.table-view table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
}
.table-view th, .table-view td {
  text-align: right;
  padding: 4px 8px;
  white-space: nowrap;
}
.table-view th:first-child, .table-view td:first-child { text-align: left; }
.table-view thead th {
  color: var(--text-muted);
  font-weight: 500;
  border-bottom: 1px solid var(--grid);
}

/* ============================================================
   Generic tables (brands / stations)
   ============================================================ */

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

table {
  border-collapse: collapse;
  width: 100%;
  min-width: 640px;
}

thead th {
  text-align: left;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
  padding: 8px 10px;
  border-bottom: 1px solid var(--grid);
  white-space: nowrap;
  position: sticky;
  top: 0;
  background: var(--surface);
}

th.is-sortable {
  cursor: pointer;
  user-select: none;
}
th.is-sortable:hover { color: var(--text-primary); }
th.is-sortable::after {
  content: "";
  display: inline-block;
  width: 0.6em;
}
th.is-sortable[data-sort-dir="asc"]::after { content: " \2191"; }
th.is-sortable[data-sort-dir="desc"]::after { content: " \2193"; }

th.is-num, td.is-num { text-align: right; }

tbody td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--grid);
  font-size: 13px;
  vertical-align: middle;
}

tbody tr:hover td { background: var(--surface-hover); }

.cell-primary { font-weight: 600; color: var(--text-primary); }
.cell-secondary { font-size: 12px; color: var(--text-muted); display: block; }
.cell-muted { color: var(--text-muted); }
.cell-num { font-variant-numeric: tabular-nums; }

/* status badge — color never carries meaning alone: dot + Russian label */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px 3px 7px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
}
.status-badge .dot { width: 7px; height: 7px; }

/* Text stays in ink tokens (never the data hue) — the dot beside it is the
   only colored mark, per marks-and-anatomy.md "text never wears the data color". */
.status-badge--yes,
.status-badge--low,
.status-badge--queue,
.status-badge--no      { background: var(--status-no-wash); color: var(--text-primary); }
.status-badge--yes     { background: var(--status-yes-wash); }
.status-badge--low     { background: var(--status-low-wash); }
.status-badge--queue   { background: var(--status-queue-wash); }
.status-badge--unknown { background: var(--status-unknown-wash); color: var(--text-secondary); }

.status-badge--yes .dot    { background: var(--status-yes); }
.status-badge--low .dot    { background: var(--status-low); }
.status-badge--queue .dot  { background: var(--status-queue); }
.status-badge--no .dot     { background: var(--status-no); }
.status-badge--unknown .dot{ background: var(--status-unknown); }

/* V4: tbank verdict badges — two per cell (92/95 mini-badges) */
.verdict-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 20px;
  border-radius: 4px;
  font-size: 10.5px;
  font-weight: 600;
  margin-right: 4px;
  flex: none;
}

.verdict-badge--yes2    { background: var(--status-yes-wash); color: var(--status-yes); }
.verdict-badge--yes     { background: var(--status-yes-wash); color: var(--status-yes); }
.verdict-badge--tb_yes  { background: var(--surface-2); color: var(--status-yes); border: 1px solid var(--status-yes); }
.verdict-badge--tb_maybe { background: var(--status-low-wash); color: var(--status-low); }
.verdict-badge--conflict { background: var(--status-queue-wash); color: var(--status-queue); }
.verdict-badge--no      { background: var(--status-no-wash); color: var(--status-no); }
.verdict-badge--no2     { background: var(--status-no-wash); color: var(--status-no); }
.verdict-badge--tb_no   { background: var(--status-unknown-wash); color: var(--status-unknown); }
.verdict-badge--unknown { background: var(--status-unknown-wash); color: var(--status-unknown); }

/* brand mini stacked bar — horizontal part-to-whole, 2px surface gaps */
.brand-bar {
  display: flex;
  align-items: stretch;
  height: 10px;
  width: 140px;
  gap: 2px;
  border-radius: 3px;
  overflow: hidden;
  background: var(--surface-2);
}
.brand-bar-seg { height: 100%; min-width: 0; }
.brand-bar-seg--yes { background: var(--status-yes); }
.brand-bar-seg--low { background: var(--status-low); }
.brand-bar-seg--queue { background: var(--status-queue); }
.brand-bar-seg--no { background: var(--status-no); }
.brand-bar-seg--unknown { background: var(--status-unknown); }

.brand-row-name { display: flex; align-items: center; gap: 10px; }
.brand-cell-statuses { display: flex; align-items: center; justify-content: flex-end; }

/* ============================================================
   Stations controls
   ============================================================ */

.stations-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}

.text-input, .select-input {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 13.5px;
  color: var(--text-primary);
}
.text-input { flex: 1 1 260px; min-width: 200px; }
.select-input { flex: 0 0 auto; }
.text-input:focus, .select-input:focus { border-color: var(--focus-ring); }

/* ============================================================
   Trend (V2) — verdict cards + daily bar chart
   ============================================================ */

.trend-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.empty-state-inline {
  color: var(--text-muted);
  font-size: 13.5px;
  padding: 24px 10px;
  text-align: center;
  grid-column: 1 / -1;
}

.trend-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

.trend-card--insufficient { opacity: 0.7; }

.trend-card-label {
  font-size: 12.5px;
  color: var(--text-secondary);
}

.trend-card-value {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

/* The arrow is the only colored mark in the card — the number and label stay
   in ink tokens (marks-and-anatomy.md: "text never wears the data color").
   Color follows `direction` from the API, never the sign of change_pct. */
.trend-arrow {
  font-size: 13px;
  line-height: 1;
  color: var(--text-muted);
}
.trend-card--progress .trend-arrow { color: var(--success-text); }
.trend-card--regress .trend-arrow { color: var(--danger-text); }

.trend-card-pct {
  font-size: 19px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.trend-card-period {
  font-size: 11.5px;
  color: var(--text-muted);
}

.trend-card-status {
  font-size: 13px;
  color: var(--text-muted);
}

.trend-chart-block { margin-top: 4px; }

.trend-chart-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-secondary);
  margin: 0 0 8px;
}

.chart-wrap-small { height: 160px; }

/* ============================================================
   Heatmap (V2) — "when to fill up"
   ============================================================ */

.heatmap-controls-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}

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

.heatmap-table {
  border-collapse: separate;
  border-spacing: 2px;
  width: 100%;
  min-width: 760px;
  /* Fixed layout distributes width evenly across all 25 columns. With the
     default auto layout, only the row-label/corner column lacks an explicit
     width, so it alone absorbs all the slack from width:100% — inflating into
     a huge empty first column that shoves the 24 hour cells to the right. */
  table-layout: fixed;
}

.heatmap-corner { background: transparent; }

.heatmap-hour-label {
  font-size: 10.5px;
  color: var(--text-muted);
  font-weight: 500;
  text-align: center;
  padding: 0 0 4px;
  font-variant-numeric: tabular-nums;
}

.heatmap-dow-label {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 600;
  text-align: right;
  padding-right: 8px;
  white-space: nowrap;
  position: sticky;
  left: 0;
  background: var(--surface);
}

/* Sequential = one hue, per palette.md; identity carried entirely by the
   fill, so the cell itself has no text. Value + sample count live in the
   title/aria-label (interaction.md: tooltips enhance, never gate). */
.heatmap-cell {
  width: 22px;
  height: 20px;
  border-radius: 3px;
}

/* No-data cells get a flat, distinctly-neutral fill (not a step of the
   sequential ramp) so "no data" never gets mistaken for "near zero". */
.heatmap-cell--empty {
  background: var(--surface-2);
}

.heatmap-legend {
  margin-top: 14px;
  max-width: 320px;
}

.heatmap-legend-bar {
  height: 10px;
  border-radius: 4px;
  margin-bottom: 6px;
}

.heatmap-legend-labels {
  display: flex;
  justify-content: space-between;
  font-size: 11.5px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.heatmap-caption { margin-top: 10px; }

/* ============================================================
   Best times (V2) — recommendation card
   ============================================================ */

.best-times-block { margin-top: 20px; }

/* Warning-tier badge, same construction as .blocked-badge: colored wash +
   icon carry the meaning, the note text itself stays ink. */
.best-times-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-primary);
  background: var(--status-low-wash);
  border: 1px solid var(--status-low);
  padding: 6px 12px;
  border-radius: 999px;
  margin-bottom: 14px;
}
.best-times-badge::before {
  content: "\26A0";
  color: var(--status-low);
}

.best-times-columns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
}

.best-times-col-title {
  font-size: 13.5px;
  margin: 0 0 8px;
  color: var(--text-secondary);
}

.best-times-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.best-times-item {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 8px;
  font-size: 13px;
  padding: 8px 10px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
}

.best-times-dow {
  font-weight: 600;
  color: var(--text-primary);
  min-width: 24px;
}

.best-times-range {
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.best-times-stats {
  color: var(--text-muted);
  font-size: 12px;
}

/* ============================================================
   V5 — «Когда заправляться»: прогноз + типичный день/неделя
   ============================================================ */

.fc-metric-note { margin: -4px 0 14px; }

.fc-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
  margin-bottom: 4px;
}

.fc-tile {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.fc-tile-label {
  font-size: 12.5px;
  color: var(--text-secondary);
}

.fc-tile-value {
  font-size: 21px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}

.fc-tile-sub {
  font-size: 12px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

/* Same rule as the trend cards: only the arrow wears the semantic color,
   the verdict text stays ink. */
.fc-verdict {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}
.fc-verdict--big { font-size: 19px; letter-spacing: -0.01em; }
.fc-verdict-arrow { font-size: 0.85em; color: var(--text-muted); }
.fc-verdict--better .fc-verdict-arrow { color: var(--success-text); }
.fc-verdict--worse .fc-verdict-arrow { color: var(--danger-text); }

.fc-block-title {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-secondary);
  margin: 20px 0 8px;
}

.fc-caption { margin-top: 8px; }

.fc-summary {
  font-size: 13.5px;
  color: var(--text-primary);
  margin: 0 0 4px;
}

.profile-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin: 26px 0 8px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}
.profile-head h3 { font-size: 15px; margin: 0; }

.profile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
  margin-top: 12px;
}
.profile-grid h4 {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
  margin: 0 0 6px;
}

.segmented--small .segmented-btn { padding: 5px 12px; font-size: 12.5px; }

.legacy-heatmap {
  margin-top: 24px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.legacy-heatmap > summary {
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-secondary);
}
.legacy-heatmap > summary:hover { color: var(--text-primary); }
.legacy-heatmap-note { margin: 10px 0 12px; }

/* ============================================================
   Footer
   ============================================================ */

.page-footer {
  max-width: 1280px;
  margin: 12px auto 32px;
  padding: 0 24px;
  color: var(--text-muted);
  font-size: 12px;
}

/* ============================================================
   Responsive
   ============================================================ */

@media (max-width: 640px) {
  .topbar-inner { padding: 12px 16px; }
  main { padding: 16px 16px 8px; }
  .stat-value { font-size: 22px; }
  .chart-wrap { height: 260px; }
  .chart-wrap-small { height: 140px; }
}

/* Public view (benzostat.abogdanov.dev): T-Bank data, brands and stations are not published there */
[data-public="1"] .private-only { display: none !important; }

.page-footer a { color: inherit; }
