/* ============ шрифты (vendored, спека §10) ============
   Inter variable, сабсеты latin + cyrillic, диапазон весов 400–600.
   unicode-range сверен с ответом Google Fonts css2 (см. план итерации A, Task 2).
   Нет файла/сети — стек падает на system-ui (см. --font-sans ниже). */
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url("/static/fonts/inter-cyrillic.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url("/static/fonts/inter-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ============================================================
   SAT Index — Pipeline Dashboard
   Операторская консоль. Чистый CSS, без сборки и без CDN.
   Палитра: OnTrack DS (primary blue #3F73AB, accent #EA5D31,
   статусы из ряда Status: fg = базовый, bg = lighten-3 @ 25%).
   Темы: авто (prefers-color-scheme) + ручная через html[data-theme].
   Подключать как /static/styles.css?v=N — поднимайте N при правках.
   ============================================================ */

:root {
  color-scheme: light;

  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Cascadia Mono", "Liberation Mono", monospace;

  --bg: #f6f8f9;            /* background/light-50 */
  --surface: #ffffff;
  --surface-2: #edf1f2;      /* background/light */
  --surface-3: #e4e5ec;      /* background/b2 */
  --border: #e6eef3;         /* background/border */
  --border-strong: #d3d9e0;  /* text/400 */

  --text: #1d2126;           /* text/900 body */
  --text-muted: #576674;     /* text/700 */
  --text-faint: #86919d;     /* text/600 secondary */

  --accent: #3f73ab;         /* primary/500 main */
  --accent-hover: #4a86c7;   /* primary/400 hover */
  --accent-strong: #325c89;  /* primary/600 pressed */
  --accent-soft: #ecf1f7;    /* primary/50 */
  --accent-2: #ea5d31;       /* accent/500 — фирменный знак */
  --on-accent: #ffffff;

  --code-bg: #0d1722;        /* primary/900 */
  --code-text: #d9e3ee;      /* primary/100 */
  --code-border: #192e44;    /* primary/800 */

  --shadow: 0 1px 2px rgba(13, 23, 34, 0.05), 0 2px 8px rgba(13, 23, 34, 0.04);
  --radius: 10px;
  --radius-sm: 7px;
  --header-h: 52px;

  /* статусы: fg / bg (status-* / status-*-lighten-3 @ 25%) */
  --st-plan-fg: #44404c;  --st-plan-bg: rgba(136, 132, 145, 0.25); /* default */
  --st-blue-fg: #193e84;  --st-blue-bg: rgba(88, 135, 221, 0.25);  /* info */
  --st-run-fg:  #0e4755;  --st-run-bg:  rgba(60, 149, 171, 0.25);  /* persian */
  --st-done-fg: #254d25;  --st-done-bg: rgba(69, 162, 72, 0.25);   /* success */
  --st-fail-fg: #7d1d2e;  --st-fail-bg: rgba(235, 75, 89, 0.25);   /* danger */
  --st-wait-fg: #7e4203;  --st-wait-bg: rgba(220, 125, 19, 0.25);  /* warning */
  --st-skip-fg: #576674;  --st-skip-bg: rgba(63, 70, 78, 0.08);    /* text-default-10 */

  --line-ok: rgba(69, 162, 72, 0.45);
  --line-danger: rgba(235, 75, 89, 0.45);
  --st-run-pulse: rgba(60, 149, 171, 0.35);
  --live-pulse: rgba(63, 115, 171, 0.3);
}

/* Тёмные токены. Блок намеренно продублирован:
   1) авто-тема по ОС, 2) явный выбор пользователя. */
@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0d1722;
    --surface: #192e44;
    --surface-2: rgba(74, 134, 199, 0.12);
    --surface-3: rgba(74, 134, 199, 0.22);
    --border: #264567;
    --border-strong: #325c89;
    --text: #ecf1f7;
    --text-muted: #b2c7dd;
    --text-faint: #8cabcd;
    --accent: #4a86c7;
    --accent-hover: #8cabcd;
    --accent-strong: #b2c7dd;
    --accent-soft: rgba(74, 134, 199, 0.18);
    --accent-2: #ea5d31;
    --on-accent: #ffffff;
    --code-bg: #0d1722;
    --code-text: #d9e3ee;
    --code-border: #264567;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 2px 10px rgba(0, 0, 0, 0.25);
    --st-plan-fg: #b6bbc2;  --st-plan-bg: rgba(136, 132, 145, 0.22);
    --st-blue-fg: #5887dd;  --st-blue-bg: rgba(88, 135, 221, 0.18);
    --st-run-fg:  #3c95ab;  --st-run-bg:  rgba(60, 149, 171, 0.18);
    --st-done-fg: #45a248;  --st-done-bg: rgba(69, 162, 72, 0.18);
    --st-fail-fg: #eb4b59;  --st-fail-bg: rgba(235, 75, 89, 0.18);
    --st-wait-fg: #dc7d13;  --st-wait-bg: rgba(220, 125, 19, 0.18);
    --st-skip-fg: #86919d;  --st-skip-bg: rgba(134, 145, 157, 0.14);
    --line-ok: rgba(69, 162, 72, 0.4);
    --line-danger: rgba(235, 75, 89, 0.4);
    --st-run-pulse: rgba(60, 149, 171, 0.3);
    --live-pulse: rgba(74, 134, 199, 0.3);
  }
}
html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d1722;
  --surface: #192e44;
  --surface-2: rgba(74, 134, 199, 0.12);
  --surface-3: rgba(74, 134, 199, 0.22);
  --border: #264567;
  --border-strong: #325c89;
  --text: #ecf1f7;
  --text-muted: #b2c7dd;
  --text-faint: #8cabcd;
  --accent: #4a86c7;
  --accent-hover: #8cabcd;
  --accent-strong: #b2c7dd;
  --accent-soft: rgba(74, 134, 199, 0.18);
  --accent-2: #ea5d31;
  --on-accent: #ffffff;
  --code-bg: #0d1722;
  --code-text: #d9e3ee;
  --code-border: #264567;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 2px 10px rgba(0, 0, 0, 0.25);
  --st-plan-fg: #b6bbc2;  --st-plan-bg: rgba(136, 132, 145, 0.22);
  --st-blue-fg: #5887dd;  --st-blue-bg: rgba(88, 135, 221, 0.18);
  --st-run-fg:  #3c95ab;  --st-run-bg:  rgba(60, 149, 171, 0.18);
  --st-done-fg: #45a248;  --st-done-bg: rgba(69, 162, 72, 0.18);
  --st-fail-fg: #eb4b59;  --st-fail-bg: rgba(235, 75, 89, 0.18);
  --st-wait-fg: #dc7d13;  --st-wait-bg: rgba(220, 125, 19, 0.18);
  --st-skip-fg: #86919d;  --st-skip-bg: rgba(134, 145, 157, 0.14);
  --line-ok: rgba(69, 162, 72, 0.4);
  --line-danger: rgba(235, 75, 89, 0.4);
  --st-run-pulse: rgba(60, 149, 171, 0.3);
  --live-pulse: rgba(74, 134, 199, 0.3);
}

/* ============ база ============ */
* { box-sizing: border-box; }
html { scrollbar-gutter: stable; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 var(--font-sans);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); }
a:hover { color: var(--accent-hover); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }
::selection { background: var(--accent-soft); }
.mono { font-family: var(--font-mono); font-size: 13px; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--text-muted); }

/* ============ шапка ============ */
.app-header {
  position: sticky; top: 0; z-index: 40;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.app-header-inner {
  max-width: 1360px; margin: 0 auto;
  height: var(--header-h);
  display: flex; align-items: center; gap: 20px;
  padding: 0 28px;
}
.brand { display: flex; align-items: center; gap: 9px; text-decoration: none; color: var(--text); }
.brand:hover { color: var(--text); }
.brand-mark { width: 24px; height: 24px; flex: none; display: block; }
.brand-name { font-weight: 700; font-size: 14.5px; letter-spacing: -0.01em; }
.brand-sub { font-size: 10.5px; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.09em; padding-top: 2px; }
.app-nav { display: flex; gap: 4px; margin-left: 6px; }
.app-nav a {
  padding: 6px 12px; border-radius: var(--radius-sm);
  color: var(--text-muted); text-decoration: none;
  font-weight: 500; font-size: 13.5px;
  transition: background 0.12s, color 0.12s;
}
.app-nav a:hover { color: var(--text); background: var(--surface-2); }
.app-nav a.active { color: var(--accent-strong); background: var(--accent-soft); }
.theme-toggle {
  margin-left: auto;
  width: 32px; height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; border: 1px solid transparent; border-radius: var(--radius-sm);
  color: var(--text-muted); cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.theme-toggle:hover { background: var(--surface-2); color: var(--text); }
.theme-toggle svg { width: 16px; height: 16px; }
.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }
@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) .theme-toggle .icon-sun { display: block; }
  html:not([data-theme="light"]) .theme-toggle .icon-moon { display: none; }
}
html[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
html[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

/* ============ каркас страницы ============ */
.app-main {
  max-width: 1360px; margin: 0 auto;
  padding: 18px 28px 56px;
  min-height: calc(100vh - var(--header-h));
}
.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
  margin: 4px 0 14px;
}
.page-head h1 { font-size: 20px; font-weight: 650; letter-spacing: -0.01em; margin: 0; }
.title-group { display: flex; flex-direction: column; gap: 6px; }
.title-row { display: flex; align-items: center; gap: 12px; }
.title-row h1 { white-space: nowrap; }
.back-link { font-size: 12.5px; color: var(--text-muted); text-decoration: none; }
.back-link:hover { color: var(--accent); }
.section-title {
  font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.07em;
  color: var(--text-muted); margin: 24px 0 10px;
}

/* live-индикатор полинга (вне полящегося контейнера) */
.live {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 4px 5px 4px 12px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 999px;
  font-size: 12.5px; color: var(--text-muted);
}
.live-dot {
  width: 7px; height: 7px; border-radius: 50%; flex: none;
  background: var(--accent);
  --pulse-c: var(--live-pulse);
  animation: st-pulse 2.6s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}
.live .live-label-off { display: none; }
.live.paused .live-label-on { display: none; }
.live.paused .live-label-off { display: inline; }
.live.paused .live-dot { background: var(--text-faint); animation: none; }

/* ============ вкладки ============ */
.tabs {
  display: inline-flex; gap: 2px;
  padding: 3px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 9px;
  margin: 0 0 14px;
}
.tab {
  padding: 5px 14px; border-radius: 6px;
  color: var(--text-muted); text-decoration: none;
  font-size: 13.5px; font-weight: 500;
  transition: color 0.12s, background 0.12s;
}
.tab:hover { color: var(--text); }
.tab.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

/* ============ таблицы ============ */
.table-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.data-table {
  width: 100%;
  border-collapse: separate; border-spacing: 0;
  table-layout: fixed;
}
.data-table th {
  position: sticky; top: var(--header-h); z-index: 5;
  background: var(--surface);
  text-align: left;
  font: 500 11px/1.3 var(--font-sans);
  letter-spacing: 0.05em;
  color: var(--text-faint);
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-strong);
}
.data-table th:first-child { border-top-left-radius: 9px; }
.data-table th:last-child { border-top-right-radius: 9px; }
/* Companies list uses a div-grid header (custom column widths + sort links), not a
   semantic <thead>. Mirror .data-table th stickiness here so the responsive
   de-sticky below (max-width:760px) reaches it too — otherwise an inline sticky
   header is pushed 52px into the .table-card scroll container and hides row 1. */
.co-list-head { position: sticky; top: var(--header-h); z-index: 5; background: var(--surface); }
.data-table td {
  padding: 9px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 13.5px;
  vertical-align: middle;
}
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody td:first-child { border-bottom-left-radius: 0; }
tbody .row-link { cursor: pointer; }
tbody .row-link:hover td { background: var(--surface-2); }
tbody .row-link:hover .row-anchor { text-decoration: underline; }
.row-anchor { color: var(--accent); font-weight: 600; text-decoration: none; }
.cell-clip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.col-id { width: 96px; }
.col-status { width: 176px; }
.col-pool { width: 116px; }
.col-num { width: 84px; text-align: right; font-variant-numeric: tabular-nums; }
.col-time { width: 156px; text-align: right; font-variant-numeric: tabular-nums; color: var(--text-muted); white-space: nowrap; }
td.col-num, td.col-time { font-size: 13px; }
/* Заголовки числовых/датовых колонок выравниваем по правому краю,
   как и их значения (перебиваем .data-table th { text-align: left }). */
.data-table th.col-num, .data-table th.col-time,
.data-table th.col-fields, .data-table th.col-date { text-align: right; }
.data-table--flat th { position: static; }
time { font-variant-numeric: tabular-nums; }
.ts-empty { color: var(--text-faint); }

/* полящиеся зоны: фиксируем минимум, чтобы своп не дёргал страницу */
#task-list-container, #health-container { min-height: 180px; }

/* ============ бейджи статусов ============ */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 2.5px 9px;
  border-radius: 999px;
  font: 500 12px/1.5 var(--font-mono);
  white-space: nowrap;
  --st-fg: var(--text-muted);
  --st-bg: var(--surface-2);
  color: var(--st-fg);
  background: var(--st-bg);
}
.badge-dot {
  width: 6px; height: 6px; border-radius: 50%; flex: none;
  background: currentColor;
}
.status-planned              { --st-fg: var(--st-plan-fg); --st-bg: var(--st-plan-bg); }
.status-ready, .status-queued{ --st-fg: var(--st-blue-fg); --st-bg: var(--st-blue-bg); }
.status-running              { --st-fg: var(--st-run-fg);  --st-bg: var(--st-run-bg); }
.status-completed            { --st-fg: var(--st-done-fg); --st-bg: var(--st-done-bg); }
.status-failed               { --st-fg: var(--st-fail-fg); --st-bg: var(--st-fail-bg); }
.status-pending_provider     { --st-fg: var(--st-wait-fg); --st-bg: var(--st-wait-bg); }
[class*="status-skipped"]    { --st-fg: var(--st-skip-fg); --st-bg: var(--st-skip-bg); }
.status-running .badge-dot {
  --pulse-c: var(--st-run-pulse);
  animation: st-pulse 1.8s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}
@keyframes st-pulse {
  0%   { box-shadow: 0 0 0 0 var(--pulse-c); }
  70%  { box-shadow: 0 0 0 6px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}

/* ============ пагинация ============ */
.pager {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 12px;
}
.pager-link {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 12px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-muted); text-decoration: none;
  font-size: 13px; font-weight: 500;
  transition: color 0.12s, border-color 0.12s, background 0.12s;
}
a.pager-link:hover { color: var(--text); border-color: var(--text-faint); }
.pager-link.disabled { opacity: 0.45; border-color: var(--border); pointer-events: none; }
.pager-info { color: var(--text-faint); font-size: 12.5px; font-variant-numeric: tabular-nums; }

/* ============ кнопки ============ */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 15px;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  font: 500 13.5px/1.4 var(--font-sans);
  cursor: pointer;
  text-decoration: none;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.btn svg { width: 14px; height: 14px; }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-hover); color: var(--on-accent); }
.btn-primary:active { background: var(--accent-strong); }
.btn-ghost { background: transparent; border-color: var(--border-strong); color: var(--text-muted); }
.btn-ghost:hover { color: var(--text); border-color: var(--text-faint); background: var(--surface-2); }
.btn-sm { padding: 3px 10px; font-size: 12px; border-radius: 6px; }

/* ============ пустые состояния ============ */
.empty-state {
  display: flex; flex-direction: column; align-items: center;
  gap: 4px;
  padding: 56px 20px;
  text-align: center;
}
.empty-icon { width: 38px; height: 38px; color: var(--text-faint); margin-bottom: 8px; }
.empty-title { font-size: 14.5px; font-weight: 600; margin: 0; }
.empty-sub { font-size: 13px; color: var(--text-muted); margin: 0; }

/* ============ деталь задачи ============ */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: start;
}
.detail-grid > * { min-width: 0; }
.span-2 { grid-column: 1 / -1; }
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 18px;
}
.card .data-table { table-layout: auto; }
.card-title {
  font-size: 12px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.07em;
  color: var(--text-muted);
  margin: 0 0 12px;
}
.card-title-danger { color: var(--st-fail-fg); }
.kv { margin: 0; }
.kv > div {
  display: grid; grid-template-columns: 168px 1fr;
  gap: 12px; align-items: baseline;
  padding: 7px 0;
  border-top: 1px solid var(--border);
}
.kv > div:first-child { border-top: 0; padding-top: 0; }
.kv dt { font-family: var(--font-mono); font-size: 12px; color: var(--text-muted); }
.kv-note { margin-left: 8px; font-family: var(--font-sans); font-size: 11.5px; color: var(--text-faint); }
.kv dd { margin: 0; font-size: 13.5px; min-width: 0; overflow-wrap: break-word; }
.code-block {
  margin: 0;
  background: var(--code-bg); color: var(--code-text);
  border: 1px solid var(--code-border);
  border-radius: 8px;
  padding: 14px 16px;
  font: 12.5px/1.55 var(--font-mono);
  overflow: auto;
  max-height: 440px;
}
.code-block-error { border-color: #7d1d2e; }

/* ============ health ============ */
.health-banner {
  display: flex; gap: 14px; align-items: flex-start;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
}
.health-banner p { margin: 0; }
.banner-icon { width: 24px; height: 24px; flex: none; margin-top: 1px; }
.banner-title { font-size: 15px; font-weight: 650; margin: 0 0 3px; }
.banner-text { font-size: 13.5px; color: var(--text-muted); }
.health-ok {
  align-items: center;
  background: var(--st-done-bg); border-color: var(--line-ok);
}
.health-ok .banner-text { color: var(--text); }
.health-ok .banner-text strong { color: var(--st-done-fg); }
.health-ok .live-dot { background: var(--st-done-fg); --pulse-c: rgba(69, 162, 72, 0.3); }
.health-alert {
  background: var(--st-fail-bg); border-color: var(--line-danger);
  padding: 20px 22px;
}
.health-alert .banner-icon { width: 28px; height: 28px; color: var(--st-fail-fg); }
.health-alert .banner-title { font-size: 17px; color: var(--st-fail-fg); }
.health-alert .banner-text { color: var(--text); }
.health-neutral { background: var(--surface); }
.health-neutral .banner-icon { color: var(--text-faint); }

.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-top: 14px;
}
.stat-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 13px 16px;
}
.stat-label {
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.07em;
  color: var(--text-faint);
  margin-bottom: 6px;
}
.stat-value { font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }

.pool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}
.pool-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 13px 16px 10px;
}
.pool-head {
  display: flex; align-items: baseline; gap: 8px;
  padding-bottom: 9px; margin-bottom: 5px;
  border-bottom: 1px solid var(--border);
}
.pool-name { font-family: var(--font-mono); font-size: 13px; font-weight: 600; }
.pool-total { margin-left: auto; font-size: 12px; color: var(--text-faint); font-variant-numeric: tabular-nums; }
.pool-row {
  display: grid; grid-template-columns: 120px 1fr 36px;
  align-items: center; gap: 10px;
  padding: 6px 0;
}
.pool-bar {
  height: 4px; border-radius: 2px;
  background: var(--surface-3);
  overflow: hidden;
}
.pool-bar i {
  display: block; height: 100%; border-radius: 2px;
  background: var(--st-fg, var(--text-faint));
}
.pool-count { text-align: right; font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }

/* ============ компании ============ */
/* Ширины колонок разделов «Компании» и «Поля». */
.col-fields { width: 104px; text-align: right; font-variant-numeric: tabular-nums; color: var(--text-muted); }
.col-date   { width: 132px; text-align: right; font-variant-numeric: tabular-nums; color: var(--text-muted); white-space: nowrap; }
.col-run    { width: 212px; }
.col-fresh  { width: 148px; }
td.col-fields, td.col-date { font-size: 13px; }

/* Имя компании/поля + инлайн-бейдж активности в одной ячейке. */
.name-cell { display: flex; align-items: center; gap: 8px; min-width: 0; }
.name-cell .name-text {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-weight: 550;
}
.name-cell.is-inactive .name-text { color: var(--text-muted); font-weight: 500; }
tbody .row-link:hover .name-text { color: var(--text); }

/* Компактный бейдж активности — та же система, что статус-бейджи. */
.badge-active   { --st-fg: var(--st-done-fg); --st-bg: var(--st-done-bg); }
.badge-inactive { --st-fg: var(--st-skip-fg); --st-bg: var(--st-skip-bg); }
.badge-sm { font: 500 11px/1.5 var(--font-mono); padding: 1.5px 8px; }

/* Freshness-бейдж поля: свежий / устарел / нет данных —
   success / warning / default из палитры статусов. */
.fresh-fresh { --st-fg: var(--st-done-fg); --st-bg: var(--st-done-bg); }
.fresh-stale { --st-fg: var(--st-wait-fg); --st-bg: var(--st-wait-bg); }
.fresh-none  { --st-fg: var(--st-skip-fg); --st-bg: var(--st-skip-bg); }

/* Ячейка «последний прогон» в списке: бейдж + когда. */
.run-cell { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; }
.run-when { font-size: 12px; color: var(--text-faint); font-variant-numeric: tabular-nums; white-space: nowrap; }
.run-none { color: var(--text-faint); }

/* Разбивка прогона по статусам на детали компании. */
.run-breakdown { display: flex; flex-wrap: wrap; gap: 6px; }
.run-breakdown .badge b { font-weight: 700; font-variant-numeric: tabular-nums; }

@media (max-width: 960px) {
  .col-run { width: 176px; }
  .col-date { width: 112px; }
  .col-fields { width: 84px; }
}

/* ============ адаптив ============ */
@media (max-width: 960px) {
  .app-header-inner, .app-main { padding-left: 16px; padding-right: 16px; }
  .brand-sub { display: none; }
  .col-status { width: 152px; }
  .col-time { width: 138px; }
  .col-pool { width: 96px; }
  .detail-grid { grid-template-columns: 1fr; }
  .kv > div { grid-template-columns: 140px 1fr; }
}
@media (max-width: 760px) {
  .table-card { overflow-x: auto; }
  .data-table { min-width: 720px; }
  .data-table th { position: static; }
  .co-list-head { position: static; }
}

/* ============ доступность ============ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
