/* Кабинет логиста WinSys — тот же облик, что у кабинета замеров и сканера (MeasureApp, Scanner2): шрифты Golos Text и
   IBM Plex Mono, серый фон, белые карточки со скруглением, крупные кнопки и поля, пилюли состояний.
   Цвет раздела — синий, как режим «Погрузка» сканера; зелёный ✓ — шаг сделан, оранжевый — внимание, красный — ошибка.
   Отгрузка по машине — полоса из шести шагов (steps.js): сделанные зелёные, следующий выделен синим, под полосой —
   подсказка и кнопка следующего шага. Документы на машину — белая бумага A4 в обеих темах. */
:root {
  --bg: #E8EBED; --surface: #FFFFFF; --surface2: #F2F4F5; --ink: #14181B; --muted: #58616A; --line: #CBD1D6; --line2: #E1E5E8;
  --accent: #1F5FA8; --accent-ink: #FFFFFF; --accent-text: #1F5FA8; --accent-soft: #E4EDF8; --accent-line: #1F5FA8;
  --ok: #1B7842; --ok-soft: #E0F1E7; --err: #BE2E26; --err-soft: #FBE5E3; --warn: #965500; --warn-soft: #FFEFD6; --on-st: #FFFFFF;
  --f-ui: "Golos Text", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --f-num: "IBM Plex Mono", ui-monospace, SFMono-Regular, Consolas, monospace;
  --r: 14px; --maxw: 1600px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0F1214; --surface: #191D20; --surface2: #22272B; --ink: #ECEFF1; --muted: #9AA4AD; --line: #353C42; --line2: #2A3035;
    --accent: #2E73C4; --accent-ink: #FFFFFF; --accent-text: #7DB0EE; --accent-soft: #1A2B3F; --accent-line: #5B98DF;
    --ok: #41BF78; --ok-soft: #16331F; --err: #FF6E62; --err-soft: #3D1B19; --warn: #F1A43E; --warn-soft: #382811; --on-st: #0F1214;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); }
body { color: var(--ink); font-family: var(--f-ui); font-size: 15px; line-height: 1.4; -webkit-text-size-adjust: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--accent-line); outline-offset: 2px; }
[hidden] { display: none !important; }
.boot { padding: 24px; color: var(--muted); }

/* шапка: знак раздела, разделы (работа | справочники), кто вошёл */
.top { position: sticky; top: 0; z-index: 30; background: var(--bg); border-bottom: 1px solid var(--line); }
.top-in { max-width: var(--maxw); margin: 0 auto; padding: 8px 16px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; min-height: 60px; }
.brand { display: flex; align-items: center; gap: 9px; margin: 0; font-weight: 700; font-size: 17px; white-space: nowrap; }
.brand i { width: 14px; height: 14px; border-radius: 3px; background: var(--accent); }
.mnav { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; }
.mnav .tab { height: 40px; padding: 0 9px; border-radius: 10px; font-weight: 600; font-size: 14px; color: var(--muted); display: inline-flex; align-items: center; text-decoration: none; white-space: nowrap; }
.mnav .tab:hover { color: var(--ink); }
.mnav .tab.on { background: var(--surface); color: var(--ink); box-shadow: inset 0 -3px 0 var(--accent); }
.mnav .tab.soon { opacity: .5; cursor: default; }
.mnav .sep { width: 1px; height: 24px; margin: 0 5px; background: var(--line); }
.me { margin-left: auto; display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--muted); white-space: nowrap; min-width: 0; }
.me span { max-width: 160px; overflow: hidden; text-overflow: ellipsis; }
main { max-width: var(--maxw); margin: 0 auto; padding: 16px 16px 48px; display: flex; flex-direction: column; gap: 14px; }

