/* ---------- шрифт: Golos Text (OFL, файли в /fonts — працює без інтернету) ---------- */
@font-face { font-family: "Golos Text"; font-style: normal; font-weight: 400 900; font-display: swap;
  src: url(/fonts/golos-text-cyrillic-ext.woff2) format("woff2"); unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F; }
@font-face { font-family: "Golos Text"; font-style: normal; font-weight: 400 900; font-display: swap;
  src: url(/fonts/golos-text-cyrillic.woff2) format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Golos Text"; font-style: normal; font-weight: 400 900; font-display: swap;
  src: url(/fonts/golos-text-latin-ext.woff2) format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Golos Text"; font-style: normal; font-weight: 400 900; font-display: swap;
  src: url(/fonts/golos-text-latin.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

/* ---------- токени: креслярський папір, графіт, верстатна зелена, сигнальні жовта й червона ---------- */
:root {
  --bg: #EDEFEA; --surface: #F8F9F6; --surface-2: #F1F3EF; --text: #1F2428; --muted: #545C62; --line: #D5DAD4;
  --steel: #8C959B; --hover: #E5EDE6;
  --accent: #2E5A4C; --accent-weak: #DCE8E1; --accent-text: #2E5A4C; --on-accent: #F8F9F6;
  --ok: #2E6B4F; --ok-bg: #DCE8E1; --warn: #6E5300; --warn-bg: #F8EBC2; --yellow: #E8B10C; --bad: #C23B2E; --bad-bg: #F6DEDA;
  --info: #3F5563; --info-bg: #E2E8EA; --violet: #1F2428; --violet-bg: #E1E4DF;
  --shadow: none; --shadow-lg: 0 16px 48px rgba(31, 36, 40, .22);
  --radius: 14px; --side: 216px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14181B; --surface: #1C2125; --surface-2: #22282C; --text: #E6E9E4; --muted: #A9B1AC; --line: #2C3338;
    --steel: #78838A; --hover: #252D2F;
    --accent: #74B89F; --accent-weak: #20342D; --accent-text: #8FCBB3; --on-accent: #14181B;
    --ok: #74B89F; --ok-bg: #20342D; --warn: #F0C33C; --warn-bg: #3A3115; --yellow: #F0C33C; --bad: #F07A6B; --bad-bg: #3D201C;
    --info: #A9C1CE; --info-bg: #243038; --violet: #E6E9E4; --violet-bg: #2A3034;
    --shadow: none; --shadow-lg: 0 16px 48px rgba(0, 0, 0, .6);
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text); font: 15.5px/1.5 "Golos Text", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; font-variant-numeric: tabular-nums;
  display: grid; grid-template-columns: var(--side) minmax(0, 1fr); min-height: 100vh;
}
h1, h2, h3 { margin: 0; line-height: 1.2; }
h1 { font-size: 28px; font-weight: 700; letter-spacing: -.02em; }
h2 { font-size: 17px; }
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }
small { color: var(--muted); font-size: .82em; }
.muted { color: var(--muted); }
.icon { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- каркас ---------- */
.side { position: sticky; top: 0; height: 100vh; background: var(--bg); border-right: 1px solid var(--line); padding: 20px 12px; display: flex; flex-direction: column; gap: 14px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; color: var(--text); padding: 0 10px 6px; }
.brand:hover { text-decoration: none; }
.logo { width: 30px; height: 30px; border-radius: 8px; background: var(--accent); color: var(--on-accent); display: grid; place-items: center; font-weight: 800; font-size: 13px; letter-spacing: -.02em; }
.side nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.side nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--muted); font-weight: 500; }
.side nav a:hover { background: var(--surface); color: var(--text); text-decoration: none; }
.side nav a.active { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: inset 3px 0 0 var(--accent); }
.side nav .grp { margin: 16px 10px 4px; font-size: 12.5px; color: var(--steel); }
.side nav .more { display: none; }
.side .sheet { display: none; }
.side-foot { display: flex; flex-direction: column; gap: 10px; }
.who { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.user-select { font-size: 14px; }
.lang { display: flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.lang button { flex: 1; border: 0; background: none; padding: 6px; border-radius: 7px; font-weight: 600; font-size: 13px; color: var(--muted); cursor: pointer; }
.lang button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.main { padding: 26px 34px 60px; min-width: 0; max-width: 1500px; width: 100%; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head .actions, .card-head .actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.back { display: inline-flex; align-items: center; gap: 2px; color: var(--muted); font-size: 14px; margin-bottom: 6px; }
.back .icon { width: 16px; height: 16px; }

/* ---------- кнопки и поля ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 40px; padding: 8px 15px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font: inherit; font-weight: 600; font-size: 15px; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { filter: brightness(1.07); }
.btn.danger { background: var(--bad); border-color: var(--bad); color: var(--on-accent); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.sm { min-height: 32px; padding: 4px 10px; font-size: 13.5px; border-radius: 8px; }
.btn.lg { min-height: 56px; font-size: 18px; border-radius: 14px; padding: 12px 22px; }
.btn.ok { background: var(--ok); border-color: var(--ok); color: var(--on-accent); }
input, select, textarea { font: inherit; font-size: 15px; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 9px; padding: 8px 11px; min-height: 40px; width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
input[type=checkbox] { width: 18px; height: 18px; min-height: 0; accent-color: var(--accent); }
textarea { min-height: 84px; resize: vertical; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field .lbl { font-size: 13px; font-weight: 600; color: var(--muted); }
.field .hint { font-size: 12.5px; color: var(--muted); }
.check { display: flex; align-items: center; gap: 9px; font-size: 15px; cursor: pointer; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar input[type=search], .toolbar .search { max-width: 320px; }
.toolbar select { width: auto; min-width: 150px; }

/* ---------- карточки и таблицы ---------- */
.card { background: var(--surface); border: 0; border-radius: var(--radius); padding: 18px 22px; margin-bottom: 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.card.flush { padding: 0; overflow: hidden; }
.card.flush .card-head { padding: 16px 20px 0; }
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 15px; }
th { text-align: left; font-size: 13px; color: var(--steel); font-weight: 500; padding: 10px 12px; border-bottom: 1px solid var(--line); background: transparent; white-space: nowrap; }
td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--surface-2); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.num.zero { color: var(--muted); }
.num.low { color: var(--bad); font-weight: 600; }
.pn { font-weight: 600; font-variant-numeric: tabular-nums; }
.sub { color: var(--muted); font-size: 13px; }
.empty { text-align: center; color: var(--muted); padding: 34px 16px; }
.empty p { margin: 0 0 12px; }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: 12.5px; font-weight: 600; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); white-space: nowrap; }
.badge.ok { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.badge.warn { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.badge.bad { background: var(--bad-bg); color: var(--bad); border-color: transparent; }
.badge.info { background: var(--info-bg); color: var(--info); border-color: transparent; }
.badge.accent { background: var(--violet-bg); color: var(--violet); border-color: transparent; }
.error-card { border-color: var(--bad); }

/* ---------- склад: переключатель и дерево ---------- */
.wh-tabs { display: inline-flex; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 4px; gap: 4px; box-shadow: var(--shadow); flex-wrap: wrap; }
.wh-tabs button { border: 0; background: none; padding: 9px 20px; border-radius: 9px; font: inherit; font-weight: 600; color: var(--muted); cursor: pointer; }
.wh-tabs button.on { background: var(--accent); color: var(--on-accent); }
.product-card { padding: 0; overflow: hidden; }
.product-head { display: flex; align-items: center; gap: 16px; padding: 16px 20px; flex-wrap: wrap; border-bottom: 1px solid var(--line); }
.product-head h2 { font-size: 20px; }
.pills { display: flex; gap: 8px; flex-wrap: wrap; }
.pill { padding: 5px 12px; border-radius: 999px; font-size: 13.5px; font-weight: 600; background: var(--surface-2); border: 1px solid var(--line); color: var(--muted); }
.pill.ok { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.pill.bad { background: var(--bad-bg); color: var(--bad); border-color: transparent; }
.tree th, .tree td { padding: 9px 10px; }
.tree td.node { min-width: 300px; }
.tree .indent { display: inline-flex; align-items: center; gap: 4px; }
.tree .caret { flex: none; width: 22px; height: 22px; border: 0; background: none; border-radius: 6px; cursor: pointer; color: var(--muted); display: inline-grid; place-items: center; padding: 0; }
.tree .caret:hover { background: var(--surface-2); }
.tree .caret .icon { width: 15px; height: 15px; transition: transform .12s; }
.tree .caret.open .icon { transform: rotate(90deg); }
.tree .caret.none { visibility: hidden; }
.tree tr.lvl0 td { background: var(--surface-2); font-weight: 600; }
.tree tr.lvl1 td.node { font-weight: 600; }
.tree .cell { display: inline-block; min-width: 40px; text-align: right; font-variant-numeric: tabular-nums; }
.tree .cell.zero { color: var(--line); }
.tree .stage-ordered { color: var(--info); font-weight: 600; }
.tree .stage-paid { color: var(--violet); font-weight: 600; }
.tree .stage-shipped { color: var(--warn); font-weight: 600; }
.tree .stage-partner { color: var(--ok); font-weight: 600; }
.tree .miss { font-weight: 700; color: var(--bad); }
.tree .miss-ok { color: var(--ok); font-weight: 700; }
.tree small.expect { display: block; text-align: right; color: var(--ok); }
.tree .chips { display: inline-flex; gap: 6px; margin-left: 8px; }
.tree .th-help { cursor: help; border-bottom: 1px dotted var(--muted); }
.menu-btn { border: 0; background: none; cursor: pointer; color: var(--muted); padding: 4px 6px; border-radius: 7px; }
.menu-btn:hover { background: var(--surface-2); color: var(--text); }
.menu { position: absolute; z-index: 40; min-width: 220px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 6px; }
.menu button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 9px 12px; border-radius: 8px; font: inherit; font-size: 14.5px; color: var(--text); cursor: pointer; }
.menu button:hover { background: var(--surface-2); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 5px 0; }

/* ---------- доски (канбан) ---------- */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: 14px; overflow-x: auto; padding-bottom: 8px; align-items: start; }
.col { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; min-height: 160px; }
.col.over { outline: 2px dashed var(--accent); outline-offset: -3px; background: var(--accent-weak); }
.col-head { display: flex; align-items: center; justify-content: space-between; padding: 4px 6px 10px; font-weight: 700; font-size: 14px; }
.col-head .count { background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 0 9px; font-size: 12.5px; color: var(--muted); }
.kcard { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px; margin-bottom: 9px; box-shadow: var(--shadow); cursor: pointer; display: flex; flex-direction: column; gap: 6px; }
.kcard:hover { border-color: var(--accent); }
.kcard.dragging { opacity: .45; }
.kcard .top { display: flex; justify-content: space-between; gap: 8px; font-weight: 700; }
.kcard .meta { font-size: 13px; color: var(--muted); display: flex; gap: 10px; flex-wrap: wrap; }
.kcard .late { color: var(--bad); font-weight: 600; }
.kcard .soon { color: var(--warn); font-weight: 600; }
.progress { height: 7px; border-radius: 99px; background: var(--line); overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.progress.ok > i { background: var(--ok); }
.stepper { display: flex; gap: 0; margin: 4px 0 18px; overflow-x: auto; }
.step { flex: 1; min-width: 108px; text-align: center; position: relative; padding-top: 34px; font-size: 13.5px; font-weight: 600; color: var(--muted); cursor: default; }
.step::before { content: ""; position: absolute; top: 13px; left: 0; right: 0; height: 3px; background: var(--line); }
.step:first-child::before { left: 50%; }
.step:last-child::before { right: 50%; }
.step i { position: absolute; top: 3px; left: 50%; transform: translateX(-50%); width: 24px; height: 24px; border-radius: 50%; background: var(--surface); border: 3px solid var(--line); z-index: 1; display: grid; place-items: center; font-style: normal; }
.step.done { color: var(--text); }
.step.done::before, .step.cur::before { background: var(--accent); }
.step.done i { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.step.cur i { border-color: var(--accent); }
.step.cur { color: var(--accent-text); }
.step.cur::after { content: ""; }
.step .icon { width: 13px; height: 13px; stroke-width: 3; }
.step.click { cursor: pointer; }
.step.click:hover { color: var(--text); }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 14px 22px; font-size: 14.5px; }
.timeline li::before { content: ""; position: absolute; left: 4px; top: 6px; width: 9px; height: 9px; border-radius: 50%; background: var(--accent); }
.timeline li::after { content: ""; position: absolute; left: 8px; top: 16px; bottom: -4px; width: 1px; background: var(--line); }
.timeline li:last-child::after { display: none; }
.kv { display: grid; grid-template-columns: 170px 1fr; gap: 6px 14px; font-size: 15px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.stat-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; background: var(--surface); }
.stat-card h3 { font-size: 16px; margin-bottom: 10px; }
.metric { display: flex; justify-content: space-between; padding: 4px 0; font-size: 14.5px; border-bottom: 1px dashed var(--line); }
.metric:last-child { border-bottom: 0; }
.metric b { font-variant-numeric: tabular-nums; }
.tabs { display: inline-flex; gap: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 4px; margin-bottom: 18px; box-shadow: var(--shadow); flex-wrap: wrap; }
.tabs button, .tabs a { border: 0; background: none; padding: 8px 18px; border-radius: 9px; font: inherit; font-weight: 600; color: var(--muted); cursor: pointer; }
.tabs .on { background: var(--accent-weak); color: var(--accent-text); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 18px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 13px 16px; box-shadow: var(--shadow); }
.kpi b { display: block; font-size: 26px; letter-spacing: -.02em; }
.kpi span { color: var(--muted); font-size: 13px; }
.kpi.bad b { color: var(--bad); }
.kpi.ok b { color: var(--ok); }
.hint-card { background: var(--accent-weak); border-color: transparent; color: var(--accent-text); }
.hint-card ol { margin: 8px 0 0; padding-left: 20px; }

/* ---------- модальные окна, тосты ---------- */
.backdrop { position: fixed; inset: 0; background: rgba(15, 20, 30, .5); display: flex; align-items: flex-start; justify-content: center; padding: 5vh 14px; z-index: 100; overflow-y: auto; }
.modal { background: var(--surface); border-radius: 16px; box-shadow: var(--shadow-lg); width: 100%; max-width: 560px; border: 1px solid var(--line); }
.modal.wide { max-width: 880px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal-head .x { border: 0; background: none; font-size: 26px; line-height: 1; cursor: pointer; color: var(--muted); border-radius: 8px; width: 34px; height: 34px; }
.modal-head .x:hover { background: var(--surface-2); }
.modal-body { padding: 18px 20px; display: flex; flex-direction: column; gap: 14px; }
.modal-foot { display: flex; flex-wrap: wrap; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 16px 16px; }
.modal-foot > :last-child { margin-left: auto; }   /* перенеслась на свій рядок (вузький екран) — праворуч, як завжди */
.confirm-text { margin: 0; }
#toasts { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 200; align-items: center; width: calc(100% - 24px); pointer-events: none; }
.toast { background: var(--text); color: var(--bg); padding: 11px 18px; border-radius: 12px; box-shadow: var(--shadow-lg); font-size: 15px; max-width: 560px; transition: opacity .3s; }
.toast.error { background: #b42318; }
.toast.out { opacity: 0; }
.lines input, .lines select { min-height: 36px; padding: 5px 8px; }
.lines td { padding: 6px 6px; }
/* вікно ролі: розділ × три галочки; на телефоні — дрібніші заголовки колонок (вміщує вікно перенос підвалу .modal-foot) */
table.rights th.num, table.rights td.num { text-align: center; }
table.rights .cell-check { display: inline-flex; padding: 4px; cursor: pointer; }
@media (max-width: 600px) {
  table.rights th, table.rights td { padding: 8px 4px; }
  table.rights th.num { font-size: 11px; white-space: normal; }
}
.lines .del { border: 0; background: none; color: var(--muted); font-size: 20px; cursor: pointer; }
.lines .del:hover { color: var(--bad); }
.picker { min-width: 240px; }

/* ---------- инструкции ---------- */
.steps { display: flex; flex-direction: column; gap: 14px; }
.istep { display: grid; grid-template-columns: 38px 1fr; gap: 14px; }
.istep .no { width: 38px; height: 38px; border-radius: 50%; background: var(--accent); color: var(--on-accent); display: grid; place-items: center; font-weight: 700; }
.istep.done .no { background: var(--ok); }
.istep .body { display: flex; flex-direction: column; gap: 10px; }
.istep p { margin: 0; font-size: 17px; white-space: pre-wrap; }
.istep img { max-width: min(100%, 520px); border-radius: 12px; border: 1px solid var(--line); cursor: zoom-in; background: #fff; }
.step-edit { display: grid; grid-template-columns: 30px 1fr 150px auto; gap: 10px; align-items: start; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); }
.step-edit img { width: 150px; height: 100px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); background: #fff; }
.img-drop { width: 150px; height: 100px; border: 2px dashed var(--line); border-radius: 8px; display: grid; place-items: center; color: var(--muted); font-size: 13px; text-align: center; cursor: pointer; padding: 6px; }
.lightbox { position: fixed; inset: 0; background: rgba(0, 0, 0, .86); z-index: 300; display: grid; place-items: center; padding: 16px; cursor: zoom-out; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 10px; background: #fff; }

/* ---------- рабочий экран (телефон / планшет) ---------- */
.task-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.task { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 18px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 12px; }
.task h3 { font-size: 20px; }
.qty-stepper { display: inline-flex; align-items: center; gap: 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--surface); }
.qty-stepper button { border: 0; background: var(--surface-2); width: 52px; height: 52px; font-size: 26px; cursor: pointer; color: var(--text); }
.qty-stepper input { width: 84px; text-align: center; font-size: 22px; font-weight: 700; border: 0; border-radius: 0; min-height: 52px; }
.timer { font-variant-numeric: tabular-nums; font-size: 30px; font-weight: 800; display: flex; align-items: center; gap: 10px; }
.timer.run { color: var(--ok); }
.timer .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--line); }
.timer.run .dot { background: var(--ok); animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { opacity: .25; } }
.sticky-actions { position: sticky; bottom: 0; background: var(--surface); border-top: 1px solid var(--line); padding: 12px 0 calc(12px + env(safe-area-inset-bottom)); margin-top: 8px; display: flex; gap: 10px; flex-wrap: wrap; z-index: 5; }
.sticky-actions .btn { flex: 1; min-width: 150px; }

/* ---------- адаптив ---------- */
@media (max-width: 980px) {
  body { grid-template-columns: minmax(0, 1fr); }
  .side { position: static; height: auto; flex-direction: row; align-items: center; flex-wrap: wrap; padding: 10px 12px; gap: 8px 14px; border-right: 0; border-bottom: 1px solid var(--line); }
  /* меню — нижня панель з підписами; довідники й налаштування — під кнопкою «Ще» */
  .side nav { position: fixed; z-index: 30; left: 0; right: 0; bottom: 0; flex: none; flex-direction: row; justify-content: space-around; gap: 0;
    padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--line); }
  .side nav a, .side nav .more { flex-direction: column; justify-content: center; gap: 2px; font-size: 11.5px; padding: 6px 4px; min-width: 62px; border-radius: 8px; }
  .side nav a.active { box-shadow: inset 0 3px 0 var(--accent); background: transparent; }
  .side nav .grp, .side nav a.ref, .side nav a.pm { display: none; }
  /* липкі дії менеджера стоять над нижньою панеллю меню, а не під нею */
  body:not(.role-worker) .rc-actions { bottom: calc(60px + env(safe-area-inset-bottom)); }
  .side nav .more { display: flex; align-items: center; border: 0; background: none; color: var(--muted); font: inherit; font-size: 11.5px; font-weight: 500; cursor: pointer; }
  .side .sheet { position: fixed; z-index: 31; right: 8px; bottom: calc(66px + env(safe-area-inset-bottom)); min-width: 220px; background: var(--surface); border: 1px solid var(--line);
    border-radius: 12px; box-shadow: var(--shadow-lg); padding: 6px; flex-direction: column; }
  .side.more-open .sheet { display: flex; }
  .side .sheet a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 8px; color: var(--text); }
  .role-worker .side nav { display: none; }
  .side { min-width: 0; }
  .user-select { max-width: 150px; }
  .sticky-actions .btn { min-width: 120px; }
  .page-head { align-items: flex-start; }
  .side-foot { flex-direction: row; align-items: center; margin-left: auto; }
  .who span { display: none; }
  .main { padding: 18px 14px 80px; }
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 1fr; }
  .step-edit { grid-template-columns: 24px 1fr; }
  h1 { font-size: 22px; }
  .tree td.node { min-width: 220px; }
}
@media (max-width: 560px) {
  .task-list { grid-template-columns: 1fr; }
  .modal { border-radius: 14px; }
  .backdrop { padding: 2vh 8px; }
  .btn.lg { width: 100%; }
}

