/* ============================================================================
   Дизайн-система «Pars Console v2»
   Источник: claude.ai/design → «Прототип интерфейса управления закупками»

   Макет построен на инлайновых стилях. Здесь они переведены в классы:
   CSP приложения — style-src 'self', и он блокирует не только <style> с кодом,
   но и любые style="…" на элементах. Никаких инлайновых стилей, никаких
   внешних доменов.

   Динамические значения (ширина полосы, цвет статуса) выражаются
   семантическими классами (.is-ok/.is-warn/…) и шкалой .pct-N,
   а не подстановкой в style.
   ========================================================================= */

/* --- 1. Токены -------------------------------------------------------- */

:root {
  --bg-page: #f4f6f8;
  --bg-base: #ffffff;
  --bg-subtle: #f8f9fb;
  --bg-inset: #eef1f5;
  --bg-hover: #f4f6f9;

  --border: #e3e7ed;
  --border-soft: #edf0f4;
  --border-strong: #c7cdd8;

  --text-primary: #14171f;
  --text-secondary: #5b6474;
  --text-muted: #8b94a3;

  --accent: #2563eb;
  --accent-bg: #eef4ff;
  --accent-soft: #f6f9ff;

  --ok: #15803d;        --ok-bg: #eefaf1;
  --warn: #b45309;      --warn-bg: #fef6ec;
  --danger: #b91c1c;    --danger-bg: #fdf0f0;
  --info: #0369a1;      --info-bg: #eef7fd;
  --neutral: #64748b;

  --shadow: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, .12);

  --font-ui: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-mono: ui-monospace, 'SF Mono', 'Cascadia Mono', Menlo, Consolas, monospace;

  --sidebar-w: 236px;
  --header-h: 52px;
}

[data-pars-theme="dark"] {
  --bg-page: #0b0d12;
  --bg-base: #11141b;
  --bg-subtle: #161a22;
  --bg-inset: #1b2029;
  --bg-hover: #1e242e;

  --border: #232935;
  --border-soft: #1c222c;
  --border-strong: #38414f;

  --text-primary: #e7eaf0;
  --text-secondary: #9aa4b4;
  --text-muted: #697386;

  --accent: #4d8dff;
  --accent-bg: #152340;
  --accent-soft: #0f1a2e;

  --ok: #3ecf8e;        --ok-bg: #0f2a20;
  --warn: #f0b429;      --warn-bg: #2c2110;
  --danger: #f87171;    --danger-bg: #2e1618;
  --info: #38bdf8;      --info-bg: #0d2434;
  --neutral: #8b95a6;

  --shadow: 0 1px 2px rgba(0, 0, 0, .5);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, .55);
}

/* Системная тема, пока пользователь не выбрал явно */
@media (prefers-color-scheme: dark) {
  :root:not([data-pars-theme="light"]) {
    --bg-page: #0b0d12; --bg-base: #11141b; --bg-subtle: #161a22;
    --bg-inset: #1b2029; --bg-hover: #1e242e;
    --border: #232935; --border-soft: #1c222c; --border-strong: #38414f;
    --text-primary: #e7eaf0; --text-secondary: #9aa4b4; --text-muted: #697386;
    --accent: #4d8dff; --accent-bg: #152340; --accent-soft: #0f1a2e;
    --ok: #3ecf8e; --ok-bg: #0f2a20; --warn: #f0b429; --warn-bg: #2c2110;
    --danger: #f87171; --danger-bg: #2e1618; --info: #38bdf8; --info-bg: #0d2434;
    --neutral: #8b95a6;
    --shadow: 0 1px 2px rgba(0,0,0,.5); --shadow-lg: 0 8px 24px rgba(0,0,0,.55);
  }
}

/* --- 2. База ---------------------------------------------------------- */

* { box-sizing: border-box; }

html { color-scheme: light dark; }

