@import url('https://fonts.googleapis.com/css2?family=Unbounded:wght@500;700;800&family=Onest:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;700&display=swap');
/* ============================================================
   CREATICA — оформление «Шов». Общий стиль всей системы.
   Один файл на все отделы: разметка классов та же, что была,
   меняется только внешний вид. Логика страниц не затронута.
   Откат: вернуть в index.html ссылку на style.css.
   ============================================================ */

:root {
  color-scheme: light;

  /* материалы цеха + фирменный тон с логотипа */
  --grafit:      #1A1D24;
  --holst:       #ECEBE6;
  --paper:       #FBFAF8;
  --brand:       #D0A184;   /* тон подложки логотипа */
  --brand-soft:  #F5E7DD;
  --indigo:      #3B47D3;
  --indigo-2:    #6E77E8;
  --indigo-soft: #E5E6FA;
  --latun:       #B5822C;
  --latun-soft:  #F6EBD5;
  --nit:         #C43C2E;
  --nit-soft:    #F9E3E0;
  --zelen:       #2C8A57;
  --zelen-soft:  #DDF0E5;

  --ink:      #1A1D24;
  --ink-2:    #4C5361;
  --ink-3:    #838B99;
  --hairline: rgba(26, 29, 36, .12);
  --hairline-soft: rgba(26, 29, 36, .07);
  --field:    #FFFFFF;

  --on-bench:   #F2F1EC;
  --on-bench-2: #9AA1B0;

  --lift: 0 1px 2px rgba(26,29,36,.05), 0 12px 28px -18px rgba(26,29,36,.45);

  --display: 'Unbounded', 'Onest', system-ui, sans-serif;
  --body: 'Onest', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, Consolas, monospace;

  /* совместимость со старыми именами переменных в разметке и dash-common.js */
  --text: #1A1D24;  --text-2: #4C5361;  --muted: #838B99;
  --surface: #FBFAF8; --surface-2: #F3F2EE;
  --border: rgba(26,29,36,.12); --grid: rgba(26,29,36,.12);
  --accent: #3B47D3; --accent-soft: #E5E6FA;
  --good: #2C8A57; --good-soft: #DDF0E5;
  --warn: #B5822C; --warn-soft: #F6EBD5;
  --crit: #C43C2E; --crit-soft: #F9E3E0;
  --info: #3B47D3; --info-soft: #E5E6FA;
  --teal: #2C8A57; --teal-soft: #DDF0E5;
  --violet: #7A5AF0; --violet-soft: #EDE9FE;
  --shadow: 0 1px 2px rgba(26,29,36,.05), 0 12px 28px -18px rgba(26,29,36,.45);
  --radius: 14px;
}

@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --grafit: #0E1015; --holst: #14171D; --paper: #1C2029;
    --brand: #D0A184; --brand-soft: rgba(208,161,132,.16);
    --indigo: #7C86FF; --indigo-2: #A2A9FF; --indigo-soft: rgba(124,134,255,.16);
    --latun: #E0A93F; --latun-soft: rgba(224,169,63,.15);
    --nit: #F0705F;   --nit-soft: rgba(240,112,95,.15);
    --zelen: #4FBE84; --zelen-soft: rgba(79,190,132,.15);
    --ink: #EDECE7; --ink-2: #AEB5C2; --ink-3: #79808E;
    --hairline: rgba(255,255,255,.12); --hairline-soft: rgba(255,255,255,.07);
    --field: #141821;
    --lift: 0 1px 2px rgba(0,0,0,.4), 0 14px 32px -20px rgba(0,0,0,.9);

    --text: #EDECE7; --text-2: #AEB5C2; --muted: #79808E;
    --surface: #1C2029; --surface-2: #232833;
    --border: rgba(255,255,255,.12); --grid: rgba(255,255,255,.12);
    --accent: #7C86FF; --accent-soft: rgba(124,134,255,.16);
    --good: #4FBE84; --good-soft: rgba(79,190,132,.15);
    --warn: #E0A93F; --warn-soft: rgba(224,169,63,.15);
    --crit: #F0705F; --crit-soft: rgba(240,112,95,.15);
    --info: #7C86FF; --info-soft: rgba(124,134,255,.16);
    --teal: #4FBE84; --teal-soft: rgba(79,190,132,.15);
    --violet: #A78BFA; --violet-soft: rgba(167,139,250,.16);
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 14px 32px -20px rgba(0,0,0,.9);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --grafit: #0E1015; --holst: #14171D; --paper: #1C2029;
  --brand: #D0A184; --brand-soft: rgba(208,161,132,.16);
  --indigo: #7C86FF; --indigo-2: #A2A9FF; --indigo-soft: rgba(124,134,255,.16);
  --latun: #E0A93F; --latun-soft: rgba(224,169,63,.15);
  --nit: #F0705F;   --nit-soft: rgba(240,112,95,.15);
  --zelen: #4FBE84; --zelen-soft: rgba(79,190,132,.15);
  --ink: #EDECE7; --ink-2: #AEB5C2; --ink-3: #79808E;
  --hairline: rgba(255,255,255,.12); --hairline-soft: rgba(255,255,255,.07);
  --field: #141821;
  --lift: 0 1px 2px rgba(0,0,0,.4), 0 14px 32px -20px rgba(0,0,0,.9);
  --text: #EDECE7; --text-2: #AEB5C2; --muted: #79808E;
  --surface: #1C2029; --surface-2: #232833;
  --border: rgba(255,255,255,.12); --grid: rgba(255,255,255,.12);
  --accent: #7C86FF; --accent-soft: rgba(124,134,255,.16);
  --good: #4FBE84; --good-soft: rgba(79,190,132,.15);
  --warn: #E0A93F; --warn-soft: rgba(224,169,63,.15);
  --crit: #F0705F; --crit-soft: rgba(240,112,95,.15);
  --info: #7C86FF; --info-soft: rgba(124,134,255,.16);
  --teal: #4FBE84; --teal-soft: rgba(79,190,132,.15);
  --violet: #A78BFA; --violet-soft: rgba(167,139,250,.16);
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 14px 32px -20px rgba(0,0,0,.9);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--body);
  font-size: 15px; line-height: 1.45;
  color: var(--ink);
  background: var(--holst);
  min-height: 100vh;
  padding: 0 0 40px;
  -webkit-font-smoothing: antialiased;
}
.container { max-width: 1680px; margin: 0 auto; padding: 0 22px; }
a { color: var(--indigo); text-decoration: none; }
a:hover { text-decoration: underline; }
::selection { background: var(--indigo-soft); color: var(--indigo); }
:focus-visible { outline: 2px solid var(--indigo); outline-offset: 2px; border-radius: 3px; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--hairline); border-radius: 6px; }

h1 { font-family: var(--display); font-size: 19px; font-weight: 700; letter-spacing: -.01em; }
h2 { font-family: var(--display); font-size: 15px; font-weight: 700; }
h3 { font-size: 15px; font-weight: 600; }
h4 { font-size: 13.5px; font-weight: 600; color: var(--ink-2); }

/* ============================================================
   ВЕРСТАК — тёмная шапка отдела
   ============================================================ */
header, .header, .header-bar {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  background: var(--grafit); color: var(--on-bench);
  margin: 0 -22px 22px; padding: 15px 28px;
  position: relative;
}
header::before, .header::before, .header-bar::before {
  content: ''; position: absolute; inset: 0;
  background-image: repeating-linear-gradient(135deg, rgba(255,255,255,.035) 0 1px, transparent 1px 7px);
  pointer-events: none;
}
header > *, .header > *, .header-bar > * { position: relative; }
header h1, .header h1, .header-bar h1 {
  color: var(--on-bench); font-size: 17px; font-weight: 700;
  display: flex; align-items: center; gap: 10px;
}
.header-left { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.header-actions, .header-right { margin-left: auto; display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }

/* логотип компании в шапке — на белой плашке, чтобы чёрные буквы читались */
.brand-logo {
  height: 24px; width: auto; display: block; flex-shrink: 0;
  background: #fff; padding: 6px 10px; border-radius: 8px;
  box-sizing: content-box;
}
.brand-sep { width: 1px; height: 26px; background: rgba(255,255,255,.16); }
.theme-btn { font-size: 15px; line-height: 1; padding: 8px 11px; }

.user-name {
  font-size: 13px; color: var(--on-bench-2);
  display: inline-flex; align-items: center; gap: 8px;
}
.user-name::before {
  content: ''; width: 7px; height: 7px; border-radius: 50%;
  background: var(--zelen); flex-shrink: 0;
}

.btn-logout, .btn-dashboard, .btn-back, .btn-refresh {
  font-family: var(--body); font-size: 13.5px; font-weight: 500;
  color: var(--on-bench); background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.12); border-radius: 9px;
  padding: 8px 13px; cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; gap: 7px; white-space: nowrap;
  transition: background .16s, border-color .16s;
}
.btn-logout:hover, .btn-dashboard:hover, .btn-back:hover, .btn-refresh:hover {
  background: rgba(255,255,255,.14); border-color: rgba(255,255,255,.24); text-decoration: none;
}
/* Кнопки шапки живут на тёмной полосе и не должны с ней спорить:
   один спокойный вид на всех, ярче только при наведении. */
