/* Оформление. Тёмная тема — как на макетах экранов; светлая включается кнопкой вверху. */

:root {
  --bg: #0e0f11;
  --surface: #17181b;
  --surface-2: #1f2125;
  --line: #2b2e34;
  --text: #f1f2f4;
  --muted: #a0a6b0;
  --accent: #3987e5;
  --accent-ink: #ffffff;
  --accent-soft: rgba(57, 135, 229, 0.16);
  --good: #3ecf8e;
  --good-soft: rgba(62, 207, 142, 0.14);
  --warn: #f2b84b;
  --warn-soft: rgba(242, 184, 75, 0.14);
  --bad: #f2707a;
  --bad-soft: rgba(242, 112, 122, 0.14);
  --series-1: #3987e5;
  --series-2: #199e70;
  --grid: #2c2c2a;
  --photo: #f2f0ec;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
  --radius: 14px;
  color-scheme: dark;
}

:root[data-theme='light'] {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --line: #e1e4ea;
  --text: #17263a;
  --muted: #5a697c;
  --accent: #2a78d6;
  --accent-ink: #ffffff;
  --accent-soft: rgba(42, 120, 214, 0.1);
  --good: #0f7f47;
  --good-soft: rgba(15, 127, 71, 0.1);
  --warn: #8f5b00;
  --warn-soft: rgba(210, 140, 0, 0.14);
  --bad: #c2303f;
  --bad-soft: rgba(194, 48, 63, 0.1);
  --series-1: #2a78d6;
  --series-2: #1baf7a;
  --grid: #e1e0d9;
  --photo: #f2f0ec;
  --shadow: 0 18px 50px rgba(23, 38, 58, 0.22);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-variant-numeric: tabular-nums;
}
body.locked { overflow: hidden; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 24px; line-height: 1.2; letter-spacing: -0.01em; }
h2 { font-size: 16px; }
h3 { font-size: 14px; margin: 18px 0 8px; color: var(--muted); font-weight: 600; }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.ico { flex: none; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.good { color: var(--good); }
.bad { color: var(--bad); }
.big { font-size: 18px; }
.link { color: var(--accent); font-weight: 600; font-size: 14px; }
.link:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

/* ---------- каркас ---------- */
.shell { display: grid; grid-template-columns: 232px minmax(0, 1fr); grid-template-rows: auto 1fr; min-height: 100vh; }
.top { grid-column: 1 / -1; display: flex; align-items: center; gap: 12px; padding: 10px 20px; border-bottom: 1px solid var(--line); background: var(--surface); position: sticky; top: 0; z-index: 20; }
.brand { display: flex; align-items: center; gap: 10px; }
.logo { width: 34px; height: 34px; border-radius: 10px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-weight: 700; font-size: 13px; letter-spacing: 0.02em; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text small { color: var(--muted); font-size: 12px; }
.demo-pill { font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: var(--warn-soft); color: var(--warn); }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.role-pick { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.role-pick select { max-width: 210px; }
.icon-btn { width: 38px; height: 38px; display: grid; place-items: center; border: 1px solid var(--line); background: transparent; border-radius: 10px; color: var(--muted); }
.icon-btn:hover { color: var(--text); background: var(--surface-2); }

.nav { padding: 14px 12px; border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 2px; position: sticky; top: 59px; align-self: start; height: calc(100vh - 59px); overflow: auto; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 10px; color: var(--muted); font-weight: 500; }
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a.on { background: var(--accent-soft); color: var(--text); font-weight: 600; }
.nav a.on .ico { color: var(--accent); }
.nav-note { margin-top: auto; padding: 12px; font-size: 12.5px; color: var(--muted); border-top: 1px solid var(--line); }

.view { padding: 24px 28px 40px; min-width: 0; }
.page { max-width: 1120px; display: flex; flex-direction: column; gap: 16px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.page-head p { margin-top: 4px; }
.period { font-size: 13px; padding: 5px 11px; border-radius: 999px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: 14px; }
.back:hover { color: var(--text); }
.foot-note { max-width: 1120px; margin-top: 28px; font-size: 12.5px; color: var(--muted); }

/* ---------- карточки и цифры ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.kpis.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
a.kpi:hover, .tile:hover { border-color: var(--accent); }
.kpi-label { font-size: 13px; color: var(--muted); }
.kpi b { font-size: 24px; line-height: 1.25; letter-spacing: -0.01em; }
.kpi small { font-size: 12.5px; color: var(--muted); }
.card .kpis .kpi { background: var(--surface-2); }

.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.tile { text-align: left; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 3px; }
.tile span { font-size: 13px; color: var(--muted); }
.tile b { font-size: 17px; }

.money-list { display: flex; flex-direction: column; }
.money-row { display: flex; align-items: center; gap: 10px; padding: 12px 0; border-top: 1px solid var(--line); }
.money-row:first-child { border-top: 0; padding-top: 2px; }
.money-row span { flex: 1; color: var(--muted); }
.money-row b { white-space: nowrap; }
.money-row .ico { color: var(--muted); }
.money-row:hover span { color: var(--text); }

.alerts { display: flex; flex-direction: column; gap: 8px; }
.alert { color: var(--text); display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 12px; background: var(--surface-2); border-left: 3px solid var(--line); }
.alert > div { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.alert span { font-size: 13.5px; color: var(--muted); }
.alert.bad { border-left-color: var(--bad); } .alert.bad > .ico:first-child { color: var(--bad); }
.alert.warn { border-left-color: var(--warn); } .alert.warn > .ico:first-child { color: var(--warn); }
.alert.info { border-left-color: var(--accent); } .alert.info > .ico:first-child { color: var(--accent); }
.alert > .ico:last-child { color: var(--muted); }
.alert:hover { background: var(--accent-soft); }

/* ---------- кнопки, метки, фильтры ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 9px 15px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); font-weight: 600; white-space: nowrap; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; }
.btn.small { padding: 6px 11px; font-size: 13.5px; border-radius: 9px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.badges { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.badge { display: inline-block; font-size: 12.5px; font-weight: 600; padding: 2px 9px; border-radius: 999px; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.badge.ok { background: var(--good-soft); color: var(--good); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.info { background: var(--accent-soft); color: var(--accent); }
:root[data-theme='light'] .badge.info { color: #1c5cab; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs a { padding: 9px 14px; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; white-space: nowrap; display: flex; gap: 7px; align-items: center; }
.tabs a.on { color: var(--text); border-bottom-color: var(--accent); }
.count { font-size: 12px; background: var(--accent); color: var(--accent-ink); border-radius: 999px; padding: 0 7px; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: transparent; color: var(--muted); font-size: 13.5px; font-weight: 500; }
.chip:hover { color: var(--text); }
.chip.on { background: var(--accent-soft); border-color: var(--accent); color: var(--text); font-weight: 600; }
select, input[type='text'], input[type='number'], input[type='date'] { background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; min-width: 0; }
select.filter { padding: 6px 10px; font-size: 13.5px; border-radius: 999px; max-width: 100%; }

/* ---------- таблицы ---------- */
.table-wrap { overflow-x: auto; margin: 0 -4px; }
table { border-collapse: collapse; width: 100%; }
.grid th { text-align: left; font-size: 12.5px; font-weight: 600; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.grid td { padding: 11px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.grid tbody tr:last-child td { border-bottom: 0; }
.grid tfoot td { border-top: 1px solid var(--line); border-bottom: 0; font-weight: 600; color: var(--muted); }
.grid .r { text-align: right; white-space: nowrap; }
.grid .c { text-align: center; }
.grid tr.click { cursor: pointer; }
.grid tr.click:hover td { background: var(--surface-2); }
.access input { width: 18px; height: 18px; accent-color: var(--accent); }
.empty { color: var(--muted); padding: 12px 0; }
.kv { display: grid; grid-template-columns: minmax(120px, 40%) 1fr; gap: 9px 14px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 500; }
.with-dot { display: flex; align-items: center; gap: 10px; }
.swatch { width: 14px; height: 14px; border-radius: 50%; border: 1px solid rgba(128, 128, 128, 0.5); flex: none; display: inline-block; }
.prog-cell { display: flex; flex-direction: column; gap: 5px; align-items: flex-end; min-width: 110px; }
.prog-cell .bar { width: 100%; }
.plain { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 5px; font-size: 14px; }
.warn-text { color: var(--warn); display: flex; align-items: center; gap: 7px; font-weight: 600; }
.good-text { color: var(--good); display: flex; align-items: center; gap: 7px; font-size: 14px; }

/* ---------- полосы ---------- */
.bar { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.card .bar, .kpi .bar { background: var(--line); }
.bar i { display: block; height: 100%; border-radius: 999px; background: #7f8ea3; }
.bar.ok i { background: var(--good); }
.bar.bad i { background: var(--bad); }
.rank { display: flex; flex-direction: column; }
.rank-row { display: grid; grid-template-columns: 170px 1fr 130px 60px; gap: 12px; align-items: center; padding: 8px 4px; background: none; border: 0; border-radius: 8px; text-align: left; }
.rank-row:hover { background: var(--surface-2); }
.rank-bar { height: 10px; border-radius: 4px; background: var(--line); overflow: hidden; }
.rank-bar i { display: block; height: 100%; background: var(--series-1); border-radius: 4px; }
.rank-row b, .rank-row small { text-align: right; white-space: nowrap; }
.rank-row small { color: var(--muted); }

/* ---------- график ---------- */
.chart-box { position: relative; }
.chart { width: 100%; height: auto; display: block; }
.chart .axis { font-size: 12px; fill: var(--muted); }
.chart .grid-line { stroke: var(--grid); stroke-width: 1; }
.chart .base-line { stroke: var(--muted); stroke-width: 1; opacity: 0.6; }
.chart .hit { fill: transparent; }
.chart .bar-group:hover .hit, .chart .bar-group:focus .hit { fill: var(--accent-soft); }
.chart .bar-group { outline: none; }
.series-1 { fill: var(--series-1); background: var(--series-1); }
.series-2 { fill: var(--series-2); background: var(--series-2); }
.legend { display: flex; gap: 18px; justify-content: center; font-size: 13px; color: var(--muted); margin-top: 4px; }
.dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; margin-right: 6px; }
.chart-tip { position: absolute; top: 0; transform: translateX(-50%); background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 11px; font-size: 13px; display: flex; flex-direction: column; gap: 2px; pointer-events: none; white-space: nowrap; box-shadow: var(--shadow); z-index: 2; }

/* ---------- производство ---------- */
.order-cards, .req-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.order-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column; gap: 12px; }
.order-card:hover { border-color: var(--accent); }
.oc-head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.oc-head > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.flow { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 5px; }
.flow-step { background: var(--surface-2); border-radius: 9px; padding: 7px 2px; text-align: center; border: 1px solid transparent; min-width: 0; }
.flow-step span { display: block; font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.flow-step b { font-size: 15px; }
.flow-step.plan { background: transparent; border-color: var(--line); }
.flow-step.part { border-color: var(--accent); }
.flow-step.full { border-color: var(--good); }
.oc-todo { display: flex; gap: 7px; align-items: center; font-size: 13.5px; color: var(--accent); font-weight: 600; }
.oc-todo.warn { color: var(--warn); }
.stages { display: flex; flex-direction: column; gap: 13px; }
.stage-top { display: flex; justify-content: space-between; font-size: 14px; margin-bottom: 6px; }
.stage-mini { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.stage-mini > div { display: flex; flex-direction: column; gap: 4px; }
.stage-mini span { font-size: 12px; color: var(--muted); }
.stage-btns { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.stage-btn { text-align: left; background: var(--accent-soft); border: 1px solid var(--accent); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; }
.stage-btn span { font-size: 13px; color: var(--muted); }
.stage-btn:disabled { background: var(--surface-2); border-color: var(--line); color: var(--muted); cursor: default; }
.stage-btn:not(:disabled):hover { filter: brightness(1.15); }
.check-box { border: 1px solid var(--warn); background: var(--warn-soft); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }

/* ---------- контрагенты и каталог ---------- */
.tracker { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; list-style: none; margin: 0; padding: 0; }
.tracker li { display: flex; flex-direction: column; align-items: center; gap: 5px; font-size: 12px; color: var(--muted); text-align: center; position: relative; }
.tracker li::before { content: ''; position: absolute; top: 12px; right: 50%; width: 100%; height: 2px; background: var(--line); }
.tracker li:first-child::before { display: none; }
.tracker i { position: relative; width: 26px; height: 26px; border-radius: 50%; background: var(--surface-2); border: 2px solid var(--line); display: grid; place-items: center; font-style: normal; font-size: 12px; font-weight: 700; }
.tracker .past i, .tracker .now i { background: var(--good); border-color: var(--good); color: #06281a; }
.tracker .past::before, .tracker .now::before { background: var(--good); }
.tracker .now { color: var(--text); font-weight: 600; }
.req-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; border-top: 1px solid var(--line); padding-top: 12px; }
.bonus-pill { display: inline-flex; gap: 8px; align-items: center; padding: 8px 14px; border-radius: 999px; background: var(--good-soft); color: var(--good); font-weight: 600; }
.catalog { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.product { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; }
.photo { background: var(--photo); aspect-ratio: 4 / 3.3; display: grid; place-items: center; padding: 14px; }
.garment { width: 58%; height: auto; filter: drop-shadow(0 8px 10px rgba(0, 0, 0, 0.18)); }
.product-body { padding: 14px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.price b { font-size: 17px; }
.swatches { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.swatch-btn { width: 28px; height: 28px; border-radius: 50%; border: 2px solid transparent; background: none; padding: 2px; }
.swatch-btn i { display: block; width: 100%; height: 100%; border-radius: 50%; border: 1px solid rgba(128, 128, 128, 0.55); }
.swatch-btn.on { border-color: var(--accent); }
.buy { display: flex; gap: 8px; align-items: center; margin-top: auto; flex-wrap: wrap; }
.stepper { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.stepper button { width: 34px; height: 34px; background: var(--surface-2); border: 0; font-size: 18px; }
.stepper span { padding: 0 10px; font-size: 13.5px; white-space: nowrap; }
.has-cart { padding-bottom: 90px; }
.cart-bar { position: fixed; left: 252px; right: 20px; bottom: 16px; max-width: 1100px; background: var(--surface-2); border: 1px solid var(--accent); border-radius: var(--radius); padding: 12px 16px; display: flex; justify-content: space-between; align-items: center; gap: 12px; box-shadow: var(--shadow); z-index: 15; }
.cart-bar > div:first-child { display: flex; flex-direction: column; min-width: 0; }

/* ---------- помощник ---------- */
.chat-page { max-width: 860px; }
.chat { display: flex; flex-direction: column; gap: 12px; }
.msg { border-radius: 14px; padding: 12px 15px; max-width: 100%; }
.msg.me { align-self: flex-end; background: var(--accent); color: var(--accent-ink); max-width: 80%; scroll-margin-top: 76px; }
.msg.ai { background: var(--surface); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.msg.ai p { margin-bottom: 8px; } .msg.ai p:last-child { margin-bottom: 0; }
.ai-mark { display: flex; gap: 6px; align-items: center; font-size: 12.5px; color: var(--muted); font-weight: 600; }
.ai-mark .ico { color: var(--warn); }
.mini { font-size: 14px; margin: 4px 0 10px; display: block; overflow-x: auto; }
.mini th { text-align: left; color: var(--muted); font-size: 12.5px; font-weight: 600; padding: 5px 10px 5px 0; border-bottom: 1px solid var(--line); white-space: nowrap; }
.mini td { padding: 6px 10px 6px 0; border-bottom: 1px solid var(--line); }
.mini .r { text-align: right; padding-right: 0; padding-left: 10px; white-space: nowrap; }
.chat-empty { border: 1px dashed var(--line); border-radius: var(--radius); padding: 22px; display: flex; flex-direction: column; gap: 10px; align-items: flex-start; color: var(--muted); }
.chat-empty .ico { color: var(--warn); }
.examples { display: flex; flex-wrap: wrap; gap: 8px; }
.examples .chip { color: var(--text); text-align: left; }
.ask { display: flex; gap: 8px; position: sticky; bottom: 12px; background: var(--bg); padding: 8px 0; }
.ask input { flex: 1; padding: 12px 14px; background: var(--surface); }

/* ---------- окна и формы ---------- */
.modal { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.6); display: grid; place-items: center; padding: 16px; z-index: 50; }
.sheet { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; width: min(520px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; box-shadow: var(--shadow); }
.sheet.wide { width: min(720px, 100%); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.sheet-head h2 { font-size: 17px; }
.sheet-head .icon-btn { border: 0; }
.sheet-body { padding: 16px 18px 18px; overflow: auto; }
.form { display: flex; flex-direction: column; gap: 14px; }
.form-intro { color: var(--muted); }
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field.half { grid-column: auto; }
.field label { font-size: 13px; color: var(--muted); font-weight: 600; }
.field small { font-size: 12.5px; color: var(--muted); }
.field.check { flex-direction: row; align-items: center; gap: 9px; }
.field.check input { width: 18px; height: 18px; accent-color: var(--accent); flex: none; }
.form-hint { font-size: 13.5px; color: var(--muted); }
.form-error { color: var(--bad); font-weight: 600; font-size: 14px; }
.form-error:empty { display: none; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.live { display: flex; flex-direction: column; gap: 8px; }
.live:empty { display: none; }
.calc { background: var(--surface-2); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; }
.calc-title { font-size: 12.5px; color: var(--muted); font-weight: 600; margin-bottom: 2px; }
.calc-row { display: flex; gap: 10px; align-items: baseline; font-size: 14px; }
.calc-row span { flex: 1; color: var(--muted); }
.calc-row small { color: var(--muted); min-width: 92px; text-align: right; }
.calc-row.sum { border-top: 1px solid var(--line); padding-top: 6px; }
.calc-row.good b { color: var(--good); }
.calc-row.bad b, .calc-row.bad span { color: var(--bad); }
.calc details { font-size: 13.5px; margin-top: 4px; }
.calc summary { cursor: pointer; color: var(--accent); margin-bottom: 6px; }
.toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); background: var(--surface-2); border: 1px solid var(--good); color: var(--text); border-radius: 12px; padding: 11px 16px; display: flex; gap: 9px; align-items: center; box-shadow: var(--shadow); z-index: 60; max-width: calc(100vw - 24px); font-weight: 500; }
.toast .ico { color: var(--good); }
.toast.bad { border-color: var(--bad); } .toast.bad .ico { color: var(--bad); }

/* ---------- планшет и телефон ---------- */
@media (max-width: 1000px) {
  .hide-md { display: none; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cols, .order-cards, .req-cards { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 820px) {
  .shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto 1fr; }
  .top { padding: 9px 16px; gap: 8px; }
  .brand-text small, .role-pick span { display: none; }
  .nav { position: sticky; top: 57px; z-index: 19; height: auto; flex-direction: row; border-right: 0; border-bottom: 1px solid var(--line); background: var(--surface); padding: 6px 12px; overflow-x: auto; scrollbar-width: none; gap: 2px; }
  .nav a { padding: 8px 11px; white-space: nowrap; gap: 7px; font-size: 14px; }
  .nav-note { display: none; }
  .view { padding: 16px 16px 32px; }
  h1 { font-size: 21px; }
  .cart-bar { left: 12px; right: 12px; bottom: 10px; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rank-row { grid-template-columns: 1fr auto; row-gap: 5px; }
  .rank-bar { grid-column: 1 / -1; order: 3; }
  .rank-row small { display: none; }
}
@media (max-width: 600px) {
  .hide-sm { display: none; }
  .kpi b { font-size: 20px; }
  .kpis.three { grid-template-columns: minmax(0, 1fr); }
  .card { padding: 14px; }
  .grid th, .grid td { padding-left: 6px; padding-right: 6px; }
  .flow-step span { font-size: 10px; }
  .stage-mini { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .fields { grid-template-columns: 1fr; }
  .field.half { grid-column: 1 / -1; }
  .modal { padding: 0; place-items: end stretch; }
  .sheet, .sheet.wide { width: 100%; border-radius: 16px 16px 0 0; max-height: 92vh; }
  .role-pick select { max-width: 150px; }
  .demo-pill { display: none; }
  .kv { grid-template-columns: minmax(0, 1fr); gap: 2px 0; }
  .kv dd { margin-bottom: 8px; }
  .ask .btn span { display: none; }
  .msg.me { max-width: 92%; }
}
@media (prefers-reduced-motion: no-preference) {
  .bar i, .rank-bar i { transition: width 0.3s ease; }
}