body {
  margin: 0;
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 20px;
  color: var(--text-primary);
  background: var(--bg-page);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-radius: 3px;
}

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 6px; }
::-webkit-scrollbar-track { background: transparent; }

@keyframes pulse { 0%, 100% { opacity: 1 } 50% { opacity: .35 } }

/* --- 3. Каркас -------------------------------------------------------- */

.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  border-right: 1px solid var(--border);
  background: var(--bg-base);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar__head {
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 14px;
  border-bottom: 1px solid var(--border-soft);
}

.logo {
  width: 22px; height: 22px;
  border-radius: 5px;
  background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-size: 11px; font-weight: 700;
  letter-spacing: -.02em;
  flex: none;
}

.sidebar__title { font-size: 12.5px; font-weight: 600; letter-spacing: -.01em; line-height: 15px; }
.sidebar__sub { font-size: 10.5px; line-height: 13px; color: var(--text-muted); font-family: var(--font-mono); }

.nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 8px 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.nav__group {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 14px 9px 5px;
}

.nv {
  position: relative;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 9px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-secondary);
  text-decoration: none;
}
.nv:hover { background: var(--bg-hover); color: var(--text-primary); text-decoration: none; }
.nv[data-active="true"] { background: var(--accent-bg); color: var(--accent); font-weight: 500; }
.nv[data-active="true"] .nvbar { opacity: 1; }

.nvbar {
  position: absolute;
  left: -8px; top: 6px; bottom: 6px;
  width: 2px;
  border-radius: 0 2px 2px 0;
  background: var(--accent);
  opacity: 0;
}

.nv__dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; opacity: .45; flex: none; }
.nv__count { margin-left: auto; font-family: var(--font-mono); font-size: 11px; color: var(--text-muted); }
.nv__live { margin-left: auto; width: 6px; height: 6px; border-radius: 50%; background: var(--info); animation: pulse 2s infinite; flex: none; }

.nv__badge {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 9px;
  border: 1px solid;
}

.sidebar__foot {
  border-top: 1px solid var(--border-soft);
  padding: 9px 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.queue {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 9px;
  background: var(--bg-subtle);
}
.queue__title {
  display: flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 600;
  letter-spacing: .05em; text-transform: uppercase;
  color: var(--text-muted);
}
.queue__row { display: flex; align-items: center; gap: 7px; margin-top: 6px; }
.queue__count { font-family: var(--font-mono); font-size: 11px; color: var(--text-secondary); }
.queue__note { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

.who { display: flex; align-items: center; gap: 8px; }
.who__avatar {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--accent-bg); border: 1px solid var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 10.5px; font-weight: 600; color: var(--accent);
  flex: none;
}
.who__body { flex: 1; min-width: 0; }
.who__name { font-size: 12px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who__meta { font-size: 10.5px; color: var(--text-muted); display: flex; align-items: center; gap: 4px; }
.who__logout {
  background: none; border: none; padding: 0;
  font: inherit; font-size: 10.5px; color: var(--text-muted);
  cursor: pointer; text-align: left;
}
.who__logout:hover { color: var(--danger); }

.main { min-width: 0; overflow-x: hidden; display: flex; flex-direction: column; }

.topbar {
  height: var(--header-h);
  border-bottom: 1px solid var(--border);
  background: var(--bg-base);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 18px;
  position: sticky;
  top: 0;
  z-index: 20;
  min-width: 0;
}

.crumbs {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--text-muted);
  white-space: nowrap; min-width: 0; overflow: hidden; flex-shrink: 1;
}
.crumbs__sep { opacity: .5; }
.crumbs__leaf { color: var(--text-primary); font-weight: 500; }

.search {
  flex: 1 1 90px;
  min-width: 0;
  max-width: 400px;
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-inset);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 9px;
}
.search input {
  flex: 1; min-width: 0;
  border: none; background: none; outline: none;
  font: inherit; font-size: 12.5px; color: var(--text-primary);
}
.search input::placeholder { color: var(--text-muted); }
.kbd {
  font-family: var(--font-mono); font-size: 10.5px; color: var(--text-muted);
  border: 1px solid var(--border-strong); border-radius: 3px;
  padding: 0 5px; background: var(--bg-base); flex: none;
}