/* кнопки и поля — как в кабинете замеров */
button { min-height: 40px; padding: 0 14px; border: 2px solid var(--line); border-radius: 10px; background: var(--surface); font-weight: 600; font-size: 14.5px; line-height: 1.2;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-align: center; white-space: nowrap; cursor: pointer; -webkit-appearance: none; appearance: none; }
button:hover:not(:disabled) { border-color: var(--muted); }
button:disabled { opacity: .45; cursor: not-allowed; }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
button.primary:hover:not(:disabled) { border-color: var(--accent); filter: brightness(1.1); }
button.link { min-height: 0; padding: 2px 4px; border: 0; background: none; color: var(--accent-text); font-weight: 500; text-decoration: underline; text-underline-offset: 2px; }
button.armed, button.armed:hover:not(:disabled) { background: var(--err-soft); border-color: var(--err); color: var(--err); }
button.sm { min-height: 32px; padding: 0 10px; border-width: 1.5px; border-radius: 8px; font-size: 13.5px; }
button.danger { color: var(--err); }
button.wide { width: 100%; }
a.back { display: inline-flex; align-items: center; gap: 4px; height: 40px; padding: 0 12px 0 8px; border-radius: 10px; background: var(--surface); color: var(--ink); font-weight: 600; text-decoration: none; white-space: nowrap; }
a.back:hover { box-shadow: inset 0 0 0 2px var(--line); }
input[type=text], input[type=number], input[type=password], input[type=search], input[type=date], select, textarea {
  min-height: 40px; padding: 0 10px; border: 2px solid var(--line); border-radius: 10px; background: var(--surface); font-size: 14.5px; min-width: 0; max-width: 100%;
}
textarea { padding: 8px 10px; }
input:focus, select:focus, textarea:focus { border-color: var(--accent-line); outline: none; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .85; }
input:disabled, select:disabled, textarea:disabled { opacity: .7; background: var(--surface2); }
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); flex: none; }
label.chk { display: inline-flex; gap: 8px; align-items: center; cursor: pointer; margin-right: 14px; white-space: nowrap; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
td.num, .mono { font-family: var(--f-num); font-weight: 500; font-size: 14px; }
.cap { color: var(--muted); font-size: 14px; }

/* заголовок страницы и фильтры-пилюли */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.toolbar h2 { margin: 0; font-size: 21px; letter-spacing: -.01em; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { min-height: 36px; padding: 0 13px; border: 1.5px solid var(--line); border-radius: 18px; background: var(--surface); font-weight: 600; font-size: 14px; color: var(--muted); }
.chip.on, .chip.on:hover:not(:disabled) { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

/* вход */
.login { width: 100%; max-width: 440px; margin: 10vh auto 0; }
.login form { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.login .fl { display: flex; flex-direction: column; gap: 6px; }
.login .fl label { font-weight: 600; font-size: 14px; }
.login input { min-height: 48px; font-size: 16px; }
.login button.primary { min-height: 50px; font-size: 16px; }
.login .problem:empty { display: none; }
.login .problem { background: var(--err-soft); border-radius: 10px; padding: 10px 12px; font-size: 14.5px; }
.login .cap { margin: -4px 0 0; }

/* карточки, списки слева и редакторы справа */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); min-width: 0; overflow: hidden; }
.list { display: flex; flex-direction: column; min-height: 420px; }
.list .search { padding: 10px; border-bottom: 1px solid var(--line2); }
.list .search input[type=search] { width: 100%; }
.list .scroll { overflow: auto; max-height: calc(100vh - 290px); flex: 1; }
.list .btns { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--line2); flex-wrap: wrap; background: var(--surface2); }
.grid { width: 100%; border-collapse: collapse; }
.grid th { text-align: left; font-weight: 600; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; padding: 8px 10px; border-bottom: 1px solid var(--line);
  background: var(--surface); position: sticky; top: 0; z-index: 1; }
.grid th.num { text-align: right; }
.grid td { padding: 8px 10px; border-bottom: 1px solid var(--line2); vertical-align: top; }
.grid tbody tr:last-child td { border-bottom: 0; }
.list tbody tr { cursor: pointer; }
.list tbody tr:hover td, .grid.pts tbody tr:hover td { background: var(--surface2); }
.list tbody tr.on td, .grid.pts tbody tr.on td { background: var(--accent-soft); }
.list tbody tr.on td:first-child, .grid.pts tbody tr.on td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.list tbody tr.off td:first-child { text-decoration: line-through; opacity: .7; }
tr.day td, .list tbody tr.day td { background: var(--surface2); font-weight: 700; font-size: 13px; padding-top: 7px; padding-bottom: 7px; }
.list tbody tr.day { cursor: default; }
.edit { padding: 0; }
.head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 14px 16px; border-bottom: 1px solid var(--line2); }
.head h2 { margin: 0; font-size: 18px; flex: 1; min-width: 0; }
.tabs { display: flex; gap: 2px; padding: 4px 10px 0; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs button { min-height: 42px; border: 0; border-radius: 10px 10px 0 0; background: none; padding: 0 13px; color: var(--muted); }
.tabs button:hover:not(:disabled) { color: var(--ink); }
.tabs button.on { color: var(--ink); box-shadow: inset 0 -3px 0 var(--accent); }
.tabs button .dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--warn); margin-left: 4px; }
.page { padding: 16px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.form { display: grid; grid-template-columns: 160px 1fr; gap: 10px 12px; align-items: center; max-width: 760px; }
.form > label { color: var(--muted); font-weight: 600; font-size: 14px; }
.form textarea { min-height: 72px; resize: vertical; }
.foot { display: flex; gap: 8px; justify-content: flex-end; align-items: center; flex-wrap: wrap; padding: 12px 16px; border-top: 1px solid var(--line2); background: var(--surface2); }
.foot .msg { flex: 1; min-width: 200px; }
.empty { padding: 36px 20px; color: var(--muted); text-align: center; }
.fld { display: grid; gap: 4px; align-content: start; }
.fld > span { color: var(--muted); font-size: 13px; font-weight: 600; }
.fld.inline { display: inline-flex; align-items: center; gap: 8px; }
.fld.grow { flex: 1; min-width: 160px; }
input.qty { width: 76px; text-align: right; font-family: var(--f-num); }
.grid td input[type=text], .grid td input[type=number], .grid td select { min-height: 32px; padding: 0 8px; border-width: 1.5px; border-radius: 8px; }
.grid td input[type=checkbox] { margin-top: 2px; }
.pad { padding: 12px 14px; }
.bhead { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: space-between; }

/* пилюли состояний и сообщения */
.tag { display: inline-block; margin-left: 6px; padding: 2px 9px; border-radius: 999px; font-size: 12.5px; font-weight: 600; background: var(--surface2); color: var(--muted); white-space: nowrap; vertical-align: 1px; }
.tag.ok { background: var(--ok-soft); color: var(--ok); }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
.tag.err { background: var(--err-soft); color: var(--err); }
.tag.acc { background: var(--accent-soft); color: var(--accent-text); }
.head .tag, .toolbar .tag, .trow .tag { margin-left: 0; }
.problem { color: var(--err); }
p.problem { margin: 0; background: var(--err-soft); border-radius: 10px; padding: 10px 12px; }
.note { color: var(--warn); font-size: 13px; }
p.note { margin: 0 0 10px; background: var(--warn-soft); border-radius: 10px; padding: 10px 12px; font-size: 14.5px; }
.msg.problem { color: var(--err); }
.fnote { background: var(--accent-soft); border-radius: 10px; padding: 10px 12px; font-size: 14.5px; }

/* окно «Материалы и нормы» */
.mats { display: grid; grid-template-columns: minmax(260px, 360px) 1fr; gap: 14px; align-items: start; }
.mats > * { min-width: 0; }
.rnav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.rnav .title { font-weight: 700; flex: 1; min-width: 200px; }
.conds { width: 100%; max-width: 880px; border: 1px solid var(--line); border-radius: 10px; border-collapse: separate; border-spacing: 0; margin-bottom: 14px; overflow: hidden; }
.conds td { padding: 8px 12px; border-bottom: 1px solid var(--line2); }
.conds td:first-child { width: 160px; color: var(--muted); font-weight: 600; font-size: 14px; background: var(--surface2); }
.conds tr:last-child td { border-bottom: 0; }
.formula textarea { width: 100%; max-width: 880px; min-height: 66px; font-family: var(--f-num); font-size: 14px; resize: vertical; }
.fstate { min-height: 20px; margin: 4px 0 6px; font-size: 13.5px; }
.fstate.bad { color: var(--err); }
.fstate.good { color: var(--ok); }
.vars { max-width: 880px; margin: 4px 0 14px; display: flex; flex-direction: column; gap: 5px; }
.vars .vg { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.vars .vg > span { color: var(--muted); font-size: 12.5px; width: 80px; }
.vars button { min-height: 26px; padding: 0 8px; border: 0; border-radius: 13px; font-family: var(--f-num); font-size: 12.5px; font-weight: 500; background: var(--accent-soft); color: var(--accent-text); }
.rparams { display: flex; gap: 18px; flex-wrap: wrap; align-items: end; margin-bottom: 14px; }
.rparams > div { display: grid; gap: 4px; }
.rparams > div > span { color: var(--muted); font-size: 13px; font-weight: 600; }
.rparams input[type=text] { width: 96px; }

/* проверка на заказах */
.check { border-top: 1px dashed var(--line); padding-top: 14px; max-width: 1000px; }
.check .codes { width: 280px; }
.res { margin-top: 10px; display: grid; gap: 10px; }
.ord { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--surface); }
.ord .oh { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; padding: 9px 12px; background: var(--surface2); border-bottom: 1px solid var(--line2); }
.ord .oh b { margin-right: 4px; font-family: var(--f-num); }
.ord .ob { padding: 10px 12px; }
.qty { font-weight: 700; font-size: 15px; }
.misses { margin: 4px 0 0; padding-left: 18px; color: var(--muted); font-size: 13px; }
details.vars-all summary { cursor: pointer; color: var(--accent-text); font-size: 13px; margin-top: 8px; font-weight: 600; }
.vtable { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 2px 14px; margin-top: 6px; font-size: 13px; }
.vtable span { font-family: var(--f-num); }

/* справочники 0-Е */
.dict { display: grid; grid-template-columns: minmax(320px, 1.25fr) minmax(360px, 1fr); gap: 14px; align-items: start; }
.dict > * { min-width: 0; }
.dict .search { gap: 8px; flex-wrap: nowrap; }
.dict .search input[type=search] { flex: 1; width: auto; }
.dict .search label.chk { margin-right: 4px; }
.sub { margin-top: 14px; border-top: 1px dashed var(--line); padding-top: 12px; display: grid; gap: 8px; }
.refs { display: flex; flex-wrap: wrap; gap: 6px 0; max-height: 320px; overflow-y: auto; }
.refs > label.chk { min-width: 230px; }
.refgroup { width: 100%; display: flex; flex-wrap: wrap; gap: 4px 0; padding: 6px 0; border-bottom: 1px solid var(--line2); }
.refgroup > div { width: 100%; }
.refgroup > label.chk { min-width: 230px; }
.points td { vertical-align: middle; padding: 6px 8px; }
.points td:last-child { white-space: nowrap; }
.points select { max-width: 200px; }
.points button { min-height: 30px; min-width: 30px; padding: 0 6px; margin-right: 2px; border-width: 1.5px; border-radius: 8px; }
.pagehelp { margin: 0; color: var(--muted); font-size: 14px; max-width: 1100px; }

/* история */
.hist td { font-size: 13.5px; }
.hist .chg { color: var(--muted); }

/* поиск в каталоге */
.cat { margin-top: 8px; border: 1px solid var(--line); border-radius: 10px; max-height: 280px; overflow-y: auto; }
.cat div { padding: 7px 10px; cursor: pointer; border-bottom: 1px solid var(--line2); }
.cat div:hover { background: var(--surface2); }

.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 60; width: max-content; max-width: min(620px, calc(100vw - 32px)); padding: 12px 16px; border-radius: 12px;
  background: #20262B; color: #FFFFFF; font-size: 14.5px; box-shadow: 0 6px 20px rgba(0, 0, 0, .25); border: 1px solid rgba(255, 255, 255, .12); transition: opacity .5s; }
.toast.err { background: var(--err); color: #FFFFFF; }
.toast.gone { opacity: 0; }

/* окна поверх страницы */
dialog.modal { border: 1px solid var(--line); border-radius: var(--r); padding: 0; background: var(--surface); color: var(--ink); width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 40px);
  box-shadow: 0 18px 50px rgba(0, 0, 0, .28); }
dialog.modal.wide { width: min(1280px, calc(100vw - 32px)); }
dialog.modal::backdrop { background: rgba(15, 18, 20, .45); }
dialog.modal[open] { display: flex; flex-direction: column; }
.mhead { display: flex; align-items: center; gap: 10px; padding: 12px 12px 12px 18px; border-bottom: 1px solid var(--line); }
.mhead h2 { margin: 0; font-size: 18px; flex: 1; }
.mhead button.link { width: 40px; height: 40px; border-radius: 10px; font-size: 24px; line-height: 1; text-decoration: none; color: var(--muted); }
.mhead button.link:hover { background: var(--surface2); color: var(--ink); }
.mbody { padding: 16px 18px; overflow: auto; flex: 1; }
.mbody > p:first-child { margin-top: 0; }

/* ---------- отгрузки ---------- */
/* план: слева машины по дням, справа выбранная машина */
.ship { display: grid; grid-template-columns: minmax(330px, 410px) minmax(0, 1fr); gap: 14px; align-items: start; }
.ship > * { min-width: 0; }
.plan { position: sticky; top: 76px; }
.pnav { display: flex; align-items: center; gap: 6px; padding: 10px; border-bottom: 1px solid var(--line2); }
.pnav .ptitle { flex: 1; font-weight: 700; text-align: center; line-height: 1.2; }
.pnav .ptitle small { display: block; color: var(--muted); font-weight: 500; font-size: 12.5px; }
.pnav button { min-width: 40px; padding: 0 10px; }
.tlist { display: flex; flex-direction: column; gap: 6px; padding: 10px; max-height: calc(100vh - 220px); overflow-y: auto; }
.dayh { display: flex; align-items: baseline; gap: 6px; margin: 8px 2px 0; font-size: 13.5px; font-weight: 700; }
.dayh:first-child { margin-top: 0; }
.dayh small { color: var(--muted); font-weight: 500; }
.dayh.today { color: var(--accent-text); }
.dayh.past { color: var(--muted); }
.trow { width: 100%; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 3px 10px; align-items: center; justify-content: stretch; padding: 9px 12px;
  border: 1.5px solid var(--line); border-radius: 12px; background: var(--surface); text-align: left; white-space: normal; font-weight: 400; font-size: 14.5px; }
.trow b { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trow small { display: block; color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trow .tr-n { justify-self: end; font-family: var(--f-num); font-size: 13px; color: var(--muted); white-space: nowrap; }
.trow .tag { justify-self: end; }
.trow.on, .trow.on:hover:not(:disabled) { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); background: var(--accent-soft); }
.trow.st-sent { opacity: .72; }
.tlist .empty { padding: 28px 12px; }
.tlist .empty button { margin-top: 12px; }

/* машина: шапка, шаги, следующий шаг, разделы 1 «Маршрут» и 2 «Заказы» */
.trip .head h2 { flex: none; font-size: 20px; }
.trip .head .cap { flex: 1; min-width: 200px; }
.steps { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; padding: 14px 16px 12px; }
.step { position: relative; min-height: 58px; display: flex; align-items: center; justify-content: flex-start; gap: 9px; padding: 8px 10px; border: 1.5px solid var(--line); border-radius: 12px;
  background: var(--surface); text-align: left; white-space: normal; font-weight: 400; }
.step:not(:last-child)::after { content: ""; position: absolute; right: -9px; top: 50%; width: 8px; height: 2px; background: var(--line); }
.step .st, .tsec-h .st, .nextbar .st { flex: none; width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--line); display: grid; place-items: center; font: 600 14px/1 var(--f-num); color: var(--muted); background: var(--surface); }
.step .st-t { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.step .st-t b { font-size: 14.5px; }
.step .st-t small { font-size: 12.5px; color: var(--muted); }
.step.done .st, .tsec-h .st.done { background: var(--ok); border-color: var(--ok); color: var(--on-st); }
.step.prog .st { border-color: var(--warn); color: var(--warn); }
.step.warn .st { border-color: var(--warn); color: var(--warn); }
.step.warn .st-t small, .step.prog .st-t small { color: var(--warn); font-weight: 600; }
.step.next, .step.next:hover:not(:disabled) { border-color: var(--accent); background: var(--accent-soft); }
.step.next .st, .tsec-h .st.next, .nextbar .st { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.step.next .st-t small { color: var(--accent-text); font-weight: 600; }
.step.cur { box-shadow: 0 0 0 2px var(--ink); border-color: var(--ink); }
.step.cur:hover:not(:disabled) { border-color: var(--ink); }
.nextbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin: 0 16px 16px; padding: 12px 14px; border: 1.5px solid var(--accent); border-radius: 12px; background: var(--accent-soft); }
.nextbar .st { width: 32px; height: 32px; font-size: 15px; }
.nextbar .grow { min-width: 220px; }
.nextbar b { font-size: 15.5px; }
.nextbar .small { font-size: 14px; margin-top: 1px; }
.nextbar.done { border-color: var(--ok); background: var(--ok-soft); }
.nextbar.done .st { background: var(--ok); border-color: var(--ok); color: var(--on-st); }
.tsec { padding: 14px 16px 16px; border-top: 1px solid var(--line2); display: flex; flex-direction: column; gap: 12px; scroll-margin-top: 80px; }
.tsec-h { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; }
.tsec-h h3 { margin: 0; font-size: 17px; display: flex; align-items: center; gap: 9px; }
.tsec-h .cap { flex: 1; min-width: 160px; }
.tfields { display: grid; grid-template-columns: minmax(150px, 1fr) 150px minmax(150px, 1fr) minmax(150px, 1fr) minmax(180px, 1.3fr) auto; gap: 10px 12px; align-items: end; }
.tfields select, .tfields input { width: 100%; }
.tbox { border: 1px solid var(--line2); border-radius: 10px; overflow: auto; }
.tbox .grid th { background: var(--surface2); }
.grid.pts tbody tr, .grid.ords tbody tr { cursor: pointer; }
.addpt { margin-top: 2px; }
.addpt input { width: 200px; }
.ptacts { display: flex; flex-wrap: wrap; gap: 6px; }
.trip-empty { padding: 22px 24px 26px; }
.trip-empty h2 { margin: 0 0 4px; font-size: 19px; }
.trip-empty ol { margin: 14px 0 0; padding: 0; list-style: none; display: grid; gap: 10px; }
.trip-empty li { display: flex; gap: 12px; align-items: flex-start; }
.trip-empty li .st { flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font: 600 14px/1 var(--f-num); background: var(--accent-soft); color: var(--accent-text); }
.trip-empty li small { display: block; color: var(--muted); font-size: 13.5px; }
.stepcard .steps { padding-bottom: 14px; }
.stepcard .nextbar { margin-top: -2px; }

/* выбор готовых заказов */
.selgrid { display: grid; grid-template-columns: minmax(260px, 340px) 1fr; gap: 18px; margin-bottom: 10px; }
.locs { display: flex; flex-direction: column; gap: 6px; max-height: 220px; overflow-y: auto; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; margin-top: 6px; }
.locs .row { gap: 4px 10px; padding-top: 4px; border-top: 1px solid var(--line2); }
.filters { display: flex; flex-wrap: wrap; gap: 10px 14px; align-content: start; }
.filters p { width: 100%; margin: 0; }
.selres { display: grid; grid-template-columns: 1fr 210px; gap: 12px; align-items: start; margin-top: 8px; }
.selres .scroll { max-height: calc(100vh - 460px); min-height: 220px; overflow-y: auto; border: 1px solid var(--line); border-radius: 10px; }
.sum { display: grid; gap: 4px; border-radius: 12px; padding: 12px; background: var(--surface2); font-size: 14px; }
.sum b { font-size: 15px; margin-bottom: 2px; }
tr.picked td { background: var(--accent-soft); }

/* подготовка материалов */
.prephead, .dochead { display: flex; align-items: center; gap: 8px 12px; flex-wrap: wrap; }
.prephead h2, .dochead h2 { margin: 0; font-size: 21px; letter-spacing: -.01em; }
.prepgrid { display: grid; grid-template-columns: minmax(380px, 1fr) minmax(520px, 1.5fr); gap: 14px; align-items: start; }
.prepgrid > * { min-width: 0; }
.prepgrid .list .scroll { max-height: calc(100vh - 330px); }
.prepgrid .list .grid th, .prepgrid .list .grid td { padding-left: 8px; padding-right: 8px; }
.tabbody { padding: 10px 12px; }
.scroll.lines { max-height: calc(100vh - 360px); overflow-y: auto; }
.lines tr.off td { color: var(--muted); text-decoration: line-through; }
.lines tr.off td:first-child, .lines tr.off td input { text-decoration: none; }
.addline { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); }

/* документы на машину — экран и печать A4 */
.docs { display: grid; gap: 16px; justify-content: center; }
.docmiss { max-width: 640px; margin: 8px auto; padding: 22px 24px; text-align: center; display: grid; gap: 12px; justify-items: center; }
.docmiss b { font-size: 17px; }
.dpage { background: #fff; color: #000; width: 210mm; max-width: 100%; min-height: 120mm; padding: 12mm 12mm 14mm; box-shadow: 0 1px 4px rgba(0, 0, 0, .25); font-size: 11pt; border-radius: 2px; }
.dhead { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.dtitle { font-size: 15pt; }
.dpage .brand { display: block; text-align: right; font-weight: 600; font-size: 11pt; white-space: normal; }
.dpage .muted { color: #555; }
.dpage h3 { font-size: 12pt; margin: 12px 0 4px; }
.dgrid { width: 100%; border-collapse: collapse; }
.dgrid th, .dgrid td { border: 1px solid #999; padding: 2px 5px; vertical-align: top; text-align: left; font-family: var(--f-ui); font-size: inherit; font-weight: 400; }
.dgrid th { background: #eee; font-size: 9.5pt; font-weight: 600; }
.dgrid td.num { text-align: right; }
.dgrid tr.pt td { background: #e8eef7; font-weight: 600; }
.dgrid tr.sv td { font-style: italic; }
.dgrid td.box { text-align: center; width: 22px; }
.dgrid.load td:nth-child(5) { min-width: 34mm; }
.dgrid.load td:nth-child(7) { white-space: nowrap; }
.dgrid.load td:nth-child(2) { max-width: 48mm; }
.dgrid.sat td:first-child { width: 90px; }
.dgrid.sat td:last-child { width: 70px; }
.dfoot { margin-top: 8px; font-weight: 600; }
.sign { display: flex; justify-content: space-between; margin-top: 18mm; gap: 20px; }

/* история выдач */
.histctl { padding: 10px 16px; border-bottom: 1px solid var(--line2); gap: 10px; }
.printonly { display: none; }

@media print {
  body { background: #fff; }
  header.top, .noprint, .toast { display: none !important; }
  main { padding: 0; max-width: none; }
  .docs { display: block; }
  .dpage { box-shadow: none; width: auto; padding: 0; min-height: 0; page-break-after: always; }
  .dpage:last-child { page-break-after: auto; }
  .panel { border: 0; }
  .printonly { display: block; }
  .scroll { max-height: none !important; overflow: visible !important; }
  @page { size: A4; margin: 10mm; }
}
@media (max-width: 1280px) {
  .tfields { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1100px) {
  .ship, .prepgrid, .selgrid, .selres { grid-template-columns: 1fr; }
  .plan { position: static; }
  .tlist { max-height: 420px; }
  .steps { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .step:nth-child(3)::after { display: none; }
}
@media (max-width: 860px) {
  .mats, .dict { grid-template-columns: 1fr; }
  .conds td:first-child { width: 96px; }
  label.chk { white-space: normal; }
  .check .codes { width: 100%; }
  .list .scroll { max-height: 320px; }
  .form { grid-template-columns: 1fr; }
  .top { position: static; }
  .me { margin-left: 0; }
  .me span { display: none; }
  .tfields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .step::after { display: none; }
  .tfields { grid-template-columns: 1fr; }
}
