/* Onest (variable 100..900, локально без зовнішніх запитів) */
@font-face {
  font-family: 'Onest';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/static/fonts/onest-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: 'Onest';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/static/fonts/onest-cyrillic.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Onest';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/static/fonts/onest-symbols.woff2") format("woff2");
  unicode-range: U+0001-000C, U+000E-001F, U+007F-009F, U+20DD-20E0, U+20E2-20E4, U+2150-218F, U+2190, U+2192, U+2194-2199, U+21AF, U+21E6-21F0, U+21F3, U+2218-2219, U+2299, U+22C4-22C6, U+2300-243F, U+2440-244A, U+2460-24FF, U+25A0-27BF, U+2800-28FF, U+2921-2922, U+2981, U+29BF, U+29EB, U+2B00-2BFF, U+4DC0-4DFF, U+FFF9-FFFB, U+10140-1018E, U+10190-1019C, U+101A0, U+101D0-101FD, U+102E0-102FB, U+10E60-10E7E, U+1D2C0-1D2D3, U+1D2E0-1D37F, U+1F000-1F0FF, U+1F100-1F1AE, U+1F1E6-1F1FF, U+1F30D-1F30F, U+1F315, U+1F31C, U+1F31E, U+1F320-1F32C, U+1F336, U+1F378, U+1F37D, U+1F382, U+1F393-1F39F, U+1F3A7-1F3A8, U+1F3AC-1F3AF, U+1F3C2, U+1F3C4-1F3C6, U+1F3CA-1F3CE, U+1F3D4-1F3E0, U+1F3ED, U+1F3F1-1F3F3, U+1F3F5-1F3F7, U+1F408, U+1F415, U+1F41F, U+1F426, U+1F43F, U+1F441-1F442, U+1F444, U+1F446-1F449, U+1F44C-1F44E, U+1F453, U+1F46A, U+1F47D, U+1F4A3, U+1F4B0, U+1F4B3, U+1F4B9, U+1F4BB, U+1F4BF, U+1F4C8-1F4CB, U+1F4D6, U+1F4DA, U+1F4DF, U+1F4E3-1F4E6, U+1F4EA-1F4ED, U+1F4F7, U+1F4F9-1F4FB, U+1F4FD-1F4FE, U+1F503, U+1F507-1F50B, U+1F50D, U+1F512-1F513, U+1F53E-1F54A, U+1F54F-1F5FA, U+1F610, U+1F650-1F67F, U+1F687, U+1F68D, U+1F691, U+1F694, U+1F698, U+1F6AD, U+1F6B2, U+1F6B9-1F6BA, U+1F6BC, U+1F6C6-1F6CF, U+1F6D3-1F6D7, U+1F6E0-1F6EA, U+1F6F0-1F6F3, U+1F6F7-1F6FC, U+1F700-1F80B, U+1F810-1F847, U+1F850-1F859, U+1F860-1F887, U+1F890-1F8AD, U+1F8B0-1F8BB, U+1F8C0-1F8C1, U+1F8D0-1F8D8, U+1F900-1F90B, U+1F93B, U+1F946, U+1F984, U+1F996, U+1F9E9, U+1FA00-1FA6F, U+1FA70-1FA7C, U+1FA80-1FAC6, U+1FAC8, U+1FACC-1FADD, U+1FADF-1FAEB, U+1FAEF-1FAFA, U+1FB00-1FBFF;
}
@font-face {
  font-family: 'Onest';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/static/fonts/onest-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: 'Onest';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/static/fonts/onest-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: #eeeff1;
  --card: #ffffff;
  --shadow: 0 1px 2px rgba(20, 20, 30, .04), 0 2px 8px rgba(20, 20, 30, .05);
  --side: #27282c;
  --side-hover: #35363b;
  --side-line: #3f4046;
  --side-text: #c8c8cd;
  --side-muted: #85868d;
  --line: #e4e4e7;
  --head: #ececee;
  --text: #2b2b2e;
  --muted: #7a7a80;
  --dark: #4a4a4f;
  --dark-hover: #3a3a3e;
  --soft: #f0f0f2;

  --c-new: #2b6cb0;       --c-new-bg: #e6eef8;
  --c-corr: #b7791f;      --c-corr-bg: #fbf1de;
  --c-manual: #c53030;    --c-manual-bg: #fbe5e5;
  --c-trans: #2f855a;     --c-trans-bg: #e3f3ea;
  --c-cancel: #6b6b70;    --c-cancel-bg: #ececee;
  --c-ep: #6b46c1;        --c-ep-bg: #eee8fa;
  --c-err: #c53030;       --c-err-bg: #fdecec;
  --c-ok: #2f855a;
  --c-paid: #2e9e5b;      /* оплата: зелений $ — оплачене, помаранчевий — при отриманні (як у BL) */
  --c-cod: #ee8a1c;

  --radius: 12px;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font: 14px/1.45 "Onest", sans-serif;
  color: var(--text);
  background: var(--bg);
}
a { color: inherit; }
h1 { font-size: 20px; margin: 0 0 16px; font-weight: 600; }
h2 { font-size: 15px; margin: 0 0 12px; font-weight: 600; }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 13px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.center { text-align: center; }