.topbar__right { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.burger { display: none; }

.content { padding: 18px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }

/* --- 4. Примитивы ----------------------------------------------------- */

.btn {
  font-family: inherit;
  font-size: 12px;
  padding: 5px 11px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-base);
  color: var(--text-primary);
  cursor: pointer;
  box-shadow: var(--shadow);
  white-space: nowrap;
}
.btn:hover { border-color: var(--border-strong); background: var(--bg-hover); text-decoration: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn--strong { border-color: var(--border-strong); box-shadow: none; }
.btn--ghost { border-color: transparent; background: transparent; color: var(--text-muted); box-shadow: none; }
.btn--ghost:hover { background: var(--bg-hover); color: var(--text-primary); }

.btnp {
  font-family: inherit; font-size: 12px; padding: 5px 11px;
  border: 1px solid var(--accent); border-radius: 6px;
  background: var(--accent); color: #fff; cursor: pointer;
  white-space: nowrap;
}
.btnp:hover { filter: brightness(1.07); color: #fff; text-decoration: none; }
.btnp:disabled { opacity: .45; cursor: not-allowed; filter: none; }

.chip {
  cursor: pointer;
  font-size: 12px;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-base);
  color: var(--text-secondary);
  white-space: nowrap;
  font-family: inherit;
}
.chip:hover { border-color: var(--border-strong); color: var(--text-primary); text-decoration: none; }
.chip--mono { font-family: var(--font-mono); padding: 4px 9px; }

.pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px;
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 3px 10px;
  background: var(--bg-base);
  color: var(--text-secondary);
  white-space: nowrap;
  min-width: 0;
  overflow: hidden;
}
.pill__text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.dot { width: 6px; height: 6px; border-radius: 50%; flex: none; background: var(--neutral); display: inline-block; }
.dot--sm { width: 5px; height: 5px; }

.tag {
  font-family: var(--font-mono);
  font-size: 10.5px;
  padding: 1px 6px;
  border-radius: 3px;
  white-space: nowrap;
}

.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.muted { color: var(--text-muted); }
.secondary { color: var(--text-secondary); }
.nowrap { white-space: nowrap; }

/* Семантика статусов. Цвет никогда не единственный носитель смысла —
   рядом всегда точка или текст (§4.4 ТЗ). */
.is-ok      { color: var(--ok); }
.is-warn    { color: var(--warn); }
.is-danger  { color: var(--danger); }
.is-info    { color: var(--info); }
.is-neutral { color: var(--text-muted); }

/* Заливки .bg-* объявлены в самом конце файла: они утилиты и обязаны
   выигрывать у компонентных правил вроде .meter__fill по порядку каскада. */

.soft-ok     { background: var(--ok-bg);     color: var(--ok);         border-color: var(--ok); }
.soft-warn    { background: var(--warn-bg);   color: var(--warn);       border-color: var(--warn); }
.soft-danger  { background: var(--danger-bg); color: var(--danger);     border-color: var(--danger); }
.soft-info    { background: var(--info-bg);   color: var(--info);       border-color: var(--info); }
.soft-neutral { background: var(--bg-inset);  color: var(--text-muted); border-color: var(--border); }

/* --- 5. Заголовок страницы -------------------------------------------- */

.page-head { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.page-head h1 { margin: 0; font-size: 21px; line-height: 28px; font-weight: 600; letter-spacing: -.015em; }
.page-head__sub { font-size: 12.5px; color: var(--text-secondary); margin-top: 3px; }
.page-head__actions { margin-left: auto; display: flex; align-items: center; gap: 7px; }

/* --- 6. Карточки KPI --------------------------------------------------- */

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px; }

.kpi {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 13px;
  background: var(--bg-base);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: inherit;
  text-decoration: none;
}
.kpi:hover { background: var(--bg-hover); text-decoration: none; }
.kpi__top { display: flex; align-items: center; gap: 7px; }
.kpi__label {
  font-size: 10.5px; font-weight: 600;
  letter-spacing: .06em; text-transform: uppercase;
  color: var(--text-muted);
}
.kpi__top .dot { margin-left: auto; }
.kpi__figure { display: flex; align-items: flex-end; gap: 6px; }
.kpi__value {
  font-family: var(--font-mono);
  font-size: 27px; line-height: 30px; font-weight: 600;
  font-variant-numeric: tabular-nums; letter-spacing: -.02em;
  white-space: nowrap;
}
.kpi__unit { font-family: var(--font-mono); font-size: 12px; color: var(--text-muted); padding-bottom: 3px; white-space: nowrap; }
.kpi__spark { height: 22px; }
.kpi__note {
  font-size: 11.5px; color: var(--text-secondary);
  border-top: 1px solid var(--border-soft);
  padding-top: 7px;
}

/* --- 7. Секции --------------------------------------------------------- */

.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 14px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 14px; }

.card {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-base);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.card__head {
  padding: 10px 13px;
  border-bottom: 1px solid var(--border-soft);
  background: var(--bg-subtle);
  display: flex;
  align-items: center;
  gap: 8px;
}
.card__title {
  font-size: 11px; font-weight: 600;
  letter-spacing: .06em; text-transform: uppercase;
  color: var(--text-secondary);
}
.card__meta { margin-left: auto; font-family: var(--font-mono); font-size: 11px; color: var(--text-muted); }
.card__body { padding: 12px 13px; display: flex; flex-direction: column; gap: 11px; }

.count-badge {
  font-family: var(--font-mono);
  font-size: 10.5px; font-weight: 600;
  padding: 0 6px; border-radius: 9px;
  border: 1px solid;
}

/* --- 8. Строка «требует внимания» ------------------------------------- */

.rw:hover { background: var(--bg-hover); }

.att { display: flex; border-bottom: 1px solid var(--border-soft); }
.att:last-child { border-bottom: none; }
.att__bar { width: 3px; flex: none; }
.att__body { flex: 1; min-width: 0; padding: 11px 13px; }
.att__top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.att__title { font-size: 13px; font-weight: 600; letter-spacing: -.005em; }
.att__time { margin-left: auto; font-family: var(--font-mono); font-size: 11px; color: var(--text-muted); white-space: nowrap; }
.att__text { font-size: 12.5px; color: var(--text-secondary); margin-top: 4px; text-wrap: pretty; }
.att__actions { display: flex; gap: 6px; margin-top: 9px; }

/* --- 9. Полосы прогресса ---------------------------------------------- */

.meter { height: 5px; border-radius: 3px; background: var(--bg-inset); overflow: hidden; margin-top: 5px; }
.meter--thin { height: 4px; border-radius: 2px; margin-top: 0; flex: 1; }
.meter__fill { height: 100%; border-radius: 3px; background: var(--neutral); }