/* ---------- вкладка BOM: дерево карточек ---------- */
.bom-page { display: flex; flex-direction: column; height: calc(100vh - 86px); min-height: 520px; }
.bom-page .page-head { margin-bottom: 6px; }
.bom-root { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 14px; }
.bom-root select { min-width: 280px; }
.bom-hint { margin: 0 0 12px; font-size: 13px; color: var(--muted); }
.bom-main { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 320px; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.bom-vp { position: relative; overflow: hidden; cursor: grab; background: var(--bg); background-image: radial-gradient(var(--line) 1px, transparent 1px); background-size: 22px 22px; touch-action: none; }
.bom-vp.drag { cursor: grabbing; }
.bworld { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.bworld.smooth { transition: transform .5s cubic-bezier(.2, .8, .2, 1); }
.bnode, .bln { position: absolute; transition: left .45s cubic-bezier(.2, .8, .2, 1), top .45s cubic-bezier(.2, .8, .2, 1), width .45s cubic-bezier(.2, .8, .2, 1), height .45s cubic-bezier(.2, .8, .2, 1), opacity .35s; }
.bln { background: var(--muted); opacity: .55; }
.bnode.card { width: 200px; padding: 0; margin: 0; border: 1.5px solid var(--line); border-radius: 10px; cursor: pointer; user-select: none; }
.bnode.card:hover { border-color: var(--accent); }
.bnode.card.sel { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-weak), var(--shadow); }
.bnode.card.flash { animation: bflash 1.2s ease; }
@keyframes bflash { 0%, 40% { box-shadow: 0 0 0 6px var(--ok-bg); } 100% { box-shadow: var(--shadow); } }
.bnode .pic { height: 40px; border-radius: 9px 9px 0 0; background: var(--surface-2); display: grid; place-items: center; color: var(--muted); }
.bnode.kind-engine .pic { background: var(--violet-bg); color: var(--violet); }
.bnode.kind-assembly .pic { background: var(--accent-weak); color: var(--accent-text); }
.bnode .body { padding: 6px 10px 8px; }
.bnode .pn { font-weight: 700; font-size: 13px; display: flex; align-items: center; gap: 6px; }
.bnode .qty { margin-left: auto; font-size: 12px; font-weight: 700; background: var(--accent-weak); color: var(--accent-text); border-radius: 6px; padding: 0 6px; }
.bnode .qty:hover { outline: 1.5px dashed var(--accent); }
.bnode .nm { font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin: 1px 0 4px; }
.bnode .meta { display: flex; gap: 5px; align-items: center; font-size: 11px; color: var(--muted); }
.bnode .chip { border-radius: 5px; padding: 0 5px; font-size: 10.5px; font-weight: 600; background: var(--surface-2); }
.bnode .chip.qc { background: var(--warn-bg); color: var(--warn); }
.bnode .cost { margin-top: 4px; font-size: 12px; font-weight: 600; }
.bnode .cost.warn { color: var(--warn); }
.bnode .cost.muted { color: var(--muted); font-weight: 400; }
.bnode .tg { position: absolute; left: 50%; bottom: -12px; transform: translateX(-50%); min-width: 24px; height: 22px; padding: 0 7px; border-radius: 11px; border: 1.5px solid var(--line); background: var(--surface); color: var(--muted); font-size: 11.5px; font-weight: 700; display: grid; place-items: center; }
.bnode.card:hover .tg, .bnode.card.open .tg { border-color: var(--accent); color: var(--accent-text); }
.bplus { position: absolute; right: 6px; top: 6px; width: 26px; height: 26px; border-radius: 7px; border: 1px solid var(--line); background: var(--surface); color: var(--accent-text); font-weight: 700; cursor: pointer; opacity: 0; transition: opacity .15s; }
.bnode.card:hover .bplus, .bnode.card.sel .bplus { opacity: 1; }
.bplus:hover { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.bghost { width: 124px; height: 76px; border: 1.5px dashed var(--line); border-radius: 10px; color: var(--accent-text); display: grid; place-items: center; text-align: center; font-size: 13px; font-weight: 600; cursor: pointer; }
.bghost:hover { border-color: var(--accent); background: var(--accent-weak); }
.bzoom { position: absolute; right: 12px; bottom: 12px; display: flex; gap: 6px; z-index: 3; }
.bzoom button { min-width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font-size: 17px; cursor: pointer; box-shadow: var(--shadow); }
.bzoom button.wide { padding: 0 12px; font-size: 14px; }
.bpanel { border-left: 1px solid var(--line); padding: 16px; overflow: auto; }
.bpanel h2 { font-size: 20px; margin: 8px 0 2px; }
.bpanel h3 { font-size: 14px; margin: 14px 0 6px; }
.bpanel .sub { color: var(--muted); }
.bkv { display: grid; grid-template-columns: auto 1fr; gap: 5px 12px; font-size: 14px; margin: 12px 0 0; }
.bkv dt { color: var(--muted); }
.bkv dd { margin: 0; }
.blist { list-style: none; padding: 0; margin: 0 0 12px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.blist li { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-top: 1px solid var(--line); font-size: 13.5px; }
.blist li:first-child { border-top: 0; }
.blist li b { flex: none; }
.blist li .nm { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--muted); }
.blist .q, .blist .rm { border: 1px solid var(--line); background: var(--surface); color: var(--text); border-radius: 7px; padding: 2px 7px; cursor: pointer; font: inherit; font-size: 12.5px; }
.blist .q:hover { border-color: var(--accent); color: var(--accent-text); }
.blist .rm { color: var(--bad); }
.blist .rm:hover { background: var(--bad-bg); }
.bpop { position: fixed; z-index: 60; width: 360px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.bpop h3 { margin: 0; font-size: 15px; }
.bpop .tabs { display: flex; gap: 6px; }
.bpop .tabs button { flex: 1; }
.bpop .tabs button.on { background: var(--accent-weak); border-color: var(--accent); color: var(--accent-text); }
.bpop .res { max-height: 220px; overflow: auto; border: 1px solid var(--line); border-radius: 9px; }
.bpop .res > div { padding: 7px 10px; border-top: 1px solid var(--line); cursor: pointer; font-size: 13.5px; }
.bpop .res > div:first-child { border-top: 0; }
.bpop .res > div:hover, .bpop .res > div.on { background: var(--accent-weak); }
.bpop .res p { margin: 10px; }
.bpop .brow { display: flex; align-items: center; gap: 8px; }
.bpop .brow > span { width: 92px; flex: none; color: var(--muted); font-size: 13px; }
.bpop .brow input, .bpop .brow select { flex: 1; min-width: 0; }
.bpop .acts { display: flex; gap: 8px; justify-content: flex-end; margin-top: 4px; }
@media (max-width: 980px) {
  .bom-page { height: auto; }
  .bom-main { grid-template-columns: 1fr; }
  .bom-vp { height: 62vh; }
  .bpanel { border-left: 0; border-top: 1px solid var(--line); }
  .bom-root select { min-width: 0; max-width: 60vw; }
}
#view.busy { cursor: progress; }

/* ---------- склад: фільтри, підсвічування, «їде» ---------- */
.page-sub { margin: 4px 0 0; font-size: 14.5px; }
.seg { display: inline-flex; background: var(--surface); border: 1px solid var(--line); border-radius: 9px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: none; padding: 5px 12px; border-radius: 6px; cursor: pointer; color: var(--muted); font: inherit; font-weight: 500; }
.seg button[aria-pressed="true"] { background: var(--text); color: var(--bg); }
.fbar { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.frow { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.frow .sp { flex: 1; }
.fprod, .fplan { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 14.5px; }
.fprod select { width: auto; font-weight: 600; }
.fprod b { color: var(--text); }
.fplan input { width: calc(var(--digits, 3) * 1ch + 50px); text-align: right; font-weight: 700; }  /* ширина — під цифри (App.fitDigits) */
.fbar select { width: auto; }
.search { position: relative; display: flex; align-items: center; }
.search .icon { position: absolute; left: 10px; width: 17px; height: 17px; color: var(--steel); pointer-events: none; }
.search input { width: 260px; padding-left: 34px; padding-right: 30px; }
.search kbd { position: absolute; right: 8px; font: 600 12px/1 inherit; color: var(--steel); border: 1px solid var(--line); border-radius: 4px; padding: 3px 6px; }
.search input:focus + kbd, .search input:not(:placeholder-shown) + kbd { display: none; }
@media (hover: none) { .search kbd { display: none; } }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chips button { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line); background: var(--surface); border-radius: 16px; padding: 5px 12px; cursor: pointer; color: var(--muted); font: inherit; font-weight: 500; }
.chips button b { font-weight: 700; color: var(--text); }
.chips button i { width: 8px; height: 8px; border-radius: 50%; }
.chips .c-no i { background: var(--bad); }
.chips .c-cov i { background: var(--yellow); }
.chips .c-ok i { background: var(--ok); }
.chips button[aria-checked="true"] { background: var(--text); border-color: var(--text); color: var(--bg); }
.chips button[aria-checked="true"] b { color: var(--bg); }
.chips button:disabled { opacity: .45; cursor: default; }
.fsel { display: flex; gap: 8px; flex-wrap: wrap; }
.fmore { display: none; }
.frow.active { gap: 6px; font-size: 13.5px; color: var(--muted); }
.frow.active .tag { display: inline-flex; align-items: center; gap: 4px; background: var(--accent-weak); color: var(--text); border-radius: 14px; padding: 2px 4px 2px 10px; }
.frow.active .tag button { border: 0; background: none; cursor: pointer; width: 22px; height: 22px; border-radius: 50%; color: var(--muted); font-size: 16px; line-height: 1; }
.frow.active .tag button:hover { background: var(--surface); color: var(--text); }
.frow.active .reset { border: 0; background: none; color: var(--accent-text); font: inherit; font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
/* фільтри дошок документів: рядок шуканої деталі на картці / у списку */
.df-hit { font-size: 13px; font-weight: 600; color: var(--accent-text); font-variant-numeric: tabular-nums; }
td .df-hit { font-weight: 500; }
#df select { width: auto; max-width: 260px; }
#df .search input { width: 320px; }
@media (max-width: 760px) { #df select { flex: 1 1 100%; max-width: none; } #df .search input { width: 100%; } }
.stock-sum { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.stock-page .table-wrap { background: var(--surface); border-radius: var(--radius); }
.stock-page .tree th { padding: 12px 12px 10px; }
.stock-page .tree th:first-child { padding-left: 16px; }
.stock-page .tree td { padding: 9px 12px; }
.stock-page .tree td.node { padding-left: 10px; }
.stock-page .tree tr.lvl0 td { background: transparent; }
.tree tbody tr { transition: background-color .12s; }
.tree tbody tr:not(.detail):hover, .tree tbody tr:not(.detail):focus-within { background: var(--hover); }
.tree tbody tr:not(.detail):hover .pn { text-decoration: underline; text-decoration-color: var(--steel); text-underline-offset: 3px; }
.tree a.pn { color: inherit; text-decoration: none; }
.tree a.pn:hover, .tree a.pn:focus-visible { text-decoration: underline; text-decoration-color: currentColor; text-underline-offset: 3px; }
.tree tbody tr:focus-visible { outline: 2.5px solid var(--accent); outline-offset: -2.5px; }
.tree tr.short td:first-child { box-shadow: inset 3px 0 0 var(--bad); }
.tree tr.cov td:first-child { box-shadow: inset 3px 0 0 var(--yellow); }
.tree tr.fine:not(.lvl0) td { color: var(--muted); }
.tree tr.fine:not(.lvl0) .pn { color: var(--text); font-weight: 500; }
.tree tr.ctx td, .tree tr.ctx .pn { color: var(--steel); }
.tree .nm { color: var(--muted); }
.tree tr.lvl0 .nm, .tree tr.lvl1 .nm { color: inherit; }
.tree .chip { display: inline-block; font-size: 12px; font-weight: 600; padding: 1px 7px; border-radius: 10px; background: var(--accent-weak); color: var(--accent-text); margin-left: 8px; vertical-align: 1px; }
.tree .where { display: block; font-size: 12.5px; color: var(--steel); }
.tree .miss { color: var(--bad); font-weight: 700; }
.tree .covered { color: var(--warn); font-weight: 700; white-space: nowrap; }
.tree .miss-ok { color: var(--ok); font-weight: 700; }
.tree .way-btn { border: 0; background: none; padding: 2px 4px; margin: -2px -4px; border-radius: 4px; cursor: pointer; font: inherit; color: var(--warn); font-weight: 600; text-decoration: underline dotted; text-underline-offset: 3px; }
.tree .way-btn.draft { color: var(--muted); font-weight: 500; }
.tree .way-btn[aria-expanded="true"] { background: var(--warn-bg); }
.tree tr.detail td { background: var(--bg); font-size: 14px; color: var(--muted); padding: 10px 16px 12px 58px; }
.tree tr.detail b { color: var(--text); }
.tree tr.detail .draft { color: var(--bad); margin: 0; }
.tree tr.detail .inc + .draft { margin-top: 6px; }
/* розбивка «Їде»: документ на рядок */
.tree tr.detail table.inc { width: auto; font-size: 14px; }
.tree tr.detail .inc td { padding: 3px 22px 3px 0; border: 0; background: transparent; white-space: nowrap; }
.tree tr.detail .inc td:last-child { padding-right: 0; }
.tree tr.detail .inc td.who { color: var(--text); white-space: normal; }
.tree tr.detail .inc a.doc { color: var(--text); font-weight: 600; }
.tree tr.detail .inc .pay { font-weight: 600; }
.tree tr.detail .inc .pay.yes { color: var(--ok); }
.tree tr.detail .inc .pay.part { color: var(--warn); }
.tree tr.detail .inc .pay.no { color: var(--bad); }
.tree td.act { width: 1%; white-space: nowrap; }
.tree .ra { display: inline-flex; gap: 6px; align-items: center; justify-content: flex-end; }
.tree .ra .menu-btn { opacity: 0; transition: opacity .12s; }
.tree tr:hover .ra .menu-btn, .tree tr:focus-within .ra .menu-btn { opacity: 1; }
@media (hover: none) { .tree .ra .menu-btn { opacity: 1; } }
.legend-line { margin-top: 12px; color: var(--muted); font-size: 13.5px; }
@media (max-width: 760px) {
  .fmore { display: inline-flex; }
  .fsel { display: none; width: 100%; }
  .fbar.open .fsel { display: flex; }
  .fsel select { flex: 1 1 140px; }
  .search, .search input { width: 100%; }
  .chips { flex-wrap: nowrap; overflow-x: auto; width: 100%; padding-bottom: 2px; }
  .chips button { flex: none; }
  .frow .sp { display: none; }
  .tree .hide-sm { display: none; }
  .stock-page .tree td.node { min-width: 0; }
  .tree .nm { display: block; font-size: 13.5px; }
  .tree tr.detail td { padding-left: 16px; }
  /* телефон: рядок документа переноситься на два */
  .tree tr.detail table.inc, .tree tr.detail .inc tbody { display: block; }
  .tree tr.detail .inc tr { display: flex; flex-wrap: wrap; gap: 2px 12px; padding: 6px 0; border-bottom: 1px solid var(--line); }
  .tree tr.detail .inc tr:last-child { border-bottom: 0; }
  .tree tr.detail .inc td { padding: 0; white-space: normal; }
  .tree tr.detail .inc td:empty { display: none; }
}
.stock-page .tree { --ind: 22px; }
@media (max-width: 760px) {
  .stock-page .tree { --ind: 10px; }
  .stock-page .tree th, .stock-page .tree td { padding: 8px 6px; }
  .stock-page .tree th:first-child, .stock-page .tree td.node { padding-left: 8px; }
  .stock-page .tree th { white-space: normal; line-height: 1.25; }
  .tree .covered { white-space: normal; }
  .tree .ra .btn { display: none; }
  .tree .ra .menu-btn { opacity: 1; padding: 4px 2px; }
}

/* ---------- «Сьогодні»: шкала збірки — єдиний виразний елемент ---------- */
.today-page .page-head { align-items: flex-start; }
.build { background: var(--surface); border-radius: var(--radius); padding: 22px 24px 20px; margin-bottom: 14px; }
.build-top { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.build-top h2 { font-size: 20px; font-weight: 700; margin: 0; }
.build .pn { color: var(--steel); font-weight: 600; }
.build .plan { margin-left: auto; display: flex; align-items: center; gap: 8px; color: var(--muted); }
.build .plan input { width: calc(var(--digits, 3) * 1ch + 50px); text-align: right; font-weight: 700; }
.verdict { display: flex; align-items: baseline; gap: 12px; margin: 16px 0 12px; flex-wrap: wrap; }
.verdict .big { font-size: 56px; font-weight: 800; line-height: .9; letter-spacing: -.04em; color: var(--accent); }
.verdict .of { font-size: 22px; font-weight: 600; color: var(--muted); }
.verdict .say { font-size: 17px; font-weight: 500; }
.ladder { display: grid; gap: 5px; }
.ladder.bars { display: flex; }
.ladder.bars .u { flex-basis: 0; min-width: 34px; }
.ladder .u { height: 46px; border-radius: 6px; display: grid; place-items: center; font-size: 13px; font-weight: 700;
  background: transparent; border: 1.5px dashed var(--line); color: transparent;
  transition: background-color .35s, border-color .35s, color .35s; transition-delay: calc(var(--i, 0) * 60ms); }
.ladder.on .u.ok { background: var(--accent); border: 1.5px solid var(--accent); color: var(--on-accent); }
.ladder.on .u.way { border: 1.5px solid var(--yellow); color: var(--warn);
  background: repeating-linear-gradient(-45deg, var(--warn-bg) 0 7px, transparent 7px 13px); }
.ladder.on .u.no { border: 1.5px dashed var(--bad); color: var(--bad); }
@media (prefers-reduced-motion: reduce) { .ladder .u { transition: none; } }
.ladder-key { display: flex; gap: 10px 5px; margin-top: 8px; font-size: 13.5px; color: var(--muted); flex-wrap: wrap; }
.ladder-key div { flex-basis: 0; min-width: 190px; border-top: 2px solid; padding-top: 6px; }
.ladder-key b { display: block; font-weight: 650; color: var(--text); font-size: 14.5px; }
.ladder-key .k-ok { border-color: var(--accent); }
.ladder-key .k-way { border-color: var(--yellow); }
.ladder-key .k-no { border-color: var(--bad); }
.build-act { display: flex; gap: 10px; align-items: center; margin-top: 18px; flex-wrap: wrap; }
.build.quiet { padding: 16px 24px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.build.quiet h2 { font-size: 17px; margin: 0; }
.build.quiet .plan { margin-left: 0; }
.build .spacer { flex: 1; }
.today-cols { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 36px; margin-top: 32px; }
.sec-h { display: flex; align-items: baseline; gap: 10px; margin-bottom: 10px; }
.sec-h h2 { font-size: 18px; font-weight: 700; margin: 0; }
.sec-h span { color: var(--steel); font-weight: 600; }
.todo { list-style: none; margin: 0; padding: 0; }
.todo li { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 13px 0; border-bottom: 1px solid var(--line); }
.todo li:first-child { border-top: 1px solid var(--line); }
.todo .dot { width: 10px; height: 10px; border-radius: 50%; }
.todo .late .dot { background: var(--bad); }
.todo .soon .dot { background: var(--yellow); }
.todo .fyi .dot { border: 2px solid var(--steel); }
.todo .t { font-weight: 600; }
.todo .late .t em { color: var(--bad); font-style: normal; }
.todo .m { color: var(--muted); font-size: 14px; margin-top: 1px; }
.when { list-style: none; margin: 0; padding: 0; }
.when li { display: grid; grid-template-columns: 70px minmax(0, 1fr); gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.when li:first-child { border-top: 1px solid var(--line); }
.when .d { font-weight: 650; }
.when .d small { display: block; font-weight: 400; color: var(--steel); font-size: 12.5px; }
.when a { color: var(--text); text-decoration: none; }
.when a:hover { text-decoration: underline; text-underline-offset: 3px; }
.calm { color: var(--muted); border-top: 1px solid var(--line); padding-top: 12px; margin: 0; }
@media (max-width: 980px) { .today-cols { grid-template-columns: minmax(0, 1fr); gap: 28px; } }
@media (max-width: 760px) {
  .build { padding: 16px; }
  .build .plan { margin-left: 0; width: 100%; }
  .verdict .big { font-size: 46px; }
  .ladder { gap: 3px; }
  .ladder .u { height: 36px; font-size: 0; }
  .ladder-key div { min-width: 140px; }
  .build.quiet { padding: 14px 16px; }
}
.nw { white-space: nowrap; }

/* ---------- телефон збирача: назва, етапи, чекліст, одна велика кнопка ---------- */
.task-page { max-width: 680px; }
.task-head h1 { font-size: 26px; font-weight: 700; letter-spacing: -.02em; line-height: 1.15; margin: 6px 0 0; }
.task-sub { color: var(--muted); margin: 4px 0 0; }
.task-sub .pn { color: var(--text); font-weight: 600; }
.task-sub .late { color: var(--bad); font-weight: 600; }
.task-sub .soon { color: var(--warn); font-weight: 600; }
.count-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.count { display: flex; align-items: baseline; gap: 10px; }
.count b { font-size: 52px; font-weight: 800; line-height: .9; letter-spacing: -.03em; color: var(--accent); }
.count span { font-size: 17px; color: var(--muted); }
/* етапи завдання на телефоні («взяти / зібрати / здати»); не плутати з .steps — кроками інструкції */
.stages { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin: 18px 0 18px; counter-reset: s; }
.stages > div { border-top: 4px solid var(--line); padding-top: 6px; font-size: 13.5px; color: var(--muted); }
.stages > div::before { counter-increment: s; content: counter(s) ". "; }
.stages .done { border-color: var(--accent); color: var(--text); }
.stages .now { border-color: var(--text); color: var(--text); font-weight: 700; }
.pick-hint { margin: 0 0 6px; font-size: 14.5px; }
.task-sec { margin-top: 18px; }
.task-sec > h2 { font-size: 17px; margin: 0 0 4px; }
.kit { list-style: none; margin: 0; padding: 0; }
.kit > li { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 6px 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.kit .box { width: 26px; height: 26px; border: 2px solid var(--steel); border-radius: 6px; display: grid; place-items: center; }
.kit .got .box { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.kit .box .icon { width: 18px; height: 18px; stroke-width: 3; }
.kit .lack .box { border-color: var(--bad); border-style: dashed; }
.kit .nm { font-weight: 600; font-size: 16px; min-width: 0; }
.kit .nm small { display: block; font-weight: 400; color: var(--muted); font-size: 13.5px; }
.kit .nm small.why { color: var(--bad); font-weight: 600; }
.kit .got .nm { color: var(--muted); }
.kit .q { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.kit .take { grid-column: 2 / -1; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.kit .take small { color: var(--muted); }
.task-page .sticky-actions { flex-direction: column; flex-wrap: nowrap; gap: 10px; background: var(--bg); border-top: 1px solid var(--line); margin-top: 20px; padding: 12px 0 calc(14px + env(safe-area-inset-bottom)); }
.task-page .sticky-actions .btn { min-width: 0; }
.task-page .sticky-actions > .btn, .cta-main .btn.primary { min-height: 56px; font-size: 18px; justify-content: center; border-radius: 12px; }
.task-page .sticky-actions > .btn.primary { order: -1; }
.task-page .sticky-actions > .cta-row { order: -2; }
.cta-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.cta-row .timer { font-size: 22px; }
.cta-main { display: flex; gap: 10px; align-items: stretch; }
.cta-main .btn.primary { flex: 1; }
.cta-more { display: flex; gap: 10px; }
.cta-more .btn { flex: 1; }
.cta-note { margin: 0; font-size: 14px; color: var(--muted); }
.cta-note.warn { color: var(--warn); font-weight: 600; }
.task { border: 0; box-shadow: none; }
.task-page .sticky-actions .cta-row .btn { flex: none; min-width: 96px; }
.cta-more .btn { min-height: 44px; }
.task h3 { font-size: 20px; margin: 0; }
.task .task-sub { margin: -6px 0 0; }
.task .count b { font-size: 40px; }
.kit-mini { list-style: none; margin: 0; padding: 0; font-size: 14.5px; }
.kit-mini li { display: flex; justify-content: space-between; gap: 10px; padding: 3px 0; color: var(--muted); }
.kit-mini b { color: var(--text); font-variant-numeric: tabular-nums; }

/* ---------- приймання, контроль якості, претензії ---------- */
.rc-page { max-width: 1100px; }
.tabs button b { margin-left: 7px; font-size: 12.5px; font-weight: 700; padding: 0 6px; border-radius: 10px; background: var(--surface-2); color: var(--muted); }
.tabs .on b { background: var(--accent); color: var(--on-accent); }
.tabs button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.todo .t em { font-style: normal; color: var(--muted); font-weight: 500; }
.todo .late .t em { color: var(--bad); }
.rc-sec { margin-top: 28px; }
.todo .t b { font-weight: 700; }
ul.plain { list-style: none; margin: 0; padding: 0; }
ul.plain li { padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 14.5px; }
.claims-closed .t, .claims-closed .m { color: var(--muted); }

/* поставка за замовленням: рядок — що чекали, скільки приїхало, що з розбіжністю */
.rc-fields { margin-bottom: 14px; }
.rcv { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.rcv > li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 16px; align-items: center; padding: 14px 0 14px 14px;
  border-bottom: 1px solid var(--line); border-left: 3px solid transparent; }
.rcv > li.less { border-left-color: var(--bad); }
.rcv > li.more { border-left-color: var(--yellow); }
.rcv .nm { font-weight: 600; font-size: 16px; min-width: 0; }
.rcv .nm .pn { font-weight: 700; }
.rcv .nm small { display: block; font-weight: 400; color: var(--muted); font-size: 14px; margin-top: 2px; }
.rcv .tag-qc { display: inline-block; margin-left: 8px; font-size: 11.5px; font-weight: 700; padding: 1px 6px; border-radius: 5px;
  background: var(--warn-bg); color: var(--warn); vertical-align: 2px; }
.rcv .q .qty-stepper button { width: 46px; height: 46px; font-size: 22px; }
.rcv .q .qty-stepper input { width: 92px; min-height: 46px; font-size: 20px; }
.rcv .v { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; font-size: 14.5px; }
.rcv .v .what { font-weight: 650; display: inline-flex; align-items: center; gap: 5px; }
.rcv .v .what .icon { width: 16px; height: 16px; }
.rcv .same .v .what { color: var(--ok); }
.rcv .less .v .what { color: var(--bad); }
.rcv .more .v .what { color: var(--warn); }
.rcv .v small { color: var(--muted); font-size: 13.5px; }
.rcv .v small.qc-hint { color: var(--warn); }
.rcv .rc-note { grid-column: 1 / -1; font-size: 14px; min-height: 34px; padding: 5px 10px; background: transparent; border-style: dashed; }
.rcv .rc-note:focus, .rcv .rc-note:not(:placeholder-shown) { background: var(--surface); border-style: solid; }
.choice { display: inline-flex; background: var(--surface); border: 1px solid var(--line); border-radius: 9px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.choice button { border: 0; background: none; padding: 6px 12px; border-radius: 6px; cursor: pointer; color: var(--muted); font: inherit; font-weight: 550; }
.choice.sm button { padding: 4px 10px; font-size: 13.5px; }
.choice button[aria-checked="true"] { background: var(--text); color: var(--bg); }
.choice button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.rc-actions { position: sticky; bottom: 0; background: var(--bg); border-top: 1px solid var(--line); margin-top: 0; padding: 12px 0 calc(12px + env(safe-area-inset-bottom));
  display: flex; align-items: center; justify-content: space-between; gap: 12px 20px; flex-wrap: wrap; }
.rc-actions .rcv-sum { font-size: 15px; }
.rc-actions .btn.primary { flex: none; min-width: 240px; min-height: 50px; font-size: 17px; justify-content: center; border-radius: 12px; }

/* документ приймання */
.receipt td.diff { font-size: 14px; }
.receipt td.diff .bad { color: var(--bad); font-weight: 650; }
.receipt td.diff .warn { color: var(--warn); font-weight: 650; }
.receipt tr.short td:first-child { box-shadow: inset 3px 0 0 var(--bad); }
.receipt tr.over td:first-child { box-shadow: inset 3px 0 0 var(--yellow); }
.receipts tr.click { cursor: pointer; }
.receipts tr.click:hover td { background: var(--hover); }
.receipts td .badge + .badge { margin-left: 4px; }
.qc-split { margin: 4px 0 0; font-weight: 600; color: var(--ok); }
.qc-split.bad { color: var(--bad); }
.tree .chip.qc { background: var(--warn-bg); color: var(--warn); }

@media (max-width: 760px) {
  .rcv > li { grid-template-columns: minmax(0, 1fr); padding-left: 10px; }
  .rcv .q .qty-stepper { width: 100%; }
  .rcv .q .qty-stepper input { flex: 1; width: auto; }
  .rc-actions { flex-direction: column; align-items: stretch; }
  .rc-actions .btn.primary { min-width: 0; width: 100%; }
}
.qc-note { margin: 0; padding: 8px 12px; border-radius: 8px; background: var(--warn-bg); color: var(--warn); font-size: 14px; font-weight: 550; }

/* ---------- друк документів: аркуш A4, чорне на білому, підписи сіткою як основний напис креслення ---------- */
.toast a { pointer-events: auto; color: inherit; font-weight: 700; text-decoration: underline; text-underline-offset: 2px; }
body.print-mode { display: block; }
body.print-mode .side { display: none !important; }
body.print-mode .main { max-width: none; padding: 0 0 48px; }
.print-bar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 12px max(16px, calc((100% - 210mm) / 2)); background: var(--bg); border-bottom: 1px solid var(--line); }
.print-bar .hint { color: var(--muted); font-size: 13.5px; }
.doc-sheet { --ink: #000; --soft: #4d5459; --rule: #8f979c; width: 210mm; max-width: calc(100% - 32px); min-height: 297mm; margin: 24px auto;
  padding: 14mm 12mm; background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .14), 0 14px 40px rgba(0, 0, 0, .14);
  font-size: 10pt; line-height: 1.4; font-variant-numeric: tabular-nums; }
.doc-sheet h1, .doc-sheet h2, .doc-sheet p { color: var(--ink); }
.doc-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10mm; padding-bottom: 4mm; border-bottom: 1.4pt solid var(--ink); }
.doc-head .org { display: flex; flex-direction: column; max-width: 85mm; font-size: 8.5pt; color: var(--soft); }
.doc-head .org b { color: var(--ink); font-size: 11pt; font-weight: 700; }
.doc-id { text-align: right; }
.doc-id h1 { font-size: 12pt; font-weight: 600; letter-spacing: 0; }
.doc-no { margin: 1mm 0 0; font-size: 20pt; font-weight: 700; line-height: 1.1; letter-spacing: -.01em; }
.doc-date, .doc-sub { margin: .8mm 0 0; font-size: 9pt; color: var(--soft) !important; }
.doc-meta { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 3mm 8mm; margin: 5mm 0 4mm; }
.doc-meta > div { min-width: 0; }
.doc-meta .wide { grid-column: span 2; }
.doc-meta dt { font-size: 7.5pt; color: var(--soft); }
.doc-meta dd { margin: 0; display: flex; flex-direction: column; overflow-wrap: anywhere; }
.doc-meta dd b { font-weight: 600; }
.doc-table { overflow-x: auto; }
.doc-lines { width: 100%; border-collapse: collapse; font-size: 9pt; }
.doc-lines th { padding: 1.5mm 1.3mm; border-top: 1pt solid var(--ink); border-bottom: 1pt solid var(--ink); background: none; color: var(--ink);
  font-size: 7.5pt; font-weight: 600; white-space: normal; vertical-align: bottom; text-align: left; }
.doc-lines td { padding: 1.7mm 1.3mm; border-bottom: .5pt solid var(--rule); vertical-align: top; }
.doc-lines .num { text-align: right; white-space: nowrap; }
.doc-lines th.num { text-align: right; }
.doc-lines .n { width: 6mm; color: var(--soft); }
.doc-lines .pn { white-space: nowrap; font-weight: 600; }
.doc-lines .unit { white-space: nowrap; }
.doc-lines td.strong { font-weight: 700; }
.doc-lines td.note { font-size: 8pt; }
.doc-lines .tick { width: 16mm; text-align: center; }
.doc-lines .box { display: inline-block; width: 4mm; height: 4mm; border: .8pt solid var(--ink); vertical-align: middle; }
.doc-lines tbody tr:last-child td { border-bottom: 1pt solid var(--ink); }
.doc-lines tfoot td { border-bottom: 0; font-weight: 700; }
.doc-lines td.name { min-width: 30mm; }
.doc-lines tr { break-inside: avoid; }
.doc-notes, .doc-steps { margin-top: 5mm; }
.doc-notes h2, .doc-steps h2 { font-size: 10pt; font-weight: 700; margin: 0 0 1.5mm; }
.doc-notes ul { margin: 0; padding-left: 4.5mm; font-size: 9pt; }
.doc-steps ol { list-style: none; margin: 0; padding: 0; counter-reset: st; }
.doc-steps li { display: grid; grid-template-columns: 6mm minmax(0, 1fr) 44mm; gap: 3mm; padding: 2mm 0; border-bottom: .5pt solid var(--rule);
  counter-increment: st; break-inside: avoid; font-size: 9.5pt; }
.doc-steps li::before { content: counter(st); font-weight: 700; }
.doc-steps li p { margin: 0; }
.doc-steps img { width: 100%; max-height: 30mm; object-fit: contain; object-position: right top; }
.doc-done { display: flex; flex-wrap: wrap; gap: 4mm 14mm; margin-top: 6mm; font-weight: 600; }
.doc-done .blank { display: inline-block; width: 28mm; margin: 0 2mm; border-bottom: .8pt solid var(--ink); }
.doc-empty { margin: 4mm 0; color: var(--soft) !important; }
.doc-signs { width: 100%; border-collapse: collapse; margin-top: 8mm; break-inside: avoid; font-size: 9pt; }
.doc-signs th { padding: 1mm 2mm; border: .8pt solid var(--ink); background: none; color: var(--soft); font-size: 7pt; font-weight: 500; text-align: left; white-space: nowrap; }
.doc-signs tr td { height: 10mm; padding: 0 2mm; border: .8pt solid var(--ink); vertical-align: middle; }
.doc-signs td.role { width: 34%; font-weight: 600; }
.doc-signs td.sig { width: 24%; }
.doc-signs td.date { width: 16%; }
.doc-printed { margin: 5mm 0 0; font-size: 7pt; color: var(--soft) !important; }

@media (max-width: 560px) {
  .doc-sheet { max-width: calc(100% - 16px); margin: 8px auto; padding: 6mm 4mm; min-height: 0; font-size: 9pt; }
  .doc-head { flex-direction: column; gap: 3mm; }
  .doc-id { text-align: left; }
  .doc-meta { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .doc-steps li { grid-template-columns: 6mm minmax(0, 1fr); }
  .doc-steps img { grid-column: 2; max-height: 40mm; object-position: left top; }
  .print-bar .hint { display: none; }
}

/* ---------- етикетки: папір — чорне на білому; розмір з налаштувань (--lw × --lh), на екрані — збільшене прев'ю ---------- */
.label-bar { max-width: 760px; margin: 18px auto 0; padding: 0 16px; }
.label-bar h1 { font-size: 22px; margin: 0 0 10px; }
.label-bar .lbl-list td { padding: 6px 8px; }
.label-bar .lbl-list input { width: 84px; text-align: right; }
.labels { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; padding: 8px 16px 32px; }
.label { width: var(--lw); height: var(--lh); box-sizing: border-box; padding: 1.2mm 1.8mm 1mm; display: flex; flex-direction: column;
  overflow: hidden; background: #fff; color: #000; line-height: 1.12; outline: 1px dashed var(--line); }
@media screen { .labels .label { zoom: 1.6; } }
/* назва поруч з артикулом; не влазить — переходить на наступний рядок, до двох рядків */
.label .l-top { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 1.4mm; min-width: 0; padding-bottom: .4mm; border-bottom: .25mm solid #000; }
.label .l-pn { flex: none; white-space: nowrap; font-size: calc(var(--lh) * .15); font-weight: 800; }
.label .l-nm { min-width: 0; overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; font-size: calc(var(--lh) * .12); }
.label .l-line { margin-top: .5mm; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: calc(var(--lh) * .105); }
.label .l-grp { font-weight: 600; }
.label svg.bc { flex: 1 1 0; width: 100%; min-height: 0; margin-top: .8mm; align-self: center; fill: #000; }
.label.small { padding: .8mm 1.2mm .6mm; }
.label.small .l-top { flex-wrap: nowrap; border-bottom: 0; padding-bottom: 0; white-space: nowrap; }
.label.small .l-nm { display: block; text-overflow: ellipsis; }
.label.small .l-pn { font-size: calc(var(--lh) * .24); }
.label.small .l-nm { font-size: calc(var(--lh) * .2); }

/* ---------- внутрішній склад і журнал дій ---------- */
.iw-note { margin: -4px 0 12px; }
tr.off td { color: var(--muted); }
.iw-whs { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.iw-dates { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.iw-dates input { width: auto; }
.iw-more { display: flex; justify-content: center; margin: 4px 0 16px; }
.audit { list-style: none; margin: 0; padding: 0; }
.audit li { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 4px 16px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.audit li:last-child { border-bottom: 0; }
.au-meta { display: flex; flex-direction: column; font-size: 13px; color: var(--muted); }
.au-meta time { font-variant-numeric: tabular-nums; color: var(--text); }
.au-body b { margin-right: 8px; }
.au-obj { font-weight: 600; }
.au-det { margin-top: 2px; font-size: 14px; color: var(--muted); overflow-wrap: anywhere; }
.iw-rc [hidden], .iw-warn[hidden] { display: none !important; }
.iw-rc-units td:first-child { width: 28px; }
.iw-rc-units input { min-width: 120px; }
.iw-number { font-variant-numeric: tabular-nums; letter-spacing: .01em; }
.iw-ops { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.iw-ops .btn { flex: 1 1 160px; }
.iw-off-banner { background: var(--bad-bg); color: var(--bad); display: flex; flex-direction: column; gap: 4px; }
.iw-warn { margin: 0; color: var(--warn); font-size: 14px; }
.iw-notfound h2 { margin: 0 0 8px; }
@media (max-width: 760px) {
  .audit li { grid-template-columns: minmax(0, 1fr); }
  .au-meta { flex-direction: row; gap: 8px; }
  .iw-page .toolbar select, .iw-page .toolbar .search { flex: 1 1 100%; max-width: none; min-width: 0; }
  .iw-dates { flex: 1 1 100%; }
  .iw-dates input { flex: 1; min-width: 0; }
}

/* етикетка внутрішнього складу B2: номер зверху, нижче QR і назва (розміри в мм ставить iwlabels.js) */
.label.iw { display: block; padding: 1.6mm; line-height: 1.15; }
.label.iw .l-num { display: block; white-space: nowrap; overflow: hidden; font-weight: 800; line-height: 1; letter-spacing: -.01em; }
.label.iw .l-row { display: flex; align-items: flex-start; }
.label.iw svg.qr { flex: none; display: block; fill: #000; }
.label.iw .l-nm { min-width: 0; margin-left: 1.2mm; display: -webkit-box; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.iw-lbl-warn { background: var(--warn-bg); color: var(--warn); }

@page { size: A4; margin: 12mm; }
@media print {
  .label-bar { display: none !important; }
  .labels { display: block; padding: 0; }
  .label { outline: 0; break-after: page; }
  .label:last-child { break-after: auto; }
  html, body { background: #fff !important; }
  body { display: block; }
  .side, #toasts, .print-bar { display: none !important; }
  .main { max-width: none; padding: 0 !important; }
  .doc-sheet { width: auto; max-width: none; min-height: 0; margin: 0; padding: 0; box-shadow: none; }
  .doc-table { overflow: visible; }
}

/* ---------- вхід (auth.js) і користувач унизу меню ---------- */
body.auth-mode { display: block; }
body.auth-mode .side { display: none; }
.auth { max-width: 420px; margin: 7vh auto 40px; padding: 0 16px; display: flex; flex-direction: column; gap: 16px; }
.auth-brand { display: flex; align-items: center; justify-content: center; gap: 10px; font-weight: 700; font-size: 20px; }
.auth-card h1 { font-size: 22px; margin: 0 0 4px; }
.auth-sub { margin: 0 0 14px; }
.auth-form .btn.primary { justify-content: center; }
.auth-err { color: var(--bad); margin: 0; font-weight: 500; }
.auth-err:empty { display: none; }
.auth-steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 10px; }
.auth-steps li > * { margin-top: 8px; }
.auth-qr { background: #fff; padding: 6px; border-radius: 10px; width: 196px; border: 1px solid var(--line); }
.auth-qr svg { display: block; width: 100%; height: auto; fill: #000; }
.auth-key { display: block; font-size: 15px; letter-spacing: .04em; word-spacing: .15em; background: var(--surface-2); padding: 8px 10px; border-radius: 8px; }
#totp-code { font-size: 22px; letter-spacing: .2em; max-width: 180px; }
.auth .lang { align-self: center; min-width: 160px; }
.me { display: flex; flex-direction: column; gap: 6px; padding: 0 4px; }
.me-who { display: flex; flex-direction: column; min-width: 0; }
.me-who b { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-role { font-size: 12px; color: var(--muted); }
.me-act { display: flex; flex-wrap: wrap; gap: 4px 12px; }
.linkbtn { border: 0; background: none; padding: 0; font: inherit; font-size: 13px; color: var(--accent-text); cursor: pointer; display: inline-flex; align-items: center; gap: 4px; }
.linkbtn:hover { text-decoration: underline; }
.linkbtn .icon { width: 16px; height: 16px; }
td.nowrap { white-space: nowrap; }
.temp-pw code { font-size: 22px; letter-spacing: .06em; background: var(--surface-2); padding: 6px 12px; border-radius: 8px; user-select: all; }
@media (max-width: 760px) {
  .me { flex-direction: row; align-items: center; gap: 4px; padding: 0; }
  .me-role, #pw-change span, #logout span { display: none; }
  .me-act { gap: 0; }
  .me-act .linkbtn { padding: 8px 5px; margin: -8px 0; }
  .me-act .linkbtn .icon { width: 20px; height: 20px; }
  .me-who b { max-width: 104px; }
}

/* прослідковування: партії й серійні номери (static/js/trace.js, worker.js, production.js) */
.lot-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.lot-chip { display: inline-flex; align-items: baseline; gap: 2px; padding: 2px 9px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface); color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; text-decoration: none; white-space: nowrap; }
a.lot-chip:hover { background: var(--hover); }
.lot-chip small { color: var(--muted); font-weight: 500; }
.kit .lot-hint { color: var(--accent-text); font-weight: 600; }
.lot-sel { max-width: 180px; }
.sn-boxes { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.sn-pick { min-height: 40px; }
.sn-input { width: 100%; }
#trace-q { flex: 1 1 260px; min-width: 0; }
.field[hidden] { display: none; }

/* номер версії (static/js/version.js): бокова панель на комп'ютері, низ сторінки на телефоні, екран входу; не в друці */
.app-ver { font-size: 12px; color: var(--muted); text-align: center; font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.main > .app-ver { display: none; margin-top: 28px; }
@media (max-width: 980px) {
  .side-foot .app-ver { display: none; }
  .main > .app-ver { display: block; }
}
.print-mode .app-ver { display: none !important; }
@media print { .app-ver { display: none !important; } }

/* ---- позначка середовища (App.applyEnv): локальна версія — приглушений червоний, stage — жовтий; на проді й на друці немає ---- */
.env-bar { position: fixed; top: 0; left: 0; right: 0; height: 26px; z-index: 90; display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 0 12px; background: var(--bad-bg); color: var(--bad); border-bottom: 1px solid var(--line); font-size: 12.5px; font-weight: 600;
  white-space: nowrap; overflow: hidden; }
.env-bar::before { content: ''; flex: none; width: 7px; height: 7px; border-radius: 50%; background: currentColor; margin-right: 2px; }
.env-bar span { font-weight: 500; opacity: .85; }
.env-bar.stage { background: var(--warn-bg); color: var(--warn); }
body.has-env-bar { padding-top: 26px; }
@media (min-width: 981px) {
  body.has-env-bar .side { top: 26px; height: calc(100vh - 26px); }
  body.has-env-bar .bom-page { height: calc(100vh - 112px); }
}
body.print-mode .env-bar { display: none; }
body.print-mode.has-env-bar { padding-top: 0; }
@media print { .env-bar { display: none !important; } body.has-env-bar { padding-top: 0; } }

/* ---- «Специфікації» → вигляд «Таблиця» (bom.js): дерево-таблиця з відступом за рівнем, дії в рядку ---- */
.bom-page .page-head .actions { gap: 12px; flex-wrap: wrap; }
.btab-wrap { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.btab-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.btab-tools .search input { width: 240px; }
.btab-tools .count { margin-left: auto; color: var(--muted); font-size: 13px; }
.btab { overflow: auto; min-height: 0; flex: 1; --ind: 22px; }
.btab table.tree { font-size: 14.5px; }
.btab thead th { position: sticky; top: 0; z-index: 1; background: var(--surface); }
.btab tbody tr { cursor: pointer; }
.btab tbody tr:hover td { background: var(--hover); }
.btab tbody tr.sel td { background: var(--accent-weak); }
.btab table.tree tbody tr:not(.detail):hover .pn { text-decoration: none; }
.btab td.node { min-width: 320px; }
.btab .indent { padding-left: calc(var(--ind) * var(--d)); }
.btab .pn { font-weight: 600; }
.btab .nm { color: var(--muted); }
.btab tr.lvl0 .nm, .btab tr.lvl1 .nm { color: inherit; }
.btab .badge { margin-left: 6px; font-size: 11.5px; padding: 1px 7px; }
.btab .qbtn { border: 1px solid transparent; background: none; font: inherit; color: inherit; padding: 2px 8px; border-radius: 7px; cursor: pointer; font-variant-numeric: tabular-nums; }
.btab .qbtn:hover, .btab .qbtn:focus-visible { border-color: var(--accent); color: var(--accent-text); background: var(--surface); }
.btab td.tot { font-weight: 600; }
.btab td.unit, .btab td.cost { white-space: nowrap; }
.btab td.cost.warn { color: var(--warn); }
.btab td.cost.muted, .btab td.zero { color: var(--muted); }
.btab td.acts { white-space: nowrap; text-align: right; width: 1%; padding-right: 10px; }
.btab .ib { width: 30px; height: 30px; border: 1px solid var(--line); background: var(--surface); border-radius: 8px; cursor: pointer; color: var(--muted); font: inherit; font-size: 16px;
  line-height: 1; display: inline-grid; place-items: center; margin-left: 4px; }
.btab .ib .icon { width: 16px; height: 16px; }
.btab .ib.badd { color: var(--accent-text); border-color: var(--accent); }
.btab .ib:hover { background: var(--surface-2); color: var(--text); }
.btab .ib.brm:hover { color: var(--bad); border-color: var(--bad); }
.btab mark { background: var(--yellow); color: #18202e; border-radius: 3px; padding: 0 1px; }
.btab tr.flash td { animation: tflash 1.6s ease; }
@keyframes tflash { 0%, 45% { background: var(--ok-bg); } }
.btab .empty-node { color: var(--muted); font-style: italic; font-size: 13.5px; }
@media (max-width: 980px) {
  .bom-page.tbl-mode { height: auto; }
  .tbl-mode .btab { max-height: 70vh; }
}
@media (max-width: 760px) {
  .btab td.node { min-width: 0; }
  .btab th, .btab td { padding: 8px 5px; }
  .btab th:first-child, .btab td.node { padding-left: 6px; }
  .btab .badge.info, .btab .badge.accent { display: none; }
  .btab .pn { display: block; }
  .btab .ib { width: 28px; height: 28px; margin-left: 2px; }
  .btab th { white-space: normal; line-height: 1.2; }
  .btab td.acts { padding-right: 4px; }
  .btab { --ind: 10px; }
  .btab .hide-sm { display: none; }
  .btab-tools .search, .btab-tools .search input { width: 100%; }
  .btab-tools .count { margin-left: 0; }
}
@media (prefers-reduced-motion: reduce) { .btab tr.flash td { animation: none; background: var(--ok-bg); } }