.btn-dashboard { border-color: rgba(255,255,255,.28); }
.btn-refresh:disabled { opacity: .5; cursor: default; }
/* если кнопка попала на светлую часть страницы — не теряем её */
.card .btn-back, .card .btn-refresh, .panel-body .btn-back {
  color: var(--ink-2); background: transparent; border-color: var(--hairline);
}

/* ============================================================
   ЭКРАН ВХОДА
   ============================================================ */
.auth-screen, #authScreen { padding: 60px 0; }
#authScreen .card, .auth-card {
  width: 100%; max-width: 400px; margin: 0 auto;
  background: var(--paper); border: 1px solid var(--hairline);
  border-radius: 16px; padding: 32px 30px; box-shadow: var(--lift);
  text-align: center;
}
#authScreen h1, .auth-card h2 {
  font-family: var(--display); font-size: 20px; font-weight: 700; margin-bottom: 4px;
}
.logo { margin-bottom: 18px; }
.logo img { max-width: 210px; height: auto; }
.logo-icon {
  width: 54px; height: 54px; margin: 0 auto; border-radius: 14px;
  display: grid; place-items: center; font-size: 26px;
  background: var(--brand-soft);
}
.subtitle {
  font-family: var(--mono); font-size: 11px; letter-spacing: .14em;
  text-transform: uppercase; color: var(--ink-3); margin-bottom: 22px;
}
#authScreen .form-group, .auth-card .form-group { text-align: left; }

/* ============================================================
   ВКЛАДКИ — бирки со срезанным углом
   ============================================================ */
.tabs {
  display: flex; gap: 4px; align-items: flex-end; flex-wrap: wrap;
  margin: 0 -22px 20px; padding: 0 22px;
  background: var(--grafit);
}
/* вкладки прирастают к шапке только если идут сразу за ней */
header + .tabs, .header + .tabs, .header-bar + .tabs { margin-top: -22px; }
.tab-btn {
  --cut: 14px;
  font-family: var(--body); font-size: 14px; font-weight: 500; white-space: nowrap;
  color: var(--on-bench-2); background: rgba(255,255,255,.06);
  border: none; cursor: pointer; padding: 11px 18px 12px;
  clip-path: polygon(0 0, calc(100% - var(--cut)) 0, 100% var(--cut), 100% 100%, 0 100%);
  display: inline-flex; align-items: center; gap: 8px;
  transition: background .16s, color .16s;
}
.tab-btn:hover { background: rgba(255,255,255,.12); color: var(--on-bench); }
.tab-btn.active {
  background: var(--holst); color: var(--ink); font-weight: 600; padding-bottom: 14px;
}
/* число позиций за вкладкой */
.tab-cnt {
  font-family: var(--mono); font-size: 11px; font-weight: 700;
  background: rgba(255,255,255,.14); color: var(--on-bench);
  border-radius: 999px; padding: 2px 7px; line-height: 1.4;
}
.tab-btn.active .tab-cnt { background: var(--indigo-soft); color: var(--indigo); }

/* ============================================================
   ФИЛЬТРЫ
   ============================================================ */
.filters, .filter-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: var(--paper); border: 1px solid var(--hairline);
  border-radius: 14px; padding: 13px 18px; margin-bottom: 16px;
  box-shadow: var(--lift);
}
.filters input, .filters select, .filter-bar input, .filter-bar select { width: auto; }
.filter-search { flex: 1; min-width: 200px; max-width: 380px; }
.filter-select { min-width: 190px; }

/* ============================================================
   ПОЛЯ И КНОПКИ
   ============================================================ */