.health__row { display: flex; align-items: baseline; gap: 8px; font-size: 12.5px; }
.health__value { margin-left: auto; font-family: var(--font-mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.health__limit { font-family: var(--font-mono); font-size: 11px; color: var(--text-muted); white-space: nowrap; }

/* Шкала ширины: CSP не даёт написать style="width:64%", поэтому проценты —
   классами. Шаг 1 %, около 3 КБ. */
.pct-0{width:0}.pct-1{width:1%}.pct-2{width:2%}.pct-3{width:3%}.pct-4{width:4%}
.pct-5{width:5%}.pct-6{width:6%}.pct-7{width:7%}.pct-8{width:8%}.pct-9{width:9%}
.pct-10{width:10%}.pct-11{width:11%}.pct-12{width:12%}.pct-13{width:13%}.pct-14{width:14%}
.pct-15{width:15%}.pct-16{width:16%}.pct-17{width:17%}.pct-18{width:18%}.pct-19{width:19%}
.pct-20{width:20%}.pct-21{width:21%}.pct-22{width:22%}.pct-23{width:23%}.pct-24{width:24%}
.pct-25{width:25%}.pct-26{width:26%}.pct-27{width:27%}.pct-28{width:28%}.pct-29{width:29%}
.pct-30{width:30%}.pct-31{width:31%}.pct-32{width:32%}.pct-33{width:33%}.pct-34{width:34%}
.pct-35{width:35%}.pct-36{width:36%}.pct-37{width:37%}.pct-38{width:38%}.pct-39{width:39%}
.pct-40{width:40%}.pct-41{width:41%}.pct-42{width:42%}.pct-43{width:43%}.pct-44{width:44%}
.pct-45{width:45%}.pct-46{width:46%}.pct-47{width:47%}.pct-48{width:48%}.pct-49{width:49%}
.pct-50{width:50%}.pct-51{width:51%}.pct-52{width:52%}.pct-53{width:53%}.pct-54{width:54%}
.pct-55{width:55%}.pct-56{width:56%}.pct-57{width:57%}.pct-58{width:58%}.pct-59{width:59%}
.pct-60{width:60%}.pct-61{width:61%}.pct-62{width:62%}.pct-63{width:63%}.pct-64{width:64%}
.pct-65{width:65%}.pct-66{width:66%}.pct-67{width:67%}.pct-68{width:68%}.pct-69{width:69%}
.pct-70{width:70%}.pct-71{width:71%}.pct-72{width:72%}.pct-73{width:73%}.pct-74{width:74%}
.pct-75{width:75%}.pct-76{width:76%}.pct-77{width:77%}.pct-78{width:78%}.pct-79{width:79%}
.pct-80{width:80%}.pct-81{width:81%}.pct-82{width:82%}.pct-83{width:83%}.pct-84{width:84%}
.pct-85{width:85%}.pct-86{width:86%}.pct-87{width:87%}.pct-88{width:88%}.pct-89{width:89%}
.pct-90{width:90%}.pct-91{width:91%}.pct-92{width:92%}.pct-93{width:93%}.pct-94{width:94%}
.pct-95{width:95%}.pct-96{width:96%}.pct-97{width:97%}.pct-98{width:98%}.pct-99{width:99%}
.pct-100{width:100%}

/* --- 10. Таблицы ------------------------------------------------------- */

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

table.data { border-collapse: collapse; width: 100%; font-size: 12.5px; }

table.data th {
  position: sticky; top: 0; z-index: 2;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border);
  padding: 7px 13px;
  text-align: left;
  font-size: 10.5px; font-weight: 600;
  letter-spacing: .06em; text-transform: uppercase;
  color: var(--text-muted);
  white-space: nowrap;
}
table.data th.num { text-align: right; }

table.data td {
  padding: 8px 13px;
  border-bottom: 1px solid var(--border-soft);
  vertical-align: middle;
}
table.data tbody tr:last-child td { border-bottom: none; }
table.data tbody tr:hover { background: var(--bg-hover); }

.dense td { padding: 5px 13px; }

.row-line {
  display: flex; align-items: center; gap: 10px;
  padding: 0 13px; height: 34px;
  border-bottom: 1px solid var(--border-soft);
  font-size: 12.5px;
}
.row-line:last-child { border-bottom: none; }

/* --- 11. Пустые состояния и уведомления -------------------------------- */

.empty { padding: 34px 18px; text-align: center; color: var(--text-secondary); }
.empty__title { font-size: 15px; font-weight: 600; color: var(--text-primary); }
.empty__text { font-size: 12.5px; margin-top: 5px; text-wrap: pretty; }
.empty__actions { margin-top: 12px; display: flex; gap: 7px; justify-content: center; flex-wrap: wrap; }

.alert {
  border: 1px solid var(--border);
  border-left-width: 3px;
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 12.5px;
  background: var(--bg-base);
}
.alert__title { font-weight: 600; font-size: 13px; }
.alert__text { color: var(--text-secondary); margin-top: 3px; text-wrap: pretty; }

.stub {
  border: 1px dashed var(--border-strong);
  border-radius: 8px;
  padding: 28px 20px;
  background: var(--bg-subtle);
  text-align: center;
}
.stub__title { font-size: 15px; font-weight: 600; }
.stub__text { font-size: 12.5px; color: var(--text-secondary); margin-top: 6px; text-wrap: pretty; }
.stub__stage {
  display: inline-block; margin-top: 10px;
  font-family: var(--font-mono); font-size: 11px;
  padding: 2px 8px; border-radius: 4px;
  background: var(--bg-inset); color: var(--text-muted);
}

/* --- 12. Вход ---------------------------------------------------------- */

.login-page {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  background: var(--bg-page);
}
.login {
  width: 100%; max-width: 360px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-base);
  box-shadow: var(--shadow-lg);
  padding: 22px;
}
.login__brand { display: flex; align-items: center; gap: 9px; margin-bottom: 18px; }
.login h1 { margin: 0 0 4px; font-size: 18px; font-weight: 600; letter-spacing: -.01em; }
.login__sub { font-size: 12.5px; color: var(--text-secondary); margin-bottom: 16px; }