/* Джерело: прапорець + назва */
.src { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.flag { width: 16px; height: 12px; border-radius: 2px; box-shadow: 0 0 1px rgba(0, 0, 0, .45); flex: none; }

/* Каркас: бокове меню + основна зона */
.layout { display: grid; grid-template-columns: 244px 1fr; min-height: 100vh; }
/* Темне бокове меню: графіт, активний пункт — світла «пігулка» (монохром, без акцентного кольору) */
.sidebar {
  background: var(--side); color: var(--side-text);
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  padding: 20px 12px; display: flex; flex-direction: column; gap: 2px;
}
.brand {
  display: block; font-size: 24px; font-weight: 700; margin: 0 0 14px; padding: 2px 10px;
  border-radius: 8px; letter-spacing: .5px; color: #fff; text-decoration: none;
}
.brand:hover { background: var(--side-hover); }
.nav-group {
  color: var(--side-muted); font-size: 11px; text-transform: uppercase;
  letter-spacing: .6px; margin: 16px 10px 4px;
}
.nav-group:first-child { margin-top: 6px; }
.nav a {
  display: block; padding: 7px 10px; border-radius: 8px; text-decoration: none;
  color: var(--side-text); font-size: 13.5px;
}
.nav a:hover { background: var(--side-hover); color: #fff; }
.nav a.active { background: var(--bg); color: var(--text); font-weight: 600; }
.nav a.nav-status { display: flex; align-items: center; gap: 8px; }
.nav-label { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-count {
  margin-left: auto; font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums;
  padding: 1px 6px; border-radius: 999px; flex: none;
  background: rgba(255, 255, 255, .10); color: var(--side-text);
}
.nav-count.zero { background: transparent; color: var(--side-muted); opacity: .65; font-weight: 400; }
.nav a.active .nav-count { background: rgba(0, 0, 0, .09); color: var(--text); }
.nav a.active .nav-count.zero { background: transparent; color: var(--muted); opacity: .8; }
.sidebar .spacer { flex: 1; }
.sidebar .btn.light { background: transparent; color: var(--side-text); border-color: var(--side-line); }
.sidebar .btn.light:hover { background: var(--side-hover); color: #fff; }

.main { padding: 20px 28px; min-width: 0; }
.topbar { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; }
.topbar form.search { flex: 1; max-width: 420px; }
.topbar .who { margin-left: auto; text-align: right; line-height: 1.2; }
.topbar .who small { color: var(--muted); }

/* Картки, форми, кнопки */
.card { background: var(--card); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 16px; box-shadow: var(--shadow); }
.topbar input[type=search] { background: var(--card); box-shadow: var(--shadow); }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }
.grid2 > .card { margin-bottom: 0; }

input[type=text], input[type=search], input[type=password], input[type=date], select, textarea {
  font: inherit; color: inherit; background: var(--soft); border: 1px solid var(--line);
  border-radius: 8px; padding: 7px 10px;
}
input[type=search] { width: 100%; }
textarea { width: 100%; min-height: 70px; resize: vertical; }
.btn {
  font: inherit; border: 0; border-radius: 8px; padding: 8px 14px; cursor: pointer;
  background: var(--dark); color: #fff; text-decoration: none; display: inline-block;
}
.btn:hover { background: var(--dark-hover); }
.btn:disabled { opacity: .35; cursor: default; background: var(--dark); }
.btn.light { background: var(--soft); color: var(--text); border: 1px solid var(--line); }
.btn.small { padding: 4px 10px; font-size: 13px; }
.btn.danger { background: var(--c-err); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* Таблиці: щільні, менеджеру треба бачити багато рядків */
table.data { width: 100%; border-collapse: collapse; }
table.data th {
  background: var(--head); text-align: left; font-weight: 500; font-size: 13px;
  padding: 8px 10px; white-space: nowrap;
}
table.data th.right { text-align: right; }  /* заголовок вирівняний так само, як значення колонки */
table.data th.center { text-align: center; }
table.data th:first-child { border-radius: 8px 0 0 8px; }
table.data th:last-child { border-radius: 0 8px 8px 0; }
table.data td { padding: 6px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data tr:hover td { background: #fafafa; }
table.data td.num a { font-weight: 600; text-decoration: none; }
table.data td.num a:hover { text-decoration: underline; }
.table-wrap { overflow-x: auto; }

/* Список замовлень: просторіші рядки, під статусами — дата переходу в статус */
table.data.orders td { padding: 12px 10px; vertical-align: middle; }
.cell-stack { display: flex; flex-direction: column; gap: 8px; }
.cell-stack > div { min-height: 38px; display: flex; flex-direction: column; justify-content: center; align-items: flex-start; gap: 3px; }
.when { color: var(--muted); font-size: 12px; }
.num-row { display: inline-flex; align-items: center; }
.num-row .issue-mark { margin-left: 4px; }
table.data.orders td.client { max-width: 220px; }
/* Колонка «Перехід»: кілька переходів однієї ТТН — в один ряд, кожен статус над своєю датою */
.cell-stack > .moves { flex-direction: row; align-items: center; gap: 14px; }
.moves > span { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; }

/* Статуси */
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; white-space: nowrap; }
.st-new { color: var(--c-new); background: var(--c-new-bg); }
.st-correction { color: var(--c-corr); background: var(--c-corr-bg); }
.st-manual_check { color: var(--c-manual); background: var(--c-manual-bg); }
.st-transferred { color: var(--c-trans); background: var(--c-trans-bg); }
.st-cancelled { color: var(--c-cancel); background: var(--c-cancel-bg); }
.st-externally_processed { color: var(--c-ep); background: var(--c-ep-bg); }
.issue-mark { color: var(--c-err); font-weight: 700; cursor: help; }

/* Статуси посилки (нормалізовані, як у wetrack) */
.ps-created { color: var(--c-cancel); background: var(--c-cancel-bg); }
.ps-in_transit, .ps-out_for_delivery { color: var(--c-new); background: var(--c-new-bg); }
.ps-in_locker { color: var(--c-ep); background: var(--c-ep-bg); }
.ps-delivered { color: var(--c-trans); background: var(--c-trans-bg); }
.ps-returning, .ps-returned { color: var(--c-corr); background: var(--c-corr-bg); }
.ps-canceled { color: var(--c-cancel); background: var(--c-cancel-bg); }
.ps-refused, .ps-lost, .ps-unknown { color: var(--c-err); background: var(--c-err-bg); }
.parcel-line { margin: 2px 0 6px; }
.parcel-events { margin-top: 6px; }
.parcel-events summary { cursor: pointer; }
.parcel-events .history { margin-top: 6px; }
.parcel-events .history li { margin-bottom: 4px; }

.alert { border-radius: 8px; padding: 10px 14px; margin-bottom: 12px; }
.alert.err { background: var(--c-err-bg); color: var(--c-err); }
.alert.ok { background: var(--c-trans-bg); color: var(--c-ok); }
.alert ul { margin: 4px 0 0; padding-left: 18px; }

/* Стан імпорту */
.imports { display: flex; gap: 8px; flex-wrap: wrap; }
.imp { background: var(--soft); border-radius: 8px; padding: 6px 10px; font-size: 13px; }
.imp.bad { background: var(--c-err-bg); color: var(--c-err); }
.imp.warn { background: var(--c-corr-bg); color: #7a5410; }
.imp.paused { color: var(--muted); }
.imp .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--c-ok); margin-right: 6px; }
.imp.bad .dot { background: var(--c-err); }
.imp.warn .dot { background: var(--c-corr); }
.imp.paused .dot { background: var(--muted); }

/* Фільтри: один рядок над таблицею */
.filter-bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.dd { position: relative; }
.dd-btn {
  font: inherit; font-size: 13px; color: var(--text); background: var(--soft); border: 1px solid var(--line);
  border-radius: 8px; padding: 5px 26px 5px 10px; cursor: pointer; list-style: none; white-space: nowrap;
  position: relative; display: inline-block;
}
.dd-btn::-webkit-details-marker { display: none; }
.dd-btn::after {
  content: ""; position: absolute; right: 10px; top: 50%; margin-top: -4px;
  border: solid var(--muted); border-width: 0 1.5px 1.5px 0; padding: 2.5px; transform: rotate(45deg);
}
.dd-btn.on { border-color: var(--dark); background: var(--card); }
/* Незастосовані зміни у випадайці: м'який синій акцент, щоб видно було, де наклацано до «Застосувати» */
.dd-btn.dirty { border-color: var(--c-new); background: var(--c-new-bg); color: var(--c-new); }
.dd-btn.dirty::after { border-color: var(--c-new); }
.dd-btn.dirty .dd-count { background: var(--c-new); }
/* Лічильник вибраних значень замість самих значень у підписі — кнопка не змінює ширину від вибору */
.dd-count {
  display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 5px;
  margin-left: 6px; border-radius: 999px; background: var(--dark); color: #fff; font-size: 11px; font-weight: 600;
}
.dd-btn:disabled { cursor: not-allowed; color: var(--muted); }
.dd-menu {
  position: absolute; z-index: 10; top: calc(100% + 4px); left: 0; min-width: 100%; color: var(--text);
  background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 6px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .08);
}
.dd-menu label { display: flex; gap: 8px; align-items: center; padding: 4px 8px; border-radius: 6px; white-space: nowrap; cursor: pointer; }
.dd-menu label:hover { background: var(--soft); }
.dd-menu .wh-icon { cursor: inherit; }
/* Період у випадайці. У «Перехід у статус» — під списком статусів, бо дата — частина тієї ж умови;
   у «Дата замовлення» — єдиний вміст меню, без розділювача. */
.dd-dates {
  display: flex; gap: 6px; align-items: center; white-space: nowrap; font-size: 13px; color: var(--muted);
  border-top: 1px solid var(--line); margin-top: 6px; padding: 8px 8px 2px;
}
.dd-menu > .dd-dates:first-child { border-top: 0; margin-top: 0; padding: 2px; }
.dd-dates input[type=date] { padding: 4px 8px; font-size: 13px; color: var(--text); }
.filter-actions { margin-left: auto; display: flex; gap: 8px; }
/* Рядок фільтрів: усі елементи однієї висоти, незалежно від падінгів і рамок */
.filter-bar { --ctl-h: 32px; }
.filter-bar .dd-btn, .filter-bar .btn, .filter-bar input[type=date] { height: var(--ctl-h); }
.filter-bar .dd-btn, .filter-bar .btn { display: inline-flex; align-items: center; padding-top: 0; padding-bottom: 0; }
/* Застосовані фільтри — рядком під панеллю: що саме вибрано, і як прибрати один фільтр */
.filter-chips { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin: 0 0 12px; }
.chip {
  display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 500;
  color: var(--c-new); text-decoration: none; background: var(--c-new-bg);
  border: 1px solid rgba(43, 108, 176, .25); border-radius: 999px; padding: 3px 6px 3px 10px; white-space: nowrap;
}
.chip .muted { color: var(--c-new); opacity: .75; font-weight: 400; }
.chip .x { color: var(--c-new); opacity: .65; font-size: 11px; margin-left: 2px; padding: 0 4px; }
.chip:hover { border-color: var(--c-new); background: #dce8f6; }
.chip:hover .x { opacity: 1; }

/* Оплата: квадратик із $ */
.pay {
  display: inline-block; width: 18px; height: 18px; line-height: 18px; border-radius: 4px;
  color: #fff; font-weight: 700; font-size: 12px; text-align: center; cursor: help;
}
.pay-prepaid { background: var(--c-paid); }
.pay-cod { background: var(--c-cod); }
.pay-unknown { background: var(--c-err); }

/* Журнал задач (Status) */
.job-queued { color: var(--c-cancel); background: var(--c-cancel-bg); }
.job-running { color: var(--c-new); background: var(--c-new-bg); }
.job-done { color: var(--c-trans); background: var(--c-trans-bg); }
.job-failed { color: var(--c-err); background: var(--c-err-bg); }
details.job-error summary { cursor: pointer; color: var(--c-err); }
details.job-error pre.raw { margin: 6px 0 0; white-space: pre-wrap; }

/* Пагінація: « ‹ 1 2 3 4 5 … 42 › » праворуч під таблицею */
.pager { display: flex; gap: 6px; align-items: center; justify-content: flex-end; flex-wrap: wrap; margin-top: 14px; }
.pager a, .pager span {
  min-width: 34px; height: 34px; padding: 0 8px; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); border-radius: 8px; background: var(--card); text-decoration: none; font-size: 13px;
}
.pager a:hover { background: var(--soft); }
.pager .cur { background: var(--dark); border-color: var(--dark); color: #fff; font-weight: 600; }
.pager .off { color: var(--line); }
.pager .gap { border-color: transparent; color: var(--muted); }

/* Картка замовлення */
dl.kv { display: grid; grid-template-columns: 170px 1fr; gap: 6px 12px; margin: 0; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; }
.history li { margin-bottom: 8px; }
.history { list-style: none; padding: 0; margin: 0; }
pre.raw { background: var(--soft); border-radius: 8px; padding: 12px; overflow: auto; max-height: 400px; font-size: 12px; }
.small { font-size: 12px; }
.alert.warn { background: var(--c-corr-bg); color: #7a5410; }

/* Розкладка картки: шапка зі статусом -> товари -> 2 рівні по висоті колонки -> примітки -> історія */
.order-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.order-head-main { min-width: 0; flex: 1; }
.order-head .row { gap: 12px; }
.order-head h1 { margin: 0; font-size: 18px; }
.order-head-meta { margin-top: 8px; }
.order-head-actions { display: flex; align-items: flex-start; gap: 10px; flex-wrap: wrap; }
.order-head-actions .st-dd { min-width: 195px; }
.order-head-actions .st-dd .dd-menu { left: auto; right: 0; min-width: 240px; }
@media (max-width: 760px) {
  .order-head-actions .st-dd .dd-menu { left: 0; right: auto; }
}

.order-mid-grid {
  display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(340px, 1fr); gap: 16px;
  align-items: stretch; margin-bottom: 16px;
}
.order-mid-grid .card { margin-bottom: 0; }
.order-delivery-card { display: flex; flex-direction: column; }
.order-actions-col { display: flex; flex-direction: column; gap: 16px; height: 100%; }
.warehouse-card { flex: 1; display: flex; flex-direction: column; }
.warehouse-send-form { flex: 1; display: flex; flex-direction: column; gap: 10px; }
.warehouse-send-form > .btn { width: 100%; text-align: center; }
.card-spacer { flex: 1; }
@media (max-width: 1100px) {
  .order-mid-grid { grid-template-columns: minmax(0, 1fr); }
  .order-actions-col { height: auto; }
  .warehouse-card { flex: 0 1 auto; }
}
.pay-tag {
  display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px; border-radius: 6px;
  font-size: 12px; font-weight: 600; white-space: nowrap; border: 1px solid;
}
.pay-tag b { font-size: 13px; }
.pay-tag.cod { color: #b8650c; background: #fff3e6; border-color: #ffd8ab; }
.pay-tag.prepaid { color: var(--c-paid); background: #e9f8ee; border-color: #bce6ca; }
.pay-tag.unknown { color: var(--c-err); background: var(--c-err-bg); border-color: #f5c2c2; }

.card-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.card-title h1, .card-title h2 { margin: 0; }
.card-title.top { align-items: center; margin-bottom: 16px; }
.card-title.top h1 { display: flex; align-items: center; gap: 8px; }
.badge.plain { background: var(--soft); color: var(--text); border: 1px solid var(--line); }
.stock-ok { color: var(--c-ok); }

.sku-tag { background: var(--soft); border: 1px solid var(--line); border-radius: 4px; padding: 1px 6px; font-size: 12px; }
td .sub { color: var(--muted); font-size: 12px; margin-top: 3px; }
td .item-name { font-weight: 600; }
td.name-col { min-width: 240px; }

/* Залишки по складах: логотип складу в заголовку колонки (картинки з wetrack) */
.wh-icon { display: inline-flex; align-items: center; gap: 5px; cursor: help; }
.wh-icon img {
  width: 20px; height: 20px; object-fit: contain; background: #fff; border: 1px solid var(--line);
  border-radius: 5px; padding: 2px;
}
.wh-icon.off { color: var(--muted); }
.wh-icon.off img { opacity: .45; }
table.data th.wh-col { width: 64px; }
td.wh-stub { background: repeating-linear-gradient(135deg, transparent 0 6px, var(--soft) 6px 8px); }  /* на вузькому екрані таблиця скролиться, а не стискає назву в стовпчик */

.totals { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; margin-top: 12px; font-size: 13px; }
.totals > div { display: flex; justify-content: space-between; gap: 16px; width: 280px; }
.totals .grand { font-size: 16px; font-weight: 700; border-top: 1px solid var(--line); padding-top: 6px; margin-top: 2px; }

.blocks { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 18px 24px; }
.blocks h3 { font-size: 13px; font-weight: 600; color: var(--dark); margin: 0 0 8px; }
.block-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.block-head h3 { margin: 0; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; padding: 0; border-radius: 6px;
  background: var(--card); border: 1px solid var(--line); color: var(--text);
  cursor: pointer;
}
.icon-btn:hover:not(:disabled) { background: var(--soft); border-color: #c8c8cd; }
.icon-btn:disabled { opacity: .35; cursor: not-allowed; }
.addr-form { display: flex; flex-direction: column; gap: 8px; }
.addr-form .addr-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.addr-form label { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--muted); }
.addr-form input[type=text] { width: 100%; color: var(--text); }
dl.kv.tight { grid-template-columns: 90px 1fr; gap: 5px 10px; font-size: 13px; }

.timeline { list-style: none; margin: 0; padding: 0 0 0 16px; position: relative; font-size: 13px; }
.timeline::before { content: ""; position: absolute; left: 4px; top: 6px; bottom: 6px; width: 2px; background: var(--line); }
.timeline li { position: relative; margin-bottom: 10px; }
.timeline li:last-child { margin-bottom: 0; }
.timeline li::before {
  content: ""; position: absolute; left: -16px; top: 5px; width: 8px; height: 8px; border-radius: 50%;
  background: var(--dark); border: 2px solid var(--card);
}

/* Блоки дій: ТТН та Склад */
.action-card { padding: 16px 18px; }
.side-title {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .5px; color: var(--dark); margin-bottom: 10px;
}
.side-title .badge { text-transform: none; letter-spacing: 0; font-weight: 600; }
.side-hint {
  font-size: 11px; font-weight: 500; text-transform: none; letter-spacing: 0; color: var(--muted);
  background: var(--soft); border: 1px solid var(--line); border-radius: 999px; padding: 1px 8px;
}
.stack { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.stack > .btn, .stack > form > .btn { width: 100%; text-align: center; }
.stack select, .stack input[type=text] { width: 100%; }

/* Плитки вибору перевізника та складу замість <select> */
.choice-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(145px, 1fr)); gap: 8px; }
.choice-tile, .wh-choice { position: relative; display: block; cursor: pointer; }
.choice-tile input[type=radio], .wh-choice input[type=radio] {
  position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none;
}
.choice-body {
  display: flex; flex-direction: column; gap: 2px; padding: 9px 11px; border-radius: 9px;
  background: var(--card); border: 1px solid var(--line); transition: border-color .12s, background .12s;
}
.choice-tile:hover .choice-body { border-color: #c8c8cd; background: var(--soft); }
.choice-tile input[type=radio]:checked + .choice-body {
  border-color: var(--dark); background: var(--soft); box-shadow: inset 0 0 0 1px var(--dark);
}
.choice-tile input[type=radio]:focus-visible + .choice-body { outline: 2px solid var(--c-new); outline-offset: 2px; }
.choice-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.choice-name { font-size: 13px; font-weight: 600; color: var(--text); }
.choice-sub { font-size: 11.5px; color: var(--muted); }
.choice-dot {
  width: 14px; height: 14px; border-radius: 50%; border: 1.5px solid #b4b4bc; background: var(--card); flex: none;
  display: inline-flex; align-items: center; justify-content: center;
}
.choice-tile input[type=radio]:checked + .choice-body .choice-dot,
.wh-choice input[type=radio]:checked + .wh-choice-body .choice-dot {
  border-color: var(--dark); background: var(--dark); box-shadow: inset 0 0 0 3px var(--card);
}

.wh-choices { display: flex; flex-direction: column; gap: 8px; }
.wh-choice-body {
  display: flex; align-items: center; gap: 10px; padding: 9px 11px; border-radius: 9px;
  background: var(--card); border: 1px solid var(--line); transition: border-color .12s, background .12s;
}
.wh-choice:hover:not(.disabled) .wh-choice-body { border-color: #c8c8cd; background: var(--soft); }
.wh-choice input[type=radio]:checked + .wh-choice-body {
  border-color: var(--dark); background: var(--soft); box-shadow: inset 0 0 0 1px var(--dark);
}
.wh-choice input[type=radio]:focus-visible + .wh-choice-body { outline: 2px solid var(--c-new); outline-offset: 2px; }
.wh-choice-body img {
  width: 26px; height: 26px; object-fit: contain; background: #fff; border: 1px solid var(--line);
  border-radius: 6px; padding: 2px; flex: none;
}
.wh-choice-meta { display: flex; flex-direction: column; gap: 1px; min-width: 0; flex: 1; }
.wh-choice-name { font-size: 13px; font-weight: 600; color: var(--text); }
.wh-choice-stock { font-size: 12px; }
.wh-choice-stock.ok { color: var(--c-ok); font-weight: 600; }
.wh-choice-stock.bad { color: var(--c-err); font-weight: 600; }
.wh-choice.disabled { cursor: default; }
.wh-choice.disabled .wh-choice-body { opacity: .62; background: var(--soft); border-style: dashed; }
.wh-choice.disabled img { opacity: .6; }

.send-meta {
  background: var(--soft); border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 10px; font-size: 12.5px;
}
.send-meta .ok-lbl { color: var(--c-ok); font-weight: 600; }

/* Смуга комунікації під середнім блоком: коментар покупця + примітка менеджера */
.notes-strip { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; align-items: stretch; }
.notes-strip.single { grid-template-columns: 1fr; }
.note-strip-box {
  background: var(--card); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow);
  border: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px;
}
.note-strip-box.buyer-note { background: var(--c-corr-bg); border-color: #eedbb4; color: #7a5410; }
.note-strip-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px;
}
.note-strip-text { font-size: 13.5px; line-height: 1.45; }
.manager-note-box.has-note { background: #fbfbfc; border-color: #d4d4dc; }
.manager-note-row { display: flex; gap: 8px; align-items: flex-start; }
.manager-note-row textarea {
  flex: 1; min-height: 36px; padding: 7px 10px; font-size: 13.5px; line-height: 1.4;
  transition: min-height .15s ease;
}
.manager-note-row textarea:focus { min-height: 76px; }
@media (max-width: 960px) {
  .notes-strip { grid-template-columns: 1fr; }
}
/* Випадайка статусу, як у BL: кольоровий квадратик + назва; .sq — після .st-*, щоб фон брався з кольору статусу */
.sq { display: inline-block; width: 12px; height: 12px; border-radius: 3px; background: currentColor; flex: none; }
.nav .sq { width: 10px; height: 10px; border-radius: 3px; background: currentColor; }
.nav .sq.st-new { color: #63b3ed; }
.nav .sq.st-correction { color: #f6ad55; }
.nav .sq.st-manual_check { color: #fc8181; }
.nav .sq.st-transferred { color: #68d391; }
.nav .sq.st-cancelled { color: #9a9ba3; }
.nav .sq.st-externally_processed { color: #b794f4; }
.nav a.active .sq.st-new { color: var(--c-new); }
.nav a.active .sq.st-correction { color: var(--c-corr); }
.nav a.active .sq.st-manual_check { color: var(--c-manual); }
.nav a.active .sq.st-transferred { color: var(--c-trans); }
.nav a.active .sq.st-cancelled { color: var(--c-cancel); }
.nav a.active .sq.st-externally_processed { color: var(--c-ep); }
.st-pick-row { flex-wrap: nowrap; gap: 6px; }
.st-dd { flex: 1; min-width: 0; }
.st-dd .dd-btn { display: flex; align-items: center; gap: 8px; width: 100%; font-size: 14px; padding: 7px 28px 7px 10px; background: var(--card); }
.st-dd .dd-menu { min-width: 100%; padding: 4px; }
.st-opt {
  display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 10px; border: 0; border-radius: 6px;
  background: none; font: inherit; font-size: 14px; color: var(--text); text-align: left; white-space: nowrap;
}
button.st-opt { cursor: pointer; }
button.st-opt:hover, button.st-opt:focus-visible, .st-opt.picked { background: var(--c-new-bg); outline: none; }
.st-opt.cur { background: var(--soft); font-weight: 600; }
.st-opt.off { color: var(--muted); cursor: not-allowed; }
.st-opt.off .sq { opacity: .35; }
.st-note { margin-left: auto; padding-left: 12px; font-size: 11px; font-weight: 400; color: var(--muted); }
.st-pick-row > .btn { flex: none; }

.confirm { display: flex; gap: 6px; align-items: center; font-size: 13px; color: var(--c-manual); }
.confirm[hidden] { display: none; }
.awb { background: var(--soft); border-radius: 8px; padding: 10px 12px; margin-bottom: 10px; }
.awb-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.awb-actions { display: inline-flex; align-items: center; gap: 2px; flex: none; }
.inline-form { display: inline; margin: 0; }
.awb-row { display: flex; align-items: center; justify-content: space-between; margin: 2px 0 6px; }
.awb-row b { font-size: 15px; }
.btn.danger-light { background: var(--c-err-bg); color: var(--c-err); border: 1px solid #f5c2c2; }
.btn.danger-light:hover { background: #fbdada; }
.old-ttn { margin-top: 12px; }
.old-ttn summary { cursor: pointer; }
.old-ttn .history { margin-top: 6px; }
.ttn-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 10px; background: var(--soft); padding: 4px; border-radius: 8px; }
.ttn-tab { border: 0; background: transparent; border-radius: 6px; padding: 6px 8px; font: inherit; font-size: 13px; font-weight: 500; color: var(--muted); cursor: pointer; }
.ttn-tab.active { background: var(--card); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, .06); }
.manual-ttn-form label { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--muted); }
.manual-ttn-form input, .manual-ttn-form select { width: 100%; font: inherit; font-size: 13px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--card); color: var(--text); }
.alert.warn { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }

.copy {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  background: none; border: 0; cursor: pointer; color: var(--muted); padding: 2px 4px; margin-left: 4px;
  border-radius: 4px; vertical-align: middle; line-height: 0; text-decoration: none;
}
.copy:hover { color: var(--text); background: var(--soft); }
.copy.danger:hover { color: var(--c-err); background: var(--c-err-bg); }
.copy.done { color: var(--c-ok); }

/* Вхід */
.login-wrap { min-height: 100vh; display: grid; place-items: center; }
.login-card { width: 340px; }
.login-card label { display: block; margin: 10px 0 4px; color: var(--muted); font-size: 13px; }
.login-card input { width: 100%; }
.login-card .btn { width: 100%; margin-top: 16px; }
.pin-box { font-size: 28px; letter-spacing: 6px; font-weight: 700; }

/* Повноекранне блокування картки на час важких запитів (ТТН, SEND, статус) */
.busy-overlay[hidden] { display: none; }
.busy-overlay {
  position: fixed; inset: 0; z-index: 1000; background: rgba(39, 40, 44, .28);
  display: grid; place-items: center; cursor: wait;
}
.busy-box {
  display: flex; align-items: center; gap: 12px; padding: 14px 20px; border-radius: var(--radius);
  background: var(--card); border: 1px solid var(--line); box-shadow: 0 10px 30px rgba(20, 20, 30, .16);
  color: var(--text); font-weight: 600;
}
.spinner {
  width: 18px; height: 18px; border: 2px solid var(--line); border-top-color: var(--dark);
  border-radius: 50%; animation: oms-spin .7s linear infinite; flex: none;
}
@keyframes oms-spin { to { transform: rotate(360deg); } }

/* Модальне попередження при зміні статусу з Transferred */
dialog.oms-dialog {
  border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px;
  max-width: 420px; width: calc(100% - 32px); background: var(--card); color: var(--text);
  box-shadow: 0 12px 32px rgba(20, 20, 30, .2);
}
dialog.oms-dialog::backdrop { background: rgba(39, 40, 44, .35); }
dialog.oms-dialog p { margin: 0 0 16px; line-height: 1.5; }
dialog.oms-dialog a { color: var(--c-new); font-weight: 600; text-decoration: none; }
dialog.oms-dialog a:hover { text-decoration: underline; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }
