/* Стиль 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: none; min-width: 0; }
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(5, 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; }
@media (min-width: 2100px) { .dash-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.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; }

.area-rule { display: flex; gap: 20px; align-items: center; justify-content: space-between; border-left: 4px solid var(--accent); }
.area-rule p { margin: 4px 0 0; }
.link-tag { display: inline-block; min-width: 54px; padding: 1px 6px; border-radius: 6px; background: var(--soft, #eef1f5);
  font-size: 12px; font-weight: 700; text-align: center; }

/* Склад материалов */
.head-actions { display: flex; gap: 10px; align-items: center; }
.head-actions form { margin: 0; }
.stock-sum { grid-template-columns: repeat(3, minmax(0, 1fr)); max-width: 900px; }
.row-line { display: flex; gap: 8px; align-items: baseline; padding: 8px 0; border-bottom: 1px solid var(--line); }
.row-line .right { margin-left: auto; }
.pager { display: flex; gap: 16px; align-items: center; justify-content: center; margin: 16px 0; }
.doc-head { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px 16px; align-items: end; }
.doc-add { display: grid; grid-template-columns: minmax(260px, 3fr) minmax(110px, 1fr) minmax(110px, 1fr) auto; gap: 10px; align-items: end; }
.doc-lines input.qty { width: 120px; text-align: right; }
.doc-lines .diff-plus { color: var(--ok); font-weight: 600; }
.doc-lines .diff-minus { color: var(--bad); font-weight: 600; }
@media (max-width: 900px) { .doc-add { grid-template-columns: 1fr 1fr; } .stock-sum { grid-template-columns: 1fr; } }
.alert.warn-alert { background: var(--warn-bg); border-color: #f1d9b5; color: var(--ink); }
.doc-head label.field, .doc-add label.field { display: grid; gap: 6px; font-size: 13px; font-weight: 600; color: var(--ink); }
.override { margin-top: 10px; }
.override summary { cursor: pointer; font-weight: 600; color: var(--bad); }
.override .form { margin-top: 10px; max-width: 640px; }
/* Витрина стандартных изделий */
.showcase { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 14px; align-items: start; padding-bottom: 80px; }
.sc-model { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.sc-model h2 { margin: 0 0 8px; font-size: 17px; }
.sc-variants { display: grid; gap: 6px; }
.sc-variant { display: grid; grid-template-columns: 1fr auto 74px auto; gap: 10px; align-items: center; padding: 6px 8px; border-radius: 8px; cursor: pointer; }
.sc-variant:hover { background: #f6f7f9; }
.sc-variant.on { background: var(--warn-bg); }
.sc-variant input { width: 74px; text-align: right; margin: 0; }
.sc-name { display: grid; gap: 1px; min-width: 0; }
.sc-name .small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sc-price { font-weight: 600; white-space: nowrap; }
.sc-bar { position: fixed; left: 0; right: 0; bottom: 0; display: flex; gap: 16px; justify-content: flex-end; align-items: center;
  padding: 12px 34px; background: rgba(255,255,255,.96); border-top: 1px solid var(--line); z-index: 20; }
.project-form { max-width: 980px; }
.project-form .field { max-width: none; }
.pf-row { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 900px) { .pf-row { grid-template-columns: 1fr 1fr; } }
.oc-search { align-items: end; flex-wrap: wrap; }
.oc-search .field { display: grid; gap: 6px; font-size: 13px; font-weight: 600; }
.oc-add { display: grid; grid-template-columns: minmax(240px, 3fr) repeat(3, minmax(90px, 1fr)) repeat(3, minmax(120px, 1.4fr)) auto; gap: 10px; align-items: end; }
.oc-add .field { display: grid; gap: 6px; font-size: 13px; font-weight: 600; }
.oc-take { display: flex; gap: 6px; margin: 0; }
.oc-take input { width: 110px; margin: 0; }
@media (max-width: 1100px) { .oc-add { grid-template-columns: 1fr 1fr; } }
/* Сотрудники */
.staff-form { max-width: 1100px; }
.sf-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px 16px; }
.sf-grid .field { max-width: none; }
.role-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.role-card { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.role-card span { display: grid; gap: 2px; }
.role-card:has(input:checked) { border-color: var(--accent); background: var(--warn-bg); }
.section-checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 6px 16px; }

/* Задание участка: состояния */
.job.is-mine { border: 2px solid var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 4px rgba(217, 138, 79, .14); }
.job.is-busy { border-left: 5px solid #b8bec8; }
.job-state { font-weight: 700; font-size: 15px; padding: 8px 12px; border-radius: 10px; text-align: center; }
.job-state.mine { background: var(--accent); color: #fff; }
.job-state.busy { background: var(--idle-bg); color: var(--muted); }
.job-actions .wide-btn.big, .report-line button.done { min-height: 60px; font-size: 19px; font-weight: 700; border-radius: 12px; }
.report-line button.done { background: #7a4a24; border-color: #7a4a24; color: #fff; }
.report-line button.done:hover { background: #643b1b; }
.job-actions .take:not(.secondary) { background: var(--ok); border-color: var(--ok); color: #fff; }
.job-actions .secondary.wide-btn.big { background: #fff; border: 2px solid var(--line-strong); color: var(--ink); }
.master-report summary { cursor: pointer; color: var(--muted); font-size: 14px; padding: 6px 0; }
.master-report .report-form { margin-top: 8px; }
/* Терминал цеха: крупно, без меню, удобно пальцем */
body.kiosk .main { margin-left: 0; }
body.kiosk .content { padding: 24px 28px 40px; }
.kiosk-header { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 20px; padding: 12px 28px;
  background: #1e1e2d; color: #fff; }
.kiosk-brand { font-weight: 800; font-size: 22px; color: #fff; letter-spacing: .5px; }
.kiosk-brand span { color: var(--accent); }
.kiosk-brand:hover { text-decoration: none; }
.kiosk-who { display: grid; font-size: 20px; margin-right: auto; }
.kiosk-who span { font-size: 14px; color: #b9bdc8; }
.kiosk-nav { display: flex; gap: 8px; }
.kiosk-nav a { color: #fff; padding: 12px 18px; border-radius: 10px; background: rgba(255,255,255,.08); font-size: 17px; font-weight: 600; }
.kiosk-nav a:hover { background: rgba(255,255,255,.16); text-decoration: none; }
.kiosk-timer { color: #ffcf9e; font-weight: 700; min-width: 120px; text-align: right; }
.kiosk-exit { background: var(--bad); border-color: var(--bad); color: #fff; font-size: 19px; font-weight: 700; min-height: 54px; padding: 0 28px; border-radius: 12px; }
.kiosk-header .lang-switch button { background: transparent; color: #b9bdc8; }
.kiosk-header .lang-switch button.active { background: #fff; color: #1e1e2d; }
/* Экран терминала: участки по группам. Зелёная плитка — есть свободные задания: по краю бежит огонёк. */
@property --kt-spin { syntax: "<angle>"; inherits: false; initial-value: 0deg; }
.kg-head { display: flex; align-items: baseline; gap: 14px; height: 40px; margin: 0 0 12px; border-bottom: 2px solid var(--line-strong);
  white-space: nowrap; }
.kg-head h2 { font-size: 22px; margin: 0; }
.kg-free { color: var(--ok); font-size: 17px; font-weight: 600; }
.kg-free b { font-size: 20px; }
.kiosk-groups { --tile: clamp(250px, calc((100vw - 300px) / 8), 340px); display: flex; flex-wrap: wrap; gap: 26px 32px; align-items: flex-start; }
.kiosk-group { flex: 0 0 auto; width: calc(var(--cols, 1) * var(--tile) + (var(--cols, 1) - 1) * 18px); max-width: 100%; }
.kiosk-group .kiosk-grid { grid-template-columns: repeat(auto-fill, var(--tile)); }
@media (max-width: 700px) { .kiosk-group .kiosk-grid { grid-template-columns: 1fr; } .kiosk-group { flex: 1 1 100%; } }
.kiosk-quiet { margin-top: 34px; }
.kiosk-quiet h2 { font-size: 17px; color: var(--muted); margin-bottom: 10px; }
.kiosk-quiet div { display: flex; flex-wrap: wrap; gap: 8px; }
.kiosk-quiet a { padding: 10px 16px; border-radius: 10px; border: 2px solid var(--line-strong); color: var(--muted);
  font-size: 16px; font-weight: 600; background: #fff; }
.kiosk-quiet a:hover { text-decoration: none; color: var(--ink); }
.kiosk-grid { display: grid; gap: 18px; }
/* Плитка: фиксированные размеры и одинаковые строки — плитки в ряд выглядят одинаково при любом наполнении. */
.kiosk-tile { display: grid; grid-template-rows: auto auto auto 1fr; height: 268px; padding: 20px 22px 18px; border-radius: 20px;
  background: #fff; border: 4px solid var(--line); color: var(--ink); transition: transform .12s; overflow: hidden; }
.kiosk-tile:hover { text-decoration: none; }
.kiosk-tile:active { transform: scale(.98); }
.kt-name { font-size: 24px; font-weight: 800; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kt-big { font-size: 60px; font-weight: 800; line-height: 1.05; margin-top: 6px; }
.kt-text { font-size: 18px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kt-lines { align-self: end; display: grid; gap: 3px; padding-top: 10px; border-top: 1px solid rgba(0, 0, 0, .08); }
.kt-line { font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); }
.kt-line b { color: var(--ink); }
.kt-muted { color: var(--muted); opacity: .8; }
.kt-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 7px; background: var(--ok); vertical-align: 0; }
.kt-dot.d-soon { background: #e39a2d; }
.kt-dot.d-late { background: var(--bad); }
.kt-line.kt-wrap { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.kt-late { color: var(--bad); font-style: normal; font-weight: 700; }
.kiosk-tile.k-ready { border-color: transparent; color: #11402a;
  background: linear-gradient(var(--ok-bg), var(--ok-bg)) padding-box,
    conic-gradient(from var(--kt-spin), var(--ok) 0deg 250deg, #6fdc9e 300deg, #ffffff 320deg, #6fdc9e 340deg, var(--ok) 360deg) border-box;
  animation: kt-spin 3s linear infinite, kt-glow 2.4s ease-in-out infinite; }
.kiosk-tile.k-ready .kt-big, .kiosk-tile.k-ready .kt-text { color: var(--ok); }
.kiosk-tile.k-busy { border-color: #6f93c9; background: #edf3fb; }
.kiosk-tile.k-busy .kt-big, .kiosk-tile.k-busy .kt-text { color: #3b5f94; }
.kiosk-tile.k-waiting { border-color: #e7b25f; background: var(--warn-bg); }
.kiosk-tile.k-waiting .kt-big, .kiosk-tile.k-waiting .kt-text { color: var(--warn); }
.kiosk-tile.k-empty { color: var(--muted); border-width: 2px; border-style: dashed; border-color: var(--line-strong); background: transparent; }
@keyframes kt-spin { to { --kt-spin: 360deg; } }
@keyframes kt-glow { 0%, 100% { box-shadow: 0 0 0 0 rgba(31, 122, 77, .0); } 50% { box-shadow: 0 0 0 7px rgba(31, 122, 77, .16), 0 10px 26px rgba(31, 122, 77, .22); } }
@media (prefers-reduced-motion: reduce) { .kiosk-tile.k-ready { animation: none; border-color: var(--ok); background: var(--ok-bg); } }
.kiosk-head { margin-bottom: 22px; }
.kiosk-head h1 { font-size: 30px; margin: 4px 0 8px; }
.kiosk-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin: 0; font-size: 16px; color: var(--muted); }
.kiosk-legend .lg { display: inline-block; width: 18px; height: 18px; border-radius: 6px; border: 3px solid; margin-left: 8px; }
.kiosk-legend .lg:first-child { margin-left: 0; }
.lg-ready { border-color: var(--ok) !important; background: var(--ok-bg); }
.lg-busy { border-color: #6f93c9 !important; background: #edf3fb; }
.lg-waiting { border-color: #e7b25f !important; background: var(--warn-bg); }
.lg-empty { border: 2px dashed var(--line-strong) !important; }
/* Экран «Нажмите своё имя»: назад — большой кнопкой, шапка участка в цвет его плитки. */
.kiosk-back { display: inline-flex; align-items: center; gap: 10px; min-height: 52px; padding: 0 22px 0 16px; margin-bottom: 18px;
  border-radius: 14px; background: #fff; border: 2px solid var(--line-strong); color: var(--ink); font-size: 19px; font-weight: 700; }
.kiosk-back span { font-size: 24px; line-height: 1; }
.kiosk-back:hover { text-decoration: none; border-color: var(--ink); }
.kiosk-hero { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 18px 30px; padding: 22px 26px;
  margin-bottom: 24px; border-radius: 20px; border: 4px solid var(--line-strong); background: #fff; }
.kiosk-hero.k-ready { border-color: var(--ok); background: var(--ok-bg); }
.kiosk-hero.k-busy { border-color: #6f93c9; background: #edf3fb; }
.kiosk-hero.k-waiting { border-color: #e7b25f; background: var(--warn-bg); }
.kiosk-hero.k-empty { border-style: dashed; background: transparent; }
.kh-title h1 { font-size: 34px; margin: 0 0 4px; }
.kh-title p { margin: 0; font-size: 18px; color: var(--muted); }
.kh-stats { display: flex; flex-wrap: wrap; gap: 12px; }
.kh-stat { display: grid; min-width: 130px; max-width: 320px; padding: 10px 16px; border-radius: 14px; background: rgba(255, 255, 255, .8); }
.kh-stat b { font-size: 34px; line-height: 1.1; color: var(--ink); }
.kh-stat span { font-size: 15px; font-weight: 600; color: var(--text); }
.kh-stat.s-ready b, .kh-stat.s-ready span { color: var(--ok); }
.kh-stat.s-busy b { color: #3b5f94; }
.kh-stat.s-waiting b { color: var(--warn); }
.kh-stat b.d-soon { color: var(--warn); }
.kh-stat b.d-late { color: var(--bad); }
.kiosk-people { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 18px; }
.kiosk-person { display: grid; justify-items: center; align-content: center; gap: 8px; padding: 24px 14px; min-height: 220px;
  border-radius: 20px; background: #fff; border: 3px solid var(--line); color: var(--ink); cursor: pointer; font: inherit;
  transition: transform .12s, border-color .12s; }
.kiosk-person:hover { border-color: var(--accent); }
.kiosk-person:active { transform: scale(.97); }
.kiosk-person.is-busy { border-color: #6f93c9; background: #f4f8fd; }
.kp-avatar { display: grid; place-items: center; width: 96px; height: 96px; border-radius: 50%; background: var(--accent-soft);
  color: var(--accent-dark); font-size: 34px; font-weight: 800; }
.kiosk-person.is-busy .kp-avatar { background: #dfe9f7; color: #3b5f94; }
.kp-name { font-size: 21px; font-weight: 750; text-align: center; line-height: 1.25; }
.kp-pos { color: var(--muted); font-size: 15px; }
.kp-badge { font-size: 14px; font-weight: 700; color: #fff; background: #3b5f94; border-radius: 999px; padding: 3px 12px; }
.kiosk-pin { border: 0; border-radius: 22px; padding: 28px 32px; width: min(420px, 92vw); text-align: center; }
.kiosk-pin::backdrop { background: rgba(20, 20, 30, .6); }
.kiosk-pin h2 { margin: 0; font-size: 26px; }
.kiosk-pin p { margin: 4px 0 14px; color: var(--muted); font-size: 17px; }
.pin-dots { display: flex; gap: 16px; justify-content: center; margin-bottom: 20px; }
.pin-dots i { width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--line-strong); }
.pin-dots i.on { background: var(--ink); border-color: var(--ink); }
.pin-pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.pin-pad button { min-height: 76px; font-size: 30px; font-weight: 700; border-radius: 16px; background: #f1f3f6; border: 0; color: var(--ink); justify-content: center; }
.pin-pad button:active { background: #dfe3e9; }
.pin-pad .pp-muted { font-size: 18px; color: var(--muted); }
body.kiosk .job-title { font-size: 24px; }
body.kiosk .messages li { font-size: 18px; padding: 14px 18px; }

/* ---------- карточка задания цеха (v2): состояние, заказ и срок, из чего делать, детали, путь ---------- */
.job { grid-template-columns: minmax(0, 1fr) 300px; padding: 0 26px 22px; overflow: hidden; }
.job-status { grid-column: 1 / -1; margin: 0 -26px; padding: 11px 26px; font-size: 17px; font-weight: 700;
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; }
.job-status.s-ready { background: var(--ok-bg); color: var(--ok); }
.job-status.s-wait { background: var(--idle-bg); color: var(--muted); }
.job-status.s-mine { background: var(--accent); color: #fff; }
.job-status.s-busy { background: var(--warn-bg); color: var(--warn); }
.job-with { font-weight: 500; font-size: 15px; opacity: .9; }
.job.is-mine { background: #fff; }
.job-tags { display: flex; flex-wrap: wrap; gap: 8px; margin: 2px 0 10px; }
.job-tags > span { border-radius: 8px; padding: 5px 11px; font-size: 15px; background: var(--idle-bg); color: var(--text); }
.job-tags b { color: var(--ink); font-size: 17px; }
.job-order-no { background: var(--ink) !important; color: #fff !important; }
.job-order-no b { color: #fff; }
.job-deadline.d-ok { background: var(--ok-bg); }
.job-deadline.d-soon { background: var(--warn-bg); color: var(--warn); }
.job-deadline.d-late { background: var(--bad-bg); color: var(--bad); font-weight: 600; }
.job-deadline.d-late b { color: var(--bad); }
.job-urgent { background: var(--bad) !important; color: #fff !important; font-weight: 700; }
.job-of { font-weight: 500; font-size: 16px; color: var(--muted); margin-left: 6px; }
.job-facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; margin: 12px 0 14px; }
.job-facts > div { border: 1px solid var(--line-strong); border-radius: 10px; padding: 7px 12px; }
.job-facts > div.is-key { border-color: var(--accent); background: var(--accent-soft); }
.job-facts dt { font-size: 12.5px; color: var(--muted); }
.job-facts dd { margin: 0; font-size: 17px; font-weight: 650; color: var(--ink); line-height: 1.3; }
.job-note { background: var(--warn-bg); border-left: 4px solid var(--warn); border-radius: 6px; padding: 7px 12px;
  margin: 0 0 12px; color: var(--ink); font-weight: 600; }
.job-note.small { font-size: 13px; padding: 3px 8px; margin: 4px 0 0; }
.job-details { margin: 0 0 14px; }
.job-details summary { cursor: pointer; font-weight: 650; color: var(--ink); font-size: 15px; padding: 4px 0; }
.job-details table { margin-top: 6px; font-size: 15px; }
.job-details td.size { font-weight: 700; color: var(--ink); white-space: nowrap; font-size: 16px; }
.job-route { list-style: none; display: flex; flex-wrap: wrap; gap: 4px; padding: 0; margin: 0 0 14px; font-size: 13px; }
.job-route li { padding: 3px 10px 3px 8px; border-radius: 6px; background: var(--idle-bg); color: var(--muted); }
.job-route li:not(:last-child)::after { content: "›"; margin-left: 8px; color: var(--line-strong); }
.job-route li.done { color: var(--ok); }
.job-route li.done::before { content: "✓ "; }
.job-route li.started { color: var(--warn); }
.job-route li.here { background: var(--ink); color: #fff; font-weight: 700; }
.job-actions { align-self: start; margin-top: 14px; }
.job-hint { margin: 0; font-size: 13px; color: var(--muted); text-align: center; }
body.kiosk .job-facts dd { font-size: 18px; }
@media (max-width: 900px) { .job { padding: 0 18px 18px; } .job-status { margin: 0 -18px; padding: 10px 18px; } }
.kiosk-tile.k-empty .kt-big { opacity: .35; }

/* ---------- график производства ---------- */
.plan-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0; }
.plan-down { border-left: 4px solid var(--bad); margin-bottom: 18px; }
.plan-problems { margin-bottom: 16px; }
.plan-problems summary { cursor: pointer; }
.plan-problems ul { margin: 10px 0 0; padding-left: 20px; color: var(--text); font-size: 14px; }
.plan-table tr.is-late td { background: #fdf3f2; }
.plan-table tr.is-pool td { background: #f6f7f9; }
.plan-table tr.is-critical td { background: #fff8ec; }
.plan-cause { font-size: 13px; color: var(--bad); margin-top: 4px; max-width: 360px; }
.tile b.plan-bottleneck { font-size: 22px; }
.plan-days { font-size: 13px; }
.plan-days th.is-today { color: var(--accent-dark); }
.plan-days .plan-station { text-align: left; white-space: nowrap; font-weight: 650; }
.pd { min-width: 110px; vertical-align: top; }
.pd b { display: block; font-size: 15px; }
.pd-some { background: #f3faf6; }
.pd-full { background: #fff4e0; }
.pd-over { background: #fde8e6; }
.pd-over b { color: var(--bad); }
.pd-job { display: inline-block; margin: 2px 4px 0 0; padding: 1px 6px; border-radius: 5px; background: rgba(255,255,255,.8);
  font-size: 12px; color: var(--ink); }
.pd-job.late { color: var(--bad); font-weight: 650; }
.plan-bar { display: inline-block; width: 160px; height: 10px; border-radius: 5px; background: var(--idle-bg); vertical-align: middle;
  overflow: hidden; margin-right: 8px; }
.plan-bar span { display: block; height: 100%; background: var(--accent); }
.is-late .plan-bar span { background: var(--bad); }
.plan-order-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px 30px; align-items: center; margin-bottom: 16px; }
.plan-order-head h2 { margin: 0 0 4px; }
.plan-dates { display: flex; flex-wrap: wrap; gap: 10px; }
.plan-dates > div { display: grid; padding: 8px 14px; border-radius: 10px; background: var(--idle-bg); min-width: 120px; }
.plan-dates span { font-size: 12px; color: var(--muted); }
.plan-dates b { font-size: 19px; color: var(--ink); }
.plan-why { border-left: 4px solid var(--warn); margin-bottom: 16px; }
.plan-summary { white-space: normal; color: var(--text); }
.plan-shifts { margin: 0; padding-left: 20px; }
.plan-settings input.num-input { width: 90px; }
.plan-settings input.short-input { width: 70px; }
.plan-settings-form { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 6px 24px; }
.ps-intro { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 16px; margin-bottom: 16px; }
@media (max-width: 900px) { .ps-intro { grid-template-columns: 1fr; } }
.ps-intro .panel { margin: 0; }
.ps-intro h3 { margin-top: 0; }
.ps-upload { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.ps-help p { font-size: 14px; margin: 0 0 8px; }
.ps-line { margin-bottom: 16px; }
.plan-settings td { vertical-align: top; }
.plan-settings input[type=number] { width: 96px; }
.ps-cell { white-space: nowrap; }
.plan-settings input.ps-pool { width: 80px; }
.ps-cap b { font-size: 17px; color: var(--ink); }
.ps-legacy { font-size: 12px; color: var(--muted); margin-top: 3px; }
.ps-off td { opacity: .55; }
.ps-save { display: flex; align-items: center; gap: 14px; margin: 8px 0 30px; }
/* «Срочно» и «Стоит» */
.pf { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.pf form { margin: 0; display: inline; }
.pf-inline { display: inline-flex !important; gap: 6px; }
.pf-badge { display: inline-flex; align-items: center; border-radius: 7px; padding: 3px 9px; font-size: 12.5px; font-weight: 700; white-space: nowrap; }
.pf-urgent { background: var(--bad); color: #fff; }
.pf-wait { background: var(--warn-bg); color: var(--warn); }
.pf-hold { background: #e4e7ec; color: var(--text); }
.pf-go-badge { background: var(--ok-bg); color: var(--ok); }
.pf-btn { display: inline-flex; align-items: center; padding: 4px 11px; border-radius: 8px; border: 1px solid var(--line-strong);
  background: #fff; color: var(--ink); font-size: 13px; font-weight: 600; cursor: pointer; list-style: none; min-height: 0; }
.pf-btn::-webkit-details-marker { display: none; }
.pf-btn:hover { border-color: var(--ink); }
.pf-go { background: var(--ok); border-color: var(--ok); color: #fff; }
.pf-link { border: 0; background: none; padding: 0; color: var(--muted); font-size: 12.5px; text-decoration: underline; cursor: pointer; min-height: 0; }
.pf-drop { position: relative; }
.pf-form { position: absolute; z-index: 20; right: 0; top: calc(100% + 6px); width: 300px; display: grid; gap: 8px; padding: 14px;
  background: #fff; border: 1px solid var(--line-strong); border-radius: 12px; box-shadow: 0 12px 30px rgba(20, 20, 40, .16); }
.pf-form label { font-size: 13px; font-weight: 600; }
.pf-form p { margin: 0; }
.pu-rank { font-size: 20px; color: var(--bad); }
.pu-actions { white-space: nowrap; }
.plan-block { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 20px; margin: 14px 0;
  padding: 12px 16px; border-radius: 12px; background: var(--idle-bg); border-left: 4px solid var(--line-strong); }
.plan-block.is-urgent { background: #fdf0ef; border-left-color: var(--bad); }
.plan-block.is-hold { background: #eef0f3; border-left-color: var(--muted); }
.pb-title { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; font-size: 14px; }
.pb-cause { color: var(--bad); font-size: 13px; }
.pb-why { flex-basis: 100%; font-size: 13px; color: var(--text); }
.plan-table .pf-form { position: static; width: 260px; box-shadow: none; margin-top: 6px; }
.plan-table td:first-child a { white-space: nowrap; }
