/* MultiBar 1.9.7 */

/* ---------- Потяните вниз — обновить (вкладки «Накладные … Зал», приложение с главного экрана) ---------- */
/* 1.9.43: индикатор «потяни вниз» теперь в шапке (кольцо сохранения) — см. mb-199.css */

/* ---------- Зал: кнопка «на весь экран» над схемой ---------- */
.hall-cv-tools { position: absolute; right: 8px; top: 8px; z-index: 3; display: flex; gap: 6px; }
.hall-cv-tools button { width: 36px; height: 36px; border-radius: 11px; border: 1.5px solid var(--border); background: rgb(var(--card-rgb)); color: var(--text); display: inline-flex; align-items: center; justify-content: center; box-shadow: 0 3px 12px rgba(0, 0, 0, .18); padding: 0; }
.hall-cv-tools button:active { transform: scale(.94); }

/* ---------- Зал: схема на весь экран (и поворот на 90° там, где браузер не умеет поворачивать экран — iPhone) ---------- */
.hall-overlay.is-full.open { position: fixed !important; inset: 0 !important; height: var(--vvh, 100dvh) !important; padding: 0 !important; z-index: 9300 !important; background: rgb(var(--bg-rgb)) !important; }
body .nkl-overlay.mb-as-tab.hall-overlay.is-full .nkl-screen, .hall-overlay.is-full .nkl-screen {
    position: absolute !important; inset: 0 !important; height: auto !important; max-width: none !important; margin: 0 !important; display: block !important;
    border: 0 !important; border-radius: 0 !important; box-shadow: none !important; background: rgb(var(--bg-rgb)) !important; padding: 0 !important;
}
.hall-overlay.is-full .nkl-header, .hall-overlay.is-full .hall-top, .hall-overlay.is-full .hall-bar, .hall-overlay.is-full .hall-time,
.hall-overlay.is-full .hall-leg, .hall-overlay.is-full #hall-tp, .hall-overlay.is-full .hall-foot { display: none !important; }
.hall-overlay.is-full .hall-body { display: block !important; position: absolute !important; inset: 0; padding: 0 !important; overflow: hidden !important; }
.hall-overlay.is-full .hall-cvbox {
    position: absolute !important; margin: 0 !important;
    left: calc(env(safe-area-inset-left, 0px) + 6px); right: calc(env(safe-area-inset-right, 0px) + 6px);
    top: calc(env(safe-area-inset-top, 0px) + 6px); bottom: calc(env(safe-area-inset-bottom, 0px) + 6px);
}
.hall-overlay.is-full .hall-cvbox .hall-cvwrap { height: 100% !important; max-height: none !important; min-height: 0; box-sizing: border-box; }
.hall-overlay.is-full.is-rot .hall-cvbox {
    left: 50%; top: 50%; right: auto; bottom: auto;
    width: calc(var(--vvh, 100dvh) - 12px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)); height: calc(100vw - 12px);
    transform: translate(-50%, -50%) rotate(90deg);
}

/* ---------- Чаты: «доставлено / прочитано» у последнего своего сообщения прямо в списке ---------- */
.chat-li-st { flex: 0 0 auto; display: inline-flex; align-items: center; margin: 0 -2px 0 auto; opacity: .55; }
.chat-li-st + time { margin-left: 0 !important; }
.chat-li-st .mb-icon + .mb-icon { margin-left: -8px; }
.chat-li-st.read { color: var(--primary); opacity: 1; }

/* ---------- Журнал изменений: «Изменения | Очередь отправки» ---------- */
.alq-seg { display: flex; gap: 4px; margin: 0 14px 6px; padding: 3px; border-radius: 12px; background: rgba(127, 127, 127, .14); flex: 0 0 auto; }
.alq-seg button { flex: 1 1 0; height: 34px; border: 0; border-radius: 9px; background: transparent; color: var(--text); font: inherit; font-size: 13px; font-weight: 800; opacity: .7; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.alq-seg button.on { background: rgb(var(--card-rgb)); opacity: 1; color: var(--primary); box-shadow: 0 1px 4px rgba(0, 0, 0, .1); }
.alq-n { font-style: normal; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: #f2b705; color: #3b2a00; font-size: 11px; line-height: 18px; }
.alq-n[hidden] { display: none; }
.alq-pane { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 4px 14px 14px; -webkit-overflow-scrolling: touch; }
.alq-pane[hidden] { display: none !important; }
.alq-head { display: flex; flex-direction: column; gap: 3px; padding: 12px; border-radius: 14px; margin: 4px 0 10px; border: 1.5px solid var(--border); }
.alq-head b { font-size: 15px; } .alq-head span { font-size: 12.5px; opacity: .75; }
.alq-head .btn-main { margin-top: 8px; align-self: flex-start; padding: 8px 14px; min-height: 0; font-size: 13px; }
.alq-head.ok { border-color: rgba(var(--primary-rgb), .35); background: rgba(var(--primary-rgb), .06); }
.alq-head.busy { border-color: rgba(242, 183, 5, .6); background: rgba(242, 183, 5, .12); }
.alq-head.off { border-color: rgba(239, 68, 68, .45); background: rgba(239, 68, 68, .07); }
.alq-cap { font-size: 11.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; opacity: .55; margin: 10px 2px 4px; }
.alq-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 8px 4px; border-bottom: 1px solid var(--border); font-size: 13px; }
.alq-t { font-variant-numeric: tabular-nums; opacity: .6; font-size: 12px; }
.alq-w { display: flex; flex-direction: column; min-width: 0; } .alq-w b { font-weight: 800; } .alq-w small { opacity: .6; font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.alq-st { font-size: 11.5px; font-weight: 800; white-space: nowrap; }
.alq-st.ok { color: var(--primary); } .alq-st.wait { color: #b07a00; } .alq-st.err { color: #ef4444; max-width: 46vw; overflow: hidden; text-overflow: ellipsis; }
[data-theme^="dark"] .alq-st.wait { color: #fcd34d; }
.alq-empty { font-size: 13px; opacity: .6; padding: 10px 4px; }

/* ---------- Склад: зоны подсчёта и «По весу» ---------- */
#inv-list .inv-zone { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 3px; max-width: 74px; height: 32px; padding: 0 7px; border-radius: 10px; border: 1.5px dashed rgba(var(--primary-rgb), .35); background: transparent; color: var(--text); opacity: .6; font: inherit; font-size: 11.5px; font-weight: 800; }
#inv-list .inv-zone span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#inv-list .inv-zone.set { opacity: 1; border-style: solid; color: var(--primary); background: rgba(var(--primary-rgb), .08); }
#inv-list .inv-place-badge .inv-zone { height: 30px; margin-right: 2px; }
#inv-list .inv-zone-sum { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin: -2px 0 6px; font-size: 12px; opacity: .85; color: var(--primary); }
#inv-list .inv-zone-sum span b { font-weight: 800; color: var(--text); }
#inv-list .inv-fact-footer { display: flex; gap: 8px; flex-wrap: wrap; }
.inv-w .inv-w-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 10px 0 6px; }
.inv-w .inv-w-grid label { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.inv-w .inv-w-grid label span { font-size: 12px; font-weight: 700; opacity: .7; }
.inv-w .inv-w-grid .inv-w-now { grid-column: 1 / -1; }
.inv-w .inv-w-grid .inv-w-now input { font-size: 20px; font-weight: 800; height: 52px; }
.inv-w .inv-w-res { padding: 10px 12px; border-radius: 12px; background: rgba(127, 127, 127, .1); font-size: 14px; margin-bottom: 8px; }
.inv-w .inv-w-res.ok { background: rgba(242, 183, 5, .16); } .inv-w .inv-w-res.ok b { font-size: 17px; }
.inv-w .inv-w-res.bad { color: #b45309; }
.inv-w .inv-w-bt { width: 100%; margin-bottom: 8px; }
/* в строке жидкости зона — отдельной короткой строкой сверху, поля объёма и количества не сжимаются */
#inv-list .inv-tare-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto minmax(0, 1fr) auto; column-gap: 6px; row-gap: 2px; align-items: center; }
#inv-list .inv-tare-row > .u-part[hidden] { display: none; }
#inv-list .inv-tare-row .inv-zone { grid-column: 1 / -1; justify-self: start; max-width: none; height: 22px; padding: 0 2px; border: 0 !important; background: transparent !important; justify-content: flex-start; font-size: 11.5px; }
#inv-list .inv-tare-row .inv-zone.set { opacity: 1; }
#inv-list .inv-place-badge .inv-zone { max-width: 58px; padding: 0 5px; }

/* ---------- Шапка на телефоне (iPhone и др.): имя аккаунта снова видно — над часами, двумя строками ---------- */
@media (max-width: 430px) {
    body .header-title-row .header-status-cluster { display: grid !important; grid-template-columns: auto auto; grid-template-rows: auto auto; column-gap: 4px; row-gap: 0; align-items: center; height: auto !important; max-width: none; flex: 0 0 auto; }
    body .header-title-row .header-status-cluster #header-save-indicator { grid-column: 1; grid-row: 1 / 3; }
    body .header-title-row .header-status-cluster #header-status-user { display: block !important; grid-column: 2; grid-row: 1; max-width: 78px; font-size: 10.5px; font-weight: 800; line-height: 1.2; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    body .header-title-row .header-status-cluster #header-status-clock { grid-column: 2; grid-row: 2; font-size: 10.5px; line-height: 1.2; text-align: right; }
    body .header-title-row #header-status-user:empty { display: none !important; }
}
@media (max-width: 375px) {
    body .header-title-row .header-history-btn { width: 31px !important; }
    body .header-title-row .header-status-cluster #header-status-user { max-width: 62px; }
}
/* название вкладки не сжимается (на iPhone шрифт шире — раньше название ужималось до нуля); ужимаются кнопки */
body .header-title-row h1#header-title { flex: 0 0 auto !important; max-width: 40vw; }
body .header-title-row .header-history-btn { flex: 0 1 auto; min-width: 26px; }
@media (max-width: 340px) { body .header-title-row h1#header-title .ht-name { font-size: 14px; } }

/* ---------- iPhone: двойное нажатие нигде не приближает страницу ---------- */
html, body { touch-action: pan-x pan-y; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }   /* без двойного нажатия и щипка по странице */

/* ---------- ИИ-помощник ---------- */
.global-search-bar .mb-ai-btn { color: var(--primary) !important; }
.global-search-bar .mb-ai-btn[hidden] { display: none !important; }
.mb-ai-overlay { position: fixed; inset: 0; z-index: 10050; background: rgba(0, 0, 0, .35); display: flex; align-items: flex-end; justify-content: center; opacity: 0; visibility: hidden; pointer-events: none; transition: opacity .18s ease, visibility 0s linear .2s; }
.mb-ai-overlay.open { opacity: 1; visibility: visible; pointer-events: auto; transition: opacity .18s ease; }
.mb-ai-panel { width: 100%; max-width: 560px; height: min(78vh, 640px); height: min(78dvh, 640px); background: rgb(var(--card-rgb)); color: var(--text); border-radius: 20px 20px 0 0; display: flex; flex-direction: column; box-shadow: 0 -10px 40px rgba(0, 0, 0, .25); transform: translateY(14px); transition: transform .22s cubic-bezier(.16, 1, .3, 1); padding-bottom: env(safe-area-inset-bottom, 0px); }
.mb-ai-overlay.open .mb-ai-panel { transform: none; }
html.kb-open .mb-ai-panel { height: calc(var(--vvh, 100dvh) - 24px); }
.mb-ai-head { display: flex; align-items: center; gap: 8px; padding: 12px 10px 8px 14px; border-bottom: 1px solid var(--border); }
.mb-ai-ico { display: inline-flex; width: 32px; height: 32px; border-radius: 10px; align-items: center; justify-content: center; background: linear-gradient(135deg, rgba(var(--primary-rgb), .18), rgba(168, 85, 247, .2)); color: var(--primary); }
.mb-ai-head b { font-size: 16px; } .mb-ai-head small { font-size: 11px; opacity: .55; margin-right: auto; }
.mb-ai-hbtn { width: 36px; height: 36px; border: 0; border-radius: 10px; background: transparent; color: var(--text); display: inline-flex; align-items: center; justify-content: center; opacity: .75; }
.mb-ai-list { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 8px; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.mb-ai-hello { display: flex; flex-wrap: wrap; gap: 6px; } .mb-ai-hello b { flex: 0 0 100%; font-size: 17px; } .mb-ai-hello span { flex: 0 0 100%; font-size: 13px; opacity: .65; margin-bottom: 4px; }
.mb-ai-chip { border: 1.5px solid rgba(var(--primary-rgb), .3); background: rgba(var(--primary-rgb), .06); color: var(--primary); border-radius: 999px; padding: 7px 11px; font: inherit; font-size: 13px; font-weight: 700; text-align: left; }
.mb-ai-msg { max-width: 86%; padding: 9px 12px; border-radius: 16px; font-size: 14.5px; line-height: 1.4; word-wrap: break-word; }
.mb-ai-msg.me { align-self: flex-end; background: var(--primary); color: #fff; border-bottom-right-radius: 5px; }
.mb-ai-msg.ai { align-self: flex-start; background: rgba(127, 127, 127, .12); border-bottom-left-radius: 5px; }
.mb-ai-msg.err { background: rgba(239, 68, 68, .1); color: #b91c1c; }
[data-theme^="dark"] .mb-ai-msg.err { color: #fca5a5; }
.mb-ai-msg.wait { display: inline-flex; gap: 4px; padding: 12px 14px; }
.mb-ai-msg.wait i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .4; animation: mbAiDot 1s infinite ease-in-out; }
.mb-ai-msg.wait i:nth-child(2) { animation-delay: .15s; } .mb-ai-msg.wait i:nth-child(3) { animation-delay: .3s; }
@keyframes mbAiDot { 0%, 80%, 100% { opacity: .25; transform: none; } 40% { opacity: .9; transform: translateY(-3px); } }
.mb-ai-act { align-self: flex-start; display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 700; padding: 5px 10px; border-radius: 10px; background: rgba(var(--primary-rgb), .08); color: var(--primary); }
.mb-ai-act.bad { background: rgba(242, 183, 5, .14); color: #8a5a00; } [data-theme^="dark"] .mb-ai-act.bad { color: #fcd34d; }
.mb-ai-share { display: flex; margin-top: 8px; padding: 8px 12px; min-height: 0; font-size: 13px; gap: 6px; align-items: center; }
.mb-ai-bar { display: flex; align-items: center; gap: 6px; padding: 8px 10px 10px; border-top: 1px solid var(--border); }
.mb-ai-in { flex: 1 1 auto; min-width: 0; height: 44px; border-radius: 22px; border: 1.5px solid var(--border); background: var(--bg); color: var(--text); padding: 0 14px; font: inherit; font-size: 16px; }
.mb-ai-mic, .mb-ai-send { flex: 0 0 auto; width: 44px; height: 44px; border-radius: 50%; border: 0; display: inline-flex; align-items: center; justify-content: center; }
.mb-ai-mic { background: rgba(var(--primary-rgb), .1); color: var(--primary); }
.mb-ai-mic.on { background: #ef4444; color: #fff; animation: mbAiPulse 1.2s infinite; }
@keyframes mbAiPulse { 0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, .5); } 100% { box-shadow: 0 0 0 14px rgba(239, 68, 68, 0); } }
.mb-ai-send { background: var(--primary); color: #fff; } .mb-ai-send:disabled { opacity: .5; }