input[type="text"], input[type="email"], input[type="password"], input[type="date"],
input[type="number"], input[type="file"], select, textarea {
  width: 100%; font-family: var(--body); font-size: 14px; color: var(--ink);
  background: var(--field); border: 1px solid var(--hairline);
  border-radius: 9px; padding: 9px 12px;
  transition: border-color .14s, box-shadow .14s;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--indigo); box-shadow: 0 0 0 3px var(--indigo-soft);
}
input::placeholder, textarea::placeholder { color: var(--ink-3); }
select { cursor: pointer; }
textarea { resize: vertical; line-height: 1.5; }
input[type="date"] { font-family: var(--mono); font-size: 13px; }
input[type="number"] { font-family: var(--mono); }
input[type="file"] { padding: 7px 10px; font-size: 13px; color: var(--ink-2); cursor: pointer; }
input[type="file"]:hover { border-color: var(--indigo); }
label { display: block; font-size: 13px; font-weight: 500; color: var(--ink-2); margin-bottom: 6px; }
.req { color: var(--nit); }
.opt { color: var(--ink-3); font-weight: 400; }
.form-group { margin-bottom: 15px; position: relative; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.form-row .form-group { margin-bottom: 15px; }
.field-hint, .hint { font-size: 12px; color: var(--ink-3); margin-top: 6px; }
.field-hint.ok { color: var(--zelen); }

.btn {
  font-family: var(--body); font-size: 14px; font-weight: 600;
  border: 1px solid transparent; border-radius: 9px;
  padding: 10px 18px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: background .15s, transform .12s, border-color .15s, filter .15s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--indigo); color: #fff; }
.btn-primary:hover { background: var(--indigo-2); }
.btn-secondary { background: transparent; color: var(--ink-2); border-color: var(--hairline); }
.btn-secondary:hover { background: var(--holst); color: var(--ink); }
.btn-success { background: var(--zelen); color: #fff; }
.btn-success:hover { filter: brightness(1.07); }
.btn-danger { background: var(--nit-soft); color: var(--nit); }
.btn-danger:hover { filter: brightness(.97); }
/* приглушённое основное действие — «Добавить позицию» */
.btn-line { background: var(--indigo-soft); color: var(--indigo); }
.btn-line:hover { filter: brightness(.97); }
.btn-sm { font-size: 13px; padding: 7px 13px; }
.btn-reset {
  font-family: var(--body); font-size: 13px; font-weight: 500;
  background: transparent; color: var(--ink-2);
  border: 1px solid var(--hairline); border-radius: 9px;
  padding: 8px 14px; cursor: pointer;
}
.btn-reset:hover { background: var(--holst); color: var(--ink); }

.btn-edit, .btn-delete, .btn-birka, .btn-add-small, .btn-edit-item, .btn-remove-item {
  width: 30px; height: 30px; border-radius: 8px; padding: 0;
  border: 1px solid transparent; background: transparent;
  cursor: pointer; font-size: 14px; line-height: 1;
  display: inline-grid; place-items: center;
  transition: background .14s, border-color .14s;
}
.btn-edit:hover, .btn-delete:hover, .btn-birka:hover { background: var(--holst); border-color: var(--hairline); }
.btn-delete, .btn-remove-item { color: var(--nit); }
.btn-birka { background: var(--brand-soft); }
.btn-status { white-space: nowrap; }
.order-actions { margin-top: 14px; display: flex; gap: 8px; flex-wrap: wrap; }
.order-actions .btn { font-size: 13px; padding: 8px 14px; }

.message { font-size: 13.5px; margin-top: 12px; min-height: 18px; }
.message.error { color: var(--nit); }
.message.success { color: var(--zelen); }

/* ============================================================
   КАРТОЧКИ
   ============================================================ */
.card {
  background: var(--paper); border: 1px solid var(--hairline);
  border-radius: 14px; padding: 20px 22px; margin-bottom: 18px;
  box-shadow: var(--lift);
}
.card h2 { margin-bottom: 16px; }
.empty-text { text-align: center; color: var(--ink-3); font-size: 13.5px; padding: 30px 0; }

/* ============================================================
   ТАБЛИЦЫ ЦЕХОВ — вся строка на экране, без прокрутки вбок
   ============================================================ */
.table-wrapper, .rt-wrap, .a-table-wrap {
  background: var(--paper); border: 1px solid var(--hairline);
  border-radius: 14px; box-shadow: var(--lift);
  overflow: hidden; margin-bottom: 18px;
}
.orders-table, .rt-table, .a-table {
  width: 100%; border-collapse: separate; border-spacing: 0;
  table-layout: fixed;
}
.orders-table thead th, .rt-table thead th, .a-table thead th {
  text-align: left; font-family: var(--mono); font-weight: 500;
  font-size: 10px; letter-spacing: .06em; text-transform: uppercase;
  color: var(--ink-3); padding: 11px 9px;
  border-bottom: 1px solid var(--hairline);
  background: var(--paper); vertical-align: bottom;
  overflow: hidden; text-overflow: ellipsis;
}
/* Заголовок должен выравниваться так же, как значения под ним — иначе
   числа у правого края столбца оказываются под текстом у левого края
   заголовка и колонку не видно с одного взгляда. */
.orders-table thead th.a-right, .rt-table thead th.a-right, .a-table thead th.a-right { text-align: right; }
.orders-table thead th.a-center, .rt-table thead th.a-center, .a-table thead th.a-center { text-align: center; }
.th-sortable { cursor: pointer; user-select: none; }
.th-sortable:hover { color: var(--indigo); }
.th-sort-active { color: var(--latun); }

/* ============================================================
   ФИЛЬТР ПО СТОЛБЦУ (клик в заголовке, список значений — швейный цех)
   и закреплённая шапка таблицы. Классы генерирует sewing/script.js.
   ============================================================ */
.col-filter-btn {
  border: none; background: transparent; cursor: pointer;
  color: var(--ink-3); font-size: 10px; padding: 2px 3px; margin-left: 3px;
  border-radius: 4px; vertical-align: middle; line-height: 1;
}
.col-filter-btn:hover { background: var(--hairline-soft); color: var(--indigo); }
.col-filter-btn.th-filter-active { color: var(--indigo); background: var(--indigo-soft); }
.col-filter-pop {
  position: absolute; z-index: 60; width: 260px; max-width: calc(100vw - 16px);
  background: var(--paper); border: 1px solid var(--hairline); border-radius: 10px;
  box-shadow: var(--lift); padding: 10px; font-size: 12.5px;
}
.cf-search-input {
  width: 100%; font-family: var(--body); font-size: 12.5px; padding: 6px 8px;
  border-radius: 7px; border: 1px solid var(--hairline); background: var(--field); color: var(--ink);
  margin-bottom: 8px;
}
.cf-actions { display: flex; gap: 10px; margin-bottom: 6px; }
.cf-actions button {
  border: none; background: transparent; color: var(--indigo); font-size: 11.5px;
  cursor: pointer; padding: 0; text-decoration: underline;
}
.cf-list { max-height: 240px; overflow-y: auto; border-top: 1px solid var(--hairline-soft); border-bottom: 1px solid var(--hairline-soft); padding: 4px 0; margin-bottom: 8px; }
.cf-item {
  display: flex; align-items: center; gap: 7px; padding: 4px 2px; cursor: pointer; border-radius: 5px;
}
.cf-item:hover { background: var(--holst); }
.cf-item input { flex: none; cursor: pointer; }
.cf-item-text { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); }
.cf-count { color: var(--ink-3); font-family: var(--mono); font-size: 10.5px; }
.cf-empty { color: var(--ink-3); padding: 8px 2px; text-align: center; }
.cf-footer { display: flex; justify-content: flex-end; gap: 8px; }

/* Закреплённая шапка — швейный цех: сама таблица становится прокручиваемой
   областью, thead прилипает к её верху. .table-wrapper здесь и так clip-ит
   углы через overflow:hidden — без внутреннего скролла position:sticky на
   thead работал бы неверно (граница стика — сам .table-wrapper). */
body[data-dept="sewing"] .table-wrapper.sticky-head {
  overflow: auto; max-height: 74vh;
}
body[data-dept="sewing"] .table-wrapper.sticky-head .orders-table thead th {
  position: sticky; top: 0; z-index: 5;
}

/* Подсветка строки в швейке по наличию ткани (row-stock-*, ставит sewing/script.js
   через rowStockStatus). Осиротела при переходе на общий shov.css (дизайн «Шов») —
   правила лежали в sewing/style.css, который никто больше не подключает.
   no = ткань вообще не заводили на склад, shortage = завезли меньше, чем расписано,
   ok = метража хватает. */
body[data-dept="sewing"] .orders-table tbody tr.row-stock-no td { background: var(--nit-soft); }
body[data-dept="sewing"] .orders-table tbody tr.row-stock-shortage td { background: var(--warn-soft); }
body[data-dept="sewing"] .orders-table tbody tr.row-stock-ok td { background: var(--zelen-soft); }
body[data-dept="sewing"] .orders-table tbody tr.row-stock-no:hover td { background: var(--nit-soft); filter: brightness(.95); }
body[data-dept="sewing"] .orders-table tbody tr.row-stock-shortage:hover td { background: var(--warn-soft); filter: brightness(.95); }
body[data-dept="sewing"] .orders-table tbody tr.row-stock-ok:hover td { background: var(--zelen-soft); filter: brightness(.95); }

.orders-table tbody td, .rt-table tbody td, .a-table tbody td {
  padding: 10px 9px; font-size: 12.5px; line-height: 1.4;
  vertical-align: middle; color: var(--ink-2);
  border-bottom: 1px solid var(--hairline-soft);
  overflow-wrap: anywhere; word-break: break-word;
}
.orders-table tbody tr:last-child td, .rt-table tbody tr:last-child td { border-bottom: none; }
.orders-table tbody tr:nth-child(even) td { background: transparent; }
.orders-table tbody tr:hover td, .rt-table tbody tr:hover td { background: var(--holst); }

/* VIP-заказ — общая подсветка строки/карточки во всех отделах (см. shov.css,
   грузится каждым index.html). Ставится, когда orders.vip === true. */
.orders-table tbody tr.vip-row td, .rt-table tbody tr.vip-row td, .a-table tbody tr.vip-row td {
  background: var(--latun-soft);
  box-shadow: inset 3px 0 0 var(--latun);
}
.orders-table tbody tr.vip-row:hover td, .rt-table tbody tr.vip-row:hover td {
  background: var(--latun-soft); filter: brightness(.97);
}
.vip-badge {
  display: inline-flex; align-items: center; gap: 3px;
  font-family: var(--mono); font-size: 10px; font-weight: 700;
  letter-spacing: .03em; text-transform: uppercase;
  color: var(--latun); background: var(--latun-soft);
  border: 1px solid var(--latun); border-radius: 999px;
  padding: 2px 8px; margin-left: 6px; vertical-align: middle;
  white-space: nowrap;
}
.order-line.vip-row {
  background: var(--latun-soft);
  box-shadow: inset 3px 0 0 var(--latun);
  border-radius: 10px;
}
.order-card.vip-row {
  background: var(--latun-soft);
  box-shadow: var(--lift), inset 3px 0 0 var(--latun);
}

.orders-table .col-number, .rt-num {
  font-family: var(--mono); font-size: 12px; font-weight: 700; color: var(--ink);
}
.orders-table .col-name, .rt-name { font-weight: 600; font-size: 13px; color: var(--ink); }
.orders-table .col-client { color: var(--ink); }
.orders-table .col-comment, .rt-problem { color: var(--ink-3); font-size: 12px; }
.orders-table .col-seats, .orders-table .col-qty, .orders-table .num, .orders-table .col-meters {
  font-family: var(--mono); font-variant-numeric: tabular-nums;
}
.orders-table .num, .orders-table .col-ostatok { text-align: right; }
.orders-table .col-date { font-family: var(--mono); font-size: 12px; white-space: nowrap; }
.orders-table .col-created { font-family: var(--mono); font-size: 12px; color: var(--ink-3); }
.orders-table .col-file, .orders-table .col-birka, .orders-table .col-spec { text-align: center; }
.orders-table .col-number .cell-title { font-weight: 700; }
.cell-title { display: block; font-weight: 600; color: var(--ink); }
.cell-sub { display: block; font-size: 11px; color: var(--ink-3); margin-top: 2px; }
.worker-empty { color: var(--ink-3); }
.worker-name { color: var(--ink); font-weight: 500; }

/* элементы управления внутри таблицы */
.status-select, .ispolnitel-select, .txt-input, .rt-state,
.orders-table .col-meters input, .orders-table select, .orders-table input {
  width: 100%; font-family: var(--body); font-size: 12.5px;
  padding: 6px 8px; border-radius: 7px;
  border: 1px solid var(--hairline); background: var(--field); color: var(--ink);
}
.orders-table .col-meters input { font-family: var(--mono); text-align: right; }
.status-select { font-weight: 500; cursor: pointer; }
.status-locked {
  display: inline-flex; flex-direction: column; gap: 2px;
  font-size: 12px; color: var(--ink-2);
  background: var(--holst); border-radius: 7px; padding: 5px 9px;
}
.status-locked-note { font-size: 10px; color: var(--ink-3); }

/* редактируемый список сотрудников цеха (например «Обивщики») — вместо
   зашитого в код массива; коллекция dept_workers */
.workers-panel {
  background: var(--paper); border: 1px solid var(--hairline); border-radius: 12px;
  padding: 14px 16px; margin: -6px 0 16px; display: flex; flex-direction: column; gap: 12px;
}
.workers-list { display: flex; flex-wrap: wrap; gap: 8px; }
.worker-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--holst); color: var(--ink); border-radius: 999px;
  padding: 5px 6px 5px 12px; font-size: 12.5px; font-weight: 500;
}
.worker-chip-x {
  width: 18px; height: 18px; border-radius: 50%; border: none; cursor: pointer;
  background: var(--hairline); color: var(--ink-2); font-size: 13px; line-height: 1;
  display: inline-grid; place-items: center; padding: 0;
}
.worker-chip-x:hover { background: var(--nit-soft); color: var(--nit); }
.workers-add { display: flex; gap: 8px; align-items: center; }
.workers-add .txt-input { max-width: 260px; }