.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.field label { font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--text-muted); }
.field input {
  font: inherit; font-size: 13px;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-inset);
  color: var(--text-primary);
}
.field input:focus { outline: none; border-color: var(--accent); background: var(--bg-base); }

.login .btnp { width: 100%; padding: 8px; font-size: 13px; }

/* --- 13. Адаптив (§4.6 ТЗ) --------------------------------------------- */

/* Приоритет колонок: 3 скрывается раньше, затем 2. 1 не скрывается никогда. */
@media (max-width: 1399px) {
  [data-priority="3"] { display: none; }
}

@media (max-width: 991px) {
  [data-priority="2"] { display: none; }

  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed; z-index: 60;
    left: 0; top: 0; bottom: 0;
    width: 260px;
    transform: translateX(-100%);
    transition: transform .16s ease-out;
    box-shadow: var(--shadow-lg);
  }
  .sidebar[data-open="true"] { transform: translateX(0); }
  .burger { display: inline-flex; }
  .scrim { position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, .4); border: none; }
  .content { padding: 14px; }
}

@media (max-width: 767px) {
  .search { display: none; }
  .crumbs { font-size: 11px; }
}

/* Ниже 576 px строки таблиц становятся карточками — та же разметка,
   переключение только через CSS. */
@media (max-width: 575px) {
  .content { padding: 12px; gap: 12px; }
  .page-head h1 { font-size: 18px; line-height: 24px; }
  .kpis { grid-template-columns: 1fr 1fr; gap: 8px; }
  .kpi__value { font-size: 22px; line-height: 26px; }
  .cols { grid-template-columns: minmax(0, 1fr); }

  table.data thead { display: none; }
  table.data, table.data tbody, table.data tr, table.data td { display: block; width: 100%; }
  table.data tr { border-bottom: 1px solid var(--border); padding: 9px 0; }
  table.data tr:last-child { border-bottom: none; }
  table.data td {
    border: none;
    padding: 2px 13px;
    display: flex;
    align-items: baseline;
    gap: 10px;
  }
  table.data td::before {
    content: attr(data-label);
    flex: none;
    min-width: 96px;
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--text-muted);
  }
  table.data td.num { text-align: left; }

  .row-line { height: auto; padding: 8px 13px; flex-wrap: wrap; }
}

