/* MultiBar 1.8.9 */

/* ---------- Склад: четыре кнопки в одну строку (значок сверху, короткая подпись) ---------- */
#inventory .inv-actions { display: grid !important; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
#inventory .inv-actions .btn {
    min-width: 0 !important; flex: none !important; width: auto; display: flex !important; align-items: center; justify-content: center; overflow: visible !important;
    flex-direction: column; height: auto; min-height: 56px; padding: 7px 2px 6px; gap: 3px; font-size: 11px; line-height: 1.12; font-weight: 800;
    white-space: normal; text-align: center; border-radius: 12px;
}
#inventory .inv-actions .btn span { display: block; }
#inventory .inv-actions .btn svg { width: 17px; height: 17px; }

/* ---------- Остатки: три кнопки в одну строку, одинаковой ширины ---------- */
#residues .res-actions-row { display: flex !important; flex-wrap: nowrap !important; gap: 8px !important; }
#residues .res-actions-row > .btn-main:first-of-type, #residues .res-actions-row > button,#residues .res-actions-row > .btn-main, #residues .res-actions-row > #btn-clear-res, #residues .res-actions-row > #btn-export-res {
    flex: 1 1 0% !important; flex-basis: 0% !important; min-width: 0 !important; width: auto !important; max-width: none !important; display: flex; align-items: center; justify-content: center;
    flex-direction: column; min-height: 56px; padding: 7px 2px 6px !important; gap: 3px; font-size: 11.5px !important; line-height: 1.12; text-align: center; white-space: normal !important;
}
#residues .res-actions-row .btn-main span { display: block; }

/* ---------- Склад: быстрое переключение «Инвентаризация | Посуда» ---------- */
@keyframes invSlideL { from { opacity: .0; transform: translate3d(28px, 0, 0); } to { opacity: 1; transform: none; } }
@keyframes invSlideR { from { opacity: .0; transform: translate3d(-28px, 0, 0); } to { opacity: 1; transform: none; } }
#inv-pane-main.slide-l, #inv-pane-ware.slide-l { animation: invSlideL .17s cubic-bezier(.2, .8, .3, 1) both; }
#inv-pane-main.slide-r, #inv-pane-ware.slide-r { animation: invSlideR .17s cubic-bezier(.2, .8, .3, 1) both; }
#inventory { touch-action: pan-y; }
.inv-seg button { transition: background .14s ease, color .12s ease, box-shadow .14s ease; }

/* ---------- Склад: круглая кнопка поиска и строка поиска ---------- */
.inv-search-fab {
    position: fixed; right: 16px; bottom: var(--fab-b, 84px); width: 48px; height: 48px; border-radius: 50%; border: 1.5px solid rgba(var(--primary-rgb), .5);
    background: var(--primary); color: #fff; display: inline-flex; align-items: center; justify-content: center; padding: 0; z-index: 900;
    box-shadow: 0 6px 18px rgba(var(--primary-rgb), .38), 0 2px 6px rgba(0, 0, 0, .25); cursor: pointer; transition: transform .15s ease, opacity .15s ease;
}
.inv-search-fab[hidden] { display: none !important; }
.inv-search-fab:active { transform: scale(.92); }
.inv-search-bar {
    position: fixed; left: 12px; right: 12px; bottom: calc(var(--kb, 0px) + 12px); z-index: 1250; display: flex; align-items: center; gap: 8px; padding: 8px;
    border-radius: 18px; background: var(--card); border: 1.5px solid rgba(var(--primary-rgb), .45); box-shadow: 0 10px 30px rgba(0, 0, 0, .4);
    animation: invBarIn .16s ease-out both;
}
.inv-search-bar[hidden] { display: none !important; }
@keyframes invBarIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.inv-search-in { flex: 1 1 auto; min-width: 0; display: flex; align-items: center; gap: 8px; padding: 0 12px; border-radius: 14px; background: var(--bg); border: 1px solid var(--border); color: var(--text); }
.inv-search-in input { flex: 1 1 auto; min-width: 0; height: 44px; border: 0 !important; background: transparent !important; box-shadow: none !important; outline: none; font-size: 16px; color: var(--text); padding: 0; }
.inv-search-in small { opacity: .6; font-weight: 700; white-space: nowrap; }
.inv-search-x { flex: 0 0 auto; width: 44px; height: 44px; border-radius: 14px; border: 1px solid var(--border); background: var(--bg); color: var(--text); display: inline-flex; align-items: center; justify-content: center; padding: 0; }

