/* Стиль FM Factory RP — как у админ-панели сайта mdf.md (admin.html): тёмное меню слева,
   оранжевый акцент, светлый фон, белые карточки, шрифт Segoe UI. */
:root {
  --sidebar-bg: #1e1e2d; --sidebar-hover: #2b2b40; --sidebar-active-bg: #1b1b29; --sidebar-text: #a2a3b7;
  --bg: #f3f6f9; --panel: #fff; --line: #ebedf3; --line-strong: #d9dde2;
  --text: #3f4254; --ink: #292c32; --muted: #767d86;
  --accent: #d98a4f; --accent-dark: #c47838; --accent-soft: #fbf1e9;
  --ok: #1f7a4d; --ok-bg: #e6f4ec; --warn: #9a6200; --warn-bg: #fdf3dd;
  --bad: #c0392b; --bad-bg: #fdeeec; --idle-bg: #eef0f4;
  --radius: 12px; --shadow: 0 5px 15px rgba(0, 0, 0, .02);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body { margin: 0; display: flex; font: 14px/1.5 "Segoe UI", Roboto, system-ui, -apple-system, Arial, sans-serif;
  background: var(--bg); color: var(--text); }
a { color: var(--accent-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 24px; font-weight: 650; letter-spacing: -.02em; color: var(--ink); margin: 0 0 18px; }
h2 { font-size: 17px; font-weight: 650; color: var(--ink); margin: 0 0 12px; }
h3 { font-size: 15px; color: var(--ink); margin: 0 0 8px; }

/* ---------- каркас ---------- */
.sidebar { width: 260px; flex: 0 0 260px; background: var(--sidebar-bg); min-height: 100vh; position: sticky; top: 0;
  align-self: flex-start; height: 100vh; overflow-y: auto; }
.sidebar-brand { display: flex; align-items: center; height: 72px; padding: 0 26px; color: #fff; font-size: 20px;
  font-weight: 800; letter-spacing: 1px; border-bottom: 1px solid rgba(255, 255, 255, .05); }
.sidebar-brand span { color: var(--accent); }
.sidebar-brand:hover { text-decoration: none; }
.sidebar-nav { padding: 10px 0 24px; }
.nav-group { padding: 20px 26px 6px; color: #6c6e86; font-size: 12px; font-weight: 600; }
.nav-item { display: block; padding: 11px 26px; color: var(--sidebar-text); font-size: 14px; font-weight: 500;
  border-left: 3px solid transparent; }
.nav-item:hover { background: var(--sidebar-hover); color: #fff; text-decoration: none; }
.nav-item.active { background: var(--sidebar-active-bg); color: var(--accent); border-left-color: var(--accent);
  font-weight: 600; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; min-height: 100vh; }
.top-header { height: 72px; flex-shrink: 0; background: #fff; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; padding: 0 34px; }
.header-title { font-size: 19px; font-weight: 600; color: var(--ink); }
.header-user { display: flex; align-items: center; gap: 16px; color: var(--muted); font-weight: 600; }
.header-user form { margin: 0; }
.lang-switch { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.lang-switch button, .login .lang-switch button { width: auto; background: #fff; color: var(--muted); border: 0;
  border-radius: 0; padding: 5px 10px; font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; min-height: 0; }
.lang-switch button + button { border-left: 1px solid var(--line); }
.lang-switch button.active { background: var(--ink); color: #fff; }
.login .lang-switch { margin: 0 0 18px; }
.link-button { background: none; border: 0; padding: 0; color: var(--accent-dark); font: inherit; cursor: pointer; }
.content { padding: 28px 34px 40px; width: 100%; max-width: 1400px; }
body.guest { display: block; }
body.guest .content { max-width: none; }

/* ---------- карточки и раскладка ---------- */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 24px;
  margin-bottom: 20px; box-shadow: var(--shadow); }
.row { display: flex; flex-wrap: wrap; gap: 12px 22px; align-items: center; }
.row > h1, .row > h2 { margin-bottom: 0; }
h1 + .badge, .row h1 { margin-bottom: 0; }
.content > .row:first-child { margin-bottom: 20px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.right { margin-left: auto; }
.table-wrap { overflow-x: auto; }

/* ---------- таблицы ---------- */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12.5px; color: var(--muted); font-weight: 600; white-space: nowrap; background: #fafbfc; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td, table tr:hover td { background: #fcfcfd; }
td.num, th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ---------- статусы ---------- */
.badge { display: inline-flex; align-items: center; gap: 7px; border-radius: 999px; padding: 5px 11px; font-size: 12px;
  font-weight: 650; background: var(--idle-bg); color: var(--text); white-space: nowrap; }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .8; }
.b-ok, .s-done { background: var(--ok-bg); color: var(--ok); }
.b-warn, .s-in_progress, .s-available { background: var(--warn-bg); color: var(--warn); }
.b-bad { background: var(--bad-bg); color: var(--bad); }
.chip { display: inline-flex; align-items: center; border-radius: 7px; padding: 3px 9px; margin: 2px 4px 2px 0;
  font-size: 12.5px; background: var(--idle-bg); white-space: nowrap; }
.chip form { display: inline; margin: 0; }
.chip button { border: 0; background: none; color: var(--bad); cursor: pointer; padding: 0 0 0 6px; font-size: 14px; }
.arrow { color: #b5b9c2; margin-right: 4px; }
.bar { background: var(--idle-bg); border-radius: 999px; height: 7px; width: 120px; overflow: hidden;
  display: inline-block; vertical-align: middle; }
.bar span { display: block; height: 100%; background: var(--accent); border-radius: 999px; }

/* ---------- сообщения ---------- */
.messages { list-style: none; padding: 0; margin: 0 0 18px; }
.messages li { padding: 12px 16px; border-radius: 10px; margin-bottom: 8px; background: var(--ok-bg); color: var(--ok);
  border: 1px solid #c9e7d6; }
.messages li.error { background: var(--bad-bg); color: var(--bad); border-color: #f3c9c4; }

/* ---------- формы ---------- */
label { display: block; font-size: 12px; font-weight: 600; color: #535a65; margin-bottom: 6px; }
input, select, textarea { font: 14px "Segoe UI", Roboto, sans-serif; padding: 9px 11px; min-height: 40px;
  border: 1px solid var(--line-strong); border-radius: 8px; background: #fff; color: var(--ink); max-width: 100%; outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(217, 138, 79, .14); }
input[type=text], input[type=email], input[type=password], textarea { width: 100%; }
input[type=number] { width: 120px; }
input[type=checkbox] { width: 17px; height: 17px; min-height: 0; accent-color: var(--accent); vertical-align: middle; margin-right: 6px; }
textarea { resize: vertical; line-height: 1.55; }
.form > div { margin-bottom: 14px; max-width: 560px; }
.form .helptext { display: block; font-size: 12px; color: var(--muted); margin-top: 4px; font-weight: 400; }
.errorlist { color: var(--bad); padding: 0; list-style: none; margin: 0 0 4px; font-size: 12.5px; }
.inline-form { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.inline-form > div { margin: 0; }
.inline-form input[type=text] { width: 240px; }
.checks > div > div { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.checks > div > div label { display: inline-flex; align-items: center; color: var(--text); font-size: 13.5px; font-weight: 500; }

/* ---------- кнопки ---------- */
button, .btn { display: inline-flex; align-items: center; gap: 6px; font: 600 13.5px "Segoe UI", Roboto, sans-serif;
  padding: 9px 18px; min-height: 40px; border-radius: 8px; border: 1px solid var(--accent); background: var(--accent);
  color: #fff; cursor: pointer; transition: background .15s, border-color .15s; }
button:hover, .btn:hover { background: var(--accent-dark); border-color: var(--accent-dark); text-decoration: none; color: #fff; }
button.secondary, .btn.secondary { background: #fff; color: var(--ink); border-color: var(--line-strong); }
button.secondary:hover, .btn.secondary:hover { background: #f6f7f9; color: var(--ink); border-color: #c5cad1; }
button.danger { background: #fff; color: var(--bad); border-color: #ebccd1; }
button.danger:hover { background: var(--bad-bg); color: var(--bad); }
button.link { border: 0; background: none; color: var(--bad); padding: 0; min-height: 0; font-weight: 500; }
button.link:hover { background: none; color: var(--bad); text-decoration: underline; }
button:disabled { opacity: .55; cursor: default; }
details { margin-top: 10px; }
summary { cursor: pointer; color: var(--accent-dark); font-weight: 600; }
details > .form, details > form { margin-top: 12px; }

/* ---------- сводка ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; margin-bottom: 20px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px;
  box-shadow: var(--shadow); color: var(--muted); font-size: 13px; }
.tile b { display: block; font-size: 32px; line-height: 1.1; color: var(--ink); margin-bottom: 4px; font-weight: 700; }
.tile.bad b { color: var(--bad); }

/* ---------- заголовок страницы ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 14px 24px; margin-bottom: 22px; }
.page-head h1 { margin: 0 0 4px; }
.page-head p { margin: 0; }
.segmented { display: inline-flex; background: #e8ebf0; border-radius: 10px; padding: 3px; }
.segmented a { padding: 8px 16px; border-radius: 8px; color: var(--muted); font-weight: 600; white-space: nowrap; }
.segmented a:hover { color: var(--ink); text-decoration: none; }
.segmented a.active { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .08); }
.segmented b { font-weight: 700; color: var(--accent-dark); margin-left: 4px; }

/* ---------- экран участка: крупно, для цеха ---------- */
.job { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 18px 32px; background: var(--panel);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 24px; margin-bottom: 16px; box-shadow: var(--shadow); }
.job.is-mine { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(217, 138, 79, .12); }
.job.is-waiting { background: #f8f9fb; }
.job.is-waiting .job-title, .job.is-waiting .job-works { color: var(--muted); }
.job-title { font-size: 21px; margin: 0 0 2px; }
.job-size { font-weight: 500; color: var(--muted); margin-left: 8px; font-size: 18px; }
.job-order { margin: 0 0 12px; color: var(--muted); }
.job-due { margin-left: 12px; color: var(--accent-dark); font-weight: 600; }
.job-works { list-style: none; padding: 0; margin: 0 0 14px; display: flex; flex-wrap: wrap; gap: 6px 10px; }
.job-works li { background: var(--idle-bg); border-radius: 8px; padding: 6px 11px; font-size: 14px; }
.job-works b { margin-left: 6px; color: var(--ink); }
.job-note { margin: 0 0 14px; }
.job-progress { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 16px; }
.job-count { font-size: 15px; }
.job-count b { font-size: 26px; color: var(--ink); }
.bar.wide { width: 220px; height: 9px; }
.job-scrap { color: var(--bad); font-weight: 600; }
.job-ready { margin: 10px 0 0; color: var(--ok); }
.job-ready b { font-size: 17px; }
.job-wait { margin: 10px 0 0; color: var(--warn); font-weight: 600; }
.job-who { margin: 8px 0 0; color: var(--accent-dark); font-weight: 600; }
.job-actions { display: flex; flex-direction: column; gap: 10px; align-self: center; }
.job-actions form { margin: 0; }
.report-form label { font-size: 13px; }
.report-line { display: flex; gap: 8px; }
.report-line input[type=number] { width: 110px; font-size: 22px; min-height: 54px; font-weight: 700; text-align: center; }
.report-line input[type=text] { flex: 1; min-height: 54px; }
.report-line button { flex: 1; justify-content: center; font-size: 18px; min-height: 54px; }
.wide-btn { width: 100%; justify-content: center; }
.wide-btn.big { min-height: 58px; font-size: 18px; }
.scrap, .performers { margin-top: 10px; }
.scrap summary { color: var(--bad); }
.scrap .report-line input[type=number] { width: 90px; font-size: 18px; }
.performers label { display: flex; align-items: center; color: var(--text); font-size: 15px; font-weight: 500; margin: 8px 0 0; }
.recent summary { font-size: 15px; color: var(--ink); }
.section-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.section-grid a { display: block; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 24px 20px; font-size: 17px; font-weight: 650; color: var(--ink); box-shadow: var(--shadow); }
.section-grid a:hover { border-color: var(--accent); color: var(--accent-dark); text-decoration: none; }
.section-grid small { display: block; font-size: 13px; font-weight: 500; color: var(--muted); margin-top: 4px; }

/* ---------- позиция из каталога ---------- */
.params-form { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 4px 22px; }
.params-form > div { max-width: none; }
.params-form > button { grid-column: 1 / -1; justify-self: start; }
.params-form select { width: 100%; }
.kv { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 8px 0; font-size: 13px; }
.kv span b { font-weight: 600; color: var(--ink); }

/* ---------- вход ---------- */
.login { max-width: 400px; margin: 9vh auto; padding: 34px; }
.login h1 { font-size: 22px; }
.login-brand { font-size: 22px; font-weight: 800; letter-spacing: 1px; color: var(--ink); margin-bottom: 4px; }
.login-brand span { color: var(--accent); }
.login button { width: 100%; justify-content: center; }

/* ---------- печатные листы ---------- */
.sheet h2 { margin-top: 20px; }
@media print {
  .sidebar, .top-header, .no-print, .messages { display: none !important; }
  body { background: #fff; display: block; }
  .content { padding: 0; max-width: none; }
  .panel { border: 0; padding: 0; box-shadow: none; }
  th { background: none; }
  th, td { padding: 4px 6px; border: 1px solid #999; }
}

/* ---------- узкие экраны: меню сверху ---------- */
@media (max-width: 900px) {
  body { display: block; }
  .sidebar { width: auto; height: auto; min-height: 0; position: static; display: flex; align-items: center; overflow-x: auto; }
  .sidebar-brand { height: 56px; padding: 0 16px; font-size: 16px; border: 0; flex-shrink: 0; }
  .sidebar-nav { display: flex; padding: 0; }
  .nav-group { display: none; }
  .nav-item { padding: 18px 12px; white-space: nowrap; border-left: 0; border-bottom: 3px solid transparent; }
  .nav-item.active { border-bottom-color: var(--accent); }
  .top-header { height: 52px; padding: 0 16px; }
  .header-title { font-size: 16px; }
  .content { padding: 18px 14px 30px; }
  .panel { padding: 16px; }
  .job { grid-template-columns: 1fr; padding: 18px; }
  .bar.wide { width: 100%; }
}

/* ---------- форма заказа ---------- */
.order-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 40px; margin-bottom: 18px; }
.order-form .field { margin: 12px 0; }
.order-form select { width: 100%; }
.order-form select[size] { min-height: 150px; padding: 4px; }
.order-form .two { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.order-form .two input { width: 100%; }
@media (max-width: 900px) { .order-form-grid, .order-form .two { grid-template-columns: 1fr; } }

/* ---------- карточка заказа ---------- */
.eyebrow { font-size: 13px; font-weight: 600; color: var(--accent-dark); margin-bottom: 2px; }
.order-head h1 { margin: 0; }
.order-head .right.row { gap: 8px; }
.stages { list-style: none; display: flex; padding: 0; margin: 22px 0 6px; counter-reset: s; }
.stages li { flex: 1; position: relative; font-size: 12px; color: var(--muted); padding-top: 22px; text-align: center; }
.stages li::before { content: ""; position: absolute; top: 7px; left: 0; right: 0; height: 3px; background: var(--line); }
.stages li:first-child::before { left: 50%; }
.stages li:last-child::before { right: 50%; }
.stages li span { position: absolute; top: 1px; left: calc(50% - 7px); width: 15px; height: 15px; border-radius: 50%;
  background: #fff; border: 3px solid var(--line); z-index: 1; }
.stages li.done::before, .stages li.current::before { background: var(--accent); }
.stages li.current::before { background: linear-gradient(90deg, var(--accent) 50%, var(--line) 50%); }
.stages li:last-child.current::before { background: var(--accent); }
.stages li.done span { background: var(--accent); border-color: var(--accent); }
.stages li.current span { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(217, 138, 79, .18); }
.stages li.current { color: var(--ink); font-weight: 700; }
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px 24px; margin-top: 20px;
  padding-top: 18px; border-top: 1px solid var(--line); }
.facts > div > span:first-child { display: block; font-size: 11.5px; color: var(--muted); margin-bottom: 2px; }
.facts small { color: var(--muted); }
.note { background: #fafbfc; border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; margin: 16px 0 0; }
.alert { background: var(--warn-bg); color: var(--warn); border-radius: 10px; padding: 12px 16px; margin-top: 16px; }
.alert ul { margin: 6px 0 0; padding-left: 20px; }
.actions { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line-strong); margin: 4px 0 20px; overflow-x: auto; }
.tabs a { padding: 11px 18px; color: var(--muted); font-weight: 600; border-bottom: 3px solid transparent;
  margin-bottom: -1px; white-space: nowrap; }
.tabs a:hover { color: var(--ink); text-decoration: none; }
.tabs a.active { color: var(--ink); border-bottom-color: var(--accent); }
.tabs a b { background: var(--idle-bg); border-radius: 999px; padding: 1px 8px; font-size: 11.5px; margin-left: 4px; color: var(--text); }
.add-bar { padding-top: 16px; padding-bottom: 16px; }
.add-bar details { margin: 0; }
.item h2 { margin: 0; }
.item .qty { font-size: 15px; font-weight: 700; color: var(--accent-dark); }
.item-ops { margin: 12px 0 0; }
.tech-tools { margin-top: 10px; gap: 8px 26px; align-items: flex-start; }
.tech-tools details { margin: 0; }
.empty { color: var(--muted); text-align: center; padding: 34px; }
@media (max-width: 900px) { .stages li { font-size: 0; } .stages li.current { font-size: 11px; } }
.section-grid a.is-empty { color: var(--muted); box-shadow: none; background: #f8f9fb; }

/* ---------- параметры и маршрут позиции ---------- */
.params { margin: 14px 0 16px; display: grid; gap: 8px; }
.param-group { display: grid; grid-template-columns: 170px 1fr; gap: 4px 16px; }
.param-group dt { color: var(--muted); font-size: 13px; padding-top: 2px; }
.param-group dd { margin: 0; display: flex; flex-wrap: wrap; gap: 4px 18px; font-weight: 600; color: var(--ink); }
.param-group dd .muted { font-weight: 400; margin-right: 4px; }
.route { list-style: none; counter-reset: step; padding: 0; margin: 0; display: grid; gap: 6px; }
.route li { counter-increment: step; display: grid; grid-template-columns: 26px minmax(130px, auto) auto 1fr auto; align-items: baseline;
  gap: 4px 12px; padding: 7px 10px; border-radius: 8px; background: #fafbfc; border: 1px solid var(--line); }
.route li::before { content: counter(step); font-weight: 700; color: var(--muted); font-size: 12.5px; }
.route-sec { font-weight: 650; color: var(--ink); }
.route-qty { font-variant-numeric: tabular-nums; color: var(--muted); white-space: nowrap; }
.route-works { color: var(--muted); font-size: 13px; }
.route li form { margin: 0; }
.route li.r-done { background: var(--ok-bg); border-color: #cbe8d7; }
.route li.r-done .route-qty { color: var(--ok); font-weight: 600; }
.route li.r-in_progress { background: var(--warn-bg); border-color: #f2dfb3; }
.route li.r-in_progress .route-qty { color: var(--warn); font-weight: 600; }
.route li.r-available { background: #fff; border-color: var(--accent); }
.route li.r-available .route-qty { color: var(--accent-dark); font-weight: 600; }
@media (max-width: 900px) {
  .param-group { grid-template-columns: 1fr; }
  .route li { grid-template-columns: 22px 1fr auto; }
  .route-works { grid-column: 2 / -1; }
}
.part { border-top: 1px solid var(--line); padding: 16px 0 4px; }
.part:first-of-type { margin-top: 6px; }
.part-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 16px; margin-bottom: 10px; }
.part-head h3 { margin: 0; }
.part-head > span { color: var(--muted); }
.part-head form { margin: 0; }

/* ---------- форма позиции из каталога ---------- */
.catalog-form .fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 6px 22px; }
.catalog-form .field { margin: 6px 0; }
.catalog-form .field.wide { grid-column: span 2; }
.catalog-form .field select, .catalog-form .field input[type=number] { width: 100%; }
.catalog-form .field.check { align-self: end; }
.catalog-form .field.check label { display: flex; align-items: center; gap: 4px; font-size: 14px; color: var(--ink); min-height: 40px; }
.catalog-form textarea { min-height: 40px; }
.sticky-actions { position: sticky; bottom: 0; display: flex; gap: 10px; padding: 14px 0; background: linear-gradient(transparent, var(--bg) 30%); }
@media (max-width: 900px) { .catalog-form .field.wide { grid-column: auto; } }

/* ---------- список заказов ---------- */
.filter-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 16px; }
.filter-bar input[type=search] { width: 280px; }
.panel.flush { padding: 0; overflow: hidden; }
.panel.flush th:first-child, .panel.flush td:first-child { padding-left: 24px; }
.orders tr:not(:first-child) { cursor: pointer; }
.orders td { padding-top: 14px; padding-bottom: 14px; }
.order-no { font-weight: 700; color: var(--ink); }
.text-bad { color: var(--bad); font-weight: 600; }
.text-warn { color: var(--warn); font-weight: 600; }
@media (max-width: 900px) { .filter-bar input[type=search] { width: 100%; } }
.tile.good b { color: var(--ok); }
.load-bar { display: inline-block; width: 220px; height: 9px; background: var(--idle-bg); border-radius: 999px; overflow: hidden; vertical-align: middle; margin-right: 8px; }
.load-bar span { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
@media (max-width: 900px) { .load-bar { width: 90px; } }

.helptext { display: block; font-size: 12px; color: var(--muted); margin-top: 4px; }

/* ---------- склад готовой продукции ---------- */
.count { display: inline-block; background: var(--idle-bg); border-radius: 999px; padding: 1px 10px; font-size: 13px; margin-left: 6px; color: var(--text); }
.stock-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 10px 20px;
  padding: 14px 0; border-top: 1px solid var(--line); }
.stock-row form { margin: 0; }
.stock-qty { font-size: 18px; font-weight: 700; color: var(--ink); white-space: nowrap; }
.issue-form { display: flex; gap: 8px; }
.issue-form input { width: 220px; }
@media (max-width: 900px) { .stock-row { grid-template-columns: 1fr auto; } .stock-row form { grid-column: 1 / -1; } .issue-form input { flex: 1; width: auto; } }
.badge.site { background: #eef2fb; color: #3b5ba9; }
tr.total td { font-weight: 700; color: var(--ink); border-top: 2px solid var(--line-strong); }

/* ---------- выбор изделия и конструктор фасадов ---------- */
.choice-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; margin-bottom: 14px; }
.choice { display: block; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px;
  color: var(--text); box-shadow: var(--shadow); margin: 0; }
a.choice:hover { border-color: var(--accent); text-decoration: none; }
.choice b { display: block; font-size: 18px; color: var(--ink); margin-bottom: 6px; }
.choice span { color: var(--muted); }
.choice summary { list-style: none; color: var(--text); }
.choice summary::-webkit-details-marker { display: none; }
.choice[open] { grid-column: 1 / -1; }
.chips-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.cat-chip { background: #fff; border: 1px solid var(--line-strong); border-radius: 999px; padding: 7px 14px; color: var(--ink); font-weight: 600; }
.cat-chip:hover { border-color: var(--accent); text-decoration: none; }
.cat-chip.active { background: var(--ink); border-color: var(--ink); color: #fff; }
.cat-chip b { color: var(--muted); font-weight: 600; margin-left: 4px; }
.cat-chip.active b { color: #c9ccd4; }
.step-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-bottom: 16px; }
.step-head h2 { margin: 0; }
.step-head input[type=search] { margin-left: auto; width: 260px; }
.step { width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: #fff; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; }
.finish-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; max-height: 420px;
  overflow-y: auto; padding: 2px; }
.finish { position: relative; display: block; border: 2px solid var(--line); border-radius: 10px; padding: 8px; cursor: pointer;
  margin: 0; background: #fff; font-weight: 400; color: var(--text); }
.finish input { position: absolute; opacity: 0; }
.finish img, .finish .swatch { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 6px; background: var(--idle-bg); margin-bottom: 6px; }
.finish-name { display: block; font-size: 13px; font-weight: 600; color: var(--ink); line-height: 1.3; }
.finish-code { display: block; font-size: 11.5px; color: var(--muted); }
.finish:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(217, 138, 79, .18); }
.finish:has(input:focus-visible) { outline: 2px solid var(--accent); }
.pill-group { display: flex; flex-wrap: wrap; gap: 8px; }
.pill { display: inline-flex; align-items: center; margin: 0; padding: 9px 15px; border: 1px solid var(--line-strong); border-radius: 999px;
  cursor: pointer; font-size: 14px; font-weight: 500; color: var(--ink); background: #fff; }
.pill input { position: absolute; opacity: 0; }
.pill:has(input:checked) { background: var(--ink); border-color: var(--ink); color: #fff; }
.pill:has(input:focus-visible) { outline: 2px solid var(--accent); }
.constructor .fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 6px 22px; }
.constructor .field select, .constructor .field input[type=text] { width: 100%; }
.constructor .field.check { align-self: end; }
.constructor .field.check label { display: flex; align-items: center; min-height: 40px; color: var(--ink); font-size: 14px; }
.details-table td { padding: 6px 6px; vertical-align: middle; }
.details-table input[type=number] { width: 100px; }
.details-table td:nth-child(4) input, .details-table td:nth-child(6) input { width: 80px; }
.details-table input[type=text] { min-width: 160px; }
.details-table .n { color: var(--muted); font-weight: 600; }
.cut-list td { padding-top: 7px; padding-bottom: 7px; }
@media (max-width: 900px) { .step-head input[type=search] { width: 100%; margin-left: 0; } }

/* ---------- матрица фасадов (как заявка сайта) ---------- */
:root { --sel-bg: #e9f2ea; --sel-line: #8fb397; --sel-ink: #3d6545; --facade: #f3f0e9; --facade-line: #a39d90; }
button.small { min-height: 32px; padding: 5px 12px; font-size: 12.5px; }
button.wide { width: 100%; justify-content: center; margin-bottom: 14px; }
.fm-wizard { padding-bottom: 26px; }
.fm-wizard-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; margin-bottom: 18px; }
.fm-wizard-head h2 { margin-bottom: 8px; }
.fm-wizard-actions { margin-top: 0; flex-wrap: nowrap; }
.fm-steps { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; padding: 0; margin: 0; }
.fm-steps li span, .fm-steps li button { display: inline-block; padding: 5px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 600;
  background: var(--idle-bg); color: var(--muted); border: 0; min-height: 0; }
.fm-steps li.current span { background: var(--accent); color: #fff; }
.fm-steps li.done button { background: var(--sel-bg); color: var(--sel-ink); cursor: pointer; }
.fm-steps li.done button:hover { text-decoration: underline; }
.fm-tabs { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.fm-tab { background: none; border: 0; border-bottom: 2px solid transparent; border-radius: 0; color: var(--muted); padding: 10px 16px;
  min-height: 0; font-weight: 650; }
.fm-tab:hover { background: none; color: var(--ink); border-color: transparent; border-bottom-color: var(--line-strong); }
.fm-tab.active { color: var(--ink); border-bottom-color: var(--accent); }
.fm-tab.disabled { color: #b8bcc4; cursor: default; display: inline-flex; align-items: center; }
.fm-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-bottom: 10px; }
.fm-toolbar input[type=search] { width: 360px; }
.fm-chiprow { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 10px; }
.fm-chiprow-label { font-size: 12px; color: var(--muted); font-weight: 600; min-width: 74px; }
.fm-chip { background: #fff; border: 1px solid var(--line-strong); color: var(--ink); border-radius: 999px; padding: 5px 13px; min-height: 0;
  font-weight: 600; font-size: 13px; }
.fm-chip:hover { background: #fff; color: var(--ink); border-color: var(--accent); }
.fm-chip.active { background: var(--ink); border-color: var(--ink); color: #fff; }
.fm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(136px, 1fr)); gap: 12px; margin-top: 14px; }
.fm-grid-small { grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); }
.fm-tile { display: flex; flex-direction: column; align-items: stretch; gap: 2px; text-align: left; background: #fff; color: var(--text);
  border: 2px solid var(--line); border-radius: 10px; padding: 7px 7px 9px; min-height: 0; font-weight: 400; }
.fm-tile:hover { background: #fff; color: var(--text); border-color: #e7c3a7; }
.fm-tile img, .fm-tile .fm-tile-img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 6px; background: var(--idle-bg); margin-bottom: 6px; }
.fm-tile.contain img { object-fit: contain; background: #fff; }
.fm-tile-code { font-size: 11.5px; color: var(--muted); font-weight: 600; }
.fm-tile-name { font-size: 13px; font-weight: 650; color: var(--ink); line-height: 1.3; }
.fm-tile-meta { font-size: 11.5px; color: var(--muted); }
.fm-tile.active { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(217, 138, 79, .18); }
.fm-plain { display: block; background: linear-gradient(135deg, #f6f4ef, #e8e4dc); box-shadow: inset 0 0 0 9px #f3f0e9, inset 0 0 0 10px #c8c1b5; }
.fm-empty { grid-column: 1 / -1; color: var(--muted); padding: 24px 0; }

/* окна */
.fm-modal { border: 0; border-radius: 14px; padding: 0; width: 620px; max-width: calc(100vw - 32px); max-height: calc(100dvh - 40px);
  box-shadow: 0 24px 60px rgba(20, 22, 30, .28); color: var(--text); }
.fm-modal.wide { width: 1000px; }
.fm-modal::backdrop { background: rgba(30, 30, 45, .55); }
.fm-modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding: 22px 26px 6px; }
.fm-modal-head h2 { font-size: 20px; margin: 0 0 2px; }
.fm-modal-head p { margin: 0; font-size: 13px; }
.fm-x { background: none; border: 0; color: var(--muted); font-size: 26px; line-height: 1; padding: 0 4px; min-height: 0; }
.fm-x:hover { background: none; color: var(--ink); }
.fm-modal-body { padding: 14px 26px 6px; overflow-y: auto; max-height: calc(100dvh - 190px); }
.fm-modal-foot { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; padding: 14px 26px 20px; border-top: 1px solid var(--line); margin-top: 12px; }
.fm-modal-foot:empty { display: none; }
.fm-two { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 26px; align-items: start; }
.fm-label { font-size: 12px; font-weight: 650; color: #535a65; margin: 12px 0 7px; }
.fm-two > div > .fm-label:first-child { margin-top: 0; }
.fm-warn { background: var(--warn-bg); color: var(--warn); border-radius: 8px; padding: 9px 12px; font-weight: 600; margin: 0 0 14px; }
.fm-preview-img img, .fm-patina-preview img { width: 100%; max-height: 300px; object-fit: contain; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.fm-preview-img .fm-plain, .fm-patina-preview .fm-plain { height: 280px; border-radius: 10px; }
.fm-patina-preview b { display: block; text-align: center; margin-top: 8px; color: var(--ink); }
.fm-patina-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; margin-top: 12px; }
.fm-patina, .fm-decor { display: flex; flex-direction: column; gap: 6px; align-items: stretch; background: #fff; color: var(--ink); border: 2px solid var(--line);
  border-radius: 10px; padding: 6px 6px 8px; min-height: 0; font-weight: 600; font-size: 12.5px; text-align: center; margin: 0; }
.fm-patina:hover { background: #fff; color: var(--ink); border-color: #e7c3a7; }
.fm-patina img, .fm-decor img { width: 100%; height: 110px; object-fit: contain; }
.fm-patina .fm-plain, .fm-decor .fm-plain { height: 110px; border-radius: 6px; }
.fm-patina.active { border-color: var(--sel-line); background: var(--sel-bg); color: var(--sel-ink); }
.fm-decor-qty { display: flex; align-items: center; justify-content: center; gap: 6px; font-weight: 500; color: var(--muted); }
.fm-decor-qty input { width: 70px; min-height: 32px; padding: 4px 8px; }
.fm-segmented { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.fm-segmented button, .fm-corners button { background: #fff; color: var(--ink); border: 1px solid var(--line-strong); border-radius: 999px; min-height: 36px;
  padding: 6px 16px; font-weight: 600; }
.fm-segmented button:hover, .fm-corners button:hover { background: #fff; color: var(--ink); border-color: var(--sel-line); }
.fm-segmented button.active, .fm-corners button.active { background: var(--sel-bg); border-color: var(--sel-line); color: var(--sel-ink); }
.fm-choices { display: grid; gap: 10px; }
.fm-choice, .fm-choice-btn { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; align-items: center; text-align: left; background: #fff; color: var(--text);
  border: 1px solid var(--line-strong); border-radius: 10px; padding: 14px 16px; margin: 0; font-weight: 400; min-height: 0; cursor: pointer; }
.fm-choice input { grid-row: span 2; margin: 0; }
.fm-choice b, .fm-choice-btn b { color: var(--ink); font-size: 14.5px; }
.fm-choice span { grid-column: 2; font-size: 13px; }
.fm-choice:has(input:checked) { border-color: var(--sel-line); background: var(--sel-bg); }
.fm-choice.disabled, .fm-choice-btn.disabled { opacity: .55; cursor: default; }
.fm-choice-btn { grid-template-columns: 1fr; }
.fm-choice-btn:hover { background: #fff; color: var(--text); border-color: var(--accent); }
.fm-choice-btn.disabled:hover { border-color: var(--line-strong); }
.fm-fields { display: grid; gap: 4px; }
.fm-field { display: block; margin: 8px 0 0; }
.fm-field > span { display: block; margin-bottom: 6px; font-size: 12px; font-weight: 600; color: #535a65; }
.fm-field select, .fm-field input { width: 100%; }
.fm-radios { display: flex; gap: 18px; }
.fm-radio { display: inline-flex; align-items: center; gap: 4px; font-size: 14px; color: var(--ink); font-weight: 500; margin: 0; }
.fm-radio[hidden] { display: none; }
.fm-base { margin: 16px 0 0; padding: 10px 12px; border-radius: 8px; background: #fafbfc; border: 1px solid var(--line); }
.fm-bad { color: var(--bad); font-weight: 600; }
.fm-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.fm-corners { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.fm-corners button { border-radius: 8px; justify-content: center; }
.fm-caption { text-align: center; color: var(--ink); font-weight: 600; margin: 6px 0; }
.fm-msg { color: var(--bad); font-size: 13px; min-height: 18px; margin: 10px 0 0; }
.fm-msg.ok { color: var(--ok); }
.fm-mass { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 14px; }
.fm-drawing-box { background: #f6f7f9; border: 1px solid var(--line); border-radius: 10px; padding: 8px; }
.fm-drawing { display: block; width: 100%; max-height: 420px; }
.fm-drawing .facade { fill: var(--facade); stroke: var(--facade-line); stroke-width: 1.5; }
.fm-drawing .facade.back { fill: #fff; }
.fm-drawing .handle { fill: #6f8f74; }
.fm-drawing .cutout { fill: url(#fm-hatch); stroke: #d9534f; stroke-width: 1.5; stroke-dasharray: 5 3; }
.fm-drawing .cutout.bad { stroke-width: 2.5; }
.fm-drawing .hatch { stroke: rgba(217, 83, 79, .45); stroke-width: 4; }
.fm-drawing .dim { stroke: #8a8f98; stroke-width: 1; }
.fm-drawing .dim-text { font: 600 11px "Segoe UI", Roboto, sans-serif; fill: #4a4f57; }
.fm-drawing .dim-text.small { font-size: 10px; fill: #7b5ea7; }
.fm-drawing .dim-text.muted { fill: #a39d90; font-weight: 500; }
.fm-drawing .hole { fill: #fff; stroke: #7b5ea7; stroke-width: 1.5; }
.fm-drawing .axis { stroke: #7b5ea7; stroke-width: .7; }

/* стороны: дверь со сторонами вокруг */
.fm-door-stage { display: grid; grid-template-columns: 1fr 120px 1fr; grid-template-rows: auto 200px auto; gap: 10px; align-items: center; justify-items: center; margin: 6px auto 0; max-width: 460px; }
.fm-door-stage.wide { grid-template-columns: 1fr 210px 1fr; grid-template-rows: auto 120px auto; }
.fm-door { grid-column: 2; grid-row: 2; width: 100%; height: 100%; background: linear-gradient(135deg, #f6f4ef, #e7e3db); border: 1.5px solid var(--facade-line);
  border-radius: 3px; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 12.5px; font-weight: 600;
  box-shadow: inset 0 0 0 10px #f3f0e9, inset 0 0 0 11px #cdc6b9; }
.fm-side { white-space: nowrap; background: #fff; color: var(--ink); border: 1px solid var(--line-strong); border-radius: 999px; padding: 7px 14px; min-height: 0; font-weight: 600; font-size: 12.5px; }
.fm-side:hover { background: #fff; color: var(--ink); border-color: var(--sel-line); }
.fm-side.active { background: var(--sel-bg); border-color: var(--sel-line); color: var(--sel-ink); }
.fm-side.top { grid-column: 2; grid-row: 1; }
.fm-side.bottom { grid-column: 2; grid-row: 3; }
.fm-side.left { grid-column: 1; grid-row: 2; justify-self: end; }
.fm-side.right { grid-column: 3; grid-row: 2; justify-self: start; }
.fm-door-stage:has(.fm-side.top.active) .fm-door { border-top: 4px solid var(--sel-line); }
.fm-door-stage:has(.fm-side.bottom.active) .fm-door { border-bottom: 4px solid var(--sel-line); }
.fm-door-stage:has(.fm-side.left.active) .fm-door { border-left: 4px solid var(--sel-line); }
.fm-door-stage:has(.fm-side.right.active) .fm-door { border-right: 4px solid var(--sel-line); }

/* партии */
.fm-batch { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 22px; overflow: hidden; }
.fm-batch-head { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 18px 26px; align-items: center; padding: 18px 22px;
  background: #fbfbfc; border-bottom: 2px solid var(--accent); }
.fm-batch.dvp .fm-batch-head { grid-template-columns: minmax(0, 1fr) auto; background: #f1f5fb; border-bottom-color: #9db3d6; }
.fm-visuals { display: flex; gap: 12px; padding-right: 22px; border-right: 1px solid var(--line); }
.fm-visual { display: grid; justify-items: center; gap: 4px; width: 92px; text-align: center; }
.fm-visual-label { font-size: 10.5px; color: var(--muted); font-weight: 650; }
.fm-visual img, .fm-visual-empty, .fm-visual .fm-plain { width: 84px; height: 84px; object-fit: contain; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 3px; }
.fm-visual-empty { display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 12px; }
.fm-visual-value { font-size: 12px; font-weight: 650; color: var(--ink); line-height: 1.25; }
.fm-batch-text h2 { margin: 0 0 8px; font-size: 18px; }
.fm-batch-text p { margin: 3px 0; color: var(--text); }
.fm-batch-text b { color: var(--ink); }
.fm-batch-actions { display: grid; grid-template-columns: auto auto; gap: 8px; align-self: start; }
.fm-dvp-btn { grid-column: 1 / -1; background: #eef3fb; color: #33558f; border-color: #c3d3ec; justify-content: center; }
.fm-dvp-btn:hover { background: #e2eaf7; color: #33558f; border-color: #9db3d6; }
.fm-table-wrap { overflow-x: auto; }
.fm-details th { background: #fff; padding: 12px 10px; }
.fm-details td { padding: 9px 10px; vertical-align: top; }
.fm-details tbody tr:hover td { background: transparent; }
.fm-details .fm-n { color: var(--muted); font-weight: 650; padding-top: 18px; }
.fm-details select { min-width: 118px; }
.fm-cell input.fm-size { width: 96px; }
.fm-cell input.fm-qty { width: 76px; }
.fm-err { display: block; color: var(--bad); font-size: 11.5px; min-height: 0; margin-top: 3px; }
.fm-err:empty { display: none; }
.fm-cell.has-error input { border-color: var(--bad); background: var(--bad-bg); }
.fm-opts { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding-top: 4px; }
.fm-opt { min-height: 30px; height: 30px; white-space: nowrap; padding: 4px 10px; font-size: 12.5px; font-weight: 600; border-radius: 7px; background: #fff; color: var(--text); border: 1px solid var(--line-strong); }
.fm-opt:hover { background: #fafbfc; color: var(--ink); border-color: #c5cad1; }
.fm-opt.opt-handle { background: #eef6ef; border-color: #c4dcc8; color: #3d6545; }
.fm-opt.opt-cut { background: #fcefee; border-color: #efc7c3; color: #9a3a30; }
.fm-opt.opt-decor { background: #fdf5e4; border-color: #edd8a8; color: #855b07; }
.fm-opt.opt-holes { background: #f3effa; border-color: #d8cdee; color: #5f4791; }
.fm-opt.opt-extra { background: #eaf5f5; border-color: #bfdede; color: #2f6b6b; }
.fm-opt.on { box-shadow: inset 0 0 0 1.5px currentColor; }
.fm-opt.bad { border-color: var(--bad); box-shadow: inset 0 0 0 1.5px var(--bad); }
.fm-opt-pair { display: inline-flex; }
.fm-opt-pair .fm-opt { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.fm-opt-x { min-height: 30px; padding: 0 8px; border-radius: 0 7px 7px 0; background: #fff; color: var(--bad); border: 1px solid var(--line-strong); border-left: 0; font-size: 15px; }
.fm-opt-x:hover { background: var(--bad-bg); color: var(--bad); border-color: var(--line-strong); }
.fm-row-x { width: 28px; height: 28px; min-height: 0; padding: 0; justify-content: center; border-radius: 50%; background: #fff; color: var(--bad); border: 1px solid #ebccd1; margin-top: 6px; }
.fm-row-x:hover { background: var(--bad-bg); color: var(--bad); border-color: #ebccd1; }
.fm-note-row td { padding-top: 0; }
.fm-add-detail { display: block; width: calc(100% - 28px); margin: 6px 14px 16px; justify-content: center; background: #fbf8f3; color: #6b5338; border: 1px dashed #d8c3a6; }
.fm-add-detail:hover { background: var(--accent-soft); color: var(--accent-dark); border-color: var(--accent); }
.fm-add-batch { display: flex; margin: 4px auto 26px; padding: 16px 40px; background: none; color: var(--accent-dark); border: 2px dashed var(--accent); font-size: 15px; }
.fm-add-batch:hover { background: var(--accent-soft); color: var(--accent-dark); }
.fm-bar { position: sticky; bottom: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 20px;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 -6px 18px rgba(0, 0, 0, .06); }
.fm-bar button { padding: 11px 26px; }
.fm-summary { color: var(--muted); font-weight: 600; }
.fm-errors { background: var(--bad-bg); color: var(--bad); border: 1px solid #f3c9c4; border-radius: 10px; padding: 14px 18px; margin-bottom: 18px; }
.fm-errors ul { margin: 8px 0 0; padding-left: 18px; }
.fm-empty-state { text-align: center; padding: 40px 24px; }
@media (max-width: 1100px) {
  .fm-batch-head { grid-template-columns: 1fr; }
  .fm-visuals { border-right: 0; padding-right: 0; overflow-x: auto; }
  .fm-batch-actions { justify-self: start; grid-template-columns: auto auto auto; }
  .fm-dvp-btn { grid-column: auto; }
}
@media (max-width: 760px) {
  .fm-two, .fm-pair { grid-template-columns: 1fr; }
  .fm-toolbar input[type=search] { width: 100%; }
  .fm-chiprow-label { min-width: 100%; }
  .fm-modal-head, .fm-modal-body, .fm-modal-foot { padding-left: 16px; padding-right: 16px; }
  .fm-door-stage { grid-template-columns: 1fr 80px 1fr; grid-template-rows: auto 150px auto; }
  .fm-door-stage.wide { grid-template-columns: 1fr 120px 1fr; grid-template-rows: auto 80px auto; }
}
.choose-group { padding-bottom: 8px; }
.choose-note { margin: 0 0 16px; padding: 12px 16px; border-left: 4px solid var(--accent); background: #fff;
  border-radius: 0 8px 8px 0; color: var(--ink); }
.choose-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 20px; align-items: center; margin-bottom: 16px; }
.choose-head h2 { margin: 0; }
.choose-head p { grid-column: 1; margin: 0; }
.choose-head .btn { grid-column: 2; grid-row: 1 / span 2; }
.choice.is-later { background: #fafbfc; box-shadow: none; }
.choice.is-later b { color: var(--muted); }
.cut-list td.opt-lines span { display: block; font-size: 12.5px; color: var(--text); }
.fm-bar-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.fm-bar-right select { min-height: 42px; }
.fm-price { background: #fff; color: var(--ink); border-color: var(--line-strong); font-variant-numeric: tabular-nums; }
.fm-price:hover { background: #fafbfc; color: var(--ink); border-color: var(--accent); }
.fm-price.warn { border-color: #e9c46a; background: var(--warn-bg); color: var(--warn); }
.fm-quote td, .fm-quote th { padding: 8px 10px; }
.fm-quote .num { text-align: right; white-space: nowrap; }
.fm-quote tr.total td { font-weight: 700; border-top: 2px solid var(--line-strong); color: var(--ink); }
.links-table .fm-radio { display: flex; margin: 0 0 4px; font-size: 13px; }
.links-table .code-input { width: 160px; min-height: 32px; padding: 4px 8px; margin-top: 4px; }
/* участки: состояние цветом */
.section-grid a.sec { position: relative; display: grid; gap: 2px; padding: 18px 20px 18px 24px; overflow: hidden; }
.section-grid a.sec::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 6px; }
.sec-name { font-size: 16px; font-weight: 700; color: var(--ink); }
.sec-big { font-size: 34px; font-weight: 750; line-height: 1.1; margin-top: 6px; font-variant-numeric: tabular-nums; }
.sec-text { font-size: 13.5px; font-weight: 600; }
.sec-sub { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.sec-ready { background: #f3faf6; border-color: #bfe0cc; }
.sec-ready::before { background: var(--ok); }
.sec-ready .sec-big, .sec-ready .sec-text { color: var(--ok); }
.sec-waiting { background: #fff8ec; border-color: #f0d6a6; }
.sec-waiting::before { background: #e39a2d; }
.sec-waiting .sec-big, .sec-waiting .sec-text { color: #a8640c; }
.section-grid a.sec:hover { border-color: var(--accent); }
.sec-empty-title { margin: 28px 0 10px; font-size: 14px; color: var(--muted); }
.sec-empty { display: flex; flex-wrap: wrap; gap: 8px; }
.sec-empty a { padding: 7px 13px; border-radius: 999px; background: #eef0f4; color: var(--muted); font-size: 13px; font-weight: 600; }
.sec-empty a:hover { color: var(--ink); text-decoration: none; background: #e4e7ec; }
.period-bar { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 20px; }
.period-quick { display: flex; flex-wrap: wrap; gap: 8px; }
.pay-day h2 { text-transform: capitalize; }
.pay-day-total { font-size: 17px; font-weight: 700; color: var(--ok); }
.customer-form { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 0 22px; }
.customer-form > div { max-width: none; }
.customer-form > button { justify-self: start; }
/* главная */
.dash-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.dash-flow { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 0; margin-bottom: 22px; background: var(--panel);
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.dash-stage { display: grid; gap: 2px; padding: 18px 18px 16px; color: var(--muted); border-right: 1px solid var(--line); position: relative; }
.dash-stage:last-child { border-right: 0; }
.dash-stage:hover { background: #fafbfc; text-decoration: none; }
.dash-stage-n { font-size: 30px; font-weight: 750; color: #c3c7ce; line-height: 1.1; font-variant-numeric: tabular-nums; }
.dash-stage.has .dash-stage-n { color: var(--ink); }
.dash-stage-t { font-weight: 700; color: var(--ink); }
.dash-stage-h { font-size: 12px; }
.dash-stage.has::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--accent); }
.dash-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 20px; }
.dash-alert { border-left: 4px solid; border-radius: 8px; padding: 10px 14px; margin-bottom: 10px; }
.dash-alert.bad { border-color: var(--bad); background: var(--bad-bg); }
.dash-alert.warn { border-color: #e39a2d; background: var(--warn-bg); }
.dash-alert.info { border-color: #6b8fd6; background: #eef3fb; }
.dash-alert ul { margin: 6px 0 0; padding-left: 18px; font-size: 13px; }
.dash-note { margin: 0 0 8px; font-size: 13.5px; font-weight: 600; }
.dash-note.warn { color: var(--warn); } .dash-note.bad { color: var(--bad); }
.dash-table td { padding: 8px 6px; cursor: pointer; }
.dash-sub { margin-top: 16px; }
.dash-kpis { display: flex; flex-wrap: wrap; gap: 26px; margin-bottom: 12px; }
.dash-kpis b { display: block; font-size: 28px; color: var(--ink); font-variant-numeric: tabular-nums; }
.dash-kpis span { color: var(--muted); font-size: 13px; }
.dash-counts { list-style: none; padding: 0; margin: 0 0 10px; display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px 16px; }
.dash-counts b { color: var(--ink); font-size: 18px; margin-right: 4px; }
@media (max-width: 1100px) { .dash-flow { grid-template-columns: repeat(3, 1fr); } .dash-stage:nth-child(3) { border-right: 0; } }
@media (max-width: 760px) { .dash-flow { grid-template-columns: repeat(2, 1fr); } .dash-grid { grid-template-columns: 1fr; } }
.nav-new { display: block; margin: 14px 20px 4px; padding: 10px 14px; border-radius: 8px; background: var(--accent); color: #fff;
  font-weight: 700; text-align: center; }
.nav-new:hover { background: var(--accent-dark); color: #fff; text-decoration: none; }
