:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --ink: #16181d;
  --ink-2: #4a505c;
  --ink-3: #8a909c;
  --line: #e6e8ec;
  --line-2: #f0f1f4;
  --accent: #2f5bea;
  --accent-soft: #eef2fe;
  --green: #138a5b;
  --green-soft: #e7f6ef;
  --amber: #a8660a;
  --amber-soft: #fdf3e2;
  --violet: #6b45c9;
  --violet-soft: #f2edfc;
  --red: #c23b3b;
  --red-soft: #fdecec;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .06);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 14px; line-height: 1.45; color: var(--ink); background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; cursor: pointer; }

/* ---------- каркас ---------- */
.shell { display: grid; grid-template-columns: 268px 1fr; min-height: 100vh; }
.side { background: #101318; color: #c9ced8; padding: 20px 14px; display: flex; flex-direction: column; gap: 22px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px; color: #fff; font-weight: 700; font-size: 17px; letter-spacing: -.01em; }
.brand-mark { width: 28px; height: 28px; border-radius: 8px; background: #2f5bea; display: grid; place-items: center; }
.nav-label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: #6b7280; padding: 0 10px; margin-bottom: 6px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; color: #c9ced8; border: 0; background: none; text-align: left; width: 100%; }
.nav-item:hover { background: #1b2028; color: #fff; text-decoration: none; }
.nav-item.active { background: #222936; color: #fff; }
.nav-item.locked { color: #6b7280; cursor: default; }
.nav-item.locked:hover { background: none; color: #6b7280; }
.nav-item svg { flex: none; opacity: .9; }
.nav-item > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.soon { margin-left: auto; font-size: 10px; text-transform: uppercase; letter-spacing: .06em; background: #1f2530; color: #8a93a3; padding: 2px 6px; border-radius: 6px; }
.side-foot { margin-top: auto; font-size: 12px; color: #6b7280; padding: 0 10px; }

.main { display: flex; flex-direction: column; min-width: 0; }
.top { height: 60px; display: flex; align-items: center; justify-content: space-between; padding: 0 28px; background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.top h1 { font-size: 16px; margin: 0; font-weight: 600; }
.top-right { display: flex; align-items: center; gap: 12px; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 500; background: var(--line-2); color: var(--ink-2); }
.pill.dev { background: var(--amber-soft); color: var(--amber); }
.pill.ok { background: var(--green-soft); color: var(--green); }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-weight: 600; font-size: 13px; }
.content { padding: 28px 32px; width: 100%; }

/* ---------- поиск ---------- */
.search-wrap { position: relative; }
.search { display: flex; align-items: center; gap: 10px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 0 14px; box-shadow: var(--shadow); }
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.search input { flex: 1; border: 0; outline: 0; font: inherit; font-size: 15px; padding: 14px 0; background: transparent; color: var(--ink); }
.search .hint { font-size: 12px; color: var(--ink-3); }
.suggest { position: absolute; left: 0; right: 0; top: calc(100% + 6px); background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 12px 32px rgba(16,24,40,.12); overflow: hidden; z-index: 10; }
.suggest-item { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; padding: 10px 14px; border-bottom: 1px solid var(--line-2); cursor: pointer; }
.suggest-item:last-child { border-bottom: 0; }
.suggest-item:hover, .suggest-item.sel { background: var(--accent-soft); }
.suggest-name { font-weight: 500; }
.suggest-meta { font-size: 12px; color: var(--ink-3); }
.suggest-right { grid-row: span 2; align-self: center; text-align: right; font-size: 12px; color: var(--ink-2); }
.suggest-empty { padding: 14px; color: var(--ink-3); }

.intro { margin-top: 28px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.intro-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.intro-card b { display: block; margin-bottom: 4px; }
.intro-card p { margin: 0; color: var(--ink-2); font-size: 13px; }
.lead { color: var(--ink-2); margin: 0 0 18px; }

/* ---------- карточка ---------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.co { padding: 22px 24px; margin-top: 22px; display: grid; grid-template-columns: 1fr auto; gap: 18px; }
.co h2 { margin: 0 0 6px; font-size: 22px; letter-spacing: -.01em; }
.co-meta { display: flex; flex-wrap: wrap; row-gap: 2px; align-items: center; color: var(--ink-2); font-size: 13px;
           margin-left: -16px; clip-path: inset(0 0 0 16px); }
.co-meta > span { position: relative; padding-left: 16px; }
.co-meta > span::before { content: "·"; position: absolute; left: 6px; color: var(--ink-3); }
.kpis { display: flex; gap: 22px; align-items: flex-start; }
.kpi .v { font-size: 20px; font-weight: 600; letter-spacing: -.01em; }
.kpi .l { font-size: 12px; color: var(--ink-3); }
.verdict { grid-column: 1 / -1; display: flex; gap: 16px; align-items: center; border-top: 1px solid var(--line-2); padding-top: 16px; }
.mix { flex: none; width: 220px; }
.mix-bar { display: flex; height: 8px; border-radius: 999px; overflow: hidden; background: var(--line-2); }
.mix-bar i { display: block; height: 100%; }
.mix-legend { display: flex; gap: 10px; margin-top: 6px; font-size: 11px; color: var(--ink-3); flex-wrap: wrap; }
.mix-legend span::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 4px; background: var(--c); }
.verdict-text { color: var(--ink); font-weight: 500; }
.c-import { --c: #2f5bea; background: #2f5bea; }
.c-own { --c: #138a5b; background: #138a5b; }
.c-contract { --c: #e0a23b; background: #e0a23b; }

.section { margin-top: 18px; }
.section-head { display: flex; align-items: baseline; gap: 10px; padding: 16px 20px 10px; flex-wrap: wrap; }
.section-head h3 { margin: 0; font-size: 15px; }
.count { color: var(--ink-3); font-weight: 500; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: 12px; padding: 2px 8px; border-radius: 6px; background: var(--line-2); color: var(--ink-2); white-space: nowrap; }
.section-note { padding: 0 20px 10px; color: var(--ink-3); font-size: 12px; }

table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); font-weight: 600; padding: 8px 12px; border-top: 1px solid var(--line-2); border-bottom: 1px solid var(--line-2); background: #fbfbfc; }
td { padding: 12px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
th:first-child, td:first-child { padding-left: 20px; }
th:last-child, td:last-child { padding-right: 20px; }
.f-name { font-weight: 500; }
.f-place { color: var(--ink-2); font-size: 13px; }
.f-facts { color: var(--ink-2); font-size: 13px; margin-top: 4px; }
/* точки-разделители: у первого элемента каждой строки точка уходит в обрезанное поле слева */
.f-facts { display: flex; flex-wrap: wrap; row-gap: 2px; margin-left: -14px; clip-path: inset(0 0 0 14px); }
.f-facts span { white-space: nowrap; position: relative; padding-left: 14px; }
.f-facts span::before { content: "·"; position: absolute; left: 4px; color: var(--ink-3); }
.reg-facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px 24px; padding: 4px 20px 18px; }
.reg-facts + .section-note { padding-top: 0; padding-bottom: 16px; }
@media (max-width: 700px) { .reg-facts { grid-template-columns: 1fr 1fr; gap: 12px 16px; padding: 4px 14px 14px; } }
.reg-facts div { display: flex; flex-direction: column; gap: 2px; }
.reg-facts span { color: var(--ink-3); font-size: 12px; }
.reg-facts b { font-weight: 500; font-size: 14px; }
.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-3); font-size: 12px; }
.prod { display: flex; flex-wrap: wrap; gap: 4px; }
.prod .chip { background: var(--accent-soft); color: #2546b8; white-space: normal; max-width: 100%; line-height: 1.35; }
.prod { min-width: 0; }
.nb { font-size: 13px; color: var(--ink-2); }
.nb-item { display: block; }
.nb-item b { font-weight: 500; color: var(--ink); }
.rev { color: var(--green); font-size: 12px; margin-left: 4px; white-space: nowrap; }
.linkbtn { border: 0; background: none; color: var(--accent); padding: 0; font-size: 13px; }
.linkbtn:hover { text-decoration: underline; }
.more { padding: 12px 20px 16px; }
.btn { border: 1px solid var(--line); background: var(--panel); border-radius: 8px; padding: 7px 12px; font-weight: 500; color: var(--ink); }
.btn:hover { border-color: #cfd3da; background: #fafbfc; }
.own { padding: 16px 20px 18px; display: flex; gap: 14px; align-items: center; }
.own-icon { width: 40px; height: 40px; border-radius: 10px; background: var(--green-soft); color: var(--green); display: grid; place-items: center; flex: none; }
.badge { font-size: 11px; padding: 2px 7px; border-radius: 6px; font-weight: 500; }
.badge.factory { background: var(--green-soft); color: var(--green); }
.badge.trader { background: var(--amber-soft); color: var(--amber); }
.badge.brand { background: var(--violet-soft); color: var(--violet); }
.badge.nominal { background: #fdecec; color: #b42318; }
.doc-prod { max-width: 520px; color: var(--ink-2); font-size: 13px; }
.foot { margin: 22px 0 40px; color: var(--ink-3); font-size: 12px; }
.alert { margin-top: 18px; padding: 12px 16px; border-radius: 10px; background: var(--red-soft); color: var(--red); }
.loading { margin-top: 22px; color: var(--ink-3); }
.back { margin-top: 18px; }

/* ---------- подбор фабрики ---------- */
.filters { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.cat-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.cat { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 6px 12px; font-size: 13px; color: var(--ink-2); }
.cat:hover { border-color: #c9cfda; color: var(--ink); }
.cat.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.filter-row { display: flex; flex-wrap: wrap; gap: 18px; align-items: flex-end; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line-2); }
.filter-row label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--ink-3); }
.filter-row label.check { flex-direction: row; align-items: center; gap: 6px; color: var(--ink-2); font-size: 13px; }
.filter-row select { font: inherit; font-size: 14px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); min-width: 220px; }
.result-head { margin: 22px 0 10px; font-weight: 600; }
.fcards { display: flex; flex-direction: column; gap: 10px; }
/* фиксированная сетка: название | заказчиков | крупных | последний документ | список заказчиков */
.fcard { display: grid; grid-template-columns: minmax(0, 1.2fr) 96px 150px 112px minmax(0, 1.1fr); gap: 20px; padding: 16px 22px; align-items: start; }
.fcard-name { font-weight: 600; font-size: 15px; color: var(--ink); }
.fcard-name:hover { color: var(--accent); }
.fcard-stats { display: flex; gap: 18px; }
.stat b { display: block; font-size: 16px; font-variant-numeric: tabular-nums; }
.stat.dim b { color: var(--ink-3); font-weight: 500; }
.stat span { font-size: 12px; color: var(--ink-3); }
.fcard-clients { font-size: 13px; min-width: 0; }
.fcard-main { min-width: 0; }
.fcard-clients .nb-item { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
a.f-name { color: var(--ink); }
a.f-name:hover { color: var(--accent); }
.nb-item a { color: var(--ink); }
.nb-item a:hover { color: var(--accent); }
.links { display: flex; gap: 8px; align-items: center; margin-top: 12px; flex-wrap: wrap; }
.btn.small { padding: 4px 10px; font-size: 12px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.grid2 .section { margin-top: 18px; }
.bars { display: flex; gap: 8px; align-items: flex-end; padding: 8px 20px 16px; height: 170px; }
.bar { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; min-width: 22px; }
.bar-col { flex: 1; width: 100%; max-width: 36px; display: flex; align-items: flex-end; background: var(--line-2); border-radius: 6px; overflow: hidden; }
.bar-col i { display: block; width: 100%; background: var(--accent); border-radius: 6px 6px 0 0; }
.bar-v { font-size: 12px; font-weight: 600; }
.bar-l { font-size: 11px; color: var(--ink-3); }

.filter-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.fld { display: flex; flex-direction: column; gap: 5px; }
.fld > span { font-size: 12px; color: var(--ink-3); font-weight: 500; }
.fld select, .sort select { font: inherit; font-size: 14px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); width: 100%; }
.fld select:focus, .sort select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.result-bar { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin: 22px 0 10px; flex-wrap: wrap; }
.sort { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.sort select { width: auto; min-width: 240px; }
.empty { padding: 22px; color: var(--ink-2); }

/* ---------- адаптивность ---------- */
.table-wrap { overflow-x: auto; }
@media (max-width: 1280px) {
  .fcard { grid-template-columns: repeat(3, minmax(0, 1fr)); row-gap: 14px; }
  .fcard-main, .fcard-clients { grid-column: 1 / -1; }
  .fcard-clients { border-top: 1px solid var(--line-2); padding-top: 10px; }
  .grid2 { grid-template-columns: 1fr; gap: 0; }
}
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { display: none; }
  .top { padding: 0 16px; height: 52px; }
  .content { padding: 18px 14px; }
  .intro { grid-template-columns: 1fr; }
  .co { grid-template-columns: 1fr; padding: 18px; }
  .kpis { flex-wrap: wrap; gap: 16px; }
  .verdict { flex-direction: column; align-items: flex-start; }
  .mix { width: 100%; }
  .top-right .pill.dev { display: none; }
  .result-bar { flex-direction: column; align-items: flex-start; }
  .sort select { min-width: 0; width: 100%; }
  .sort { width: 100%; }
  td, th { padding: 10px 8px; }
  th:first-child, td:first-child { padding-left: 14px; }
}
@media (max-width: 560px) {
  /* карточка фабрики на телефоне: цифры — списком «подпись — значение» */
  .fcard { grid-template-columns: 1fr; gap: 0; padding: 14px; }
  .fcard-main { padding-bottom: 10px; }
  .fcard .stat { display: flex; flex-direction: row-reverse; justify-content: space-between; align-items: baseline;
                 gap: 12px; padding: 7px 0; border-top: 1px solid var(--line-2); }
  .fcard .stat b { font-size: 14px; display: inline; }
  .fcard .stat span { font-size: 13px; color: var(--ink-2); }
  .fcard .stat.dim { display: none; }
  .fcard .stat span::first-letter { text-transform: uppercase; }
  .fcard-clients { margin-top: 4px; }
  .co h2 { font-size: 19px; }
  .links .btn.small { padding: 4px 8px; }
}

/* ---------- шапка и меню на телефоне ---------- */
.top-brand { display: none; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; color: var(--ink); }
.burger { display: none; border: 0; background: none; padding: 6px; margin-right: -6px; color: var(--ink); border-radius: 8px; }
.burger:hover { background: var(--line-2); }
.page-title { display: none; font-size: 20px; margin: 0 0 12px; letter-spacing: -.01em; }
.mmenu { position: fixed; inset: 0; z-index: 50; background: #fff; display: flex; flex-direction: column; }
.mmenu-head { height: 56px; display: flex; align-items: center; justify-content: space-between; padding: 0 16px; border-bottom: 1px solid var(--line); }
.mmenu-head .top-brand { display: flex; }
.mmenu-head .burger { display: block; }
.mmenu-list { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 6px; }
.mmenu-item { display: flex; gap: 14px; align-items: flex-start; padding: 14px; border-radius: 12px; color: var(--ink); border: 1px solid var(--line); }
.mmenu-item:hover { text-decoration: none; background: #fafbfc; }
.mmenu-item.active { border-color: var(--accent); background: var(--accent-soft); }
.mmenu-item svg { flex: none; margin-top: 2px; color: var(--accent); }
.mmenu-item b { display: block; font-size: 15px; margin-bottom: 2px; }
.mmenu-item span { font-size: 13px; color: var(--ink-2); }
.mmenu-item.locked { opacity: .55; }
.mmenu-item em { font-style: normal; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; background: var(--line-2); color: var(--ink-3); padding: 2px 6px; border-radius: 6px; margin-left: 6px; vertical-align: middle; }
.mmenu-foot { padding: 14px 16px; border-top: 1px solid var(--line); font-size: 13px; color: var(--ink-3); }

/* ---------- фильтры на телефоне ---------- */
.cat-select { display: none; }
.filters-toggle { display: none; }

@media (max-width: 900px) {
  .top { height: 56px; }
  .top h1 { display: none; }
  .top-brand { display: flex; }
  .burger { display: block; }
  .top-right .pill, .top-right .avatar { display: none; }
  .page-title { display: block; }
}
@media (max-width: 700px) {
  .cat-grid { display: none; }
  .cat-select { display: flex; }
  .filter-grid { grid-template-columns: 1fr; gap: 12px; }
  .filter-grid .extra { display: none; }
  .filter-grid.show-all .extra { display: flex; }
  .filters-toggle { display: block; width: 100%; }
  .filters { padding: 14px; }
  .result-bar { gap: 12px; }
  .sort { flex-direction: column; align-items: stretch; gap: 5px; width: 100%; background: var(--panel);
          border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); }
  .sort .muted { font-size: 12px; font-weight: 500; }
  .sort select { width: 100%; min-width: 0; }
}

/* ---------- свой выпадающий список ---------- */
.uis { position: relative; width: 100%; }
.uis-btn { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 8px; text-align: left;
           font: inherit; font-size: 14px; padding: 8px 10px 8px 12px; border: 1px solid var(--line); border-radius: 8px;
           background: #fff; color: var(--ink); min-height: 38px; transition: border-color .12s, box-shadow .12s; }
.uis-btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.uis-btn span.ph { color: var(--ink-3); }
.uis-btn svg { flex: none; color: var(--ink-3); transition: transform .15s; }
.uis-btn:hover { border-color: #c9cfda; }
.uis.open .uis-btn, .uis-btn:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.uis.open .uis-btn svg { transform: rotate(180deg); }
.uis-pop { position: absolute; top: calc(100% + 6px); left: 0; width: 100%;
           background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 12px 32px rgba(16,24,40,.14);
           z-index: 30; padding: 4px; }
.uis-list { max-height: 320px; overflow-y: auto; }
.opt { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 10px; border-radius: 7px;
       cursor: pointer; font-size: 14px; color: var(--ink); line-height: 1.35; }
.opt.hi { background: var(--line-2); }
.opt.sel { color: var(--accent); font-weight: 500; }
.opt svg { flex: none; }
.sort .uis { width: auto; min-width: 250px; }
.sort .uis-pop { right: 0; left: auto; }
.uis-backdrop { position: fixed; inset: 0; background: rgba(16,19,24,.45); z-index: 60; }
.uis-pop.sheet { position: fixed; top: auto; left: 0; right: 0; bottom: 0; width: 100%; max-width: none; z-index: 61;
                 border-radius: 16px 16px 0 0; padding: 6px 8px calc(12px + env(safe-area-inset-bottom)); max-height: 75vh;
                 display: flex; flex-direction: column; animation: sheetUp .18s ease-out; }
.uis-pop.sheet .uis-list { max-height: none; overflow-y: auto; }
.uis-sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 6px 10px; border-bottom: 1px solid var(--line-2); margin-bottom: 4px; }
.uis-sheet-head b { font-size: 16px; }
.uis-pop.sheet .opt { padding: 13px 10px; font-size: 15px; }
@keyframes sheetUp { from { transform: translateY(30px); opacity: .4; } to { transform: none; opacity: 1; } }
@media (max-width: 700px) { .sort .uis { width: 100%; min-width: 0; } }

/* ---------- группы фабрик: одинаковые колонки во всех блоках ---------- */
table.grp { table-layout: fixed; }
table.grp col.c-name { width: 30%; }
table.grp col.c-nb { width: 26%; }
table.grp col.c-num { width: 112px; }
table.grp col.c-date { width: 116px; }
.section table td:first-child, .section table th:first-child { padding-left: 20px; }
.section table td:last-child, .section table th:last-child { padding-right: 20px; }
table.grp .f-name { overflow-wrap: anywhere; }
.nb .muted { color: var(--ink-3); }
.prod-inline { display: none; }
/* средняя ширина: «Что шьёт» уходит под название, чтобы колонки не сжимались в столбик */
@media (max-width: 1100px) and (min-width: 701px) {
  table.grp col.c-prod, table.grp th:nth-child(2), table.grp td.cell-prod { display: none; }
  table.grp col.c-name { width: auto; }
  table.grp col.c-nb { width: 36%; }
  table.grp col.c-num { width: 96px; }
  table.grp col.c-date { width: 104px; }
  .prod-inline { display: flex; margin-top: 8px; }
}

/* ---------- таблицы на телефоне → карточки ---------- */
@media (max-width: 700px) {
  .table-wrap { overflow-x: visible; }
  table.rtable thead, table.rtable colgroup { display: none; }
  table.grp { table-layout: auto; }
  .section table.rtable td:first-child, .section table.rtable td:last-child { padding-left: 0; padding-right: 0; }
  .section table.spec td:first-child { padding-left: 14px; }
  .section table.spec td:last-child { padding-right: 14px; }
  table.rtable, table.rtable tbody, table.rtable tr, table.rtable td { display: block; width: 100%; }
  table.rtable tr { padding: 12px 14px; border-bottom: 1px solid var(--line-2); }
  table.rtable tr:last-child { border-bottom: 0; }
  table.rtable td { padding: 0; border: 0; text-align: left; }
  table.rtable td:first-child { padding: 0 0 6px; }
  table.rtable td.cell-prod { padding: 0 0 8px; }
  table.rtable td[data-label] { display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
                                padding: 6px 0; border-top: 1px solid var(--line-2); font-size: 13px; }
  table.rtable td[data-label]::before { content: attr(data-label); color: var(--ink-2); font-size: 13px; flex: none; }
  table.rtable td.nb[data-label] { display: block; }
  table.rtable td.nb[data-label]::before { display: block; margin-bottom: 4px; color: var(--ink-3); font-size: 12px; }
  table.rtable td.muted[data-label] { color: var(--ink); }
  /* документы: дата и тип в одну строку */
  table.rtable td.cell-date { display: inline; padding: 0; font-size: 12px; }
  table.rtable td.cell-doc { display: inline; padding: 0 0 0 6px; }
  table.rtable td.cell-doc .muted { display: block; margin: 2px 0 6px; }
  table.rtable td.doc-prod { max-width: none; padding-bottom: 6px; }
  table.rtable td[data-label="Изготовитель"] { display: block; }
  table.rtable td[data-label="Изготовитель"]::before { display: block; font-size: 12px; color: var(--ink-3); margin-bottom: 2px; }
  /* «Что шьёт» в профиле */
  table.spec, table.spec tbody { display: block; }
  table.spec tr { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 12px; padding: 10px 14px;
                  border-bottom: 1px solid var(--line-2); }
  table.spec tr:last-child { border-bottom: 0; }
  table.spec td { display: block; padding: 0 !important; border: 0; text-align: left; }
  table.spec td:first-child { flex: 1 0 100%; }
  table.spec td.num { white-space: nowrap; font-size: 13px; color: var(--ink-2); }
  .co-meta { flex-direction: column; align-items: flex-start; gap: 2px; }
  .co-meta { margin-left: 0; clip-path: none; }
  .co-meta > span { padding-left: 0; }
  .co-meta > span::before { content: none; }
  .section-head { padding: 14px 14px 8px; }
  .section-note { padding: 0 14px 10px; }
  .more { padding: 10px 14px 14px; }
}

/* ---------- производства России ---------- */
.rf-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.rf-grid .checks { grid-column: span 2; }
@media (max-width: 1100px) { .rf-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } .rf-grid .checks { grid-column: span 3; } }
.rcard { grid-template-columns: minmax(0, 1fr) 110px 130px 140px; gap: 24px; }
.rcard .stat .act { display: block; width: fit-content; }
.act { display: inline-block; margin-top: 6px; font-style: normal; font-size: 12px; font-weight: 500; padding: 2px 8px; border-radius: 999px; }
.act.active { background: var(--green-soft); color: var(--green); }
.act.slow { background: var(--amber-soft); color: var(--amber); }
.act.rare { background: #fff1e6; color: #b54708; }
.act.stale { background: #f2f4f7; color: #667085; }
.act-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 4px; vertical-align: 1px; }
.act-dot.active { background: var(--green); } .act-dot.slow { background: var(--amber); }
.act-dot.rare { background: #f79009; } .act-dot.stale { background: #98a2b3; }
.uis-search { padding: 8px; border-bottom: 1px solid var(--line-2); }
.uis-search input { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font: inherit; font-size: 14px; outline: none; }
.uis-search input:focus { border-color: var(--accent); }
@media (max-width: 1280px) { .rcard { grid-template-columns: repeat(3, minmax(0, 1fr)); } .rcard .fcard-main { grid-column: 1 / -1; } }
@media (max-width: 700px) {
  .rf-grid { grid-template-columns: 1fr; }
  .rf-grid .checks { grid-column: auto; flex-direction: column; align-items: flex-start; }
  .rcard { grid-template-columns: 1fr; }
  .rcard .stat .act { margin: 0 8px 0 0; order: -1; }
}

.sentinel { min-height: 40px; display: flex; align-items: center; justify-content: center; padding: 8px 0; }

/* ---------- кнопки и поля ---------- */
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.05); }
.btn.primary:disabled { opacity: .5; cursor: default; }
.inp { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 9px 12px; font: inherit; font-size: 14px;
       background: var(--panel); color: var(--ink); outline: none; resize: vertical; }
.inp:focus { border-color: var(--accent); }

.nav + .nav-label { margin-top: 18px; }
.mmenu-label { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); font-weight: 600; padding: 14px 4px 6px; }

/* ---------- контакты производств ---------- */
.contact-box { margin-top: 12px; }
.contacts { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 14px; margin-bottom: 6px; }
.contacts a { color: var(--accent); white-space: nowrap; text-decoration: none; }
.contacts a:hover { text-decoration: underline; }
.cb-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; }
.cb-link { font-size: 13px; color: var(--ink-2); text-decoration: none; white-space: nowrap; }
.cb-link:hover { color: var(--accent); }
.small-note { font-size: 12px; }
.co-contacts { margin-top: 14px; }
.co-contacts .contacts { font-size: 15px; }
@media (max-width: 700px) {
  .contacts { flex-direction: column; gap: 6px; }
  .cb-actions .btn { width: 100%; }
}
.back-link { display: inline-block; margin: 0 0 12px; font-size: 14px; color: var(--ink-2); text-decoration: none; }
.back-link:hover { color: var(--accent); }

.cb-name { margin-bottom: 4px; }

/* каталог: фильтры-чипы категорий, поле бренда, флажки */
.cat-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.fchip { font: inherit; font-size: 13px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: #fff; color: var(--ink-2); cursor: pointer; }
.fchip i { font-style: normal; color: var(--ink-3); margin-left: 4px; }
.fchip:hover { border-color: var(--accent); }
.fchip.on { background: var(--accent-soft); border-color: var(--accent); color: #2546b8; }
.fchip.on i { color: #2546b8; }
.fld .txt { font: inherit; font-size: 14px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); width: 100%; box-sizing: border-box; }
.fld .txt:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.fld.checks { flex-direction: row; flex-wrap: wrap; align-items: center; align-self: end; min-height: 40px; gap: 8px 24px; font-size: 13px; color: var(--ink-2); }
.fld.checks label { display: flex; gap: 6px; align-items: center; cursor: pointer; }
.more-flt { margin-top: 10px; font-size: 13px; }
.binp { position: relative; }
.binp .txt { padding-right: 28px; }
.binp-x { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: none; font-size: 18px; line-height: 1; color: var(--ink-3); cursor: pointer; padding: 2px 6px; }
.binp .opt { display: flex; justify-content: space-between; gap: 12px; }

/* закрытые и открытые карточки, модалка открытия */
.rcard.closed .lockname { display: flex; align-items: center; gap: 8px; color: var(--ink); cursor: default; }
.rcard.closed .lockname svg { color: var(--ink-3); flex: none; }
.has-line { margin-top: 10px; font-size: 13px; color: var(--ink-3); display: flex; flex-wrap: wrap; gap: 4px 10px; }
.has-line span { color: var(--ink-2); }
.open-btn { margin-top: 12px; }
.opened-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.opened-badge { font-style: normal; font-size: 12px; padding: 2px 8px; border-radius: 6px; background: #e6f6ee; color: #18794e; }
.balance { font-size: 13px; color: var(--ink-3); }
.balance b { color: var(--ink); }
.modal-wrap { position: fixed; inset: 0; background: rgba(16, 19, 24, .45); display: flex; align-items: center; justify-content: center; z-index: 80; padding: 16px; }
.modal { width: 100%; max-width: 440px; padding: 22px 24px; }
.modal h3 { margin: 0 0 4px; font-size: 18px; }
.get-title { margin-top: 16px; font-size: 13px; color: var(--ink-3); }
.get-list { list-style: none; padding: 0; margin: 8px 0 0; font-size: 14px; }
.get-list li { padding: 4px 0 4px 24px; position: relative; }
.get-list li.ok::before { content: "✓"; position: absolute; left: 2px; color: #18794e; font-weight: 600; }
.get-list li.no { color: var(--ink-3); }
.get-list li.no::before { content: "×"; position: absolute; left: 3px; }
.modal-note { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 13px; color: var(--ink-3); }
.modal-note.warn { color: #9a5b00; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.btn.ghost { background: transparent; }
/* контакты открытого производства: строка на вид связи, значок слева, без рамок */
.clines { margin-top: 12px; display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.clines > div { display: grid; grid-template-columns: 15px minmax(0, 1fr); column-gap: 10px; align-items: start; }
.clines > div > span { display: flex; flex-wrap: wrap; gap: 4px 5px; }
.clines > div > span > a:not(:last-child)::after { content: ","; color: var(--ink-3); }
.clines svg { color: var(--ink-3); margin-top: 2px; }
.clines a { color: var(--ink); white-space: nowrap; }
.clines a:hover { color: var(--accent); }
.rcard .clines + .cb-actions { margin-top: 10px; }

/* вход по коду */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; background: var(--bg, #f5f6f8); }
.login { width: 100%; max-width: 400px; padding: 28px; }
.login-brand { color: var(--ink); margin-bottom: 18px; }
.login h2 { margin: 0 0 6px; font-size: 20px; }
.login p { margin: 0 0 16px; font-size: 14px; }
.login form { display: flex; flex-direction: column; gap: 12px; }
.login .txt { font: inherit; font-size: 15px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; width: 100%; box-sizing: border-box; }
.login .txt:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.login .txt.code { font-size: 22px; letter-spacing: 6px; text-align: center; }
.btn.wide { width: 100%; padding: 10px 12px; font-size: 15px; }
.consent { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; color: var(--ink-2); cursor: pointer; }
.consent input { margin-top: 3px; }
.login-links { display: flex; justify-content: space-between; margin-top: 14px; font-size: 13px; }
.dev-note { background: #fff6e5; color: #8a5a00; padding: 8px 10px; border-radius: 8px; font-size: 13px; }
.login .alert { margin-top: 12px; }
.ya-btn { display: flex; align-items: center; justify-content: center; gap: 10px; height: 46px; border-radius: 10px;
          background: #000; color: #fff; font-size: 15px; font-weight: 500; text-decoration: none; }
.ya-btn:hover { background: #1f1f1f; color: #fff; }
.ya-logo { width: 22px; height: 22px; border-radius: 50%; background: #fc3f1d; color: #fff; display: grid; place-items: center;
           font-size: 14px; font-weight: 700; line-height: 1; }
.login-or { display: flex; align-items: center; gap: 12px; margin: 18px 0 14px; font-size: 13px; color: var(--ink-3); }
.login-or::before, .login-or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.btn.login-sec { background: var(--panel); }
.login-hint { margin: 10px 0 0 !important; font-size: 13px !important; }
a.avatar { text-decoration: none; cursor: pointer; }

/* личный кабинет */
.acc-rows { display: flex; flex-direction: column; gap: 10px; padding: 4px 20px 6px; font-size: 14px; }
.acc-rows > div { display: grid; grid-template-columns: 90px minmax(0, 1fr); gap: 12px; align-items: center; }
.acc-rows > div > span:first-child { color: var(--ink-3); font-size: 13px; }
.acc-name { display: flex; gap: 8px; }
.acc-name .txt { font: inherit; font-size: 14px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; flex: 1; min-width: 0; }
.acc-actions { padding: 12px 20px 18px; }
.acc-balance { padding: 4px 20px 0; display: flex; align-items: baseline; gap: 10px; }
.acc-balance b { font-size: 32px; font-weight: 600; }
.acc-balance span { color: var(--ink-3); font-size: 14px; }
.account .section > .small-note { padding: 8px 20px 0; margin: 0; }
.account .section > .btn.primary { margin: 14px 20px 18px; }
.acc-danger { margin: 24px 0 8px; font-size: 13px; color: var(--ink-3); }
.dev-admin { display: block; margin-top: 18px; font-size: 12px; color: var(--ink-3); }
.login-back { display: block; margin-top: 18px; font-size: 13px; }
.co h2 .opened-badge { vertical-align: middle; margin-left: 8px; font-size: 12px; font-weight: 500; }
.co-addr { margin-top: 6px; max-width: 640px; font-size: 13px; }
.co .kpi .act { display: inline-block; margin-top: 6px; }
.co .clines + .cb-actions { margin-top: 10px; }
.co ~ .section .reg-facts, .reg-facts { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 700px) { .reg-facts { grid-template-columns: 1fr 1fr; } }

/* оформление заказа */
.co-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 24px; align-items: start; }
.co-main { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.co-step { padding: 22px 24px; }
.co-step h3 { display: flex; align-items: center; gap: 10px; margin: 0 0 16px; font-size: 17px; font-weight: 600; }
.co-num { width: 26px; height: 26px; border-radius: 50%; background: var(--ink); color: #fff; font-size: 13px; font-weight: 600;
          display: grid; place-items: center; flex: none; }
.co-opts { display: flex; flex-direction: column; gap: 10px; }
.co-opt { display: grid; grid-template-columns: 20px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 14px 18px;
          border: 1px solid var(--line); border-radius: 10px; cursor: pointer; transition: border-color .12s, background .12s; }
.co-opt:hover { border-color: #c9cfda; }
.co-opt.on { border-color: var(--accent); background: #f7f9ff; box-shadow: 0 0 0 1px var(--accent); }
.co-opt input { position: absolute; opacity: 0; pointer-events: none; }
.co-opt:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.co-radio { width: 20px; height: 20px; border-radius: 50%; border: 2px solid #c3c8d2; box-sizing: border-box; background: #fff; }
.co-opt.on .co-radio { border-color: var(--accent); border-width: 6px; }
.co-opt-t { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.co-opt-t b { font-size: 15px; font-weight: 600; }
.co-opt-t small { font-size: 13px; color: var(--ink-3); }
.co-head { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; }
.co-head em { font-style: normal; font-size: 12px; font-weight: 500; padding: 3px 8px; border-radius: 999px; white-space: nowrap; }
.co-best { background: var(--accent-soft); color: #2546b8; }
.co-save { background: var(--green-soft); color: var(--green); }
.co-price { font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; min-width: 92px; text-align: right; }
.co-ico { min-width: 92px; display: flex; justify-content: flex-end; color: var(--ink-2); }
.co-sbp { font-weight: 800; font-size: 13px; letter-spacing: .04em; color: #5b57d1; }
.co-hint { margin: 14px 0 0; font-size: 13px; color: var(--ink-3); }
.co-test { margin: 14px 0 0; padding: 10px 12px; border-radius: 8px; background: #fff6e5; color: #8a5a00; font-size: 13px; }
.co-mail { margin: 0; font-size: 14px; color: var(--ink-2); }
.co-sum { padding: 22px 24px; position: sticky; top: 80px; }
.co-sum h3 { margin: 0 0 16px; font-size: 17px; font-weight: 600; }
.co-line { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; padding: 5px 0; }
.co-line.muted { color: var(--ink-3); font-size: 13px; }
.co-total { display: flex; justify-content: space-between; align-items: baseline; margin: 12px 0 18px; padding-top: 14px;
            border-top: 1px solid var(--line); font-size: 15px; font-weight: 600; }
.co-total b { font-size: 24px; }
.btn.co-pay { width: 100%; height: 50px; font-size: 16px; font-weight: 600; border-radius: 10px; }
.co-legal { margin: 12px 0 0; font-size: 12px; color: var(--ink-3); text-align: center; }
.co-safe { display: flex; gap: 8px; align-items: flex-start; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line);
           font-size: 12px; color: var(--ink-3); }
.co-safe svg { flex: none; margin-top: 1px; }
.pay-note { margin-top: 14px; padding: 10px 12px; border-radius: 8px; background: var(--accent-soft); color: #2546b8; font-size: 13px; }
.pay-result { max-width: 520px; padding: 40px 32px; text-align: center; margin: 24px auto 0; }
.pay-result h2 { margin: 0 0 10px; font-size: 22px; }
.pay-result p { color: var(--ink-2); margin: 0 0 22px; }
.pay-ok { width: 60px; height: 60px; border-radius: 50%; background: var(--green-soft); color: var(--green);
          display: grid; place-items: center; margin: 0 auto 16px; }
.btn.pay-big { display: inline-block; padding: 11px 22px; font-size: 15px; text-decoration: none; }
.pay-spin { width: 40px; height: 40px; margin: 0 auto 16px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--accent);
            animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .pay-spin { animation: none; } }
.co-bar { display: none; }
@media (max-width: 1280px) {
  .co-wrap { grid-template-columns: 1fr; padding-bottom: 76px; }
  .co-sum { position: static; }
  .co-bar { display: flex; position: fixed; left: 268px; right: 0; bottom: 0; z-index: 20; align-items: center; justify-content: space-between;
            gap: 16px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); background: var(--panel);
            border-top: 1px solid var(--line); box-shadow: 0 -4px 16px rgba(16, 24, 40, .06); }
  .co-bar small { display: block; font-size: 12px; color: var(--ink-3); }
  .co-bar b { font-size: 19px; }
  .co-bar .btn { height: 46px; padding: 0 28px; font-size: 15px; font-weight: 600; border-radius: 10px; }
}
@media (max-width: 560px) {
  .co-step, .co-sum { padding: 18px 16px; }
  .co-opt { padding: 12px 14px; gap: 12px; }
}
.btn.acc-buy { display: inline-block; margin: 14px 20px 18px; text-decoration: none; }
@media (max-width: 900px) { .co-bar { left: 0; } }