/* ---------- Склад: позиции — отдельные карточки в стиле приложения ---------- */
#inv-list { display: flex; flex-direction: column; gap: 10px; }

/* ---------- Каталог заказов: плавное раскрытие, минималка без наложения на соседние строки ---------- */
.orders-admin-section.is-collapsed.is-anim .orders-admin-sec-body { display: block !important; }
.oa-row.oa-row-sup { align-items: center; }
.oa-row.oa-row-sup .oa-row-panel { display: block !important; grid-column: 1 / -1; height: 0; overflow: hidden; opacity: 0; transition: none; grid-template-rows: none !important; }
.oa-row.oa-row-sup.open .oa-row-panel { height: auto; opacity: 1; }
.oa-row.oa-row-sup .oa-row-panel-in { overflow: visible; min-height: 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; }

/* ---------- Журнал: фильтры 2×2 (раздел, аккаунт, даты) ---------- */
#activity-log-overlay .activity-log-filter-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) !important; gap: 8px 8px !important; }
#activity-log-overlay .activity-log-filter-field #activity-log-account-filter-trigger { width: 100%; }


/* ---------- Чаты: чёткие карточки диалогов и свайп-удаление без «просвечивания» ---------- */
#chat-list .chat-swipe { border: 1px solid var(--border); border-radius: 16px; margin: 0 0 8px !important; background: rgb(var(--card-rgb)); overflow: hidden; box-shadow: 0 1px 4px rgba(0, 0, 0, .12); }
#chat-list .chat-swipe .chat-li { background-color: rgb(var(--card-rgb)) !important; border-radius: 0; margin: 0 !important; transition: transform .2s cubic-bezier(.2, .8, .2, 1); position: relative; z-index: 1; }
#chat-list .chat-swipe .chat-li.active, #chat-list .chat-swipe .chat-li:active { background-image: linear-gradient(rgba(var(--primary-rgb), .12), rgba(var(--primary-rgb), .12)); }
#chat-list .chat-swipe .chat-swipe-del { width: 92px !important; border-radius: 0; z-index: 0; opacity: 0; transition: none !important; }
#chat-list .chat-swipe.sw-on .chat-swipe-del { opacity: 1; }

/* ---------- Общий чат: вместо ленты участников — кнопка «Участники»; «Вступить» ---------- */
#chat-members { display: none !important; }
.chat-readonly[data-mode="gen"] { flex-wrap: wrap; gap: 10px; }
.chat-readonly .chat-ro-txt { display: inline-flex; align-items: center; gap: 8px; text-align: left; flex: 1 1 200px; font-weight: 700; }
.chat-readonly .chat-join-btn { flex: 0 0 auto; min-height: 42px; padding: 0 18px; border-radius: 12px; }

