/* =========================================
   Scheme_base — прототип
   Дизайн: палитра проекта Equiform (КВАНТ)
   Серо-белая основа, акцент жёлтый #FFDF69
   Шрифты: Raleway (заголовки), Montserrat (текст)
   ========================================= */

:root {
  /* Фоны */
  --bg-app: #F9FAFB;
  --bg-card: #FFFFFF;
  --bg-soft: #F3F4F6;
  --bg-hover: #E5E7EB;
  --bg-row-alt: #FAFAFA;

  /* Текст — Equiform dark + gray scale */
  --text-primary: #2D2E32;
  --text-secondary: #6B7280;
  --text-muted: #9CA3AF;
  --text-inverse: #FFFFFF;

  /* Акценты */
  --accent-graphite: #2D2E32;
  --accent-graphite-hover: #3D3D3D;
  --accent-yellow: #FFDF69;
  --accent-yellow-hover: #FFD53A;
  --accent-yellow-soft: #FEF3C7;
  /* совместимость с прежними правилами «терракотовый» — теперь это темно-жёлтый */
  --accent-terracotta: #B45309;
  --accent-terracotta-soft: #FEF3C7;

  /* Стадии RE — оставлены семантическими (функциональные индикаторы) */
  --stage-0: #9CA3AF;
  --stage-1: #94A3B8;
  --stage-2: #D97706;
  --stage-3: #EAB308;
  --stage-4: #2D2E32;
  --stage-5: #16A34A;

  /* Stage soft (для фона) */
  --stage-0-soft: #F3F4F6;
  --stage-1-soft: #F3F4F6;
  --stage-2-soft: #FFFBEB;
  --stage-3-soft: #FEFCE8;
  --stage-4-soft: #F3F4F6;
  --stage-5-soft: #F0FDF4;

  /* Бордеры/тени */
  --border: #E5E7EB;
  --border-strong: #D1D5DB;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 28px rgba(0,0,0,0.10);

  /* Радиусы */
  --r-sm: 6px;
  --r-md: 8px;
  --r-lg: 12px;

  /* Шрифты */
  --font-body: 'Montserrat', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-heading: 'Raleway', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Consolas', monospace;

  /* Размеры */
  --topbar-h: 56px;
  --nav-w: 220px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--text-primary);
  background: var(--bg-app);
}

h1, h2, h3, .brand-name, .page-title h1 {
  font-family: var(--font-heading);
}

button { font: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select { font: inherit; }
ul, ol { list-style: none; }
a { color: inherit; text-decoration: none; }

/* =========================================
   Topbar
   ========================================= */
.topbar {
  height: var(--topbar-h);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: grid;
  grid-template-columns: 1fr minmax(360px, 520px) 1fr;
  align-items: center;
  padding: 0 20px;
  gap: 20px;
  position: sticky; top: 0; z-index: 10;
}

.brand {
  display: flex; align-items: center; gap: 10px;
  min-width: var(--nav-w);
  justify-self: start;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-self: end;
}
.logo {
  width: 32px; height: 32px;
  border-radius: var(--r-md);
  background: var(--accent-graphite);
  color: white;
  display: grid; place-items: center;
  font-weight: 700; font-size: 15px;
  letter-spacing: -0.02em;
  font-family: var(--font-heading);
  position: relative;
}
.logo::after {
  content: "";
  position: absolute;
  bottom: 4px; right: 4px;
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--accent-yellow);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-name { font-weight: 700; font-size: 14px; letter-spacing: -0.01em; }
.brand-tag { font-size: 10px; color: var(--text-secondary); margin-top: 1px; }

.search {
  width: 100%;
  position: relative;
  justify-self: stretch;
}
.search input {
  width: 100%;
  height: 34px;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  border-radius: var(--r-md);
  padding: 0 14px 0 36px;
  outline: none;
  transition: all .15s;
  font-size: 13px;
}
.search input:focus {
  background: var(--bg-card);
  border-color: var(--accent-graphite);
  box-shadow: 0 0 0 3px rgba(31, 58, 95, 0.08);
}
.search::before {
  content: "";
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  width: 14px; height: 14px;
  background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2364748B' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'><circle cx='11' cy='11' r='8'/><path d='m21 21-4.3-4.3'/></svg>") no-repeat center;
  pointer-events: none;
}

.topbar-actions { display: flex; gap: 8px; align-items: center; }
.icon-btn {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: var(--r-md);
  color: var(--text-secondary);
  transition: all .15s;
}
.icon-btn:hover { background: var(--bg-soft); color: var(--text-primary); }
.icon-btn .badge {
  position: absolute; transform: translate(8px, -8px);
  background: var(--accent-terracotta); color: white;
  font-size: 9px; font-weight: 700;
  padding: 1px 5px; border-radius: 999px;
  border: 1.5px solid var(--bg-card);
}

.user {
  display: flex; align-items: center; gap: 10px;
  padding: 4px 10px 4px 4px;
  border-radius: var(--r-md);
  cursor: pointer;
  transition: background .15s;
}
.user:hover { background: var(--bg-soft); }
.user-ava {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--accent-graphite);
  color: white;
  display: grid; place-items: center;
  font-weight: 600; font-size: 12px;
}
.user-info { line-height: 1.2; }
.user-name { font-weight: 600; font-size: 12px; }
.user-role { font-size: 10px; color: var(--text-secondary); }

/* =========================================
   Layout
   ========================================= */
.layout {
  display: grid;
  grid-template-columns: var(--nav-w) 1fr;
  min-height: calc(100vh - var(--topbar-h));
}

/* Левая навигация */
.sidenav {
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  padding: 16px 12px;
  display: flex; flex-direction: column;
  gap: 2px;
}
.nav-section {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: 12px 12px 6px;
  margin-top: 8px;
}
.nav-section:first-child { margin-top: 0; padding-top: 0; }

.nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px;
  border-radius: var(--r-md);
  color: var(--text-secondary);
  font-size: 13px;
  transition: all .12s;
  cursor: pointer;
}
.nav-link:hover { background: var(--bg-soft); color: var(--text-primary); }
.nav-link.active {
  background: var(--accent-graphite);
  color: white;
  font-weight: 500;
}
.nav-link .nav-icon {
  width: 16px; height: 16px;
  flex-shrink: 0;
  opacity: 0.7;
}
.nav-link.active .nav-icon { opacity: 1; }
.nav-link .nav-count {
  margin-left: auto;
  font-size: 11px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.nav-link.active .nav-count { color: rgba(255,255,255,0.7); }

/* Основная область */
.main {
  padding: 20px 24px;
  display: flex; flex-direction: column;
  gap: 16px;
  min-width: 0;
}

/* Page header */
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 4px;
}
.page-title h1 {
  font-size: 22px; font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}
.page-title .breadcrumb {
  font-size: 12px; color: var(--text-secondary);
  margin-bottom: 2px;
}

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px;
  border-radius: var(--r-md);
  font-size: 13px; font-weight: 500;
  transition: all .15s;
  border: 1px solid transparent;
  cursor: pointer;
}
.btn-primary {
  background: var(--accent-graphite); color: white;
}
.btn-primary:hover { background: var(--accent-graphite-hover); }
.btn-ghost {
  color: var(--text-secondary);
  border-color: var(--border);
  background: var(--bg-card);
}
.btn-ghost:hover { background: var(--bg-soft); color: var(--text-primary); }

/* =========================================
   KPI Strip — плитки с прогресс-баром (Equiform-стиль)
   ========================================= */