/* швейка: исходный текст ткани + свёрнутый выбор двух тканей для склада */
.fabric-raw { margin-bottom: 2px; }
.fb-toggle {
  display: block; width: 100%; text-align: left;
  border: none; background: transparent; padding: 3px 0 0; margin: 0;
  font-family: var(--body); font-size: 11px; font-weight: 500;
  color: var(--ink-3); cursor: pointer; white-space: normal; line-height: 1.3;
}
.fb-toggle:hover { color: var(--indigo); text-decoration: underline; }
.fb-toggle.fb-suggest { color: var(--latun); font-weight: 600; }
.fb-fields { margin-top: 5px; display: flex; flex-direction: column; gap: 5px; }

/* швейка: подсказка метража по тому же изделию (одна ткань, не разработка) */
.meter-suggest {
  display: block; width: 100%; text-align: left;
  border: none; background: transparent; padding: 3px 0 0; margin: 0;
  font-family: var(--body); font-size: 11px; font-weight: 600;
  color: var(--latun); cursor: pointer; white-space: normal; line-height: 1.3;
}
.meter-suggest:hover { color: var(--indigo); text-decoration: underline; }

/* ширины колонок по отделам — чтобы всё влезало в экран */
body[data-dept="wood"] .col-number   { width: 5.5%; }
body[data-dept="wood"] .col-name     { width: 11%; }
body[data-dept="wood"] .col-client   { width: 8%; }
body[data-dept="wood"] .col-fabric   { width: 8.5%; }
body[data-dept="wood"] .col-color    { width: 7%; }
body[data-dept="wood"] .col-otdelka  { width: 6%; }
body[data-dept="wood"] .col-kompl    { width: 7%; }
body[data-dept="wood"] .col-podushki { width: 6%; }
body[data-dept="wood"] .col-seats    { width: 3.5%; }
body[data-dept="wood"] .col-comment  { width: 9%; }
body[data-dept="wood"] .col-date     { width: 6%; }
body[data-dept="wood"] .col-file     { width: 3.5%; }
body[data-dept="wood"] .col-status   { width: 10.5%; }
body[data-dept="wood"] .col-worker   { width: 7.5%; }
body[data-dept="wood"] .col-parallel { width: 7.5%; }

body[data-dept="upholstery"] .col-number   { width: 5%; }
body[data-dept="upholstery"] .col-name     { width: 10.5%; }
body[data-dept="upholstery"] .col-fabric   { width: 8.5%; }
body[data-dept="upholstery"] .col-color    { width: 7%; }
body[data-dept="upholstery"] .col-otdelka  { width: 5.5%; }
body[data-dept="upholstery"] .col-kompl    { width: 7%; }
body[data-dept="upholstery"] .col-podushki { width: 5.5%; }
body[data-dept="upholstery"] .col-seats    { width: 3.5%; }
body[data-dept="upholstery"] .col-comment  { width: 8.5%; }
body[data-dept="upholstery"] .col-date     { width: 5.5%; }
body[data-dept="upholstery"] .col-status   { width: 10.5%; }
body[data-dept="upholstery"] .col-worker   { width: 8%; }
body[data-dept="upholstery"] .col-opory    { width: 7.5%; }
body[data-dept="upholstery"] .col-wood     { width: 3.5%; }
body[data-dept="upholstery"] .col-sewing   { width: 3.5%; }
body[data-dept="upholstery"] .col-file     { width: 3.5%; }

body[data-dept="paint"] .col-number   { width: 5.5%; }
body[data-dept="paint"] .col-name     { width: 12%; }
body[data-dept="paint"] .col-client   { width: 8.5%; }
body[data-dept="paint"] .col-fabric   { width: 8.5%; }
body[data-dept="paint"] .col-color    { width: 9%; }
body[data-dept="paint"] .col-otdelka  { width: 6.5%; }
body[data-dept="paint"] .col-kompl    { width: 7.5%; }
body[data-dept="paint"] .col-podushki { width: 6.5%; }
body[data-dept="paint"] .col-seats    { width: 4%; }
body[data-dept="paint"] .col-wood     { width: 7.5%; }
body[data-dept="paint"] .col-comment  { width: 8.5%; }
body[data-dept="paint"] .col-date     { width: 6%; }
body[data-dept="paint"] .col-file     { width: 3.5%; }
body[data-dept="paint"] .col-status   { width: 11%; }

/* Раньше проценты укладывались строго в 100% ширины экрана — на 16 столбцах
   это давало по 4% (меньше 50px) на «Наличие ткани»/«Раскроил»/«Швея», текст
   переносился в кашу и казалось, что данные обрезаются. Решение — как в
   /admin/ (там тоже широкие таблицы): страница сама шире обычного, а не
   таблица зажата в узкой колонке и скроллится. .container там
   `max-width: 96vw` вместо обычных 1680px — так и для швейки ниже. */
body[data-dept="sewing"] .container { max-width: 96vw; }
body[data-dept="sewing"] .col-number  { width: 4.5%; }
body[data-dept="sewing"] .col-name    { width: 11%; }
body[data-dept="sewing"] .col-client  { width: 8.5%; }
body[data-dept="sewing"] .col-qty     { width: 4.5%; }
body[data-dept="sewing"] .col-seats   { width: 3.5%; }
body[data-dept="sewing"] .col-comment { width: 8%; }
body[data-dept="sewing"] .col-date    { width: 5.5%; }
body[data-dept="sewing"] .col-wood    { width: 7%; }
body[data-dept="sewing"] .col-fabric  { width: 10%; }
body[data-dept="sewing"] .col-details { width: 9.5%; }
body[data-dept="sewing"] .col-cutter  { width: 6.5%; }
body[data-dept="sewing"] .col-master  { width: 6.5%; }
body[data-dept="sewing"] .col-meters  { width: 6.5%; }
body[data-dept="sewing"] .col-stock   { width: 11.5%; }
body[data-dept="sewing"] .col-status  { width: 9.5%; }
body[data-dept="sewing"] .col-file    { width: 3.5%; }
body[data-dept="sewing"] .col-birka   { width: 3.5%; }
/* Наименование/Клиент/Ткань/Комплектация держат самый «текстовый» контент
   (длинные названия, описания ткани «внутри/снаружи», ФИО) — им и добавлена
   ширина. min-width — просто подстраховка на узких экранах (страница теперь
   96vw, на обычном мониторе таблица помещается и без горизонтального скролла;
   .table-wrapper.sticky-head прокручивается сам, если места всё равно мало). */
body[data-dept="sewing"] .table-wrapper.sticky-head .orders-table { min-width: 1650px; }

/* 16-я колонка «Создан» (дата создания заказа, фильтруемая — см. otk/script.js)
   добавлена в конец таблицы. table-layout:fixed — проценты ДОЛЖНЫ укладываться
   в 100% (у .table-wrapper тут overflow:hidden, не auto, лишнее просто обрежет).
   Место под неё взято понемногу у имени/клиента/исполнителей/комментария/статуса.
   Контейнер расширен до 96vw как в швейке (см. её комментарий выше) — иначе
   даже правильные проценты дают слишком мало пикселей на 16 столбцах. */
body[data-dept="otk"] .container    { max-width: 96vw; }
body[data-dept="otk"] .col-number   { width: 5.5%; }
body[data-dept="otk"] .col-name     { width: 9.5%; }
body[data-dept="otk"] .col-client   { width: 7%; }
body[data-dept="otk"] .col-fabric   { width: 8%; }
body[data-dept="otk"] .col-color    { width: 7%; }
body[data-dept="otk"] .col-otdelka  { width: 5.5%; }
body[data-dept="otk"] .col-kompl    { width: 7%; }
body[data-dept="otk"] .col-podushki { width: 5.5%; }
body[data-dept="otk"] .col-seats    { width: 3.5%; }
body[data-dept="otk"] .col-masters  { width: 7.5%; }
body[data-dept="otk"] .col-comment  { width: 7%; }
body[data-dept="otk"] .col-date     { width: 5.5%; }
body[data-dept="otk"] .col-file     { width: 3.5%; }
body[data-dept="otk"] .col-created  { width: 5%; }
body[data-dept="otk"] .col-status   { width: 9.5%; }
body[data-dept="otk"] .col-birka    { width: 3.5%; }

/* склад, отгрузка, ремонт — колонок мало, ширину считает браузер */
body[data-dept="warehouse"] .orders-table,
body[data-dept="shipping"] .orders-table,
body[data-dept="repair"] .rt-table { table-layout: auto; }

/* ============================================================
   СТАТУСЫ — четыре тональные группы вместо десятка цветов
   ============================================================ */
.order-status, .badge, .pill, .rt-status, .sh-status, .stock-badge, .wood-badge,
.par, .rt-chip, .sklad-pill, .src-tag, .verdict, .dep, .tag-fresh {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11.5px; font-weight: 500; line-height: 1.3;
  padding: 4px 10px; border-radius: 999px; white-space: nowrap;
  background: var(--holst); color: var(--ink-2);
  max-width: 100%; overflow: hidden; text-overflow: ellipsis;
}
.order-status::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%;
  background: currentColor; flex-shrink: 0;
}
/* ждём */
.order-status.новый, .order-status.чертеж_готов, .order-status.столярка_готова,
.order-status.на_обивку, .rt-status.s-новый, .par-wait, .wood-new, .dep-wait {
  background: var(--holst); color: var(--ink-2);
}
/* в работе */
.order-status.в_столярке, .order-status.в_работе_у_обивщика, .order-status.active,
.rt-status.s-в_работе, .par-run, .wood-work, .dep-run, .pill {
  background: var(--indigo-soft); color: var(--indigo);
}
/* параллельные этапы и внимание */
.order-status.у_конструктора, .order-status.обивочный_готов, .order-status.на_отк,
.tag-fresh, .sklad-pill, .src-tag.tag-repair, .pill-warn {
  background: var(--latun-soft); color: var(--latun);
}
/* готово */
.order-status.завершен, .order-status.done, .rt-status.s-готово, .rt-status.s-выдан,
.par-ok, .wood-ready, .dep-ok, .pill-ok, .stock-yes, .verdict-ok {
  background: var(--zelen-soft); color: var(--zelen);
}
/* тревога */
.pill-bad, .stock-no, .verdict-bad, .ostatok-neg { background: var(--nit-soft); color: var(--nit); }
.pill-muted, .par-na, .dep-na, .rt-chip.skip, .verdict-wait { background: var(--holst); color: var(--ink-3); }
.rt-chip.done { background: var(--zelen-soft); color: var(--zelen); }
.rt-chip.wait { background: var(--latun-soft); color: var(--latun); }
.rt-chip { font-size: 11px; padding: 3px 8px; }
.rt-others { display: flex; gap: 4px; flex-wrap: wrap; }
.rt-master { font-size: 11px; color: var(--ink-3); display: block; margin-top: 4px; }
.rt-order { font-size: 10.5px; color: var(--ink-3); font-weight: 400; margin-top: 3px; }
.rt-bar { margin-bottom: 14px; }
.rt-legend {
  background: var(--latun-soft); border-radius: 10px;
  padding: 11px 15px; font-size: 13px; color: var(--ink-2);
}
.rt-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.rt-mine { min-width: 120px; }
.stock-warn { display: block; font-size: 11px; color: var(--nit); margin-top: 4px; }
/* швейка: две ткани на позицию — плашки остатка друг под другом с отступом */
.stock-line + .stock-line { margin-top: 6px; }
.ostatok-low { color: var(--latun); font-weight: 700; }
.ostatok-ok { color: var(--ink); font-weight: 600; }
.ostatok-neg { font-weight: 700; }

/* статус оплаты заказа (продажи, бухгалтерия) */
.pay-status {
  display: inline-flex; align-items: center; font-size: 11.5px; font-weight: 650;
  padding: 3px 10px; border-radius: 999px; white-space: nowrap; letter-spacing: .01em;
}
/* Статусы зеркалятся из dogovory.status (вкладка «Мои договора») — см.
   sales/contract.js:loadMyContracts. Те же 6 состояний, что и там. */
.pay-status.pay-chernovik { background: transparent; border: 1px solid var(--hairline); color: var(--ink-3); font-weight: 500; }
.pay-status.pay-schet_vystavlen { background: var(--latun-soft); color: var(--latun); }
.pay-status.pay-avans_poluchen { background: var(--indigo-soft); color: var(--indigo); }
.pay-status.pay-oplacheno { background: var(--zelen-soft); color: var(--zelen); }
.pay-status.pay-vypolnen { background: var(--zelen-soft); color: var(--zelen); }
.pay-status.pay-otmenen { background: var(--nit-soft); color: var(--nit); }
.pay-status.pay-none { background: transparent; border: 1px solid var(--hairline); color: var(--ink-3); font-weight: 500; }

/* документы бухгалтерии (сканы/чеки/фото) — orders.dokumenty */
.doc-list { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; max-width: 220px; }
.doc-chip {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--holst); border-radius: 999px; padding: 3px 4px 3px 9px;
  font-size: 11.5px; max-width: 100%;
}
.doc-chip .spec-link { max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-del {
  border: none; background: transparent; cursor: pointer; color: var(--ink-3);
  font-size: 12px; line-height: 1; padding: 3px 5px; border-radius: 999px;
}
.doc-del:hover { background: var(--nit-soft); color: var(--nit); }
.doc-add {
  display: inline-flex; align-items: center; cursor: pointer;
  font-size: 11.5px; font-weight: 600; color: var(--indigo);
  border: 1px dashed var(--indigo); border-radius: 999px; padding: 3px 10px;
  white-space: nowrap;
}
.doc-add:hover { background: var(--indigo-soft); }

/* признаки позиции */
.tag-obv, .dev-tag, .qty-batch, .otk-comment {
  display: inline-flex; align-items: center;
  font-family: var(--mono); font-size: 10px; font-weight: 500;
  letter-spacing: .06em; text-transform: uppercase;
  padding: 3px 7px; border-radius: 6px; white-space: nowrap;
  background: var(--holst); color: var(--ink-2);
}
.dev-tag { cursor: pointer; border: none; }
.dev-tag.dev-on { background: var(--indigo-soft); color: var(--indigo); }
.dev-tag.dev-off { background: var(--holst); color: var(--ink-3); }
.dev-tag.dev-sew { background: var(--latun-soft); color: var(--latun); }
.dev-tag:not(.dev-sew):hover { filter: brightness(.96); }
.qty-batch { background: var(--latun-soft); color: var(--latun); font-weight: 700; }

/* сроки */
.date-ok { color: var(--zelen); font-weight: 600; }
.date-warning { color: var(--latun); font-weight: 500; }
.date-urgent { color: var(--latun); font-weight: 700; }
.date-overdue { color: var(--nit); font-weight: 700; }
.date-pill { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* ============================================================
   ПОДСКАЗКИ ЦЕХА
   ============================================================ */
.hints { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.hints-title {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .12em;
  text-transform: uppercase; color: var(--ink-3); margin-bottom: 4px;
}
.hint {
  display: flex; gap: 10px; align-items: flex-start;
  background: var(--latun-soft); border-radius: 10px;
  padding: 11px 15px; font-size: 13px; color: var(--ink-2); margin: 0;
}
.hint-ico { color: var(--latun); flex-shrink: 0; }
.hint-note { color: var(--ink-3); font-size: 12px; }
.hint-good { background: var(--zelen-soft); }
.hint-good .hint-ico { color: var(--zelen); }

/* ============================================================
   ПОДСКАЗКИ ВВОДА (автодополнение)
   ============================================================ */
.suggestions {
  display: none; position: absolute; z-index: 30; left: 0; right: 0; top: 100%;
  margin-top: 4px; background: var(--paper);
  border: 1px solid var(--hairline); border-radius: 10px;
  box-shadow: 0 18px 40px -20px rgba(26,29,36,.7);
  max-height: 260px; overflow-y: auto;
}
.suggestions.show { display: block; }
.suggestion-item {
  padding: 9px 13px; cursor: pointer;
  border-bottom: 1px solid var(--hairline-soft);
}
.suggestion-item:last-child { border-bottom: none; }
.suggestion-item:hover { background: var(--indigo-soft); }
.suggestion-title { font-size: 13.5px; font-weight: 500; color: var(--ink); }
.suggestion-desc { font-family: var(--mono); font-size: 11px; color: var(--ink-3); margin-top: 2px; }

/* ============================================================
   НОВЫЙ ЗАКАЗ — заказ и позиция рядом, итог всегда под рукой
   ============================================================ */
.new-order-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
.new-order-grid .card { margin-bottom: 0; }
h2 .step {
  margin-left: auto; font-family: var(--mono); font-size: 10px;
  font-weight: 400; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3);
}
.card h2 { display: flex; align-items: center; gap: 8px; }
.commit-bar {
  position: sticky; bottom: 0; z-index: 10;
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  background: var(--grafit); color: var(--on-bench);
  border-radius: 14px; padding: 14px 20px; margin: 18px 0;
  box-shadow: 0 -6px 30px -18px rgba(0,0,0,.6);
}
.commit-sum { font-size: 13.5px; color: var(--on-bench-2); }
.commit-bar .btn { margin-left: auto; }
@media (max-width: 1100px) { .new-order-grid { grid-template-columns: 1fr; } }

/* ============================================================
   ВЫБОР ИЗДЕЛИЯ ИЗ ЗАКАЗА (приём ремонта)
   ============================================================ */
.pick-list { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.pick-head {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .1em;
  text-transform: uppercase; color: var(--ink-3); margin-bottom: 2px;
}
.pick {
  display: block; width: 100%; text-align: left; cursor: pointer;
  font-family: var(--body); color: var(--ink);
  background: var(--field); border: 1px solid var(--hairline);
  border-radius: 10px; padding: 10px 13px;
  transition: border-color .14s, background .14s;
}
.pick:hover { border-color: var(--indigo); }
.pick.is-picked { border-color: var(--indigo); background: var(--indigo-soft); }
.pick-name { display: block; font-size: 13.5px; font-weight: 600; }
.pick-sub { display: block; font-size: 12px; color: var(--ink-3); margin-top: 3px; }
.pick-other { font-size: 13px; color: var(--ink-2); border-style: dashed; }
.pick-empty { font-size: 12.5px; color: var(--ink-3); }

/* ============================================================
   МОДАЛЬНОЕ ОКНО
   ============================================================ */
.modal-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(20, 22, 28, .55); backdrop-filter: blur(2px);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 40px 20px; overflow-y: auto;
}
.modal-content {
  width: 100%; max-width: 1000px;
  background: var(--holst); border-radius: 16px;
  box-shadow: 0 30px 70px -30px rgba(0,0,0,.6);
  overflow: hidden;
}
.modal-header {
  display: flex; align-items: center; gap: 14px;
  background: var(--grafit); color: var(--on-bench);
  padding: 16px 22px;
}
.modal-header h2 { color: var(--on-bench); }
.modal-close {
  margin-left: auto; cursor: pointer; font-size: 24px; line-height: 1;
  color: var(--on-bench-2);
}
.modal-close:hover { color: var(--on-bench); }
.modal-body { padding: 20px 22px; }
.modal-footer {
  display: flex; gap: 10px; justify-content: flex-end;
  padding: 16px 22px; border-top: 1px solid var(--hairline);
  background: var(--paper);
}
.edit-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.edit-add-grid { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-start; }
.edit-add-item { flex: 1 1 160px; min-width: 0; }
.edit-add-item input { font-size: 13px; }
.edit-item-row {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 11px 0; border-bottom: 1px solid var(--hairline-soft);
}

/* Позиции в окне «Редактировать заказ» — та же карточка, что и в развёрнутом
   заказе (.ol-pos-*: имя, затем строка фактов), плюс своя строка действий. */
.edit-pos-actions { display: flex; gap: 8px; margin-top: 9px; }

/* ============================================================
   СПИСОК ЗАКАЗОВ В ПРОДАЖАХ
   ============================================================ */
#ordersList { background: var(--paper); border: 1px solid var(--hairline); border-radius: 14px; box-shadow: var(--lift); overflow: hidden; }
.orders-count { padding: 10px 18px; font-size: 12.5px; color: var(--ink-3); }
.ol-head, .ol-row {
  display: grid;
  grid-template-columns: 26px 70px minmax(120px, 1.3fr) 100px minmax(140px, 1fr) 120px 66px 44px 76px;
  align-items: center; gap: 12px;
}
.ol-head {
  padding: 11px 18px; border-bottom: 1px solid var(--hairline);
  font-family: var(--mono); font-size: 10px; letter-spacing: .08em;
  text-transform: uppercase; color: var(--ink-3);
}
.order-line { border-bottom: 1px solid var(--hairline-soft); }
.order-line:last-child { border-bottom: none; }
.ol-row { padding: 12px 18px; cursor: pointer; transition: background .12s; }
.ol-row:hover { background: var(--holst); }
.order-line.is-open { background: var(--holst); }
.order-line.is-open.vip-row { background: var(--latun-soft); }
.ol-arrow { color: var(--ink-3); font-size: 11px; }
.order-line.is-open .ol-arrow { color: var(--indigo); }
.ol-num { font-family: var(--mono); font-size: 12.5px; font-weight: 700; }
.ol-client { font-size: 13.5px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ol-date { font-family: var(--mono); font-size: 12px; }
.ol-pos, .ol-file { font-family: var(--mono); font-size: 11.5px; color: var(--ink-3); }
.ol-actions { display: flex; gap: 4px; justify-content: flex-end; }
.ol-done { font-family: var(--mono); font-size: 12px; font-weight: 700; color: var(--ink-2); }
.ol-done.all-done { color: var(--zelen); }
.ol-details { padding: 4px 18px 18px 56px; }
.ol-pos-block { padding: 11px 0; border-top: 1px dashed var(--hairline); }
.ol-pos-block:last-child { padding-bottom: 0; }
.ol-pos-name { font-size: 13.5px; font-weight: 600; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ol-pos-facts { font-size: 12.5px; color: var(--ink-2); margin-top: 5px; }
.ol-fabric-view { font-size: 12.5px; color: var(--ink-2); margin-top: 5px; display: flex; align-items: center; gap: 6px; }
.fabric-edit-btn {
  border: none; background: transparent; cursor: pointer; padding: 1px 4px;
  border-radius: 5px; color: var(--ink-3); font-size: 12px; line-height: 1;
}
.fabric-edit-btn:hover { background: var(--hairline-soft); color: var(--indigo); }
.ol-fabric-edit { position: relative; display: flex; align-items: center; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.ol-fabric-edit .ol-fabric-input { flex: 1; min-width: 160px; max-width: 320px; }
.ol-units { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 9px; }
.ol-unit {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--paper); border: 1px solid var(--hairline);
  border-radius: 8px; padding: 5px 10px;
}
.ol-unit-num { font-family: var(--mono); font-size: 11.5px; font-weight: 700; color: var(--ink); }
.ol-unit-stage { font-size: 11.5px; color: var(--ink-2); }
.ol-unit-master { font-size: 11.5px; color: var(--ink-3); border-left: 1px solid var(--hairline); padding-left: 8px; }
.ol-unit-stage.st-новый { color: var(--ink-2); }
.ol-unit-stage.st-конструктор { color: var(--latun); }
.ol-unit-stage.st-столярка { color: var(--indigo); }
.ol-unit-stage.st-столярка_готова { color: var(--ink-2); }
.ol-unit-stage.st-швейка { color: var(--latun); }
.ol-unit-stage.st-обивка { color: var(--indigo); }
.ol-unit-stage.st-отк { color: var(--latun); }
.ol-unit-stage.st-завершен { color: var(--zelen); }
.ol-extra { margin-top: 11px; font-size: 12.5px; color: var(--ink-2); display: flex; gap: 18px; flex-wrap: wrap; }
.ol-comment { margin-top: 11px; font-size: 12.5px; color: var(--ink-2); border-left: 2px solid var(--latun); padding-left: 11px; }
.order-made, .order-parallel { font-size: 12.5px; color: var(--ink-2); }

/* ============================================================
   КАРТОЧКИ ПОЗИЦИЙ (конструктор)
   ============================================================ */
.all-items-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 16px; }
.order-card {
  --cut: 18px;
  position: relative; background: var(--paper); box-shadow: var(--lift);
  border-radius: 3px; padding: 18px 20px 16px;
  clip-path: polygon(0 0, calc(100% - var(--cut)) 0, 100% var(--cut), 100% 100%, 0 100%);
  transition: transform .16s ease;
}
.order-card:hover { transform: translateY(-3px); }
.order-card::after {
  content: ''; position: absolute; top: 0; right: 0;
  width: var(--cut); height: var(--cut);
  background: linear-gradient(to bottom left, var(--hairline) 0 1px, transparent 1px);
}
.order-header { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.order-number { font-family: var(--mono); font-size: 12.5px; font-weight: 700; color: var(--ink); }
.order-header .order-status { margin-left: auto; }
.order-item-name { font-size: 15.5px; font-weight: 600; line-height: 1.25; }
.order-client { font-size: 13px; color: var(--ink-2); margin-top: 6px; }
.order-meta { font-family: var(--mono); font-size: 12px; color: var(--ink-2); margin-top: 8px; }
.order-details {
  font-size: 12.5px; color: var(--ink-2); line-height: 1.55;
  margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--hairline);
}
.order-file { font-size: 12.5px; margin-top: 10px; }
.order-file-empty { color: var(--ink-3); }
.order-date { font-size: 12.5px; color: var(--ink-2); margin-top: 10px; border-left: 2px solid var(--latun); padding-left: 10px; }
.order-date:empty { display: none; }
.order-development { font-size: 12.5px; color: var(--latun); margin-top: 8px; }
.order-progress { font-family: var(--mono); font-weight: 700; }
.order-progress.all-done { color: var(--zelen); }

.item-row {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 11px 0; border-bottom: 1px solid var(--hairline-soft);
}
.item-row:last-child { border-bottom: none; }
.item-name { font-weight: 600; font-size: 13.5px; }
.item-detail, .item-info { font-size: 12.5px; color: var(--ink-3); }
.list-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.list-title { font-family: var(--display); font-size: 15px; font-weight: 700; }
.list-count { font-family: var(--mono); font-size: 11px; color: var(--ink-3); }
.row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--hairline-soft); }
.row:last-child { border-bottom: none; }
.row-name { font-weight: 500; font-size: 13.5px; }
.rows { display: flex; flex-direction: column; }

/* ============================================================
   СКЛАД ТКАНЕЙ
   ============================================================ */
.wh-form-row { display: grid; grid-template-columns: 2fr 110px 1.4fr auto; gap: 14px; align-items: end; }
.wh-form-row .form-group { margin-bottom: 0; }
.wh-fabric { position: relative; }
.wh-summary {
  background: var(--paper); border: 1px solid var(--hairline); border-radius: 12px;
  padding: 13px 18px; margin-bottom: 16px; font-size: 13.5px; color: var(--ink-2);
}
.wh-summary b { font-family: var(--mono); color: var(--ink); }
.del-move { color: var(--nit); cursor: pointer; }

/* ============================================================
   СКЛАД И ОТГРУЗКА
   ============================================================ */
.ship-hint {
  background: var(--latun-soft); border-radius: 10px;
  padding: 11px 15px; font-size: 13px; color: var(--ink-2); margin-bottom: 16px;
}
.ship-group { margin-bottom: 20px; }
.ship-group-head {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 10px 2px; font-size: 13.5px;
}
.ship-group-head .ship-city { font-weight: 600; }
.ship-group-head .ship-count, .ship-group-head .ship-date { font-family: var(--mono); font-size: 12px; color: var(--ink-3); }
.ship-form, .ship-form-row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.ship-form-row:empty { display: none; }
.ship-form .sh-city, .ship-form .sh-dest { min-width: 120px; }
.ship-form .sh-date { min-width: 128px; }
.ship-form input, .ship-form select { font-size: 12.5px; padding: 6px 9px; }
.sh-download { font-size: 15px; }
.table-ready tbody td { vertical-align: top; }

/* ============================================================
   АДМИН-ПАНЕЛЬ И СТАТУС СЕРВЕРА
   ============================================================ */
.gauges { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; margin-bottom: 18px; }
.gauge { background: var(--paper); border: 1px solid var(--hairline); border-radius: 14px; padding: 16px 18px; box-shadow: var(--lift); }
.gauge-head { display: flex; align-items: center; gap: 9px; margin-bottom: 12px; }
.gauge-ico { font-size: 17px; }
.gauge-title { font-family: var(--mono); font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); }
.gauge-val { font-family: var(--display); font-size: 22px; font-weight: 700; margin-left: auto; }
.gauge-track { height: 5px; border-radius: 3px; background: var(--hairline); overflow: hidden; }
.gauge-fill { height: 100%; border-radius: 3px; background: var(--indigo); }
.gauge-note { font-size: 12px; color: var(--ink-3); margin-top: 8px; }
.gauge-ok   .gauge-fill { background: var(--zelen); }
.gauge-ok   .gauge-val { color: var(--zelen); }
.gauge-warn .gauge-fill { background: var(--latun); }
.gauge-warn .gauge-val { color: var(--latun); }
.gauge-bad  .gauge-fill { background: var(--nit); }
.gauge-bad  .gauge-val { color: var(--nit); }
.verdict { padding: 12px 16px; border-radius: 12px; font-size: 13.5px; display: flex; gap: 10px; align-items: center; }
.verdict b { font-weight: 700; }
.verdict span { color: inherit; }
.verdict-ok { background: var(--zelen-soft); color: var(--zelen); }
.verdict-warn { background: var(--latun-soft); color: var(--latun); }
.verdict-bad { background: var(--nit-soft); color: var(--nit); }
.verdict-wait { background: var(--holst); color: var(--ink-3); }
.rec-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.rec { background: var(--paper); border: 1px solid var(--hairline); border-radius: 12px; padding: 14px 16px; }
.rec-label { font-family: var(--mono); font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); }
.rec-val { font-family: var(--display); font-size: 19px; font-weight: 700; margin-top: 6px; }
.ip-list { display: flex; flex-direction: column; gap: 6px; }
.ip-head { font-family: var(--mono); font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); }
.ip-list code { font-family: var(--mono); font-size: 12px; color: var(--ink); }
.admin-toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.admin-count { font-family: var(--mono); font-size: 12px; color: var(--ink-3); }
.auto-toggle { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); }
.auto-toggle input { width: 16px; height: 16px; accent-color: var(--indigo); }
.a-num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.a-right { text-align: right; }
.a-center { text-align: center; }
.a-name { font-weight: 600; }
.a-sub { font-size: 11.5px; color: var(--ink-3); }
.a-fabric { font-size: 12.5px; }
.spec-row { display: flex; gap: 10px; padding: 7px 0; font-size: 13px; }
.spec-row + .spec-row { border-top: 1px solid var(--hairline-soft); }
.spec-k { color: var(--ink-3); min-width: 140px; }
.spec-v { color: var(--ink); font-weight: 500; }
.spec-link, .file-link { color: var(--indigo); }
.file-link:hover { text-decoration: underline; }

/* бирки */
.birki-bar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.birki-hint { font-size: 12.5px; color: var(--ink-3); }

/* ============================================================
   АДАПТИВ
   ============================================================ */
@media (max-width: 1400px) {
  .orders-table thead th { font-size: 9.5px; padding: 10px 7px; }
  .orders-table tbody td { font-size: 12px; padding: 9px 7px; }
  .status-select, .ispolnitel-select, .txt-input { font-size: 12px; padding: 5px 7px; }
}
@media (max-width: 1100px) {
  .container { padding: 0 14px; }
  header, .header, .header-bar { margin: 0 -14px 18px; padding: 14px 18px; }
  .tabs { margin: -18px -14px 18px; padding: 0 14px; }
  .form-row, .edit-row { grid-template-columns: 1fr; }
  .wh-form-row { grid-template-columns: 1fr; }
  .hide-narrow { display: none; }
  .ol-head, .ol-row { grid-template-columns: 24px 62px minmax(110px,1fr) 92px 120px; }
  .ol-stage, .ol-pos, .ol-file, .ol-actions { display: none; }
  .ol-row .ol-stage, .ol-row .ol-pos, .ol-row .ol-file { display: none; }
}
@media (max-width: 760px) {
  .all-items-list { grid-template-columns: 1fr; }
  .header-actions, .header-right { margin-left: 0; }

  /* ============================================================
     ТАБЛИЦЫ ЦЕХОВ НА ТЕЛЕФОНЕ — карточки вместо строк.
     Та же разметка (<table><td class="col-*">), просто th/td переключаются
     в блочную/флекс-раскладку, а подпись поля берётся из data-label,
     который проставляют script.js цехов. Один источник данных и логики —
     меняется только то, как это разложено на экране.
     ============================================================ */
  .table-wrapper, .rt-wrap, .a-table-wrap {
    overflow: visible; box-shadow: none; border: none; background: transparent;
  }
  body[data-dept="sewing"] .table-wrapper.sticky-head { overflow: visible; max-height: none; }
  /* тот же приоритет селектора, что и у десктопного правила (иначе он его
     перебивает по специфичности) — иначе таблица держит 1650px и карточки
     на телефоне уезжают за экран горизонтальным скроллом. */
  body[data-dept="sewing"] .table-wrapper.sticky-head .orders-table { min-width: 0; }

  .orders-table, .rt-table, .a-table { display: block; width: 100%; table-layout: auto; min-width: 0; }
  .orders-table thead, .rt-table thead, .a-table thead { display: none; }
  .orders-table tbody, .rt-table tbody, .a-table tbody { display: block; }

  .orders-table tbody tr, .rt-table tbody tr, .a-table tbody tr {
    display: flex; flex-direction: column; gap: 7px;
    background: var(--paper); border: 1px solid var(--hairline); border-radius: 12px;
    padding: 13px 14px; margin-bottom: 10px; box-shadow: var(--lift);
  }
  .orders-table tbody tr:hover td, .rt-table tbody tr:hover td, .a-table tbody tr:hover td { background: none; }

  .orders-table tbody td, .rt-table tbody td, .a-table tbody td {
    display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 8px; row-gap: 2px;
    padding: 0; border: none; background: none !important;
    /* десктопные .col-* держат узкую width:N% под многоколоночную таблицу —
       без сброса каждое поле в карточке остаётся зажато в те же проценты
       (несколько десятков px) и текст ломается по буквам. */
    width: auto !important; max-width: 100%;
  }
  .orders-table tbody td[data-label]::before,
  .rt-table tbody td[data-label]::before,
  .a-table tbody td[data-label]::before {
    content: attr(data-label); flex: 0 0 auto;
    font-family: var(--mono); font-size: 10px; font-weight: 700;
    text-transform: uppercase; letter-spacing: .04em; color: var(--ink-3);
  }
  .orders-table tbody td:empty, .rt-table tbody td:empty, .a-table tbody td:empty { display: none; }

  /* служебная строка-разделитель групп (напр. «Готовы к обивке») — не карточка */
  .orders-table tr.group-row { background: none; border: none; box-shadow: none; padding: 8px 2px 4px; margin-bottom: 2px; }
  .orders-table tr.group-row td { display: block; font-weight: 700; color: var(--ink-2); }

  /* номер/наименование/статус — самое важное, без подписи, наверх и крупнее */
  .orders-table .col-number, .orders-table .col-name, .orders-table .col-status,
  .rt-num, .rt-name, .a-num, .a-name {
    order: -3;
  }
  .orders-table .col-number::before, .orders-table .col-name::before, .orders-table .col-status::before,
  .rt-num::before, .rt-name::before, .a-num::before, .a-name::before { content: none !important; }
  .orders-table .col-name, .rt-name, .a-name { order: -2; font-size: 15px; }
  .orders-table .col-status { order: -1; }

  /* элементы управления — крупнее, удобнее тапать пальцем */
  .status-select, .ispolnitel-select,
  .orders-table select, .rt-table select, .a-table select,
  .orders-table input, .rt-table input { font-size: 15px; padding: 9px 10px; }

  /* подсветка строки (VIP, наличие ткани в швейке) — красим всю карточку, не полосками */
  .orders-table tbody tr.vip-row, .rt-table tbody tr.vip-row, .a-table tbody tr.vip-row {
    background: var(--latun-soft); box-shadow: inset 3px 0 0 var(--latun);
  }
  body[data-dept="sewing"] .orders-table tbody tr.row-stock-no { background: var(--nit-soft); }
  body[data-dept="sewing"] .orders-table tbody tr.row-stock-shortage { background: var(--warn-soft); }
  body[data-dept="sewing"] .orders-table tbody tr.row-stock-ok { background: var(--zelen-soft); }

  /* ============================================================
     СПИСОК «МОИ ЗАКАЗЫ» (продажи) — это не таблица, а своя grid-строка
     (.ol-row), поэтому меняем раскладку отдельно: колонки становятся
     флекс-строкой, которая сама переносится, а не фиксированной сеткой.
     ============================================================ */
  .ol-head { display: none; }
  .ol-row {
    display: flex; flex-wrap: wrap; align-items: center;
    row-gap: 6px; column-gap: 10px; padding: 12px 14px;
  }
  .ol-arrow { order: -6; }
  .ol-num { order: -5; }
  .ol-client { order: -4; flex-basis: 100%; white-space: normal; font-size: 15px; }
  .ol-date { order: -3; }
  .ol-stage { order: -2; flex-basis: 100%; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
  .ol-progress { order: -1; }
  .ol-pos, .ol-file { order: 1; }
  .ol-actions { order: 2; margin-left: auto; }
  .ol-details { padding: 4px 14px 16px; }
}
@media print {
  header, .header, .header-bar, .tabs, .filters, .filter-bar, .hints { display: none !important; }
  body { background: #fff; }
}