/* ---------- Уведомление о новой версии ---------- */
.mb-update-note {
    position: fixed; left: 50%; top: calc(env(safe-area-inset-top) + 10px); z-index: 13000; width: min(440px, calc(100vw - 24px)); box-sizing: border-box;
    display: flex; align-items: center; gap: 10px; padding: 9px 8px 9px 12px; border-radius: 16px; color: var(--text);
    background: rgb(var(--card-rgb)); border: 1.5px solid rgba(var(--primary-rgb), .55); box-shadow: 0 10px 28px rgba(0, 0, 0, .38);
    transform: translate(-50%, -140%); opacity: 0; transition: transform .35s cubic-bezier(.2, .9, .3, 1.1), opacity .25s ease;
}
.mb-update-note.show { transform: translate(-50%, 0); opacity: 1; }
.mb-update-dot { flex: 0 0 auto; width: 10px; height: 10px; border-radius: 50%; background: var(--primary); box-shadow: 0 0 0 4px rgba(var(--primary-rgb), .22); }
.mb-update-txt { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 1px; line-height: 1.2; }
.mb-update-txt b { font-size: 14px; font-weight: 800; }
.mb-update-txt small { font-size: 11.5px; opacity: .65; }
.mb-update-go { flex: 0 0 auto; height: 36px; padding: 0 14px; border-radius: 11px; border: 0; background: var(--primary); color: #fff; font-weight: 800; font-size: 13px; }
.mb-update-x { flex: 0 0 auto; width: 32px; height: 36px; border: 0; background: transparent; color: var(--text); opacity: .6; font-size: 20px; line-height: 1; }

/* ---------- Учётные записи: компактный список ---------- */
.acc-tools { display: flex; flex-direction: column; gap: 6px; margin: 2px 0 8px; position: sticky; top: 0; z-index: 2; padding-bottom: 6px; background: var(--card); }
.acc-search { width: 100%; box-sizing: border-box; height: 42px; border-radius: 12px; border: 1.5px solid var(--border); background: var(--bg); color: var(--text); padding: 0 12px; font-size: 16px; }
.acc-count { font-size: 12px; font-weight: 700; opacity: .65; }
.acc-list { display: flex; flex-direction: column; gap: 6px; }
.acc-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 14px; border: 1px solid var(--border); background: var(--bg); cursor: pointer; -webkit-tap-highlight-color: transparent; transition: background .15s ease, transform .1s ease; }
.acc-row:active { transform: scale(.992); background: rgba(var(--primary-rgb), .08); }
.acc-row.pending { border-style: dashed; opacity: .88; }
.acc-av { position: relative; flex: 0 0 auto; width: 38px; height: 38px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: 15px; color: #fff; background: hsl(var(--av, 260), 55%, 48%); }
.acc-av i { position: absolute; right: -2px; bottom: -2px; width: 12px; height: 12px; border-radius: 50%; border: 2.5px solid rgb(var(--card-rgb)); background: transparent; display: none; }
.acc-av.on i { display: block; background: #22c55e; }
.acc-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 1px; line-height: 1.2; }
.acc-main b { font-size: 14.5px; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acc-main b em { font-style: normal; font-size: 10.5px; font-weight: 800; padding: 1px 6px; border-radius: 999px; background: rgba(var(--primary-rgb), .16); color: var(--primary); margin-left: 4px; vertical-align: 1px; }
.acc-main small { font-size: 11.5px; opacity: .6; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acc-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: 11.5px; margin-top: 2px; }
.acc-chip { padding: 1px 7px; border-radius: 999px; font-weight: 800; font-size: 10.5px; }
.acc-chip.ok { background: rgba(34, 197, 94, .16); color: #22c55e; }
.acc-chip.wait { background: rgba(245, 158, 11, .18); color: #f59e0b; }
.acc-entry { font-weight: 700; opacity: .85; }
.acc-st { opacity: .6; }
.acc-st.on { opacity: 1; color: #22c55e; font-weight: 800; }
.acc-tabs { opacity: .55; }
.acc-go { flex: 0 0 auto; font-size: 22px; opacity: .4; padding: 0 2px; }

/* ---------- 1.8.10: быстрый возврат на «Инвентаризацию» — длинный список не пересчитывается целиком ---------- */

/* ---------- 1.8.10: строки каталога не сжимаются во flex-списке с ограниченной высотой (из-за этого минималка «налезала» на соседей) ---------- */
#orders-minimums-list > *, #orders-locations-list > *, .orders-minimums-list > * { flex: 0 0 auto !important; }
.oa-row.oa-row-sup { height: auto !important; min-height: 48px; overflow: visible; }

/* ---------- 1.8.10: переключатель «мл | л» в строке «Объём × Кол-во» ---------- */

/* ---------- 1.8.10: списания — одна кнопка «⋯» ---------- */
#writeoffs .wo-item-more { width: 34px; height: 34px; min-width: 34px; flex: 0 0 34px; padding: 0; border-radius: 10px; border: 1px solid var(--border); background: var(--card); color: var(--text); display: inline-flex; align-items: center; justify-content: center; opacity: .8; }
#writeoffs .wo-item-more:active { background: rgba(var(--primary-rgb), .14); }
#writeoffs .wo-item-actions { min-width: 0 !important; }

/* ======================= 1.8.10: «Графики» ======================= */
.sch-screen { display: flex; flex-direction: column; }
.sch-bar { display: flex; align-items: center; gap: 8px; padding: 8px 12px; }
.sch-month { flex: 1; text-align: center; font-size: 16px; }
.sch-month b { font-weight: 800; }
.sch-nav, .sch-today { height: 38px; min-width: 38px; border-radius: 12px; border: 1.5px solid var(--border); background: var(--card); color: var(--text); display: inline-flex; align-items: center; justify-content: center; font: inherit; font-size: 13px; font-weight: 800; padding: 0 12px; }
.sch-today { color: var(--primary); border-color: rgba(var(--primary-rgb), .4); }
.sch-wrap { flex: 1 1 auto; min-height: 0; overflow: auto; -webkit-overflow-scrolling: touch; padding: 0 0 24px; position: relative; }
.sch-table { border-collapse: separate; border-spacing: 0; font-size: 12.5px; min-width: max-content; }
.sch-table th, .sch-table td { border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); text-align: center; background: var(--card); }
.sch-table .sch-name { position: sticky; left: 0; z-index: 2; min-width: 124px; max-width: 124px; text-align: left; padding: 8px 8px; font-weight: 800; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; background: var(--card); border-right: 2px solid var(--border); }
.sch-table .sch-grp { background: rgba(var(--primary-rgb), .16); color: var(--primary); text-transform: uppercase; letter-spacing: .03em; display: table-cell; }
.sch-table .sch-grp span { margin-right: 6px; }
.sch-d { min-width: 54px; padding: 6px 2px; background: rgba(var(--primary-rgb), .08) !important; }
.sch-d b { display: block; font-size: 12.5px; font-weight: 800; }
.sch-d small { display: block; font-size: 11px; opacity: .65; font-weight: 700; }
.sch-d.we { background: rgba(239, 68, 68, .12) !important; }
.sch-d.today { outline: 2px solid var(--primary); outline-offset: -2px; }
.sch-c { min-width: 54px; height: 40px; font-weight: 800; font-size: 13px; padding: 0 2px; }
.sch-c.ed { cursor: pointer; }
.sch-c.ed:active { background: rgba(var(--primary-rgb), .18); }
.sch-c.we { background: rgba(239, 68, 68, .05); }
.sch-c.w { background: rgba(34, 197, 94, .16); }
.sch-c.m { background: rgba(250, 204, 21, .22); }
.sch-c.today { box-shadow: inset 0 0 0 2px rgba(var(--primary-rgb), .55); }
.sch-cnt td { height: 26px; font-size: 12px; font-weight: 800; opacity: .75; background: transparent; }
.sch-cnt .sch-name { font-weight: 700; font-size: 11.5px; opacity: .8; background: var(--card); }
.sch-gap td { height: 14px; background: transparent !important; border: 0 !important; }
.sch-notes .sch-name { background: #fde68a; color: #6b4e00; }
.sch-n { background: rgba(250, 204, 21, .18) !important; min-width: 54px; height: 36px; max-width: 54px; font-size: 11px; font-weight: 700; overflow: hidden; }
.sch-n.has { background: #fde047 !important; color: #5a4200; }
.sch-n span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 3px; }
.sch-empty { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; padding: 48px 24px; opacity: .85; }
.sch-sheet-bg { position: fixed; inset: 0; z-index: 10080; background: rgba(0, 0, 0, .4); display: flex; align-items: flex-end; justify-content: center; opacity: 0; transition: opacity .18s ease; }
.sch-sheet-bg.on { opacity: 1; }
.sch-sheet { width: 100%; max-width: 520px; background: var(--card); border-radius: 22px 22px 0 0; padding: 16px 16px calc(16px + env(safe-area-inset-bottom)); transform: translateY(24px); transition: transform .2s cubic-bezier(.2, .8, .2, 1); box-sizing: border-box; }
.sch-sheet-bg.on .sch-sheet { transform: none; }
.sch-sheet-t { font-size: 17px; font-weight: 800; }
.sch-sheet-s { font-size: 13px; opacity: .65; margin: 2px 0 10px; }
.sch-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 12px; }
.sch-chip { height: 40px; padding: 0 14px; border-radius: 12px; border: 1.5px solid rgba(var(--primary-rgb), .35); background: rgba(var(--primary-rgb), .08); color: var(--primary); font: inherit; font-weight: 800; font-size: 14px; }
.sch-in { width: 100%; box-sizing: border-box; height: 46px; border-radius: 12px; border: 1.5px solid var(--border); background: var(--card); color: var(--text); font: inherit; font-size: 16px; padding: 0 12px; }
.sch-sheet-a { display: flex; gap: 10px; margin-top: 12px; }
.sch-sheet-a .btn-main { flex: 1; }
/* липкая колонка имён — непрозрачная (иначе при прокрутке под ней просвечивают даты) */
.sch-table .sch-name { background: linear-gradient(var(--card), var(--card)), var(--bg) !important; }
.sch-table .sch-grp { background: linear-gradient(rgba(var(--primary-rgb), .16), rgba(var(--primary-rgb), .16)), linear-gradient(var(--card), var(--card)), var(--bg) !important; }
.sch-notes .sch-name { background: #fde68a !important; }
.sch-cnt .sch-name { background: linear-gradient(var(--card), var(--card)), var(--bg) !important; }
.sch-d { background: linear-gradient(rgba(var(--primary-rgb), .08), rgba(var(--primary-rgb), .08)), linear-gradient(var(--card), var(--card)), var(--bg) !important; }
.sch-d.we { background: linear-gradient(rgba(239, 68, 68, .12), rgba(239, 68, 68, .12)), linear-gradient(var(--card), var(--card)), var(--bg) !important; }
.sch-cnt td { opacity: 1 !important; color: rgba(var(--text-rgb, 30, 41, 59), .75); }
.sch-cnt .sch-name { opacity: 1 !important; }
/* строка «Объём × Кол-во» помещается в узкие экраны вместе с переключателем «мл | л» */

/* 1.8.11: скрытый раздел склада не выбрасывается из отрисовки (content-visibility) — возврат на «Инвентаризацию» мгновенный даже на слабом телефоне */
#inv-pane-main[hidden] { display: block !important; content-visibility: hidden; height: 0 !important; min-height: 0 !important; overflow: hidden; margin: 0 !important; padding: 0 !important; border: 0 !important; contain-intrinsic-size: 0 0; pointer-events: none; }

/* ---------- 1.8.11: удаление шаблонов — маленький кружок с крестиком в правом верхнем углу каждого шаблона ---------- */
#wo-templates-list.delete-mode .wo-tpl-chip { overflow: visible !important; }
#wo-templates-list.delete-mode .wo-tpl-cat-grid { padding-top: 10px !important; padding-right: 8px !important; row-gap: 12px !important; }
#wo-templates-list.delete-mode .wo-tpl-cat-body { overflow: visible !important; }
#wo-templates-list .wo-tpl-chip .wo-tpl-chip-del-x {
    position: absolute !important; top: -8px !important; right: -6px !important; left: auto !important; bottom: auto !important;
    width: 20px !important; height: 20px !important; min-width: 20px !important; min-height: 20px !important; max-width: 20px !important; max-height: 20px !important;
    padding: 0 !important; margin: 0 !important; border-radius: 50% !important; flex: none !important;
    align-items: center !important; justify-content: center !important; background: #ef4444 !important; color: #fff !important;
    border: 2px solid var(--card, #fff) !important; box-shadow: 0 2px 5px rgba(0, 0, 0, .3) !important; z-index: 30 !important;
}
#wo-templates-list .wo-tpl-chip .wo-tpl-chip-del-x svg { width: 10px !important; height: 10px !important; stroke-width: 3 !important; }
#wo-templates-list.delete-mode .wo-tpl-chip-main { padding-right: 8px !important; }

/* ===== 1.8.11: график — имена не закреплены по умолчанию, цвета, подпись «В смене» ===== */
.sch-table .sch-name { position: static !important; left: auto !important; }
.sch-wrap.pin .sch-table .sch-name { position: sticky !important; left: 0 !important; z-index: 2; }
.sch-cnt td, .sch-cnt .sch-name { color: var(--text, #1e293b) !important; opacity: 1 !important; font-weight: 800; }
.sch-cnt .sch-name { font-size: 12px; }
.sch-c.w { background: #BBF7D0; color: #14532D; }
.sch-c.w.k-g { background: #BBF7D0; color: #14532D; }
.sch-c.w.k-b { background: #BFDBFE; color: #1E3A8A; }
.sch-c.w.k-y { background: #FDE68A; color: #78350F; }
.sch-c.w.k-o { background: #FED7AA; color: #7C2D12; }
.sch-c.w.k-r { background: #FECACA; color: #7F1D1D; }
.sch-c.w.k-p { background: #E9D5FF; color: #581C87; }
.sch-c.w.k-k { background: #FBCFE8; color: #831843; }
.sch-c.w.k-s { background: #E5E7EB; color: #374151; }
.sch-dots { display: flex; gap: 10px; flex-wrap: wrap; margin: 10px 0 4px; }
.sch-dot { width: 32px; height: 32px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; padding: 0; }
.sch-dot.on { border-color: var(--text, #1e293b); box-shadow: 0 0 0 2px var(--card, #fff) inset; }
.sch-lab { font-size: 12px; font-weight: 700; opacity: .7; margin-top: 8px; }
