/* Локальна копія шрифту: працює без інтернету, якщо покласти файл у public/fonts/golos.ttf.
   Немає файлу — браузер просто візьме системний шрифт (див. README, розділ про резервний сервер). */
@font-face {
  font-family: 'Golos Text Local';
  src: url('/fonts/golos.ttf') format('truetype');
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --paper: #F3F5F4;
  --surface: #FFFFFF;
  --ink: #16262B;
  --muted: #5D6D72;
  --rule: #D3DBD8;
  --rule-soft: #E7ECEA;
  --accent: #0E6655;
  --accent-hover: #0A5446;
  --accent-soft: #E0EEE9;
  --warn: #7D5200;
  --warn-bg: #FFF3D6;
  --danger: #A8261E;
  --danger-bg: #FBE9E7;
  --al: #7A2E12;
  --al-bg: #FBE7DC;
  --font: 'Golos Text', 'Golos Text Local', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  --r: 6px;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--paper);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
h2 { font-size: 20px; }
h3 { font-size: 16px; }
p { margin: 0; }
a { color: var(--accent); }
[hidden] { display: none !important; }
.boot { padding: 40px; color: var(--muted); }
.muted { color: var(--muted); }
.pre { white-space: pre-wrap; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- controls ---------- */
button {
  font: inherit;
  cursor: pointer;
  border-radius: var(--r);
  border: 1px solid transparent;
  padding: 8px 14px;
  line-height: 1.2;
  background: none;
  color: var(--ink);
}
button:disabled { opacity: .5; cursor: default; }
.primary { background: var(--accent); color: #fff; font-weight: 500; }
.primary:hover:not(:disabled) { background: var(--accent-hover); }
.ghost { border-color: var(--rule); background: var(--surface); }
.ghost:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.sm { padding: 5px 10px; font-size: 13px; }
.block { width: 100%; }
.link { padding: 2px 4px; color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.danger-link { color: var(--danger); }
.icon {
  width: 28px; height: 28px; padding: 0;
  color: var(--muted); font-size: 18px; line-height: 1;
}
.icon:hover { background: var(--danger-bg); color: var(--danger); }

input, select, textarea {
  font: inherit;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--r);
  padding: 7px 10px;
  width: 100%;
  min-width: 0;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
input:disabled, select:disabled, textarea:disabled { background: var(--paper); color: var(--ink); }
textarea { resize: vertical; line-height: 1.5; }
input.num { text-align: right; }
label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
label > input, label > select, label > textarea { font-size: 15px; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }

/* ---------- header ---------- */
.top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 24px;
  padding: 0 24px;
  background: var(--ink);
  color: #fff;
  min-height: 60px;
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px; }
.brand-sub { font-size: 12px; color: #A9BAB6; }
.brand-tile {
  width: 34px; height: 34px; flex: none; display: grid; place-items: center;
  background: #F5F2EA; border-radius: 9px;
}
.brand-tile .mark { width: 24px; height: 24px; display: block; }

/* логотип на екрані входу */
.logo-lockup { display: flex; align-items: center; gap: 14px; justify-content: center; }
.logo-lockup .mark.lg { width: 58px; height: 58px; flex: none; }
.logo-text { display: grid; gap: 2px; }
.wordmark { font-size: 32px; font-weight: 700; letter-spacing: -0.035em; line-height: 1; }
.wordmark b { color: #1E2B26; font-weight: 700; }
.wordmark i { color: #E07A2F; font-style: normal; }
.wordmark em { color: #2E7D6B; font-style: normal; font-weight: 700; }
.logo-tag { font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.login-sub { text-align: center; margin-top: 2px; }
.tabs { display: flex; gap: 2px; align-self: stretch; overflow-x: auto; flex: 1; }
.tab {
  border-radius: 0; border: 0;
  border-bottom: 3px solid transparent;
  color: #C7D3D0; padding: 0 14px; white-space: nowrap;
}
.tab:hover { color: #fff; }
.tab-ico { padding: 0 12px; display: inline-flex; align-items: center; }
.tab-ico-first { margin-left: auto; }
.tab-ico svg { display: block; }
.tab.on { color: #fff; border-bottom-color: #3FA58C; font-weight: 500; }
.who { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.who > span { display: grid; text-align: right; line-height: 1.2; margin-right: 4px; }
.who small { color: #A9BAB6; font-size: 12px; }
.who .ghost { background: transparent; color: #fff; border-color: #3C5057; }
.who .ghost:hover { border-color: #fff; color: #fff; }

main { padding: 20px 24px 60px; max-width: 1480px; margin: 0 auto; }

.subnav { display: flex; gap: 4px; margin-bottom: 16px; border-bottom: 1px solid var(--rule); }
.subnav button { border-radius: var(--r) var(--r) 0 0; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; color: var(--muted); }
.subnav button.on { color: var(--ink); border-bottom-color: var(--accent); font-weight: 500; }
.count { color: var(--muted); font-weight: 400; margin-left: 2px; }

.bar { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.bar input[type=search] { max-width: 360px; }
.bar .sp, .m-actions .sp { flex: 1; }
.note { font-size: 13px; color: var(--muted); }
.empty { color: var(--muted); padding: 16px 0; }

/* ---------- soon ---------- */
.soon { max-width: 560px; margin: 60px auto; padding: 28px; background: var(--surface); border: 1px dashed var(--rule); border-radius: 10px; }
.soon h2 { margin-bottom: 8px; }
.soon p { color: var(--muted); }

/* ---------- dishes split ---------- */
.split { display: grid; grid-template-columns: 320px 1fr; gap: 20px; align-items: start; }
.dlist {
  position: sticky; top: 80px;
  background: var(--surface); border: 1px solid var(--rule); border-radius: 10px;
  display: flex; flex-direction: column; max-height: calc(100vh - 100px);
}
.dlist-tools { display: grid; gap: 8px; padding: 12px; border-bottom: 1px solid var(--rule-soft); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.dlist-items { overflow-y: auto; padding: 4px; }
.ditem {
  display: grid; gap: 2px; width: 100%; text-align: left;
  padding: 9px 10px; border-radius: var(--r);
}
.ditem:hover { background: var(--paper); }
.ditem.on { background: var(--accent-soft); }
.dname { font-weight: 500; }
.dmeta { font-size: 12.5px; color: var(--muted); }
.dlist-items .empty { padding: 16px 10px; }

.editor { background: var(--surface); border: 1px solid var(--rule); border-radius: 10px; padding: 20px 24px 24px; min-width: 0; }
.placeholder { padding: 60px 20px; text-align: center; color: var(--muted); }
.ed-head { display: flex; gap: 16px; align-items: flex-start; margin-bottom: 18px; }
.title-input {
  font-size: 24px; font-weight: 600; letter-spacing: -0.015em;
  border: 0; border-bottom: 2px solid var(--rule-soft); border-radius: 0;
  padding: 4px 0; flex: 1;
}
.title-input:focus { box-shadow: none; border-bottom-color: var(--accent); }
.title-input:disabled { background: none; }
.ed-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; padding-top: 4px; }
.dirty-flag { font-size: 12.5px; color: var(--warn); align-self: center; }

.meta-grid { display: grid; grid-template-columns: 140px 1fr 190px 150px; gap: 12px; margin-bottom: 16px; }
.field-group { margin-bottom: 14px; }
.lbl { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.lbl small { margin-left: 6px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  padding: 4px 11px; font-size: 13.5px;
  border: 1px solid var(--rule); border-radius: 999px; background: var(--surface); color: var(--muted);
}
.chip:hover:not(:disabled) { border-color: var(--accent); color: var(--ink); }
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip.al-chip.on { background: var(--al); border-color: var(--al); }

/* ---------- composition table (ТК) ---------- */
.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 22px 0 8px; }
.tbl-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; }
.comp { font-size: 13px; }
.comp th, .comp td { padding: 3px 5px; border-bottom: 1px solid var(--rule-soft); }
.comp thead th {
  font-size: 12px; font-weight: 500; color: var(--muted); text-align: right;
  border-bottom: 2px solid var(--ink); padding-bottom: 6px; white-space: nowrap;
}
.comp thead th:first-child { text-align: left; }
.comp td.c, .comp tfoot th { text-align: right; white-space: nowrap; }
.comp td.c { color: var(--muted); width: 56px; }
.comp td.c.out { color: var(--ink); }
.comp .pcell { min-width: 200px; }
.comp .pcell input { font-weight: 500; }
.comp td input.num { width: 78px; }
.comp input { padding: 4px 6px; font-size: 13px; }
.comp input.manual { background: var(--warn-bg); }
.comp tr.missing .pcell input { border-color: var(--danger); background: var(--danger-bg); }
.comp tfoot th { padding-top: 8px; border-bottom: 0; font-weight: 600; }
.comp tfoot th:first-child { text-align: left; }
.comp .hint { display: block; font-size: 12px; color: var(--muted); padding: 2px 2px 0; }
.comp .link { display: block; margin-top: 2px; font-size: 12.5px; }
.comp .empty { text-align: center; }
.after-table { display: flex; gap: 12px; align-items: center; margin-top: 8px; flex-wrap: wrap; }
.legend { font-size: 12.5px; color: var(--muted); }
.legend i { display: inline-block; width: 11px; height: 11px; background: var(--warn-bg); border: 1px solid var(--rule); vertical-align: -1px; margin-right: 4px; }

.nutri { display: grid; grid-template-columns: 1fr 1fr 1.2fr; gap: 1px; background: var(--rule); border: 1px solid var(--rule); border-radius: 8px; overflow: hidden; margin: 18px 0; }
.nutri-block { background: var(--surface); padding: 12px 14px; }
.nutri-block h4 { font-size: 13px; font-weight: 500; color: var(--muted); margin-bottom: 8px; }
.nutri dl { margin: 0; display: grid; grid-template-columns: repeat(4, auto); gap: 4px 14px; justify-content: start; }
.nutri dt { font-size: 12px; color: var(--muted); }
.nutri dd { margin: 0; font-size: 17px; font-weight: 600; white-space: nowrap; }
.nutri .kc dd { color: var(--accent); }
.al { display: inline-block; padding: 2px 9px; margin: 0 4px 4px 0; background: var(--al-bg); color: var(--al); border-radius: 999px; font-size: 13px; font-weight: 500; }
.warn { grid-column: 1 / -1; background: var(--warn-bg); color: var(--warn); padding: 9px 14px; font-size: 13.5px; }

.two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.three { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.ed-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 18px; padding-top: 12px; border-top: 1px solid var(--rule-soft); font-size: 12.5px; color: var(--muted); gap: 12px; }

/* ---------- grids ---------- */
.grid { background: var(--surface); border: 1px solid var(--rule); border-radius: 8px; border-collapse: separate; border-spacing: 0; overflow: hidden; }
.grid th, .grid td { padding: 8px 10px; border-bottom: 1px solid var(--rule-soft); text-align: left; }
.grid thead th { font-size: 12.5px; font-weight: 500; color: var(--muted); background: var(--paper); white-space: nowrap; }
.grid tbody tr:last-child td { border-bottom: 0; }
.grid .n { text-align: right; white-space: nowrap; }
.grid tr.clickable { cursor: pointer; }
.grid tr.clickable:hover td { background: var(--accent-soft); }
.grid td input { padding: 5px 8px; }
.grid .acts { text-align: right; white-space: nowrap; }
.grid .acts > * + * { margin-left: 4px; }
.grid .al { font-size: 12px; padding: 1px 7px; }
.narrow { max-width: 820px; }
.narrow .grid { margin: 8px 0 12px; }

/* ---------- reference ---------- */
.ref { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; align-items: start; }
.sec-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.sec-head .sp { flex: 1; }
.btn-group { display: inline-flex; gap: 8px; align-items: center; }
.btn-group .ghost.on { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 500; }
.btn-group .ghost.on:hover { color: #fff; }
.ent-pick { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; background: #fff; max-width: 720px; }
.ent-pick label { display: block; }
.ent-pick select { width: 100%; max-width: 560px; }
.ent-pick .note { margin: 8px 0 0; }
.warn-cell { color: var(--danger); }
tr.row-warn td { background: #fff7f5; }
.narrow.wide.cl-reg { max-width: 100%; }
/* блок ширший за колонку тексту: таблиця юросіб не має ламатися на три рядки */
.wide-block { width: min(1340px, calc(100vw - 60px)); max-width: none; }
.ent-tbl td { vertical-align: top; }
.ent-tbl .ent-who small { color: var(--muted); }
.cust-find { display: flex; align-items: center; gap: 12px; margin: 0 0 8px; }
.cust-find input { flex: 0 1 620px; min-width: 240px; }
.cust-find .note { margin: 0; white-space: nowrap; }
.cust-reg td.edr { white-space: nowrap; font-variant-numeric: tabular-nums; }
/* реєстр клієнтів: усе по центру клітинки, крім назви замовника і кнопок рядка */
.cust-reg thead th, .cust-reg thead th.n { text-align: center; vertical-align: middle; }
.cust-reg td, .cust-reg td.n { text-align: center; vertical-align: middle; }
.cust-reg thead th:first-child, .cust-reg td:first-child { text-align: left; }
.cust-reg td.acts { text-align: right; }
.cust-find label.inline { margin: 0; gap: 6px; white-space: nowrap; }
.cust-find label.inline select { min-width: 150px; }
/* свій вибір дати: системний календар показує мову браузера, тому малюємо власний */
input.dt { font-variant-numeric: tabular-nums; }
.dtp { position: absolute; z-index: 100; width: 272px; padding: 8px; background: var(--surface, #fff);
  border: 1px solid var(--line, #d8ded9); border-radius: var(--r, 8px);
  box-shadow: 0 10px 28px rgba(0,0,0,.14); font-size: 13px; }
.dtp-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.dtp-head b { text-transform: capitalize; }
.dtp-nav { border: 0; background: none; font-size: 18px; line-height: 1; padding: 2px 8px;
  cursor: pointer; color: var(--muted, #6b7571); border-radius: 6px; }
.dtp-nav:hover { background: var(--bg-soft, #f3f5f4); }
.dtp-wd, .dtp-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; }
.dtp-wd span { text-align: center; font-size: 11px; color: var(--muted, #6b7571); padding: 2px 0; }
.dtp-day { height: 32px; min-width: 0; padding: 0; border: 0; background: none; border-radius: 6px;
  cursor: pointer; font: inherit; color: inherit; }
.dtp-day:hover { background: var(--bg-soft, #f3f5f4); }
.dtp-day.now { box-shadow: inset 0 0 0 1px var(--accent, #1f7a5a); }
.dtp-day.on { background: var(--accent, #1f7a5a); color: #fff; }
.dtp-day.off { visibility: hidden; }
.dtp-foot { display: flex; justify-content: space-between; margin-top: 6px; }
.dtp-set { border: 0; background: none; color: var(--accent, #1f7a5a); cursor: pointer;
  font: inherit; padding: 4px 6px; border-radius: 6px; }
.dtp-set:hover { background: var(--bg-soft, #f3f5f4); }

.pay-days { display: flex; gap: 6px; }
.pay-days input { flex: 0 0 90px; }
.pay-days select { flex: 1; min-width: 0; }
.ct-scope { margin: 6px 0 10px; }
.ct-scope .cp-list { max-height: 220px; overflow: auto; margin-top: 6px; }
.di-kits { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 4px 14px; }
.di-kits .inline { margin: 0; }
.di-kits select { flex: 1; min-width: 0; }
/* день, що не зійшовся в цільову ціну до копійки */
.sale-off { color: var(--danger); cursor: help; }
.col-sub small { display: block; font-weight: 400; color: var(--muted); }

/* підсумок дня під кожним раціоном у редакторі цін */
.price-edit tr.pz-sum td { background: var(--bg-soft, #fafafa); font-weight: 600; border-top: 1px solid var(--line); }
.price-edit tr.pz-sum td:nth-child(2) { font-weight: 500; color: var(--muted, #666); }
/* завантаження заявок: усі вкладки книги одразу */
.oi-bulk { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin: 10px 0; }
.oi-bulk .cp-list { max-height: 220px; }
.oi-bulk .note { margin: 6px 0 0; }

/* вибір точок, куди копіювати ціни */
.cp-list { max-height: 320px; overflow: auto; margin: 10px 0; display: grid; gap: 6px; }
.cp-list .check { margin: 0; }

/* акт на оплату: той самий вигляд на екрані й у друку */
.act-doc { background: #fff; border: 1px solid var(--line); border-radius: 10px;
  padding: 22px 26px; margin-top: 14px; font-size: 14px; line-height: 1.4; max-width: 1000px; }
.act-head { width: 100%; border-collapse: collapse; margin-bottom: 10px; }
.act-head td { width: 50%; vertical-align: top; padding: 2px 10px 2px 0; border: 0; }
.act-head .sign { display: inline-block; min-width: 140px; border-bottom: 1px solid var(--ink);
  margin-left: 10px; }
.act-head .req { white-space: pre-line; font-size: 12px; color: var(--muted); margin: 6px 0; }
.act-title { text-align: center; font-size: 17px; margin: 16px 0 2px; }
.act-num { text-align: center; margin: 0 0 12px; }
.act-pre { text-align: justify; }
.act-grid { width: 100%; border-collapse: collapse; margin: 12px 0; font-size: 13px; }
.act-grid th, .act-grid td { border: 1px solid var(--line); padding: 4px 8px; }
.act-grid th { background: var(--bg-soft, #fafafa); font-weight: 600; }
.act-grid td.n, .act-grid th.n, .act-total .n { text-align: right; white-space: nowrap; }
.act-grid td:nth-child(1), .act-grid th:nth-child(1) { white-space: nowrap; }
.act-total { margin-left: auto; border-collapse: collapse; }
.act-total td { padding: 3px 10px; border: 0; }
.act-total td.n { min-width: 130px; border-bottom: 1px solid var(--line); }
.act-foot { margin-top: 20px; }

/* цикл меню в картці точки */
.cyc-form { display: flex; align-items: flex-end; gap: 10px; margin: 10px 0 4px; }
.cyc-form label { display: block; margin: 0; }
.cyc-form input { width: 120px; }

/* згортані блоки карток замовника і точки доставки */
.fold-sec { border: 1px solid var(--line); border-radius: 10px; background: #fff; margin: 14px 0; }
.fold-sec > .kit-head { padding: 10px 14px; border-bottom: 0; }
.fold-sec.open > .kit-head { border-bottom: 1px solid var(--line); }
.fold-sec > .kit-head h3 { margin: 0; font-size: 16px; }
.fold-sec .fold-ttl { cursor: pointer; }
.fold-body { padding: 12px 14px 16px; }
.fold-body > .note:first-child { margin-top: 0; }
.fold-body .grid { margin-top: 10px; }
.fold-body .set-form { margin-top: 10px; }
/* ціни точок усередині документа в картці замовника */
.grid.sub { margin: 0; font-size: 13px; }
.grid.sub th { font-weight: 500; color: var(--muted, #666); }
.contract-card .grid.sub td, .contract-card .grid.sub th { padding: 5px 10px; }
.am-grid { table-layout: fixed; }
.am-grid th:nth-child(1), .am-grid td:nth-child(1) { width: 13%; }
.am-grid th:nth-child(2), .am-grid td:nth-child(2) { width: 21%; }
.am-grid th:nth-child(3), .am-grid td:nth-child(3) { width: 5%; }
.am-grid th:nth-child(4), .am-grid td:nth-child(4) { width: 15%; }
.am-grid th:nth-child(5), .am-grid td:nth-child(5) { width: 15%; }
.am-grid th:nth-child(6), .am-grid td:nth-child(6) { width: 6%; }
.am-grid th:nth-child(7), .am-grid td:nth-child(7) { width: 11%; }
.am-grid tr.same-client td:nth-child(1) { border-top-color: transparent; }
.kit-head .note { margin: 0; }
.links { list-style: none; margin: 0; padding: 0; display: grid; gap: 1px; background: var(--rule); border: 1px solid var(--rule); border-radius: 8px; overflow: hidden; }
.links li { background: var(--surface); padding: 12px 14px; }
.links a { font-weight: 500; text-decoration: none; }
.links a:hover { text-decoration: underline; }
.links p { font-size: 13.5px; color: var(--muted); margin-top: 3px; }
.links .acts { display: block; margin-top: 4px; }
.notes { display: grid; gap: 10px; }
.note-card { background: var(--surface); border: 1px solid var(--rule); border-left: 3px solid var(--accent); border-radius: 6px; padding: 12px 14px; }
.note-card p { margin: 6px 0 8px; font-size: 14.5px; }
.note-card footer { display: flex; justify-content: space-between; gap: 8px; font-size: 12.5px; color: var(--muted); }

/* ---------- modal ---------- */
.overlay { position: fixed; inset: 0; background: rgba(22, 38, 43, .45); display: grid; place-items: center; z-index: 50; padding: 20px; }
.modal { background: var(--surface); border-radius: 12px; padding: 22px 24px; width: min(620px, 100%); max-height: calc(100vh - 40px); overflow-y: auto; display: grid; gap: 14px; }
.modal form, .modal fieldset { display: grid; gap: 14px; }
.m-actions { display: flex; gap: 8px; align-items: center; margin-top: 4px; }
.g3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.g4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }

/* ---------- toasts ---------- */
#toasts { position: fixed; right: 20px; bottom: 20px; display: grid; gap: 8px; z-index: 60; }
.toast { background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 8px; max-width: 420px; font-size: 14px; }
.toast.err { background: var(--danger); }

/* ---------- login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card { width: min(380px, 100%); background: var(--surface); border: 1px solid var(--rule); border-radius: 14px; padding: 32px 28px; display: grid; gap: 14px; }
.login-card { padding: 30px 28px 26px; }
.login-card .err { color: var(--danger); font-size: 14px; min-height: 20px; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .meta-grid { grid-template-columns: 1fr 1fr; }
  .nutri { grid-template-columns: 1fr 1fr; }
  .nutri-block:last-of-type { grid-column: 1 / -1; }
}
@media (max-width: 900px) {
  .top { flex-wrap: wrap; padding: 8px 14px 0; gap: 8px 16px; }
  .tabs { order: 3; flex-basis: 100%; }
  .tab { padding: 10px 12px; }
  .who { margin-left: auto; }
  .who > span { display: none; }
  main { padding: 14px 12px 60px; }
  .split, .ref, .two, .three { grid-template-columns: 1fr; }
  .dlist { position: static; max-height: 360px; }
  .editor { padding: 16px; }
  .ed-head { flex-direction: column; align-items: stretch; }
  .ed-actions { justify-content: flex-start; }
  .g4 { grid-template-columns: 1fr 1fr; }
  .g3 { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: no-preference) {
  .toast { animation: tin .18s ease-out; }
  @keyframes tin { from { opacity: 0; transform: translateY(6px); } }
}

/* ---------- перемикач одиниць, характеристика, фото ---------- */
.unit-switch { display: inline-flex; border: 1px solid var(--rule); border-radius: var(--r); overflow: hidden; }
.unit-switch button { border: 0; border-radius: 0; padding: 4px 14px; font-size: 13px; color: var(--muted); background: var(--surface); }
.unit-switch button.on { background: var(--accent); color: #fff; font-weight: 500; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14.5px; color: var(--ink); }
.sum-nosp { margin: 6px 0 2px; width: fit-content; cursor: pointer; }
.sum-nosp input { width: 16px; height: 16px; flex: none; }
.check input { width: 18px; height: 18px; flex: none; }
.pureed #pureed-wrap { margin-top: 10px; }
.photo-box { display: flex; align-items: center; gap: 12px; min-height: 40px; margin-bottom: 8px; }
.photo-box img { max-width: 240px; max-height: 180px; border-radius: 8px; border: 1px solid var(--rule); }
.field-group > .ghost + .link { margin-left: 8px; }
.set-form { display: grid; gap: 14px; background: var(--surface); border: 1px solid var(--rule); border-radius: 10px; padding: 18px 20px; }

.salt .salt-wrap { display: flex; align-items: flex-end; gap: 14px; margin-top: 10px; flex-wrap: wrap; }
.salt .salt-wrap label { max-width: 240px; }
.salt .salt-wrap .note { padding-bottom: 8px; }

/* ---------- меню ---------- */
.menu-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.menu-card { display: grid; gap: 3px; text-align: left; padding: 14px 16px; background: var(--surface);
  border: 1px solid var(--rule); border-radius: 10px; }
.menu-card:hover { border-color: var(--accent); }
.mc-name { font-weight: 600; font-size: 16px; }
.mc-meta { font-size: 13px; color: var(--muted); }

.menu-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.mh-title { display: grid; }
.mh-title h2 { font-size: 20px; }

.day-tabs { display: flex; gap: 4px; overflow-x: auto; padding-bottom: 8px; margin-bottom: 4px; }
.day-tabs .day { min-width: 38px; padding: 6px 8px; border: 1px solid var(--rule); border-radius: var(--r);
  background: var(--surface); color: var(--muted); }
.day-tabs .day.has { color: var(--ink); border-color: var(--accent-soft); background: var(--accent-soft); }
.day-tabs .day.on { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 500; }

.menu-grid { background: var(--surface); border: 1px solid var(--rule); border-radius: 10px; border-collapse: separate;
  border-spacing: 0; overflow: hidden; min-width: 720px; }
.menu-grid th, .menu-grid td { border-bottom: 1px solid var(--rule-soft); border-right: 1px solid var(--rule-soft);
  padding: 8px 10px; vertical-align: top; text-align: left; }
.menu-grid th:last-child, .menu-grid td:last-child { border-right: 0; }
.menu-grid thead th { background: var(--paper); font-size: 13px; }
.menu-grid thead th .rcode { display: block; font-weight: 600; font-size: 14px; }
.menu-grid thead th .rname { display: block; color: var(--muted); font-weight: 400; font-size: 12px; }
.menu-grid .meal-col { width: 150px; background: var(--paper); font-size: 13.5px; font-weight: 500; }
.menu-grid tfoot td, .menu-grid tfoot th { border-bottom: 0; background: var(--paper); }


.mi { display: flex; align-items: center; gap: 6px; padding: 3px 0; font-size: 13.5px; }
.mi-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mi-portion { width: 62px; padding: 3px 5px; font-size: 13px; }
.mi-unit { color: var(--muted); font-size: 12px; }
.mi-kcal { color: var(--muted); font-size: 12.5px; white-space: nowrap; min-width: 62px; text-align: right; }
.mi.missing .mi-name { color: var(--danger); }
.mi-warn { color: var(--warn); font-weight: 700; cursor: help; }

.pick-filters { display: flex; gap: 18px; flex-wrap: wrap; }
.pick-list { max-height: 50vh; overflow-y: auto; display: grid; gap: 1px; background: var(--rule-soft);
  border: 1px solid var(--rule); border-radius: 8px; }
.pick { display: grid; grid-template-columns: 1fr 140px 70px 80px; gap: 10px; align-items: center; text-align: left;
  background: var(--surface); padding: 8px 12px; border-radius: 0; }
.pick:hover { background: var(--accent-soft); }
.pk-name { font-weight: 500; }
.pk-meta { color: var(--muted); font-size: 13px; }
.pk-num { text-align: right; font-size: 13px; color: var(--muted); }
.add-meal { display: flex; gap: 8px; margin-top: 8px; }
.add-meal input { max-width: 240px; }
@media (max-width: 900px) { .pick { grid-template-columns: 1fr 70px; } .pk-meta { display: none; } }

/* ---------- кухня ---------- */
.kitchen-head { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.kitchen-head.place { gap: 14px; padding: 10px 14px; margin-bottom: 12px; border: 1px solid var(--line);
  border-radius: 10px; background: var(--card, #fff); }
.kitchen-head.place select { min-width: 180px; }
.btn.danger, button.ghost.danger:hover { color: var(--danger); border-color: var(--danger); background: var(--danger-bg); }
.inline { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.inline input, .inline select { width: auto; }
.inline-num { width: 70px; display: inline-block; }
.order-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.order-grid td input.o-count { width: 70px; text-align: center; }
.order-grid tfoot th { background: var(--paper); }
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12.5px; font-weight: 500; }
.badge.closed { background: var(--accent-soft); color: var(--accent); }
.new-order { display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap; margin-top: 12px; }
.new-order label { flex: none; }
.kf-h { margin: 18px 0 8px; font-size: 16px; }

.menu-tools { display: flex; gap: 18px; align-items: center; margin-bottom: 10px; flex-wrap: wrap; }
.mi { display: flex; align-items: center; gap: 6px; padding: 3px 0; font-size: 13.5px; }
.mi + .mi { border-top: 1px solid var(--rule-soft); }
.mi-more { width: 24px; height: 22px; padding: 0; color: var(--muted); border-radius: var(--r); line-height: 1; }
.mi-more:hover { background: var(--accent-soft); color: var(--accent); }
.ctx-menu { position: fixed; z-index: 70; background: var(--surface); border: 1px solid var(--rule);
  border-radius: 8px; box-shadow: 0 6px 24px rgba(22,38,43,.18); padding: 4px; display: grid; min-width: 210px; }
.ctx-menu button { text-align: left; padding: 7px 10px; font-size: 14px; border-radius: var(--r); }
.ctx-menu button:hover:not(:disabled) { background: var(--accent-soft); }
.ctx-menu button:disabled { opacity: .35; }
.mc-acts { margin-top: 6px; }
.mi-name.renamed { border-bottom: 1px dashed var(--accent); }
.mi-tools .icon { width: 22px; height: 22px; font-size: 13px; color: var(--muted); }
.mi-tools .icon:hover:not(:disabled) { background: var(--accent-soft); color: var(--accent); }
.mi-tools .icon.on { background: var(--accent); color: #fff; }
.mi-tools .icon:disabled { opacity: .3; }

.day-tabs .week { display: flex; align-items: center; gap: 6px; padding-right: 10px; border-right: 1px solid var(--rule); margin-right: 6px; }
.day-tabs .week:last-child { border-right: 0; }
.week-label { font-size: 12px; color: var(--muted); white-space: nowrap; }
.week-days { display: flex; gap: 4px; }
.kf-grid .kf-meal { background: var(--accent-soft); color: var(--accent); text-align: center; font-weight: 600; }
.kf-grid th, .kf-grid td { font-size: 13px; padding: 5px 7px; }

/* ---------- інструкція ---------- */
.help { display: grid; grid-template-columns: 250px 1fr; gap: 28px; align-items: start; max-width: 1180px; }
.help-toc { position: sticky; top: 78px; background: var(--surface); border: 1px solid var(--rule);
  border-radius: 10px; padding: 14px 16px; max-height: calc(100vh - 100px); overflow-y: auto; }
.toc-title { font-size: 12.5px; color: var(--muted); margin-bottom: 8px; }
.help-toc ol { margin: 0; padding-left: 20px; display: grid; gap: 5px; font-size: 14px; }
.help-toc a { color: var(--ink); text-decoration: none; }
.help-toc a:hover { color: var(--accent); text-decoration: underline; }
.help-body { background: var(--surface); border: 1px solid var(--rule); border-radius: 10px; padding: 26px 32px 30px; min-width: 0; }
.help-body h1 { font-size: 26px; letter-spacing: -0.02em; }
.help-lead { color: var(--muted); margin: 6px 0 4px; max-width: 62ch; }
.help-sec { padding-top: 22px; margin-top: 18px; border-top: 1px solid var(--rule-soft); scroll-margin-top: 78px; }
.help-sec h2 { display: flex; align-items: baseline; gap: 10px; font-size: 19px; margin-bottom: 10px; }
.help-sec h2 .num { display: inline-grid; place-items: center; width: 26px; height: 26px; flex: none;
  background: var(--accent-soft); color: var(--accent); border-radius: 50%; font-size: 13px; align-self: center; }
.help-sec p { margin: 8px 0; max-width: 72ch; }
.help-sec ul, .help-sec ol { margin: 8px 0; padding-left: 22px; max-width: 72ch; }
.help-sec li { margin: 4px 0; }
.help-sec u { text-decoration-color: var(--accent); }
.tipbox { background: var(--warn-bg); border-radius: 8px; padding: 10px 14px; font-size: 14.5px; }
.help-sec figure { margin: 14px 0 0; }
.help-sec img { display: block; width: 100%; height: auto; border: 1px solid var(--rule); border-radius: 8px; background: var(--paper); }
.help-sec figcaption { font-size: 12.5px; color: var(--muted); margin-top: 5px; }
.help-foot { margin-top: 26px; padding-top: 14px; border-top: 1px solid var(--rule-soft); color: var(--muted); font-size: 14px; }
@media (max-width: 900px) {
  .help { grid-template-columns: 1fr; }
  .help-toc { position: static; max-height: none; }
  .help-body { padding: 18px 16px 22px; }
}

/* ---------- артикул у меню ---------- */
.mi-code { flex: none; font-size: 11.5px; color: var(--muted); background: var(--paper);
  border: 1px solid var(--rule-soft); border-radius: 4px; padding: 0 5px; line-height: 17px; }

/* ---------- документи дня на кухні ---------- */
.order-bar .primary.on { background: var(--ink); }
.kf-grid, .kf-order, .kf-prod, .kf-calc, .kf-veg { table-layout: fixed; }
.kf-grid td, .kf-grid th, .kf-order td, .kf-order th,
.kf-prod td, .kf-prod th, .kf-calc td, .kf-calc th,
.kf-veg td, .kf-veg th { overflow-wrap: anywhere; }
.kf-grid .kf-orgrow { background: var(--surface); border-bottom: 0; padding: 10px 10px 2px; }
.kf-org { display: flex; justify-content: space-between; gap: 10px; font-size: 12.5px; color: var(--muted); }
.kf-grid .kf-nums th { text-align: center; vertical-align: middle; white-space: normal; }
.kf-grid .kf-nums th.kf-name { text-align: left; }
.kf-grid .kf-deps th { font-size: 10px; font-weight: 400; line-height: 1.15; color: var(--muted);
  vertical-align: middle; text-align: center; white-space: normal; padding: 4px 3px;
  overflow-wrap: break-word; }
/* вміст комірок по центру рядка і по центру колонки */
.kf-grid td, .kf-order td, .kf-order th, .kf-prod td, .kf-prod th,
.kf-calc td, .kf-calc th, .kf-veg td, .kf-veg th { vertical-align: middle; }
.kf-grid td.n, .kf-grid th, .kf-order td.n, .kf-order th.n,
.kf-prod td.n, .kf-prod th.n, .kf-veg td.n, .kf-veg th.n { text-align: center; }
.kf-grid tbody td:first-child, .kf-grid th.kf-name,
.kf-prod tbody td:first-child, .kf-prod thead th:first-child,
.kf-order tbody td:nth-child(2), .kf-order thead th:nth-child(2), .kf-order tfoot th:nth-child(2),
.kf-calc tbody td:nth-child(2), .kf-calc thead th:nth-child(2),
.kf-veg .veg-name, .kf-veg thead th:first-child, .kf-veg tfoot th:first-child { text-align: left; }
.kf-veg td.veg-cut, .kf-veg thead th:nth-child(2) { text-align: center; }
.kf-order td.o-cell, .kf-order td input.o-count { text-align: center; }
.kf-veg .veg-name { font-weight: 500; vertical-align: top; padding-top: 10px; }
.kf-veg .veg-first td { border-top: 1px solid var(--rule); }
.kf-veg .veg-total td { color: var(--muted); }
.kf-veg .c-name2 { width: 260px; } .kf-veg .c-cut { width: 210px; } .kf-veg .c-kg { width: 120px; }
.meal-bar { display: flex; justify-content: flex-start; gap: 8px; margin: 16px 0 5px; }
/* ширини колонок на екрані — фіксовані, таблиця не розтягується на всю сторінку */
.kf-grid, .kf-order, .kf-prod, .kf-calc, .kf-veg { width: auto; }
.kf-grid .c-dep { width: 74px; } .kf-order .c-rat { width: 84px; }
.kf-grid .c-name { width: 384px; }
.kf-grid .c-total { width: 92px; } .kf-grid .c-out { width: 78px; }
.kf-grid .c-port { width: 62px; } .kf-grid .c-probe { width: 58px; }
/* спейси: на точку дві колонки — вага і штуки */
.kf-space .c-dep { width: 72px; } .kf-space .c-pcs { width: 64px; }
.kf-space thead .kf-nums th { white-space: nowrap; }
.kf-space .sp-pcs { font-weight: 600; background: #f7f7f4; }
.kf-space thead .kf-nums th { font-weight: 500; color: var(--muted); }
.kf-order .c-no { width: 44px; } .kf-order .c-name2 { width: 340px; } .kf-order .c-sum { width: 90px; }
.kf-prod .c-name2 { width: 340px; } .kf-prod .c-unit { width: 70px; } .kf-prod .c-kg { width: 110px; }
.kf-calc .c-no { width: 44px; } .kf-calc .c-name2 { width: 340px; }
.kf-calc .c-g { width: 130px; } .kf-calc .c-kg { width: 140px; }
.kf-h .code { font-size: 12.5px; color: var(--muted); background: var(--paper);
  border: 1px solid var(--rule-soft); border-radius: 4px; padding: 1px 6px; }

/* колонка «Нарізка» у складі страви */
.comp .cutcell { min-width: 120px; }
.comp .cutcell input { font-size: 12.5px; }
/* рядок із лікарнею, тижнем і днем */
.kf-grid .kf-org { text-transform: uppercase; color: var(--ink); font-weight: 600; font-size: 11.5px; letter-spacing: .03em; }

/* невірне значення в заявці */
.order-grid input.o-count.bad { border-color: var(--danger); background: var(--danger-bg); }

/* імпорт довідника */
.imp-prog { display: grid; gap: 8px; }
.imp-bar { height: 8px; background: var(--rule-soft); border-radius: 999px; overflow: hidden; }
.imp-bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }

/* ---------- калькулятор КБЖУ ---------- */
.calc-wrap { background: var(--surface); border: 1px solid var(--rule); border-radius: 10px; padding: 18px 20px 22px; }
.calc-wrap .bar { margin-bottom: 6px; }
.calc-wrap h2 { font-size: 19px; }
.calc-head { display: flex; gap: 16px; align-items: flex-end; margin: 14px 0 10px; flex-wrap: wrap; }
.calc-head label { max-width: 300px; flex: 1 1 220px; }
.calc-wrap .comp { width: auto; }
.calc-wrap .comp .pcell { width: 300px; }
.calc-wrap .comp td.c { width: 62px; }
.calc-wrap .comp td input.num { width: 90px; }

/* ---------- меню: рядки страв, граммівки по раціонах ---------- */
.menu-grid { width: auto; table-layout: fixed; }
.menu-grid .c-dish { width: 340px; }
.menu-grid .c-rat { width: 200px; }
.menu-grid .dish-col { background: var(--paper); font-size: 13.5px; }
.menu-grid thead th { text-align: center; }
.menu-grid thead th.dish-col { text-align: left; }
.menu-grid thead th .rcode, .menu-grid thead th .rname { display: block; }
.menu-grid td.mc, .menu-grid tfoot td { text-align: center; }
.menu-grid .mc-in { justify-content: center; }
.menu-grid tfoot td.tot { display: table-cell; font-size: 12.5px; }
.menu-grid .tot .tl { display: flex; justify-content: center; gap: 6px; line-height: 1.5; }
.menu-grid .tot .tl i { font-style: normal; color: var(--muted); min-width: 32px; text-align: right; }
.menu-grid .tot .tl b { min-width: 74px; text-align: left; font-weight: 500; }
.menu-grid .tot .tl.kc b { color: var(--accent); font-weight: 600; }
.menu-grid td.dish-cell { display: flex; align-items: center; gap: 6px; font-size: 13.5px; }
.menu-grid td.dish-cell .mi-name { flex: 1; min-width: 0; }
.menu-grid .meal-head { background: var(--accent-soft); color: var(--accent); text-transform: uppercase;
  font-size: 12.5px; letter-spacing: .04em; text-align: left; }
.menu-grid td.mc { padding: 4px 8px; }
.menu-grid .mc-in { display: flex; align-items: center; gap: 5px; justify-content: flex-end; }
.menu-grid td.mc.empty { text-align: center; color: var(--muted); }
.menu-grid .cell-add { width: 100%; padding: 4px 0; color: var(--muted); border-radius: var(--r); }
.menu-grid .cell-add:hover { background: var(--accent-soft); color: var(--accent); }
.menu-grid .mc-del { width: 20px; height: 20px; padding: 0; color: var(--muted); border-radius: 4px; line-height: 1; }
.menu-grid .mc-del:hover { background: var(--danger-bg); color: var(--danger); }
.menu-grid .add-row td { padding: 4px 10px 8px; }
.menu-grid .mi-kcal { min-width: 60px; font-size: 12px; }
.menu-grid td.mc { padding: 4px 6px; }
.menu-grid .mi-portion { width: 56px; }

/* ---------- смуга резервного сервера ---------- */
.localbar { position: sticky; top: 0; z-index: 80; display: flex; align-items: center; gap: 12px;
  padding: 8px 16px; font-size: 13px; line-height: 1.35; border-bottom: 1px solid rgba(0,0,0,.12); }
.localbar b { font-weight: 700; letter-spacing: .04em; font-size: 11px; padding: 2px 7px;
  border-radius: 4px; background: rgba(0,0,0,.14); white-space: nowrap; }
.localbar span { flex: 1; min-width: 0; }
.localbar button { border: 1px solid currentColor; background: transparent; color: inherit;
  padding: 5px 12px; border-radius: 7px; font: inherit; cursor: pointer; white-space: nowrap; }
.localbar button:hover:not(:disabled) { background: rgba(255,255,255,.22); }
.localbar button:disabled { opacity: .5; cursor: default; }
.localbar.mirror { background: #eef1f5; color: #3a4552; }
.localbar.warn { background: #fdf0d0; color: #6a4b06; }
.localbar.off { background: #8c2020; color: #fff; }
.localbar.off b { background: rgba(255,255,255,.22); }
.localbar.ok { background: #1f6244; color: #fff; }
.localbar.ok b { background: rgba(255,255,255,.22); }
@media print { .localbar { display: none; } }

/* ---------- підзаголовки у складі страви ---------- */
.comp tr.grp td { background: var(--paper); }
.comp tr.grp .it-label { font-weight: 600; }
.comp tr.grp input { background: transparent; }

/* ---------- фотоінструкція ---------- */
ol.steps { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 10px; }
.step { display: flex; gap: 12px; align-items: flex-start; border: 1px solid var(--line);
  border-radius: 10px; padding: 10px; background: var(--card, #fff); }
.step-photo { width: 120px; height: 90px; flex: none; border-radius: 8px; overflow: hidden;
  background: var(--paper); display: flex; align-items: center; justify-content: center; }
.step-photo img { width: 100%; height: 100%; object-fit: cover; }
.step-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.step-body textarea { width: 100%; resize: vertical; }
.step-acts { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }

/* ---------- калькуляції для кухні у звичному для кухарів вигляді ---------- */
.kc-band { background: var(--ink, #1E2B26); color: #fff; padding: 7px 12px; border-radius: 8px;
  font-weight: 600; margin: 14px 0 10px; text-transform: uppercase; letter-spacing: .02em; font-size: 13px; }
.kc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 14px; align-items: start; }
.kc-dish { border-collapse: collapse; width: 100%; background: #fff; table-layout: fixed; }
.kc-dish .kc-c1 { width: 46%; }
.kc-dish .kc-c2 { width: 27%; }
.kc-dish td, .kc-dish th { border: 1px solid #9aa3a0; padding: 3px 6px; font-size: 12px; vertical-align: middle; }
.kc-dish .kc-title th { background: var(--paper); font-weight: 700; text-align: center; }
.kc-dish .kc-code { text-align: center; font-weight: 600; }
.kc-dish .kc-info td { text-align: center; font-size: 11.5px; background: #fbfbfa; line-height: 1.5; }
.kc-dish .kc-probe { background: #f6d6d6; border-radius: 4px; padding: 1px 6px; white-space: nowrap; }
.kc-dish .kc-sub th { background: var(--paper); font-size: 11px; font-weight: 600; text-align: center;
  color: var(--muted); text-transform: lowercase; }
.kc-dish .kc-prod { text-align: left; }
.kc-dish td.n { text-align: right; font-variant-numeric: tabular-nums; }
.kc-dish td.c { text-align: center; }
.kc-dish .kc-out th { text-align: left; font-weight: 600; background: var(--paper); }
.kc-dish tr.grp td { background: #eef1f0; }


/* ---------- перемикач клієнта і вкладка «Клієнти» ---------- */
.client-pick { font: inherit; font-size: 14px; font-weight: 600; color: #fff; background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.22); border-radius: 8px; padding: 3px 10px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 8px; max-width: 320px; }
.client-pick:hover { background: rgba(255,255,255,.2); }
.client-pick i { font-style: normal; font-size: 11px; opacity: .8; }
.client-menu { min-width: 280px; max-height: 70vh; overflow: auto; padding: 6px; }
.client-menu .cm-kitchen { margin: 6px 8px 2px; font-size: 11px; font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase; color: var(--muted); }
.client-menu button { display: flex; align-items: baseline; gap: 8px; width: 100%; font-size: 14px; }
.client-menu button.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.client-menu button small { color: var(--muted); font-size: 12px; }
.narrow.wide { max-width: 1400px; }
.kit-card { border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; margin-bottom: 16px; background: #fff; }
.kit-card.off { opacity: .6; }
.kit-head { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 10px; }
.kit-head h3 { margin: 0; font-size: 16px; }
.kit-head .note { margin: 2px 0 0; }
.own-check { align-self: end; padding-bottom: 8px; }
.own-check small { display: block; color: var(--muted); font-size: 11px; line-height: 1.2; }

/* тиждень і коригування заявки */
.week-strip { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.wday { display: flex; flex-direction: column; align-items: center; gap: 1px; min-width: 48px;
  padding: 5px 7px; border: 1px solid var(--line); border-radius: 9px; background: #fff; cursor: pointer; }
.wday .wd { font-weight: 700; font-size: 12.5px; letter-spacing: .03em; }
.wday .wdate { font-size: 11.5px; color: var(--muted); }
.wday:hover { border-color: var(--accent); }
.wday.today { box-shadow: inset 0 -3px 0 var(--accent-soft); }
.wday.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.wday.on .wdate { color: rgba(255,255,255,.85); }
.day-line h2 { margin: 0; font-size: 20px; }
.day-line h2 small { font-weight: 400; color: var(--muted); font-size: 14px; margin-left: 8px; }
.order-tabs { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 14px 0 6px; }
.otab { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; padding: 7px 12px;
  border: 1px solid var(--line); border-radius: 10px 10px 0 0; background: #fff; cursor: pointer; font-weight: 600; }
.otab small { font-weight: 400; font-size: 11.5px; color: var(--muted); }
.otab.on { border-color: var(--accent); background: var(--accent); color: #fff; }
.otab.on small { color: rgba(255,255,255,.85); }
.otab.corr { border-style: dashed; }
.order-note { margin: 0 0 10px; }
.order-log { margin-top: 16px; font-size: 13px; color: var(--muted); }
.order-log summary { cursor: pointer; }
.order-log ul { margin: 8px 0 0 18px; padding: 0; }
.order-log li { margin: 2px 0; }
.kf-scope { margin: 14px 0 4px; }

/* правила заявки клієнта */
.rules-box { border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; background: #fff; max-width: 820px; }
.meal-pick { padding-bottom: 12px; margin-bottom: 12px; border-bottom: 1px solid var(--line); }
.meal-pick .note { margin: 8px 0 0; }
.chip.lock { opacity: .75; cursor: default; }
.chip.add { border-style: dashed; color: var(--muted); }
/* перемикач варіантів: кружок ліворуч, текст поруч — усюди, не лише в правилах заявки */
.radio-row { display: flex; flex-direction: row; justify-content: flex-start;
  align-items: flex-start; gap: 10px; margin: 0 0 10px; }
.radio-row input[type=radio] { width: 16px; height: 16px; flex: none; margin: 3px 0 0; }
.radio-row > span { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.radio-row small { color: var(--muted); }
.rules-box .radio-row { display: flex; flex-direction: row; justify-content: flex-start;
  align-items: flex-start; gap: 10px; padding: 7px 0; cursor: pointer; width: auto; }
.rules-box .radio-row input[type=radio] { width: 16px; height: 16px; flex: none; margin: 3px 0 0; }
.rules-box .radio-row span { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.rules-box .radio-row small { color: var(--muted); }
.rules-box .rm-time { width: 120px; }
.rules-meals { margin: 12px 0 14px; }
.rules-meals .lbl { font-weight: 600; margin: 0 0 6px; }
.rules-grid td, .rules-grid th { vertical-align: middle; }
.rules-grid .check { margin: 0; }
.otab.ghosted { border-style: dashed; color: var(--muted); background: #fff; }
.otab .dl { font-weight: 400; font-size: 11.5px; color: var(--muted); }
.otab.on .dl { color: rgba(255,255,255,.85); }
.order-tabs:empty { display: none; }
.order-note.flat { margin-top: 14px; }

/* шапка вкладки «Кухня» */
.sum-btns { display: inline-flex; gap: 8px; flex-wrap: wrap; }
.sum-btns .on { background: var(--accent); border-color: var(--accent); color: #fff; }
.wday .wd i { font-style: normal; font-weight: 400; font-size: 10px; color: var(--muted); margin-left: 4px; }
.wday.on .wd i { color: rgba(255,255,255,.8); }
.meal-src { color: var(--muted); font-size: 12.5px; margin-left: 6px; }
.kc-band .kc-src { float: right; font-weight: 400; opacity: .85; }
.kc-semi-band { background: var(--accent); }
.week-group { display: inline-flex; align-items: center; gap: 5px; padding-right: 4px; }
.week-group + .week-group { border-left: 1px solid var(--line); padding-left: 7px; }
.week-no { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; writing-mode: vertical-rl; transform: rotate(180deg); }
.week-strip .inline { gap: 5px; font-size: 13px; }
.week-strip input[type=date], .week-strip input.dt { padding: 5px 7px; }
.week-strip select { padding: 5px 7px; max-width: 150px; }
#k-order[hidden] { display: none; }
.order-bar .doc-btn.on, .sum-btns .ghost.on { background: var(--accent); border-color: var(--accent); color: #fff; }

/* модуль «Реалізація» */
.contract-card, .price-card { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px;
  margin-bottom: 14px; background: #fff; }
.contract-card.off { opacity: .6; }
.price-grid td, .price-edit td { padding: 4px 8px; }
.price-edit input { width: 78px; text-align: right; }
.sales-grid th.meal-head { background: var(--accent-soft); }
.sales-grid td.b, .sales-grid th.b { font-weight: 700; }
.sales-grid .corr-cell { color: var(--accent); }
.sales-grid input.s-cost { width: 110px; text-align: right; }
.sales-grid tfoot th { background: #f6f7f7; }
p.warn { background: var(--danger-bg); color: var(--danger); padding: 8px 12px; border-radius: 8px; }
.amend-card { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin: 10px 0 0 18px; background: #fbfbfb; }
.amend-card h4, .doc-prices h4 { margin: 0; font-size: 14.5px; }
.doc-prices { margin-top: 10px; }
.price-grid th small, .price-edit th small { display: block; font-weight: 400; font-size: 10.5px; color: var(--muted); }
.price-edit th, .price-grid th { white-space: nowrap; }

/* широке вікно цін */
.modal.wide { width: min(1600px, 98vw); max-height: calc(100vh - 24px); }
.modal.wide .tbl-wrap { max-height: calc(100vh - 330px); overflow: auto; }
.modal.wide .price-edit th { position: sticky; top: 0; background: var(--surface); z-index: 2; }

/* таблиця реалізації */
.sales-grid th, .sales-grid td { text-align: center; }
.sales-grid tbody td:first-child, .sales-grid thead th:first-child, .sales-grid tfoot th:first-child { text-align: left; }
.sales-grid th.meal-head { text-align: center; background: var(--accent-soft); }
.sales-grid .grp { border-left: 1px solid var(--rule, #d7dedc); }
.sales-grid th small { display: block; font-weight: 400; font-size: 10.5px; color: var(--muted); }
.sales-grid input.s-cost { text-align: center; }
.sales-grid thead th.n small { color: var(--muted); }

/* вирівнювання таблиць реалізації і прайсу */
.sales-grid td.n, .sales-grid th.n, .sales-grid td.b, .sales-grid th.b { text-align: center; }
.sales-grid tbody td:first-child { white-space: nowrap; }
.sales-grid tbody td:first-child small { margin-left: 6px; }
.price-edit th.n, .price-grid th.n { text-align: center; }
.price-edit td, .price-grid td.n { text-align: center; }
.price-edit input { text-align: center; }
.modal.wide .date-note { display: grid; grid-template-columns: 190px 1fr; gap: 14px; align-items: start; }
.sales-grid td.date-cell { white-space: nowrap; }
.sales-grid td.date-cell small { margin-left: 6px; }

/* згортання таблиць цін у картці клієнта */
.doc-prices > .kit-head,
.price-card > .kit-head { align-items: flex-start; gap: 8px; }
.fold {
  width: 26px; height: 26px; flex: none; margin-top: 1px;
  border: 1px solid var(--line); border-radius: 7px; background: #fff;
  color: var(--muted); font-size: 13px; line-height: 1; cursor: pointer;
}
.fold:hover { border-color: var(--brand); color: var(--brand); }
.doc-prices:not(.open) > .kit-head,
.price-card:not(.open) > .kit-head { margin-bottom: 0; }
.fold-ttl { cursor: pointer; }
.fold-ttl:hover h3, .fold-ttl:hover h4 { color: var(--brand); }

/* вкладка реалізації: ширша сторінка і щільніші рядки — більше днів на екрані */
main.wide-tab { max-width: min(1860px, 100vw - 32px); }
.sales-grid th, .sales-grid td { padding: 4px 7px; line-height: 1.25; }
.sales-grid thead th { font-size: 12px; }
.sales-grid td { font-size: 13px; }
.sales-grid input.s-cost { width: 86px; padding: 2px 6px; font-size: 13px; }
.sales-grid td.date-cell small { font-size: 11px; }
.sales-grid th small { font-size: 10px; }

.modal.wide #kform { max-width: 900px; }

/* вибір посвідчення якості */
.qc-pick { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 14px 0 4px; }
.qc-pick button { display: flex; flex-direction: column; gap: 3px; padding: 12px 10px; height: auto; }
.qc-pick small { font-weight: 400; opacity: .7; font-size: 11px; }

/* правила заявки: у простому режимі колонки коригувань не потрібні */
.rules-grid.no-corr th:nth-child(3), .rules-grid.no-corr td:nth-child(3),
.rules-grid.no-corr th:nth-child(4), .rules-grid.no-corr td:nth-child(4) { display: none; }
.rules-grid .rm-par { width: 100%; }

/* порядок прийомів їжі в параметрах меню */
.meal-order { display: flex; flex-wrap: wrap; gap: 8px; }
.ord-item { display: inline-flex; align-items: center; gap: 2px; padding: 2px 4px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--paper); font-size: 13px; }
.ord-item > span { padding: 0 4px; }
.ord-mv { width: 22px; height: 22px; border: 0; border-radius: 50%; background: transparent;
  color: var(--muted); cursor: pointer; line-height: 1; }
.ord-mv:hover:not(:disabled) { background: var(--accent-soft); color: var(--brand); }
.ord-mv:disabled { opacity: .25; cursor: default; }

/* реалізація: дата по центру клітинки */
.sales-grid td, .sales-grid th { vertical-align: middle; }
.sales-grid tbody td:first-child, .sales-grid td.date-cell,
.sales-grid thead th:first-child { text-align: center; }

/* заявка спейса: страви × точки */
.space-grid th.sp-name, .space-grid td:first-child { text-align: left; min-width: 260px; }
.space-grid tr.sp-group th { background: var(--accent-soft); text-align: left; font-weight: 600; }
.space-grid input.o-qty { width: 72px; text-align: center; }
.space-grid td, .space-grid th { padding: 4px 6px; }
/* напівфабрикат у складі страви */
.comp tr.semi-row .it-prod { color: var(--brand); font-weight: 500; }

/* забірний лист */
/* економіка: ціни */
.eco { max-width: none; }
.eco .bar { align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.eco .inline { display: grid; gap: 3px; font-size: 13px; color: var(--muted); }
.eco .inline select { width: auto; min-width: 150px; }
.eco #eco-search { max-width: 280px; }
/* собівартість страв по кухнях */
/* у таблиці цін перша колонка широка, тут вона вузька — знімаємо успадковану ширину */
.eco-grid.dc-grid th:first-child, .eco-grid.dc-grid td:first-child { min-width: 0; }
/* службові колонки стискаємо по вмісту, назва забирає решту ширини */
.dc-grid .dc-code { width: 1%; color: var(--muted); font-size: 13px; white-space: nowrap; }
.dc-grid .dc-name { width: auto; min-width: 240px; }
.dc-grid .dc-cat { width: 1%; color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.dc-grid .dc-out { width: 1%; color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.dc-grid thead th:first-child, .dc-grid thead th:nth-child(3),
.dc-grid thead th:nth-child(4) { white-space: nowrap; }
/* блок КБЖВ відокремлений від цін: своє тло і межі з обох боків */
.dc-grid .dc-nv { width: 62px; color: var(--ink); background: #F4F7F6; }
.dc-grid td.dc-nv, .dc-grid th.dc-nv { border-left: 1px solid var(--rule-soft); }
.dc-grid td.dc-nv-last, .dc-grid th.dc-nv-last { border-right: 1px solid var(--rule); }
.dc-grid th.dc-nv + th:not(.dc-nv) { border-left: 1px solid var(--rule); }
.dc-grid thead th.dc-nv { color: var(--muted); }
.eco-grid.dc-grid .dc-groups th { background: var(--paper); font-size: 12px; font-weight: 600;
  color: var(--muted); text-align: center; letter-spacing: .02em; padding: 5px 6px; }
.dc-grid .dc-groups th.dc-nv { background: #EAF1EE; color: var(--accent); }
.dc-nut { white-space: nowrap; padding-bottom: 6px; }
.dc-nut input { width: 16px; height: 16px; flex: none; }
.dc-grid .dc-badge { display: inline-block; margin-left: 6px; padding: 0 5px; border-radius: 4px;
  background: var(--paper); color: var(--muted); font-size: 11px; vertical-align: middle; }
.dc-grid tr.dc-semi .dc-name { color: var(--muted); }
.dc-grid td.best { background: var(--accent-soft); font-weight: 600; }
.dc-grid td.worst { background: #FFF8EC; }
.dc-grid .dc-miss { color: #B26B00; font-style: normal; }
.eco .bar { flex-wrap: wrap; gap: 12px; align-items: flex-end; }
#dc-search { max-width: 260px; }

/* таблиця цін гортається у своєму вікні, шапка лишається на місці */
.eco .tbl-wrap { max-height: calc(100vh - 240px); overflow: auto; }
/* у .grid стоїть overflow: hidden — через нього шапка не липне, тож тут його знімаємо */
.eco-grid { overflow: visible; }
.eco-grid thead { position: sticky; top: 0; z-index: 3; }
.eco-grid thead th { position: sticky; top: 0; z-index: 3; background: var(--paper);
  box-shadow: inset 0 -1px 0 var(--rule), 0 1px 6px rgba(30, 43, 38, .08); }
.eco-grid thead th:first-child { z-index: 4; }

/* довідник продуктів: числові колонки по центру */
.prod-grid th.n, .prod-grid td.n { text-align: center; }

.eco-grid th small { display: block; font-weight: 400; font-size: 11px; color: var(--muted); }
.eco-grid td.muted { color: var(--rule); }
.eco-grid tr.no-cost td:first-child { color: var(--muted); }
.eco-grid .nc { display: block; font-size: 11px; color: var(--muted); }
/* ціна не з цього місяця — видно одразу, що вона з попереднього приходу */
.eco-grid td.price-old, span.price-old { color: #B26B00; }
.eco-grid td.price-old { background: #FFF8EC; cursor: help; }
/* колонки кухонь і резервної — по центру */
.eco-grid th, .eco-grid td, .eco-grid th.n, .eco-grid td.n { text-align: center; }
.eco-grid th:first-child, .eco-grid td:first-child,
.eco-grid th:nth-child(2), .eco-grid td:nth-child(2) { text-align: left; }
.dc-grid th:nth-child(2), .dc-grid td:nth-child(2),
.dc-grid th:nth-child(3), .dc-grid td:nth-child(3) { text-align: left; }
.eco-grid input.res-price { width: 86px; text-align: center; padding: 4px 6px; }
.eco-grid input.res-price.saved { border-color: var(--accent); background: var(--accent-soft); }
.price-hint { display: grid; gap: 3px; align-content: start; font-size: 13px; color: var(--muted); }
.price-hint .lbl { margin: 0; }
.eco-grid th:first-child, .eco-grid td:first-child { min-width: 260px; }
.store-map { display: grid; gap: 6px; margin-top: 6px; max-height: 320px; overflow: auto; }
.store-row { display: grid; grid-template-columns: 160px 1fr; align-items: center; gap: 10px; font-size: 14px; }
.unk-list { display: grid; gap: 6px; max-height: 420px; overflow: auto; margin: 10px 0; }
.unk-row { display: grid; grid-template-columns: minmax(220px, 1.2fr) minmax(200px, 1fr) 90px 20px;
  gap: 10px; align-items: center; }
.unk-name small { display: block; color: var(--muted); font-size: 12px; }
.unk-ok { color: var(--accent); font-weight: 600; font-size: 13px; }
.unk-ok i { font-style: normal; font-size: 11px; color: var(--muted); }
.unk-row.guessed .unk-pick { border-color: var(--accent-soft); background: #F7FBF9; }
.err-note { color: var(--danger); }

/* довідник алергенів */
.al-tab { max-width: 1040px; }
.al-grid .c-al { width: 190px; } .al-grid .c-aln { width: 110px; } .al-grid .c-aldel { width: 110px; }
.al-grid .al-full { color: var(--muted); font-size: 13.5px; }
.al-tab .add-meal { display: flex; gap: 8px; align-items: center; }
.al-tab .add-meal input { max-width: 280px; }

.blank-pick { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }
.blank-pick .on { background: var(--accent); color: #fff; border-color: var(--accent); }
.blank-pick .on:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.blank-grid input.b-fact { width: 74px; text-align: center; }
.blank-grid input.b-kg { background: #FAFBFA; }
.blank-grid input.b-note { width: 100%; text-align: left; }
.blank-grid td:first-child { min-width: 240px; }
.blank-grid td, .blank-grid th, .blank-grid td.n, .blank-grid th.n { padding: 4px 6px; text-align: center; vertical-align: middle; }
.blank-grid td:first-child, .blank-grid th:first-child { text-align: left; }

/* підказка «≈ шт» у калькуляційній карті */
.comp small.pc { display: block; font-size: 8pt; color: #444; font-weight: 400; }

/* ---- просчункові (тендерні) меню ---- */
.tn-grid td, .tn-grid th { vertical-align: top; }
.tn-st { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px;
  font-weight: 600; white-space: nowrap; background: #F1F4F3; color: var(--muted); }
.tn-st.tn-sent { background: #EAF1EE; color: var(--accent); }
.tn-st.tn-won { background: var(--accent-soft); color: var(--accent); }
.tn-st.tn-lost { background: #FFF1F0; color: #9B3B33; }
.mh-title .tn-st { margin-left: 8px; vertical-align: middle; }
.tn-pick { display: inline-flex; align-items: center; max-width: 320px; margin-top: 2px;
  padding: 2px 8px; border: 1px solid rgba(255,255,255,.25); border-radius: 999px;
  background: rgba(255,255,255,.08); color: #fff; font-size: 12px; cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tn-pick:hover { background: rgba(255,255,255,.16); }
.tn-pick i { font-style: normal; margin-left: 6px; opacity: .7; }
.tn-card h3 { margin: 18px 0 8px; font-size: 15px; }
.tn-sum { display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start;
  padding: 14px 16px; border: 1px solid var(--rule-soft); border-radius: 12px; background: var(--paper); }
.tn-big { display: flex; flex-direction: column; min-width: 150px; }
.tn-big b { font-size: 30px; line-height: 1.1; color: var(--accent); }
.tn-big.over b { color: #9B3B33; }
.tn-big span { font-size: 12px; color: var(--muted); }
.tn-sum dl { display: grid; grid-template-columns: auto auto; gap: 2px 12px; margin: 0; font-size: 13px; }
.tn-sum dt { color: var(--muted); }
.tn-sum dd { margin: 0; }
.tn-ok { color: var(--accent); }
.tn-over { color: #9B3B33; }
.tn-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-left: auto; }
.tn-form input.num { width: 90px; text-align: right; }
.tn-cols { display: grid; grid-template-columns: minmax(380px, 1.3fr) minmax(320px, 1fr); gap: 24px; }
.tn-days, .tn-meals, .tn-top { width: auto; min-width: 100%; }
.tn-days th, .tn-days td { padding: 4px 10px; }
.eco-grid.tn-days th:first-child, .eco-grid.tn-days td:first-child { min-width: 0; width: 1%; white-space: nowrap; }
.tn-days td.n, .tn-days th.n { width: 1%; white-space: nowrap; text-align: right; }
.tn-meals td.n, .tn-meals th.n, .tn-top td.n, .tn-top th.n { width: 1%; white-space: nowrap; text-align: right; }
.eco-grid.tn-meals th:first-child, .eco-grid.tn-top th:first-child { min-width: 0; }
.tn-days tfoot th { background: #F1F4F3; position: sticky; bottom: 0; }
.tn-days .tn-avg { background: #F4F7F6; font-weight: 600; }
.tn-cols .tbl-wrap { max-height: calc(100vh - 430px); }
@media (max-width: 1100px) { .tn-cols { grid-template-columns: 1fr; } }
.tn-grid td.worst { background: #FFF8EC; font-weight: 600; }
.eco-grid.tn-grid th:first-child, .eco-grid.tn-grid td:first-child { min-width: 0; width: 1%;
  white-space: nowrap; color: var(--muted); }
.tn-grid td:nth-child(2) { width: 36%; }
.tn-grid th:nth-child(3), .tn-grid td:nth-child(3) { width: 1%; white-space: nowrap; }

/* ---- собівартість і алергени просто в меню ---- */
.mi-cost { min-width: 56px; padding: 2px 6px; border: 1px solid var(--rule-soft); border-radius: 6px;
  background: #F4F7F6; color: var(--ink); font-size: 12px; font-variant-numeric: tabular-nums;
  text-align: right; white-space: nowrap; }
.mi-cost.part { color: #9B3B33; }
.mi-als { display: block; margin-top: 2px; }
.mi-als .al { margin: 1px 3px 1px 0; }
.mi-als.muted { font-size: 11px; }
.menu-grid tr.meal-sum th, .menu-grid tr.meal-sum td { background: #EAF1EE; font-weight: 600;
  color: var(--accent); border-top: 1px solid var(--rule-soft); }
.menu-grid tr.meal-sum td { text-align: right; font-variant-numeric: tabular-nums; }
.menu-grid .tl.mc-day b { color: var(--accent); }
.tn-group td { background: #F1F4F3; display: flex; align-items: center; gap: 2px; }
.tn-group b { font-size: 14px; }
.tn-group small { margin-left: 8px; }
.tn-group .link { margin-left: 10px; }
.tn-group td .sp { display: inline; }

/* ---- статистика розрахункового меню ---- */
.tn-sel { font-size: 13px; color: var(--muted); margin-right: 4px; }
.tn-sel b { color: var(--ink); }
.tn-group.on td { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.tn-group td { cursor: pointer; }
/* 5-а колонка — раціони: вона якраз має переноситись, тож nowrap лишаємо тільки «Цінам» */
.tn-grid th:nth-child(6), .tn-grid td:nth-child(6) { white-space: nowrap; }
.tn-days tr.tn-worst td { background: #FFF8EC; }
.tn-days tr.tn-worst td:first-child small { color: #9B3B33; font-size: 11px; }
.tn-dd { font-size: 12px; color: var(--muted); white-space: nowrap; }
.sub-bar { margin: 10px 0 6px; }
.tn-chart { width: 100%; max-width: 760px; height: auto; }
.tn-chart .g { stroke: var(--rule-soft); stroke-width: 1; }
.tn-chart .gl { fill: var(--muted); font-size: 10px; text-anchor: end; }
.tn-chart .xl { fill: var(--muted); font-size: 10px; text-anchor: middle; }
.tn-chart .vl { fill: var(--accent); font-size: 10px; text-anchor: middle; font-weight: 600; }
.tn-chart .ln { fill: none; stroke: var(--accent); stroke-width: 2; }
.tn-chart .dot { fill: #fff; stroke: var(--accent); stroke-width: 2; }
.tn-chart .dot.cur { fill: var(--accent); }
.chip-del { display: inline-flex; align-items: center; }
.chip-del .rat-del { border: none; background: none; cursor: pointer; color: var(--muted);
  font-size: 14px; line-height: 1; padding: 0 4px; }
.chip-del .rat-del:hover { color: #9B3B33; }
.doc-opts { display: flex; flex-wrap: wrap; gap: 10px 16px; margin-bottom: 4px; }
.menu-tools .inline.sm select { font-size: 12px; padding: 2px 6px; }
.menu-tools .note.sm { font-size: 12px; margin: 0; }
.tn-price th, .tn-price td { padding: 3px 8px; white-space: nowrap; }
.tn-price th small { display: block; font-size: 10px; font-weight: 400; color: var(--muted); }
.eco-grid.tn-price th:first-child, .eco-grid.tn-price td:first-child { min-width: 0; width: 1%; }
.tn-price .tn-rcode { font-weight: 600; vertical-align: middle; text-align: center;
  background: #F7F9F8; border-right: 1px solid var(--rule-soft); }
.tn-price tr.tn-rtotal td { background: #EAF1EE; font-weight: 600; color: var(--accent);
  border-bottom: 1px solid var(--rule); }
.tn-meals th small { font-weight: 400; color: var(--muted); }

/* ---- статистика: центрування і два графіки поруч ---- */
.tn-days th, .tn-days td, .tn-meals th, .tn-meals td,
.tn-top th, .tn-top td, .tn-price th, .tn-price td { text-align: center; }
.tn-days td.n, .tn-days th.n, .tn-meals td.n, .tn-meals th.n,
.tn-top td.n, .tn-top th.n, .tn-price td.n, .tn-price th.n { text-align: center; }
.tn-top td:first-child, .tn-top th:first-child,
.tn-meals td:first-child, .tn-meals th:first-child,
.tn-price td.tn-meal, .tn-price th:nth-child(2),
.tn-days td:first-child, .tn-days th:first-child { text-align: left; }
.tn-price td.tn-rcode { text-align: center; }
.tn-charts { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: start; }
@media (max-width: 1200px) { .tn-charts { grid-template-columns: 1fr; } }
.tn-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 6px; font-size: 12px; color: var(--muted); }
.tn-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; }

/* ---- нові блоки статистики ---- */
.tn-three { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; margin-top: 18px; align-items: start; }
@media (max-width: 1280px) { .tn-three { grid-template-columns: 1fr; } }
.tn-box h3 { margin: 0 0 8px; }

.tn-mix th, .tn-mix td, .tn-rep th, .tn-rep td,
.tn-norms th, .tn-norms td, .tn-sens th, .tn-sens td, .tn-sell th, .tn-sell td,
.tn-mix td.n, .tn-mix th.n, .tn-rep td.n, .tn-rep th.n, .tn-norms td.n, .tn-norms th.n,
.tn-sens td.n, .tn-sens th.n, .tn-sell td.n, .tn-sell th.n { text-align: center; }
.tn-mix td:first-child, .tn-mix th:first-child, .tn-rep td:first-child, .tn-rep th:first-child,
.tn-norms td:first-child, .tn-norms th:first-child, .tn-sens td:first-child, .tn-sens th:first-child,
.tn-sell td:first-child, .tn-sell th:first-child { text-align: left; }
.tn-bar { width: 210px; padding: 0 8px !important; }
.tn-bar i { display: block; height: 8px; border-radius: 4px; background: var(--accent); opacity: .75; }
.tn-norms td small { display: block; font-size: 10px; font-weight: 400; color: var(--muted); }
.tn-norms td.tn-bad { background: #FFF1F0; color: #9B3B33; font-weight: 600; }
.tn-norms td.tn-ok { background: var(--accent-soft); font-weight: 600; }
.tn-sens td.tn-bad, .tn-sell td.tn-bad { color: #9B3B33; font-weight: 600; }
.tn-sell td.tn-ok { color: var(--accent); font-weight: 600; }
.tn-markup { display: flex; gap: 10px; align-items: flex-end; margin-bottom: 10px; }
.tn-markup input.num { width: 90px; text-align: right; }
.tn-norms-edit input.num { width: 90px; text-align: right; }
.tn-box + .tn-box { border-left: none; }
.tn-sell tr.tn-rtotal td, .tn-sens tr.tn-rtotal td { background: #EAF1EE; font-weight: 600; color: var(--accent); }
.tn-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; min-height: 34px; }
.tn-head .tn-markup label.inline { display: flex; flex-direction: row; align-items: center; gap: 6px; }
.tn-head h3 { margin: 0; }
.tn-head .tn-markup { margin: 0; }
.tn-head .tn-markup input.num { width: 70px; }
.tn-caret { font-style: normal; display: inline-block; width: 14px; color: var(--muted); }
.tn-grid .tn-group:hover td { background: #EAF1EE; }
.sub-bar input[type=search] { min-width: 240px; }

/* ---- два сезони в меню ---- */
.season-switch button { font-size: 12px; padding: 4px 10px; }
.mi-season { display: inline-block; margin-left: 6px; padding: 1px 6px; border-radius: 999px;
  background: #EAF1EE; color: var(--accent); font-size: 10px; font-weight: 700; vertical-align: middle;
  cursor: help; }
.pick.on { background: var(--accent-soft); }
.mi-arts { display: inline-flex; gap: 3px; margin-right: 6px; vertical-align: middle; }
.mi-art { width: 74px; padding: 2px 5px; font-size: 11px; font-weight: 600; text-transform: uppercase;
  border: 1px solid var(--rule-soft); border-radius: 6px; background: #FBFCFB; color: var(--muted);
  text-align: center; }
.mi-art.on { border: 2px solid var(--accent); color: var(--accent); background: #fff; padding: 1px 4px; }
.mi-art:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* ---- продажні ціни ---- */
.sale-targets { max-width: 760px; }
.sale-targets th, .sale-targets td { text-align: center; }
.sale-targets td:first-child, .sale-targets th:first-child { text-align: left; }
.sale-targets input.num { width: 110px; text-align: right; }
.sale-grid th, .sale-grid td { padding: 3px 7px; text-align: center; white-space: nowrap; }
.sale-grid { table-layout: fixed; width: auto; }
.eco-grid.sale-grid th:first-child, .eco-grid.sale-grid td:first-child { min-width: 0; }
.eco-grid.sale-grid thead th, .sale-grid th.n, .sale-grid td.n,
.eco-grid.sale-grid td.sale-code { text-align: center; }
.sale-grid col.c-art { width: 72px; }
.sale-grid col.c-nm { width: 320px; }
.sale-grid col.c-w { width: 62px; }
.sale-grid col.c-c { width: 66px; }
.sale-grid col.c-p { width: 70px; }
.sale-grid td.sale-name { text-align: left; white-space: normal; }
.sale-grid td.sale-code { font-size: 11px; color: var(--muted); }
.sale-grid th.sale-rat { background: #EAF1EE; color: var(--accent); }
.sale-grid tr.sale-day td { background: var(--ink); color: #fff; font-weight: 700; letter-spacing: .03em; }
.sale-grid tr.sale-meal td { background: #F1F4F3; font-weight: 600; color: var(--accent); }
.sale-grid tr.sale-total td { background: #EAF1EE; font-weight: 600; }
.sale-grid td.sale-cost { color: var(--muted); }
.sale-grid td.sale-price { font-weight: 600; }
.sale .tbl-wrap { max-height: calc(100vh - 380px); overflow: auto; }
.sale-grid thead th { position: sticky; top: 0; z-index: 3; background: var(--paper); }
/* висота першого ряду шапки фіксована — щоб другий ряд прилипав рівно під ним */
.sale-grid thead tr:first-child th { height: 42px; box-sizing: border-box; }
.sale-grid thead tr:nth-child(2) th { top: 42px; }
.sale-fold { display: flex; align-items: center; gap: 8px; cursor: pointer; padding: 6px 2px;
  font-size: 14px; user-select: none; }
.sale-fold:hover b { color: var(--accent); }

/* завантаження меню з чужої таблиці */
.modal.mid { width: min(980px, 96vw); max-height: calc(100vh - 24px); }
.im-list { display: grid; gap: 6px; margin: 8px 0 12px; }
.im-opt { display: flex; gap: 10px; align-items: start; padding: 8px 10px; cursor: pointer;
  border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.im-opt.on { border-color: var(--accent); background: var(--accent-soft); }
.im-opt input[type=radio] { width: auto; min-width: 0; flex: none; margin-top: 3px; }
.im-opt > span { display: block; flex: 1; color: var(--ink); font-size: 14px; }
.im-opt small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.im-sum { margin: 0 0 12px; }
.im-sum th, .im-sum td { padding: 5px 9px; font-size: 13px; }
.im-miss { max-height: 320px; overflow: auto; }
.m-actions.sm { margin-top: 6px; }
#im-pane textarea { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; }
.im-opts { display: grid; gap: 6px; margin: 2px 0 12px; }
.im-opts .chk { display: flex; gap: 10px; align-items: start; padding: 7px 10px; cursor: pointer;
  border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.im-opts .chk input { width: auto; min-width: 0; flex: none; margin-top: 2px; }
.im-opts .chk > span { display: block; flex: 1; color: var(--ink); font-size: 14px; }
.im-opts .chk small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
/* межі між блоками раціонів у таблиці продажних цін */
.sale-grid th.grp, .sale-grid td.grp { border-left: 2px solid var(--rule); }
.sale-grid thead th.sale-rat { border-bottom: 1px solid var(--rule); }
.sale-grid tr.sale-total td.grp { border-left-color: var(--accent); }
.sale-grid td.sale-price { cursor: pointer; }
.sale-grid td.sale-price:hover { background: var(--accent-soft); }
.sale-grid td.sale-own { color: var(--accent); text-decoration: underline dotted; }
/* реєстр розрахункових меню: ширини колонок задані, довгий перелік раціонів переноситься */
.tn-grid { table-layout: fixed; width: 100%; }
.eco-grid.tn-grid th:first-child, .eco-grid.tn-grid td:first-child { min-width: 0; }
.tn-grid col.c-no { width: 42px; }
.tn-grid col.c-name { width: 15%; }
.tn-grid col.c-reg { width: 92px; }
.tn-grid col.c-cyc { width: 54px; }
.tn-grid col.c-per { width: 104px; }
.tn-grid col.c-st { width: 104px; }
.tn-grid col.c-upd { width: 96px; }
.tn-grid col.c-act { width: 296px; }
.tn-grid td, .tn-grid th { white-space: normal; overflow-wrap: anywhere; }
td.tn-rations { line-height: 1.35; }
.tn-grid td.acts { white-space: nowrap; }

/* Реалізація по клієнту: таблиця широка й довга — крутимо її всередині свого вікна,
   щоб горизонтальна смуга була видно одразу, шапка трималася зверху, а дата — ліворуч. */
.sales-wrap { max-height: calc(100vh - 290px); overflow: auto; }
/* у .grid стоїть overflow:hidden заради заокруглених кутів — через нього шапка не липне */
.sales-grid { overflow: visible; }
.sales-grid thead th { position: sticky; z-index: 3; background: var(--paper); }
.sales-grid thead tr:first-child th { top: 0; }
.sales-grid thead tr:nth-child(2) th { top: var(--h1, 30px); }
.sales-grid thead th.meal-head { background: var(--accent-soft); }
.sales-grid thead th:first-child { left: 0; z-index: 5; }
.sales-grid tbody td:first-child, .sales-grid tfoot th:first-child,
.sales-grid tfoot td:first-child { position: sticky; left: 0; z-index: 2; background: var(--paper); }
.sales-grid tfoot th, .sales-grid tfoot td { position: sticky; bottom: 0; z-index: 3; background: #f6f7f7; }
/* вузькі колонки з кількостями: назви раціонів у шапці переносяться по словах */
/* назви раціонів переносимо по словах: ціле слово не рвемо, тому стовпець не вужчий за нього */
.sales-grid thead th.n { white-space: normal; max-width: 86px; min-width: 38px;
  word-break: normal; overflow-wrap: break-word; line-height: 1.15; }
.sales-grid td.n { padding: 3px 4px; }
.sales-grid td.sum-cell { cursor: pointer; text-decoration: underline dotted; text-underline-offset: 3px; }
.sales-grid td.sum-cell:hover { background: var(--bg-soft, #f3f5f4); }

/* попередження з розкривним переліком (наприклад, раціони без ціни) */
details.warn > summary { cursor: pointer; list-style: none; }
details.warn > summary::-webkit-details-marker { display: none; }
details.warn > summary::before { content: '▸ '; }
details.warn[open] > summary::before { content: '▾ '; }
details.warn > table { margin: 8px 0 4px; background: var(--paper); }
details.warn .note { margin: 4px 0 2px; }

/* підсвічування рядка дня: під курсором — легке, вибраний клацанням — тримається */
.sales-grid tbody tr:hover > td,
.sales-grid tbody tr:hover > td:first-child { background: #e8f1ee; }
.sales-grid tbody tr.row-pick > td,
.sales-grid tbody tr.row-pick > td:first-child { background: #d6e9e1; }
.sales-grid tbody tr.row-pick > td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.sales-grid tbody tr.row-pick > td.n.b, .sales-grid tbody tr.row-pick > td.sum-cell { font-weight: 600; }

/* назви стовпців у шапці — по центру і по горизонталі, і по вертикалі */
.sales-grid thead th { text-align: center; vertical-align: middle; }
/* усі стовпці з пацієнтами однакової ширини (значення рахується після малювання) */
.sales-grid th.rat, .sales-grid td.rat {
  width: var(--ratw, 46px); min-width: var(--ratw, 46px); max-width: var(--ratw, 46px); }
/* у вузькому стовпці назва раціону переноситься будь-де — ширину тримаємо однакову */
.sales-grid thead th.rat { word-break: break-word; overflow-wrap: anywhere; hyphens: auto;
  padding-left: 2px; padding-right: 2px; font-size: 11px; }
.sales-grid tbody td.rat, .sales-grid tfoot th.rat { padding-left: 2px; padding-right: 2px; }
.sales-grid tfoot th.rat { font-size: 11px; }
/* стовпець «Пацієнтів» — рівно вдвічі ширший за стовпці з раціонами */
.sales-grid th.pat, .sales-grid td.pat {
  width: var(--patw, 92px); min-width: var(--patw, 92px); max-width: var(--patw, 92px); }
.sales-grid thead th.pat { word-break: break-word; overflow-wrap: anywhere; }
/* правка кількості прямо в таблиці реалізації */
.sales-grid td.cnt-cell { cursor: cell; }
.sales-grid td.cnt-cell:hover { outline: 1px solid var(--accent); outline-offset: -1px; }
.sales-grid td.cnt-cell input.cnt-inp { width: 100%; min-width: 0; padding: 0 2px; border: 0;
  background: #fff; font: inherit; text-align: center; box-shadow: 0 0 0 2px var(--accent) inset; }

/* у зведенні: точки одного договору — однією групою зі спільними клітинками.
   Лінія тонка і суцільна на всю ширину: обʼєднана клітинка має свою нижню межу,
   інакше риска обривалася б там, де вона починається */
.sales-grid tbody tr.grp-start > td { border-top: 1px solid var(--rule); }
.sales-grid tbody tr.grp-end > td,
.sales-grid tbody td.mid { border-bottom: 1px solid var(--rule); }
.sales-grid td.mid { vertical-align: middle; background: #f6f8f7; font-weight: 500; }

/* позначка демонстраційної установки */
.demo-tag { align-self: center; margin-left: 10px; padding: 2px 8px; border-radius: 999px;
  font-size: 11px; letter-spacing: .02em; background: #f5c84c; color: #3a2f00; font-weight: 600; }

/* картка установи в налаштуваннях */
.org-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 14px; align-items: end; }
.org-form > button { grid-column: 1 / -1; justify-self: start; }
.org-mods { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px 14px;
  padding: 10px 12px; border: 1px solid var(--rule-soft); border-radius: 10px; background: var(--paper); }
.org-mods .lbl { grid-column: 1 / -1; margin: 0 0 2px; font-weight: 600; }
@media (max-width: 760px) { .org-form, .org-mods { grid-template-columns: 1fr; } }