.kpi-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
.kpi-tile {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: box-shadow .15s, border-color .15s;
}
.kpi-tile:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
}
.kpi-tile-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 28px;
}
.kpi-tile-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
  font-family: var(--font-body);
  line-height: 1.2;
}
.kpi-tile-icon {
  width: 28px; height: 28px;
  border-radius: var(--r-md);
  background: var(--bg-soft);
  display: grid; place-items: center;
  color: var(--text-secondary);
  flex-shrink: 0;
}
.kpi-tile.accent .kpi-tile-icon {
  background: var(--accent-yellow);
  color: var(--accent-graphite);
}
.kpi-tile-value {
  font-family: var(--font-heading);
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.kpi-tile-value .pct {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-muted);
  margin-left: 2px;
}
.kpi-tile-bar {
  height: 6px;
  background: var(--bg-soft);
  border-radius: 999px;
  overflow: hidden;
}
.kpi-tile-bar-fill {
  display: block;
  height: 100%;
  background: var(--accent-graphite);
  border-radius: 999px;
  transition: width .4s;
}
.kpi-tile.accent .kpi-tile-bar-fill {
  background: var(--accent-yellow);
}
.kpi-tile-sub {
  font-size: 11px;
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-variant-numeric: tabular-nums;
}
.kpi-tile-sub strong {
  color: var(--text-primary);
  font-weight: 600;
}

/* =========================================
   Воронка — горизонтальная, кликабельная
   ========================================= */
.funnel-bar {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 6px;
  display: grid;
  grid-template-columns: auto repeat(6, 1fr);
  gap: 4px;
  align-items: stretch;
}
.funnel-title {
  display: flex; flex-direction: column; justify-content: center;
  padding: 0 14px 0 10px;
  font-size: 10px; text-transform: uppercase;
  letter-spacing: 0.06em; font-weight: 700;
  color: var(--text-muted);
  border-right: 1px solid var(--border);
  line-height: 1.3;
}
.funnel-stage {
  display: flex; flex-direction: column; align-items: flex-start;
  padding: 8px 12px;
  border-radius: var(--r-sm);
  cursor: pointer;
  position: relative;
  transition: all .12s;
  border: 1px solid transparent;
}
.funnel-stage:hover { background: var(--bg-soft); }
.funnel-stage.active {
  background: var(--bg-hover);
  border-color: var(--border-strong);
}
.funnel-stage::before {
  content: "";
  position: absolute; left: 12px; top: 12px;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: currentColor;
}
.funnel-stage[data-stage="0"] { color: var(--stage-0); }
.funnel-stage[data-stage="1"] { color: var(--stage-1); }
.funnel-stage[data-stage="2"] { color: var(--stage-2); }
.funnel-stage[data-stage="3"] { color: var(--stage-3); }
.funnel-stage[data-stage="4"] { color: var(--stage-4); }
.funnel-stage[data-stage="5"] { color: var(--stage-5); }

.funnel-stage-num {
  font-size: 22px; font-weight: 700;
  margin-left: 16px;
  margin-top: -2px;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}
.funnel-stage-name {
  font-size: 11px;
  margin-top: 4px;
  margin-left: 16px;
  color: var(--text-secondary);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.funnel-stage.active .funnel-stage-name {
  color: var(--text-primary);
}
.funnel-stage-arrow {
  position: absolute;
  right: -1px;
  top: 50%;
  width: 1px;
  height: 32px;
  transform: translateY(-50%);
  background: var(--border);
}
.funnel-stage:last-child .funnel-stage-arrow { display: none; }

/* =========================================
   Таблица
   ========================================= */
.table-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
}
.table-scroll {
  overflow-x: auto;
}
.table-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-soft);
  gap: 12px;
  flex-wrap: wrap;
}
.toolbar-left { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.toolbar-right { display: flex; align-items: center; gap: 8px; }
.filter-pill {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 12px;
  color: var(--text-secondary);
}
.filter-pill .x {
  cursor: pointer;
  margin-left: 2px;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1;
  display: grid; place-items: center;
  width: 14px; height: 14px;
  border-radius: 50%;
}
.filter-pill .x:hover { background: var(--bg-soft); color: var(--text-primary); }

.table-count {
  font-size: 12px; color: var(--text-secondary);
}
.table-count strong { color: var(--text-primary); font-weight: 600; }

table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.data-table thead th {
  text-align: left;
  padding: 10px 12px;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  background: var(--bg-soft);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  position: sticky; top: 0;
}
.data-table tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.data-table tbody tr {
  transition: background .12s;
  cursor: pointer;
}
.data-table tbody tr:hover { background: var(--bg-soft); }
.data-table tbody tr:nth-child(even) { background: var(--bg-row-alt); }
.data-table tbody tr:nth-child(even):hover { background: var(--bg-soft); }

.data-table .col-num { width: 36px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.data-table .col-art { font-family: 'JetBrains Mono', 'Consolas', monospace; font-size: 12px; color: var(--accent-graphite); font-weight: 600; }
.data-table .col-art.empty { color: var(--text-muted); font-weight: 400; }
.data-table .col-name { font-weight: 500; color: var(--text-primary); }
.data-table .col-oem { font-family: 'JetBrains Mono', 'Consolas', monospace; font-size: 12px; color: var(--text-secondary); }
.data-table .col-customer { color: var(--text-primary); }
.data-table .col-equipment { color: var(--text-secondary); font-size: 12px; }
.data-table .col-date { color: var(--text-secondary); font-size: 12px; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* Badge стадии */
.stage-badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 600;
  padding: 3px 8px 3px 6px;
  border-radius: 999px;
  white-space: nowrap;
}
.stage-badge::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.stage-badge.s0 { background: var(--stage-0-soft); color: var(--stage-0); }
.stage-badge.s1 { background: var(--stage-1-soft); color: var(--stage-1); }
.stage-badge.s2 { background: var(--stage-2-soft); color: var(--stage-2); }
.stage-badge.s3 { background: var(--stage-3-soft); color: var(--stage-3); }
.stage-badge.s4 { background: var(--stage-4-soft); color: var(--stage-4); }
.stage-badge.s5 { background: var(--stage-5-soft); color: var(--stage-5); }

/* Иконки в таблице (артефакты) */
.artifacts {
  display: flex; gap: 4px;
}
.art-icon {
  width: 18px; height: 18px;
  display: grid; place-items: center;
  border-radius: 3px;
  font-size: 10px; font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
}
.art-icon.has { background: #DCFCE7; color: #15803D; }
.art-icon.no  { background: var(--bg-soft); color: var(--text-muted); }

/* Empty state */
.empty-state {
  padding: 60px 20px;
  text-align: center;
  color: var(--text-secondary);
}
.empty-state .em-icon {
  font-size: 36px;
  opacity: 0.4;
  margin-bottom: 8px;
}

/* =========================================
   SVG-иконки (вставляются inline)
   ========================================= */
.icon { width: 16px; height: 16px; stroke-width: 1.8; }

/* =========================================
   Карточка заказчика
   ========================================= */
.cust-header {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 20px 24px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 24px;
  align-items: start;
}
.cust-id {
  display: flex; flex-direction: column;
  gap: 6px;
}
.cust-id-name {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}
.cust-id-meta {
  display: flex; flex-wrap: wrap;
  gap: 14px;
  font-size: 12px;
  color: var(--text-secondary);
}
.cust-id-meta .tag {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px;
  background: var(--bg-soft);
  border-radius: 999px;
  font-weight: 500;
}
.cust-id-meta .tag.equiform { background: #EFF6FF; color: var(--accent-graphite); }
.cust-id-meta .tag.oem      { background: #FFF7ED; color: var(--accent-terracotta); }

.cust-summary {
  display: grid;
  grid-template-columns: repeat(3, auto);
  gap: 0 28px;
  font-size: 12px;
}
.cust-summary > div {
  display: flex; flex-direction: column;
  gap: 2px;
}
.cust-summary .lbl {
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
}
.cust-summary .val {
  font-size: 20px;
  font-weight: 700;
  color: var(--accent-graphite);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

/* Section блоки */
.section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.section-head h2 {
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
}
.section-head .section-meta {
  font-size: 12px;
  color: var(--text-muted);
}

/* Сводный info-блок */
.info-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.info-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 16px 18px;
}
.info-card h3 {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 10px;
}
.info-list {
  display: flex; flex-direction: column;
  gap: 8px;
  font-size: 13px;
}
.info-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  min-width: 0;
}
.info-row .ir-lbl {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
  flex-shrink: 0;
  white-space: nowrap;
}
.info-row .ir-val {
  color: var(--text-primary);
  text-align: right;
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.info-row .ir-val.mono {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
}

/* Структурное дерево */
.tree {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 14px 18px;
  font-size: 13px;
}
.tree ul { padding-left: 20px; position: relative; }
.tree > ul { padding-left: 0; }
.tree li {
  position: relative;
  padding: 4px 0 4px 22px;
  line-height: 1.5;
}
.tree ul ul li::before {
  content: "";
  position: absolute;
  left: 0; top: 14px;
  width: 14px; height: 1px;
  background: var(--border-strong);
}
.tree ul ul li::after {
  content: "";
  position: absolute;
  left: 0; top: 0;
  bottom: 0;
  width: 1px;
  background: var(--border-strong);
}
.tree ul ul li:last-child::after { bottom: calc(100% - 14px); }

.tree-icon {
  display: inline-block;
  width: 14px; height: 14px;
  vertical-align: -2px;
  margin-right: 6px;
  color: var(--text-muted);
}
.tree-label { font-weight: 500; color: var(--text-primary); }
.tree-meta { font-size: 11px; color: var(--text-muted); margin-left: 4px; }
.tree-tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 1px 6px;
  border-radius: 3px;
  margin-left: 6px;
  vertical-align: 1px;
}
.tree-tag.equiform { background: #EFF6FF; color: var(--accent-graphite); }
.tree-tag.oem      { background: #FFF7ED; color: var(--accent-terracotta); }

/* =========================================
   Equipment cards (с шильдами — для случая 1–4 единиц)
   ========================================= */
.equip-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}
.equip-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 16px;
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 18px;
  cursor: pointer;
  transition: all .15s;
}
.equip-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
}
.equip-info { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.equip-tag-row { display: flex; gap: 6px; flex-wrap: wrap; }
.equip-card .equip-tag {
  display: inline-flex;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 8px;
  border-radius: 3px;
}
.equip-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
}
.equip-model {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--text-secondary);
}
.equip-stats {
  margin-top: auto;
  display: flex;
  gap: 14px;
  font-size: 12px;
  color: var(--text-secondary);
  padding-top: 8px;
  border-top: 1px solid var(--border);
}
.equip-stats strong {
  display: block;
  font-size: 16px;
  color: var(--accent-graphite);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* =========================================
   Equipment list (компактный список + popover при hover)
   --- для случая 5+ единиц у заказчика. Сейчас не используется,
       но стили готовы — на будущее, когда у заказчика будет крупный парк.
   ========================================= */
.equip-list {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
}
.equip-row {
  display: grid;
  grid-template-columns: 100px 1fr auto;
  gap: 16px;
  align-items: center;
  padding: 12px 16px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background .12s;
}
.equip-row:last-child { border-bottom: 0; }
.equip-row:hover { background: var(--bg-soft); }
.equip-row .equip-tag-cell {
  display: flex;
  align-items: center;
}
.equip-row .equip-tag {
  display: inline-flex;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 3px 9px;
  border-radius: 3px;
}
.equip-tag.equiform { background: #EFF6FF; color: var(--accent-graphite); }
.equip-tag.oem      { background: #FFF7ED; color: var(--accent-terracotta); }
.equip-tag.steza    { background: #F0FDF4; color: #16A34A; }
.equip-tag.muted    { background: var(--bg-soft); color: var(--text-secondary); }

.equip-row-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.equip-row-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
}
.equip-row-meta {
  font-size: 12px;
  color: var(--text-secondary);
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.equip-row-meta .mono {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
}
.equip-row-meta .sep { color: var(--text-muted); }

.equip-row-stats {
  display: flex;
  gap: 16px;
  font-size: 12px;
  color: var(--text-secondary);
  align-items: baseline;
}
.equip-row-stats strong {
  font-size: 14px;
  font-weight: 700;
  color: var(--accent-graphite);
  font-variant-numeric: tabular-nums;
  margin-right: 3px;
}
.equip-row-stats .stat-alert strong { color: var(--accent-terracotta); }
.equip-row-stats .stat-alert { color: var(--accent-terracotta); font-weight: 500; }

/* Hint иконка справа от строки */
.equip-row-hint {
  width: 16px; height: 16px;
  color: var(--text-muted);
  opacity: 0;
  transition: opacity .12s;
}
.equip-row:hover .equip-row-hint { opacity: 1; }

/* =========================================
   Popover оборудования (показывается при hover на строку)
   ========================================= */
.equip-popover {
  position: fixed;
  z-index: 100;
  width: 360px;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  padding: 18px;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transform: translateX(-8px);
  transition: opacity .15s ease, transform .15s ease, visibility 0s linear .15s;
}
.equip-popover.visible {
  opacity: 1;
  visibility: visible;
  transform: translateX(0);
  transition: opacity .15s ease, transform .15s ease, visibility 0s;
}
.equip-popover::before {
  content: "";
  position: absolute;
  left: -7px;
  top: 28px;
  width: 12px;
  height: 12px;
  background: var(--bg-card);
  border-left: 1px solid var(--border-strong);
  border-bottom: 1px solid var(--border-strong);
  transform: rotate(45deg);
}
.equip-popover.right-side::before {
  left: auto;
  right: -7px;
  border-left: 0;
  border-bottom: 0;
  border-right: 1px solid var(--border-strong);
  border-top: 1px solid var(--border-strong);
}

.popover-tag-row { display: flex; gap: 6px; margin-bottom: 10px; }
.popover-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
  line-height: 1.3;
}
.popover-desc {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 14px;
  line-height: 1.4;
}
.popover-shield-wrap {
  margin-bottom: 14px;
}
.popover-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.popover-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.popover-stat .ps-num {
  font-size: 18px;
  font-weight: 700;
  color: var(--accent-graphite);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.popover-stat.alert .ps-num { color: var(--accent-terracotta); }
.popover-stat .ps-lbl {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}
.popover-cta {
  margin-top: 12px;
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  font-style: italic;
}

/* =========================================
   Equipment header (на странице оборудования)
   ========================================= */
.equip-page-header {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 18px 24px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 24px;
  align-items: center;
}
.equip-page-id {
  display: flex; flex-direction: column;
  gap: 8px;
  min-width: 0;
}
.equip-page-name {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}
.equip-page-meta {
  display: flex; flex-wrap: wrap;
  gap: 14px;
  font-size: 12px;
  color: var(--text-secondary);
}
.equip-page-meta .em-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px;
  background: var(--bg-soft);
  border-radius: 999px;
  font-weight: 500;
}
.equip-page-meta .mono {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
}
.equip-page-summary {
  display: grid;
  grid-template-columns: repeat(3, auto);
  gap: 0 28px;
  font-size: 12px;
}
.equip-page-summary > div {
  display: flex; flex-direction: column;
  gap: 2px;
}
.equip-page-summary .lbl {
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
}
.equip-page-summary .val {
  font-size: 20px;
  font-weight: 700;
  color: var(--accent-graphite);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.equip-page-summary .val.alert { color: var(--accent-terracotta); }

/* =========================================
   View toggle (Схема / Список)
   ========================================= */
.view-toggle {
  display: inline-flex;
  background: var(--bg-soft);
  border-radius: var(--r-md);
  padding: 3px;
  gap: 2px;
}
.view-toggle button {
  padding: 6px 14px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  display: inline-flex; align-items: center; gap: 6px;
  transition: all .12s;
}
.view-toggle button:hover { color: var(--text-primary); }
.view-toggle button.active {
  background: var(--bg-card);
  color: var(--accent-graphite);
  box-shadow: var(--shadow-sm);
}

/* =========================================
   Интерактивная схема
   ========================================= */
.scheme-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 18px 18px 8px;
  position: relative;
}
.scheme-stage {
  background:
    repeating-linear-gradient(0deg, transparent 0, transparent 39px, var(--border) 39px, var(--border) 40px),
    repeating-linear-gradient(90deg, transparent 0, transparent 39px, var(--border) 39px, var(--border) 40px),
    var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 12px;
  margin-bottom: 12px;
  position: relative;
}
.conveyor-svg {
  width: 100%;
  height: auto;
  display: block;
}

/* SVG hotspot стили */
.hotspot {
  cursor: pointer;
  transition: filter .15s;
}
.hotspot .hs-shape {
  transition: all .15s;
}
.hotspot:hover .hs-shape {
  filter: drop-shadow(0 0 8px rgba(194, 65, 12, 0.45));
}
/* Нумерованные маркеры (1, 2, 3...) скрываем — они дублируют подписи.
   Подписи (.hs-label) и линии-выноски (.hs-leader) показываем. */
.hotspot .hs-marker,
.hotspot .hs-marker-text {
  display: none;
}
.hotspot .hs-label {
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  font-weight: 500;
  fill: var(--text-secondary);
  pointer-events: none;
  transition: fill .15s, font-weight .15s;
}
.hotspot:hover .hs-label {
  fill: var(--accent-terracotta);
  font-weight: 600;
}
.hotspot .hs-leader {
  stroke: var(--text-muted);
  stroke-width: 0.8;
  stroke-dasharray: 2,3;
  pointer-events: none;
  transition: stroke .15s, stroke-dasharray .15s;
  fill: none;
}
.hotspot:hover .hs-leader {
  stroke: var(--accent-terracotta);
  stroke-dasharray: 0;
  stroke-width: 1;
}

/* статусные кружки на схеме (по стадии RE) */
.stage-pip[data-stage="0"] { fill: var(--stage-0); }
.stage-pip[data-stage="1"] { fill: var(--stage-1); }
.stage-pip[data-stage="2"] { fill: var(--stage-2); }
.stage-pip[data-stage="3"] { fill: var(--stage-3); }
.stage-pip[data-stage="4"] { fill: var(--stage-4); }
.stage-pip[data-stage="5"] { fill: var(--stage-5); }

/* Tooltip над схемой */
.scheme-tooltip {
  position: fixed;
  z-index: 200;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  padding: 10px 14px;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transform: translate(-50%, calc(-100% - 12px));
  transition: opacity .12s, visibility 0s linear .12s;
  min-width: 220px;
}
.scheme-tooltip.visible {
  opacity: 1;
  visibility: visible;
  transition: opacity .12s, visibility 0s;
}
.scheme-tooltip::after {
  content: "";
  position: absolute;
  bottom: -7px; left: 50%;
  transform: translateX(-50%) rotate(45deg);
  width: 12px; height: 12px;
  background: var(--bg-card);
  border-right: 1px solid var(--border-strong);
  border-bottom: 1px solid var(--border-strong);
}
.tt-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}
.tt-row {
  font-size: 11px;
  color: var(--text-secondary);
  display: flex; align-items: center; gap: 6px;
  line-height: 1.4;
}
.tt-row .mono {
  font-family: 'JetBrains Mono', monospace;
  color: var(--accent-graphite);
  font-weight: 600;
}
.tt-cta {
  font-size: 10px;
  color: var(--text-muted);
  font-style: italic;
  margin-top: 6px;
  border-top: 1px dashed var(--border);
  padding-top: 5px;
}

/* Легенда схемы */
.scheme-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  padding: 10px 4px;
  font-size: 11px;
  color: var(--text-secondary);
}
.scheme-legend .lg-item { display: flex; align-items: center; gap: 6px; }
.scheme-legend .lg-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
}

/* Заглушка-плейсхолдер для KSB (схемы нет) */
.scheme-placeholder {
  padding: 60px 20px;
  text-align: center;
  color: var(--text-secondary);
  background: var(--bg-soft);
  border: 1px dashed var(--border-strong);
  border-radius: var(--r-md);
}
.scheme-placeholder .ph-icon {
  font-size: 40px;
  opacity: 0.35;
  margin-bottom: 8px;
}

/* =========================================
   Part Page — карточка детали
   ========================================= */
.part-header {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 20px 24px;
  display: grid;
  grid-template-columns: 96px 1fr auto;
  gap: 24px;
  align-items: center;
}
.part-shape {
  width: 96px;
  height: 96px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  display: grid;
  place-items: center;
}
.part-shape svg { width: 78%; height: 78%; }
.part-id {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.part-id-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.part-id-name {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}
.part-id-art {
  display: flex; align-items: baseline; gap: 12px;
  font-size: 12px;
  color: var(--text-secondary);
}
.part-id-art .mono {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  color: var(--accent-graphite);
  font-weight: 600;
}
.part-summary {
  display: grid;
  grid-template-columns: repeat(3, auto);
  gap: 0 24px;
  font-size: 12px;
}
.part-summary > div {
  display: flex; flex-direction: column;
  gap: 2px;
}
.part-summary .lbl {
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
}
.part-summary .val {
  font-size: 18px;
  font-weight: 700;
  color: var(--accent-graphite);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

/* ==== RE Pipeline progress ==== */
.pipeline {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 22px 28px 20px;
}
.pipeline-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 16px;
}
.pipeline-track {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0;
  position: relative;
}
.pipe-step {
  position: relative;
  text-align: center;
  padding-top: 28px;
}
.pipe-step .pipe-bullet {
  position: absolute;
  left: calc(50% - 11px);
  top: 0;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 2px solid var(--border-strong);
  z-index: 2;
  display: grid;
  place-items: center;
  transition: all .15s;
}
.pipe-step .pipe-bullet svg {
  width: 11px; height: 11px;
  opacity: 0;
  transition: opacity .15s;
}
.pipe-step::after {
  content: "";
  position: absolute;
  left: calc(50% + 11px);
  top: 11px;
  right: calc(-50% + 11px);
  height: 2px;
  background: var(--border-strong);
  z-index: 1;
}
.pipe-step:last-child::after { display: none; }

.pipe-step.done .pipe-bullet {
  background: var(--stage-5);
  border-color: var(--stage-5);
}
.pipe-step.done .pipe-bullet svg {
  color: white;
  opacity: 1;
}
.pipe-step.done::after { background: var(--stage-5); }

.pipe-step.current .pipe-bullet {
  background: var(--accent-terracotta);
  border-color: var(--accent-terracotta);
  box-shadow: 0 0 0 5px rgba(194, 65, 12, 0.15);
}
.pipe-step.current .pipe-bullet::after {
  content: "";
  width: 8px; height: 8px;
  border-radius: 50%;
  background: white;
}
.pipe-step.current .pipe-bullet svg { display: none; }

.pipe-step .pipe-name {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.pipe-step.done .pipe-name { color: var(--text-primary); }
.pipe-step.current .pipe-name { color: var(--accent-terracotta); }
.pipe-step .pipe-date {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
}
.pipe-step.current .pipe-date { color: var(--accent-terracotta); font-weight: 500; }

/* ==== Tabs ==== */
.tabs {
  display: flex;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 4px;
  gap: 2px;
  width: fit-content;
}
.tab-btn {
  padding: 8px 16px;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all .12s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: none;
  background: none;
  white-space: nowrap;
}
.tab-btn:hover { color: var(--text-primary); background: var(--bg-soft); }
.tab-btn.active {
  background: var(--accent-graphite);
  color: white;
}
.tab-btn .tab-icon { width: 14px; height: 14px; }

.tab-pane {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 24px;
  display: none;
}
.tab-pane.active { display: block; }

.pane-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
}
.pane-section h3 {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

/* Drawing canvas (стилизованный чертёж) */
.drawing-canvas {
  background: white;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  padding: 0;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.drawing-canvas svg { width: 100%; height: auto; display: block; }
.drawing-meta {
  background: var(--bg-soft);
  border-radius: var(--r-md);
  padding: 14px 18px;
  font-size: 12px;
}
.drawing-meta .row {
  display: flex; justify-content: space-between;
  padding: 4px 0;
  border-bottom: 1px dashed var(--border);
}
.drawing-meta .row:last-child { border-bottom: 0; }
.drawing-meta .row .lbl { color: var(--text-secondary); }
.drawing-meta .row .val { color: var(--text-primary); font-weight: 500; }
.drawing-meta .row .val.mono { font-family: 'JetBrains Mono', monospace; }

/* Photo placeholder для замера */
.photo-block {
  background: var(--bg-soft);
  border: 1px dashed var(--border-strong);
  border-radius: var(--r-md);
  aspect-ratio: 4/3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  position: relative;
  overflow: hidden;
}
.photo-block svg { max-width: 70%; max-height: 70%; }
.photo-caption {
  position: absolute;
  bottom: 8px; left: 8px; right: 8px;
  font-size: 11px;
  color: var(--text-muted);
  background: rgba(255,255,255,0.85);
  padding: 4px 8px;
  border-radius: var(--r-sm);
}

/* Action row под чертежом */
.action-row {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}

/* "Где стоит" cards */
.where-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.where-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 14px 18px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 16px;
  align-items: center;
  cursor: pointer;
  transition: all .12s;
}
.where-card:hover { background: var(--bg-soft); border-color: var(--border-strong); }
.where-card .where-tag {
  display: inline-flex;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 3px 9px;
  border-radius: 3px;
}
.where-tag.equiform { background: #EFF6FF; color: var(--accent-graphite); }
.where-tag.steza    { background: #F0FDF4; color: #16A34A; }
.where-card .where-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.where-card .where-customer {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}
.where-card .where-meta {
  font-size: 12px;
  color: var(--text-secondary);
}
.where-card .where-stats {
  display: flex; gap: 18px;
  font-size: 12px;
  color: var(--text-secondary);
  align-items: baseline;
}
.where-card .where-stats strong {
  font-size: 16px;
  color: var(--accent-graphite);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  margin-right: 4px;
}

/* =========================================
   Drawing Viewer Modal — онлайн-просмотр чертежа
   ========================================= */
.dv-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
}
.dv-modal.active { display: block; }

.dv-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

.dv-container {
  position: absolute;
  inset: 24px;
  background: var(--bg-card);
  border-radius: var(--r-md);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.dv-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 16px 12px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-card);
  flex-shrink: 0;
}

.dv-title {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
  min-width: 0;
}
.dv-title-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}
.dv-title-meta {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 2px;
}
.dv-title-meta .mono {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  color: var(--accent-graphite);
}

.dv-toolbar {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  background: var(--bg-soft);
  border-radius: var(--r-md);
  padding: 3px;
}

.dv-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 4px;
  font-size: 13px;
  color: var(--text-secondary);
  transition: all .12s;
  background: transparent;
  border: none;
  cursor: pointer;
  min-width: 32px;
  height: 30px;
}
.dv-btn:hover { background: var(--bg-card); color: var(--text-primary); }
.dv-btn.icon-only { padding: 6px; }
.dv-btn .icon { width: 14px; height: 14px; }

.dv-zoom-label {
  font-size: 12px;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
  min-width: 44px;
  text-align: center;
  font-weight: 500;
}

.dv-divider {
  width: 1px;
  height: 18px;
  background: var(--border);
  margin: 0 4px;
}

.dv-close {
  width: 32px;
  height: 32px;
  border-radius: var(--r-sm);
  display: grid;
  place-items: center;
  color: var(--text-secondary);
  transition: all .12s;
  cursor: pointer;
  background: none;
  border: none;
  font-size: 22px;
  line-height: 1;
  margin-left: 4px;
}
.dv-close:hover { background: var(--bg-soft); color: var(--text-primary); }

.dv-body {
  flex: 1;
  overflow: auto;
  background:
    repeating-linear-gradient(0deg, transparent 0, transparent 24px, rgba(60,40,20,0.04) 24px, rgba(60,40,20,0.04) 25px),
    repeating-linear-gradient(90deg, transparent 0, transparent 24px, rgba(60,40,20,0.04) 24px, rgba(60,40,20,0.04) 25px),
    #EDEAE3;
  padding: 32px;
  cursor: grab;
  text-align: center;
}
.dv-body.grabbing { cursor: grabbing; }

.dv-stage {
  display: inline-block;
  background: white;
  box-shadow: 0 8px 28px rgba(0,0,0,0.18);
  text-align: left;
}
.dv-stage svg {
  display: block;
  width: 900px;
  height: auto;
  transition: width .12s ease;
}

.dv-status {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(31, 58, 95, 0.92);
  color: white;
  font-size: 11px;
  padding: 6px 12px;
  border-radius: 999px;
  pointer-events: none;
  display: flex;
  gap: 14px;
  font-variant-numeric: tabular-nums;
}
.dv-status .sep { color: rgba(255,255,255,0.4); }

/* =========================================
   ТКП Page — превью технико-коммерческого предложения
   ========================================= */
.tkp-summary {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 16px 20px;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 18px;
  align-items: center;
}
.tkp-summary > div {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.tkp-summary .tlbl {
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
}
.tkp-summary .tval {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}
.tkp-summary .tval.big {
  font-family: var(--font-heading);
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.tkp-summary .tval.accent {
  color: var(--accent-graphite);
}

/* "Документ" — превью ТКП в стиле бумаги */
.tkp-doc {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-md);
  padding: 48px 60px;
  font-size: 13px;
  color: #1a1a1a;
}

.tkp-doc-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  border-bottom: 2px solid #1a1a1a;
  padding-bottom: 18px;
  margin-bottom: 24px;
  gap: 24px;
}
.tkp-doc-brand {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.tkp-doc-brand .br-name {
  font-family: var(--font-heading);
  font-size: 22px;
  font-weight: 700;
  color: var(--accent-graphite);
  letter-spacing: -0.01em;
}
.tkp-doc-brand .br-sub {
  font-size: 11px;
  color: var(--text-secondary);
}
.tkp-doc-meta {
  text-align: right;
  font-size: 11px;
  color: var(--text-secondary);
}
.tkp-doc-meta .doc-num {
  font-family: var(--font-heading);
  font-size: 16px;
  font-weight: 700;
  color: var(--accent-graphite);
  letter-spacing: -0.01em;
  margin-bottom: 4px;
}
.tkp-doc-meta .mono {
  font-family: var(--font-mono);
  color: var(--text-primary);
}

.tkp-doc-title {
  text-align: center;
  margin: 28px 0;
}
.tkp-doc-title h2 {
  font-family: var(--font-heading);
  font-size: 16px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-primary);
  font-weight: 700;
  margin-bottom: 6px;
}
.tkp-doc-title .subtitle {
  font-size: 13px;
  color: var(--text-secondary);
}

.tkp-recipient {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 8px 16px;
  font-size: 12.5px;
  margin-bottom: 28px;
  padding-bottom: 16px;
  border-bottom: 1px dashed var(--border-strong);
}
.tkp-recipient .r-lbl {
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 10px;
  font-weight: 600;
  padding-top: 2px;
}
.tkp-recipient .r-val { color: var(--text-primary); }
.tkp-recipient .r-val.mono { font-family: var(--font-mono); font-size: 12px; }

.tkp-section-title {
  font-family: var(--font-heading);
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 14px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border-strong);
}

.tkp-items {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  margin-bottom: 18px;
}
.tkp-items thead th {
  text-align: left;
  padding: 10px 10px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  background: var(--bg-soft);
  border-top: 1.5px solid var(--accent-graphite);
  border-bottom: 1px solid var(--border-strong);
  white-space: nowrap;
}
.tkp-items tbody td {
  padding: 10px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.tkp-items tbody tr:hover { background: var(--bg-soft); }
.tkp-items td.num { color: var(--text-muted); width: 28px; font-variant-numeric: tabular-nums; }
.tkp-items td.art { font-family: var(--font-mono); font-size: 11px; color: var(--accent-graphite); font-weight: 600; white-space: nowrap; }
.tkp-items td.name { font-weight: 500; }
.tkp-items td.qty { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tkp-items td.price, .tkp-items td.sum, .tkp-items td.cost, .tkp-items td.profit {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  font-family: var(--font-mono);
  font-size: 11.5px;
}
.tkp-items td.sum { font-weight: 700; color: var(--accent-graphite); }
.tkp-items .col-internal { display: none; }
.tkp-doc.mode-internal .col-internal { display: table-cell; }

.tkp-totals {
  margin-left: auto;
  width: 360px;
  font-size: 12.5px;
  margin-bottom: 28px;
}
.tkp-totals .row {
  display: flex;
  justify-content: space-between;
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
}
.tkp-totals .row.grand {
  background: var(--accent-graphite);
  color: white;
  border: 0;
  border-radius: var(--r-sm);
  margin-top: 6px;
  font-weight: 700;
  font-size: 14px;
}
.tkp-totals .row.grand .v { font-size: 16px; font-family: var(--font-heading); }
.tkp-totals .row .v {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.tkp-margin {
  display: none;
  margin-bottom: 24px;
  padding: 14px 18px;
  background: var(--accent-yellow-soft);
  border: 1px solid var(--accent-yellow);
  border-radius: var(--r-md);
  font-size: 12px;
}
.tkp-doc.mode-internal .tkp-margin { display: flex; gap: 24px; }
.tkp-margin > div { display: flex; flex-direction: column; gap: 2px; }
.tkp-margin .ml { font-size: 10px; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.04em; font-weight: 600; }
.tkp-margin .mv { font-family: var(--font-mono); font-size: 14px; font-weight: 700; color: var(--text-primary); }
.tkp-margin .mv.profit { color: #15803D; }

.tkp-conditions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px 32px;
  font-size: 12px;
  margin-bottom: 28px;
}
.tkp-conditions .cond {
  display: flex; flex-direction: column;
  gap: 4px;
}
.tkp-conditions .c-lbl {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 700;
  color: var(--text-secondary);
}
.tkp-conditions .c-val { color: var(--text-primary); line-height: 1.5; }

.tkp-signature {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 24px;
  align-items: end;
  padding-top: 22px;
  border-top: 1px solid var(--border-strong);
  margin-bottom: 28px;
}
.tkp-sig-line {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.tkp-sig-line .ln {
  border-bottom: 1px solid #1a1a1a;
  height: 22px;
  width: 200px;
  position: relative;
}
.tkp-sig-line .ln::after {
  content: "(подпись)";
  position: absolute;
  bottom: -14px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 9px;
  color: var(--text-muted);
}
.tkp-sig-line .role {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 12px;
}
.tkp-sig-line .name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}
.tkp-stamp {
  width: 120px; height: 120px;
  border: 2px solid #C2410C;
  border-radius: 50%;
  display: grid;
  place-items: center;
  text-align: center;
  font-size: 10px;
  color: #C2410C;
  opacity: 0.6;
  font-family: var(--font-heading);
  letter-spacing: 0.04em;
  font-weight: 700;
  text-transform: uppercase;
  transform: rotate(-8deg);
  background: rgba(255,255,255,0.5);
  line-height: 1.3;
  padding: 6px;
}

.tkp-footer {
  font-size: 11px;
  color: var(--text-secondary);
  text-align: center;
  padding-top: 14px;
  border-top: 1px dashed var(--border-strong);
  line-height: 1.6;
}
.tkp-footer .org-name { font-weight: 600; color: var(--text-primary); }

/* =========================================
   Add-to-TKP Modal — добавление позиции с количеством и коррекцией цены
   ========================================= */
.tkp-add-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
}
.tkp-add-modal.active { display: flex; }

.tkp-add-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

.tkp-add-container {
  position: relative;
  background: var(--bg-card);
  border-radius: var(--r-md);
  width: 520px;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 64px);
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  overflow: hidden;
}

.tkp-add-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.tkp-add-title {
  font-family: var(--font-heading);
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}
.tkp-add-close {
  width: 32px; height: 32px;
  border-radius: var(--r-sm);
  display: grid; place-items: center;
  color: var(--text-secondary);
  cursor: pointer;
  background: none; border: none;
  font-size: 22px; line-height: 1;
}
.tkp-add-close:hover { background: var(--bg-soft); color: var(--text-primary); }

.tkp-add-body {
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.tkp-add-part {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 14px;
  padding: 12px;
  background: var(--bg-soft);
  border-radius: var(--r-md);
  align-items: center;
}
.tkp-add-part-icon {
  width: 56px; height: 56px;
  background: white;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  display: grid; place-items: center;
}
.tkp-add-part-icon svg { width: 90%; height: 90%; }
.tkp-add-part-info { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.tkp-add-part-art {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--accent-graphite);
}
.tkp-add-part-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}
.tkp-add-part-meta {
  display: flex;
  gap: 6px;
  font-size: 11px;
  margin-top: 2px;
}

.tkp-add-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.tkp-add-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
}

.tkp-add-select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  font-size: 13px;
  font-family: inherit;
  background: white;
  color: var(--text-primary);
  cursor: pointer;
}
.tkp-add-select:focus { border-color: var(--accent-graphite); outline: none; box-shadow: 0 0 0 3px rgba(45,46,50,0.08); }

.tkp-add-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.tkp-add-qty {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: white;
  width: fit-content;
}
.tkp-add-qty-btn {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  font-size: 18px; font-weight: 600;
  color: var(--text-secondary);
  background: none; border: none;
  cursor: pointer;
}
.tkp-add-qty-btn:hover { background: var(--bg-soft); color: var(--text-primary); }
.tkp-add-qty-input {
  width: 56px; height: 36px;
  border: none;
  text-align: center;
  font-size: 14px; font-weight: 700;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  background: none;
  outline: none;
  font-family: var(--font-mono);
}
.tkp-add-qty-input::-webkit-inner-spin-button,
.tkp-add-qty-input::-webkit-outer-spin-button {
  -webkit-appearance: none; margin: 0;
}
.tkp-add-qty-unit {
  padding: 0 12px 0 4px;
  font-size: 12px;
  color: var(--text-muted);
}

.tkp-add-base {
  display: flex;
  align-items: center;
  height: 38px;
  font-size: 13px;
  color: var(--text-secondary);
}
.tkp-add-base strong {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--text-primary);
  font-weight: 700;
  margin-left: 6px;
}

.tkp-add-adj-tabs {
  display: flex;
  gap: 3px;
  background: var(--bg-soft);
  padding: 3px;
  border-radius: var(--r-md);
}
.tkp-add-adj-btn {
  flex: 1;
  padding: 7px 4px;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  background: none; border: none;
  cursor: pointer;
  font-family: var(--font-mono);
  transition: all .12s;
}
.tkp-add-adj-btn:hover { color: var(--text-primary); }
.tkp-add-adj-btn.active.discount {
  background: #16A34A; color: white;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.tkp-add-adj-btn.active.markup {
  background: var(--accent-yellow); color: var(--accent-graphite);
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.tkp-add-adj-btn.active.zero {
  background: var(--accent-graphite); color: white;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

.tkp-add-adj-custom {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}
.tkp-add-adj-input {
  width: 64px; height: 30px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 0 8px;
  font-size: 13px;
  font-weight: 700;
  text-align: center;
  font-family: var(--font-mono);
  background: white;
  color: var(--text-primary);
}
.tkp-add-adj-input:focus { outline: none; border-color: var(--accent-graphite); }

.tkp-add-price-final {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 10px 14px;
  background: var(--bg-soft);
  border-radius: var(--r-md);
  font-size: 12px;
  color: var(--text-secondary);
}
.tkp-add-price-final strong {
  font-family: var(--font-mono);
  font-size: 15px;
  color: var(--text-primary);
  font-weight: 700;
}
.tkp-add-price-final .delta {
  font-size: 11px;
  margin-left: 6px;
  color: var(--text-muted);
}
.tkp-add-price-final .delta.discount { color: #16A34A; }
.tkp-add-price-final .delta.markup { color: var(--accent-graphite); font-weight: 700; }

.tkp-add-total {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 14px 18px;
  background: var(--accent-graphite);
  color: white;
  border-radius: var(--r-md);
  font-size: 13px;
  font-weight: 600;
}
.tkp-add-total strong {
  font-family: var(--font-heading);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.tkp-add-comment {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  font-size: 13px;
  font-family: inherit;
  background: white;
  color: var(--text-primary);
}
.tkp-add-comment:focus { outline: none; border-color: var(--accent-graphite); }

.tkp-add-footer {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  background: var(--bg-soft);
  flex-shrink: 0;
}
.tkp-add-footer .left-hint {
  font-size: 11px;
  color: var(--text-muted);
  align-self: center;
}

/* Подсветка только что добавленной строки в ТКП */
.tkp-items tr.tkp-just-added {
  background: var(--accent-yellow-soft);
  animation: tkp-just-added-fade 4s ease-out;
}
@keyframes tkp-just-added-fade {
  0%   { background: #FDE68A; }
  100% { background: var(--accent-yellow-soft); }
}
.just-added-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  background: var(--accent-yellow);
  color: var(--accent-graphite);
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-radius: 3px;
  vertical-align: 1px;
}

/* =========================================
   Inline-редактирование строк ТКП:
   стэппер количества + поле коррекции цены
   ========================================= */
.tkp-items .qty-stepper {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: white;
  height: 26px;
  overflow: hidden;
}
.tkp-items .qty-btn {
  width: 22px; height: 24px;
  display: grid; place-items: center;
  font-size: 13px; font-weight: 700;
  color: var(--text-secondary);
  background: none; border: none;
  cursor: pointer;
  font-family: var(--font-mono);
}
.tkp-items .qty-btn:hover { background: var(--bg-soft); color: var(--text-primary); }
.tkp-items .qty-input {
  width: 38px; height: 24px;
  text-align: center;
  font-size: 12px; font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text-primary);
  border: none;
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  background: white;
  padding: 0;
  outline: none;
  -moz-appearance: textfield;
}
.tkp-items .qty-input::-webkit-inner-spin-button,
.tkp-items .qty-input::-webkit-outer-spin-button {
  -webkit-appearance: none; margin: 0;
}

.tkp-items .adj-cell {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}
.tkp-items .adj-input {
  width: 44px; height: 26px;
  border: 1px solid var(--border);
  border-radius: 5px;
  text-align: center;
  font-size: 12px; font-weight: 700;
  font-family: var(--font-mono);
  background: white;
  padding: 0 4px;
  outline: none;
  color: var(--text-primary);
  transition: border-color .12s, color .12s;
  -moz-appearance: textfield;
}
.tkp-items .adj-input::-webkit-inner-spin-button,
.tkp-items .adj-input::-webkit-outer-spin-button {
  -webkit-appearance: none; margin: 0;
}
.tkp-items .adj-input:focus { border-color: var(--accent-graphite); }
.tkp-items .adj-input.discount { color: #16A34A; border-color: #BBF7D0; background: #F0FDF4; }
.tkp-items .adj-input.markup   { color: #B45309; border-color: #FDE68A; background: #FFFBEB; }
.tkp-items .adj-suffix {
  font-size: 11px;
  color: var(--text-muted);
  margin-left: 1px;
}

/* Подсветка изменённой цены */
.tkp-items td.price.adjusted-discount { color: #16A34A; }
.tkp-items td.price.adjusted-markup   { color: #B45309; }
.tkp-items td.sum.adjusted-discount   { color: #16A34A; }
.tkp-items td.sum.adjusted-markup     { color: #B45309; }

/* =========================================
   Catalog Picker Modal — подбор позиций из каталога
   ========================================= */
.cat-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
}
.cat-modal.active { display: flex; }

.cat-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(2px);
}

.cat-container {
  position: relative;
  background: var(--bg-card);
  border-radius: var(--r-md);
  width: 720px;
  max-width: calc(100vw - 32px);
  height: 80vh;
  max-height: 720px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  overflow: hidden;
}

.cat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.cat-title {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}
.cat-title-name {
  font-family: var(--font-heading);
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}
.cat-title-meta {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 3px;
}
.cat-close {
  width: 32px; height: 32px;
  border-radius: var(--r-sm);
  display: grid; place-items: center;
  color: var(--text-secondary);
  cursor: pointer;
  background: none; border: none;
  font-size: 22px; line-height: 1;
}
.cat-close:hover { background: var(--bg-soft); color: var(--text-primary); }

.cat-search {
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-soft);
  flex-shrink: 0;
}
.cat-search input {
  width: 100%;
  height: 36px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  border-radius: var(--r-md);
  padding: 0 14px 0 36px;
  font-size: 13px;
  font-family: var(--font-body);
  color: var(--text-primary);
  outline: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236B7280' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'><circle cx='11' cy='11' r='8'/><path d='m21 21-4.3-4.3'/></svg>");
  background-repeat: no-repeat;
  background-position: 12px center;
}
.cat-search input:focus { border-color: var(--accent-graphite); box-shadow: 0 0 0 3px rgba(45,46,50,0.08); }

.cat-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}
.cat-row {
  display: grid;
  grid-template-columns: 36px 110px 1fr auto auto;
  gap: 12px;
  align-items: center;
  padding: 10px 20px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background .12s;
}
.cat-row:hover { background: var(--bg-soft); }
.cat-row.selected { background: var(--accent-yellow-soft); }
.cat-row.selected:hover { background: #FDE68A; }

.cat-check {
  width: 18px; height: 18px;
  border: 1.5px solid var(--border-strong);
  border-radius: 4px;
  background: white;
  display: grid; place-items: center;
  flex-shrink: 0;
}
.cat-row.selected .cat-check {
  background: var(--accent-graphite);
  border-color: var(--accent-graphite);
}
.cat-check svg {
  width: 12px; height: 12px;
  color: white;
  opacity: 0;
}
.cat-row.selected .cat-check svg { opacity: 1; }

.cat-art {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--accent-graphite);
}
.cat-name { font-size: 13px; font-weight: 500; color: var(--text-primary); }
.cat-price {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
}
.cat-unit {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-body);
}

.cat-empty {
  padding: 60px 20px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 13px;
}

.cat-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  background: var(--bg-soft);
  flex-shrink: 0;
}
.cat-counter {
  font-size: 12px;
  color: var(--text-secondary);
}
.cat-counter strong {
  color: var(--accent-graphite);
  font-weight: 700;
  font-size: 14px;
  font-family: var(--font-mono);
}

/* Кнопка "Добавить позицию" + "Новый ТКП" */
.tkp-add-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 0;
  margin: 4px 0 24px;
  border-top: 1px dashed var(--border-strong);
  border-bottom: 1px dashed var(--border-strong);
}
.tkp-add-line-actions {
  display: flex;
  gap: 8px;
}
.btn-dashed {
  padding: 8px 16px;
  border-radius: var(--r-md);
  font-size: 13px;
  font-weight: 500;
  color: var(--accent-graphite);
  background: var(--bg-card);
  border: 1.5px dashed var(--border-strong);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all .12s;
}
.btn-dashed:hover {
  border-color: var(--accent-graphite);
  background: var(--bg-soft);
}

/* Заголовок столбца "Корр." */
.tkp-items th.col-adj {
  text-align: center;
  white-space: nowrap;
}
.tkp-items td.col-adj {
  text-align: center;
}

/* Подсказка в шапке таблицы */
.tkp-edit-hint {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 400;
  margin-left: 8px;
  font-family: var(--font-body);
  text-transform: none;
  letter-spacing: 0;
}

/* Шильдик (стилизованный) */
.nameplate {
  position: relative;
  border-radius: 4px;
  padding: 14px 14px 10px;
  font-family: 'JetBrains Mono', 'Consolas', monospace;
  font-size: 11px;
  color: #1a1a1a;
  border: 1px solid #8a8a8a;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.6),
    inset 0 -1px 0 rgba(0,0,0,0.15),
    0 1px 2px rgba(0,0,0,0.1);
  background:
    repeating-linear-gradient(
      90deg,
      rgba(255,255,255,0.04) 0px,
      rgba(255,255,255,0.04) 1px,
      transparent 1px,
      transparent 3px
    ),
    linear-gradient(180deg, #d4d2cd 0%, #b6b3ac 50%, #a09c93 100%);
  user-select: none;
}
.nameplate.equiform {
  background:
    repeating-linear-gradient(
      90deg,
      rgba(255,255,255,0.04) 0px,
      rgba(255,255,255,0.04) 1px,
      transparent 1px,
      transparent 3px
    ),
    linear-gradient(180deg, #2a3a52 0%, #1F3A5F 60%, #14253b 100%);
  color: #f0eddf;
  border-color: #0d1825;
}
.np-rivet {
  position: absolute;
  width: 5px; height: 5px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #f0efea, #6e6b65 70%);
  box-shadow: 0 0 1px rgba(0,0,0,0.4);
}
.np-rivet.tl { top: 4px; left: 4px; }
.np-rivet.tr { top: 4px; right: 4px; }
.np-rivet.bl { bottom: 4px; left: 4px; }
.np-rivet.br { bottom: 4px; right: 4px; }

.nameplate.equiform .np-rivet {
  background: radial-gradient(circle at 35% 30%, #b8b2a0, #4a4538 70%);
}

.np-brand {
  font-family: 'Inter', sans-serif;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 2px;
  text-shadow: 0 1px 0 rgba(255,255,255,0.4);
}
.nameplate.equiform .np-brand {
  text-shadow: 0 1px 0 rgba(0,0,0,0.5);
  color: #f0eddf;
}
.np-tagline {
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.75;
  margin-bottom: 8px;
}
.np-model {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  margin-bottom: 8px;
  padding: 3px 6px;
  background: rgba(0,0,0,0.08);
  border: 1px dashed rgba(0,0,0,0.25);
  border-radius: 2px;
}
.nameplate.equiform .np-model {
  background: rgba(0,0,0,0.25);
  border-color: rgba(255,255,255,0.18);
}
.np-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px 10px;
  font-size: 10px;
  line-height: 1.4;
}
.np-grid .np-key {
  font-weight: 600;
  letter-spacing: 0.04em;
  opacity: 0.7;
  margin-right: 4px;
  display: inline-block;
  width: 28px;
}

/* =========================================
   Mini-table внутри карточки заказчика
   ========================================= */
.mini-table {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
}
.mini-table table { width: 100%; border-collapse: collapse; font-size: 13px; }
.mini-table thead th {
  text-align: left;
  padding: 8px 14px;
  font-weight: 600;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  background: var(--bg-soft);
  border-bottom: 1px solid var(--border);
}
.mini-table tbody td {
  padding: 9px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.mini-table tbody tr:last-child td { border-bottom: 0; }
.mini-table tbody tr { cursor: pointer; }
.mini-table tbody tr:hover { background: var(--bg-soft); }
.mini-table .col-art-mini {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--accent-graphite);
  font-weight: 600;
}
.mini-table .col-art-mini.empty { color: var(--text-muted); font-weight: 400; }

/* Линки внутри таблицы (заказчик/оборудование) */
.tbl-link {
  color: var(--accent-graphite);
  border-bottom: 1px dashed transparent;
  transition: border-color .12s;
}
.tbl-link:hover {
  border-bottom-color: var(--accent-graphite);
}

/* Breadcrumb с ссылкой */
.breadcrumb a {
  color: var(--text-secondary);
  border-bottom: 1px dashed transparent;
}
.breadcrumb a:hover {
  color: var(--accent-graphite);
  border-bottom-color: var(--accent-graphite);
}