/* Область нажатия на сенсорных экранах — не менее 44 px */
@media (pointer: coarse) {
  .nv { padding: 10px 9px; }
  .btn, .btnp, .chip { padding-top: 9px; padding-bottom: 9px; }
  table.data td { padding-top: 11px; padding-bottom: 11px; }
}

@media print {
  .sidebar, .topbar, .scrim { display: none; }
  .app { grid-template-columns: 1fr; }
}

/* --- 13b. Лог прогона --------------------------------------------------- */

.log {
  font-family: var(--font-mono);
  font-size: 11.5px;
  line-height: 17px;
  padding: 10px 13px;
  max-height: 420px;
  overflow: auto;
  background: var(--bg-subtle);
}
/* pre-wrap — на строке, а не на контейнере: иначе отрисовываются переносы
   и отступы самой HTML-разметки между <div>. */
.log__line { display: block; white-space: pre-wrap; word-break: break-word; }
.log__ts { color: var(--text-muted); margin-right: 9px; }
.log__line.is-neutral { color: var(--text-secondary); }

/* --- 13c. Вкладки и формы в карточках ----------------------------------- */

.tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}
.tb {
  padding: 8px 12px;
  font-size: 13px;
  color: var(--text-secondary);
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  text-decoration: none;
}
.tb:hover { color: var(--text-primary); background: var(--bg-hover); text-decoration: none; }
.tb[data-active="true"] { color: var(--accent); border-bottom-color: var(--accent); font-weight: 500; }

.card__body .field { margin-bottom: 0; }
.card__body .field > span { font-size: 11.5px; color: var(--text-secondary); text-wrap: pretty; }
.card__body .field label { text-transform: none; letter-spacing: 0; font-size: 12px; font-weight: 500; color: var(--text-secondary); }

.field select,
.field textarea {
  font: inherit; font-size: 13px;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-inset);
  color: var(--text-primary);
}
.field select:focus, .field textarea:focus { outline: none; border-color: var(--accent); background: var(--bg-base); }
.field input:disabled, .field select:disabled { opacity: .6; cursor: not-allowed; }

.row-inline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row-inline > input, .row-inline > select { flex: 1; min-width: 120px; }

.check {
  display: flex; align-items: center; gap: 7px;
  font-size: 12.5px; font-weight: 400 !important;
  text-transform: none !important; letter-spacing: 0 !important;
  color: var(--text-primary) !important;
  cursor: pointer;
}
.check input { width: 15px; height: 15px; flex: none; accent-color: var(--accent); }

/* --- 13d. Графики и фильтры --------------------------------------------- */

.chart { width: 100%; height: 180px; display: block; }
.chart-grid { stroke: var(--border-soft); stroke-width: 1; vector-effect: non-scaling-stroke; }
.chart-empty { padding: 28px 0; text-align: center; color: var(--text-muted); font-size: 12.5px; }

.search-input {
  font: inherit; font-size: 12.5px;
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-inset);
  color: var(--text-primary);
  min-width: 200px;
}
.search-input:focus { outline: none; border-color: var(--accent); background: var(--bg-base); }

.page-head__actions select {
  font: inherit; font-size: 12px;
  padding: 5px 9px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-base);
  color: var(--text-secondary);
}
.page-head__actions select:focus { outline: none; border-color: var(--accent); }

.card__meta .chip { margin-left: 4px; }
.kpi__value--sm { font-size: 15px; line-height: 22px; }

/* --- 14. Утилиты заливки (последними в каскаде) ------------------------ */
/* Компонентные правила (.meter__fill, .dot, .att__bar) задают форму и
   запасной цвет; статус приходит этими классами и должен их перебивать —
   поэтому блок стоит в конце файла, а не в разделе примитивов. */

.bg-ok      { background: var(--ok); }
.bg-warn    { background: var(--warn); }
.bg-danger  { background: var(--danger); }
.bg-info    { background: var(--info); }
.bg-neutral { background: var(--neutral); }
