/* WorkLine 1.10.14 — правки после аудита.
   1) выбор «плашками» (единица и причина в списаниях) — как категории в «Накладных»;
   2) сообщение «дневной лимит облака исчерпан»;
   3) «Служебное»: строка состояния правил вместо карточки Firebase;
   4) мелкие выравнивания, найденные при визуальной проверке. */

/* ---------- 1. плашки ---------- */
.wl-chips {
    display: flex; flex-wrap: nowrap; gap: 8px; align-items: center;
    overflow-x: auto; overflow-y: hidden; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain;
    scrollbar-width: none; padding: 2px 1px 3px; margin: 0; min-width: 0; max-width: 100%;
}
.wl-chips::-webkit-scrollbar { display: none; }
.wl-chips .wl-chip {
    flex: 0 0 auto; min-height: 40px; padding: 8px 15px; font-size: 13.5px; font-weight: 700; white-space: nowrap;
    max-width: 240px; overflow: hidden; text-overflow: ellipsis; cursor: pointer;
    -webkit-tap-highlight-color: transparent; touch-action: manipulation;
    transition: background-color .14s ease, border-color .14s ease, color .14s ease, transform .1s ease;
}
.wl-chips .wl-chip:active { transform: scale(.96); }
.wl-chips .wl-chip:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.wl-chips.is-disabled { opacity: .55; pointer-events: none; }
.wl-chips-empty { font-size: 12.5px; color: var(--text-secondary); padding: 10px 2px; }
.wo-chip-field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.wo-chip-field > label { margin: 0; }
.wo-chip-field .custom-select-trigger[hidden] { display: none !important; }
#writeoffs .wo-qty-row.wo-qty-date { grid-template-columns: 1fr 1fr !important; }
#writeoffs .wo-qty-row.wo-qty-date input { width: 100% !important; min-width: 0; }
#writeoffs .task-form-grid .wo-chip-field .wl-chip { width: auto; }
/* единиц всего пять — делим ряд поровну, чтобы плашки стояли ровной линейкой */
#wo-unit-chips, #woe-unit-chips { gap: 6px; }
#wo-unit-chips .wl-chip, #woe-unit-chips .wl-chip { flex: 1 1 0; justify-content: center; padding-left: 6px; padding-right: 6px; min-width: 44px; }

/* ---------- 2. дневной лимит облака ---------- */
.wl-quota-banner {
    position: fixed; left: 10px; right: 10px; top: calc(env(safe-area-inset-top, 0px) + 10px); z-index: 12050;
    display: flex; align-items: flex-start; gap: 10px; padding: 12px 12px 12px 14px; border-radius: 16px;
    background: #2a2d33; color: #fff; border: 1px solid rgba(255,255,255,.14); box-shadow: 0 12px 34px rgba(0,0,0,.32);
    max-width: 560px; margin: 0 auto; transform: translateY(-140%); opacity: 0; transition: transform .28s ease, opacity .28s ease; pointer-events: none;
}
.wl-quota-banner.show { transform: none; opacity: 1; pointer-events: auto; }
.wl-quota-txt { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1 1 auto; }
.wl-quota-txt b { font-size: 14px; font-weight: 800; }
.wl-quota-txt small { font-size: 12.5px; line-height: 1.38; color: rgba(255,255,255,.82); }
.wl-quota-x { flex: 0 0 auto; width: 32px; height: 32px; border-radius: 10px; border: 0; background: rgba(255,255,255,.12); color: #fff; font-size: 20px; line-height: 1; cursor: pointer; }

/* ---------- 3. «Служебное» ---------- */
#settings-rules-row[data-state="ok"] b { color: #1f9d55; }
#settings-rules-row[data-state="bad"] b { color: #d9534f; }
.settings-rules-warn { display: block; margin: -2px 0 8px; font-size: 12px; line-height: 1.4; color: #d9534f; }
.settings-rules-warn[hidden] { display: none; }
#settings-load-report b { color: var(--primary); font-weight: 700; }

/* ---------- 4. выравнивания (визуальная проверка 1.10.14) ---------- */
/* подсказка в поиске по приложению не помещалась на узких телефонах («Поиск по приложени…»): сама подсказка чуть мельче,
   размер вводимого текста прежний (16px — иначе iPhone приближает страницу при вводе) */
#global-search-input::placeholder { font-size: 14.5px; letter-spacing: -.1px; }
@media (max-width: 345px) { #global-search-input::placeholder { font-size: 13px; } }

/* «Сверка»: у кнопок с подписью в одну строку значок стоял ниже, чем у двухстрочных — теперь значки на одной линии */
#residues .res-actions-row > .btn-main { justify-content: flex-start !important; padding-top: 8px !important; padding-bottom: 6px !important; }
#residues .res-actions-row > .btn-main > span { min-height: 21px; display: flex !important; align-items: center; justify-content: center; text-align: center; }
/* лишний отступ под рядом кнопок */
#residues .drinks-card > .res-actions-row:last-child, #residues .res-actions-row { margin-bottom: 0 !important; }
/* заголовки «Факт / Учёт / Разница» стояли на 9px левее своих чисел */
#residues .res-list .res-row, #residues .res-row.res-item { padding-right: 13px !important; }

/* окно входа: заставка запуска не просвечивает сквозь форму входа, пока гаснет */
html.wl-splash-cut #wl-splash { transition: none !important; }

/* «Изменить списание»: поле даты того же вида, что и соседние поля */
#wo-edit-overlay .task-form-grid .wl-dt-trigger { background: #fff !important; border-color: rgba(127,127,127,.22) !important; }
[data-theme="dark"] #wo-edit-overlay .task-form-grid .wl-dt-trigger { background: #292929 !important; }

/* сличительная ведомость: заголовок прилипал к кнопкам над ним; «Очистить» теперь удаляет — кнопка заметная, в цвете удаления */
#stmt-body .st-head { margin-top: 14px; }
#stmt-body .st-clear { top: 0; min-height: 32px; padding: 6px 14px; opacity: 1; color: #d9534f; border-color: rgba(217, 83, 79, .45); background: rgba(217, 83, 79, .07); }
#stmt-body .st-clear:active { background: rgba(217, 83, 79, .16); }
#stmt-body .st-empty { margin-top: 12px; }

/* 1.10.14: галочки сообщений — 1 серая: отправлено; 2 серые: доставлено; 2 синие: прочитано (крупные и контрастные) */
.chat-status.sent, .chat-status.delivered, .chat-status.read { display: inline-flex; align-items: center; margin-left: 4px; }
.chat-status.sent, .chat-status.delivered { color: #fff !important; }
.chat-status.read { color: #3ec8ff !important; }
.chat-status svg { width: 19px !important; height: 19px !important; stroke-width: 3 !important; filter: drop-shadow(0 0 1px rgba(0,0,0,.45)); }
.chat-status.sent svg, .chat-status.delivered svg { opacity: .95; }
.chat-status.delivered svg + svg, .chat-status.read svg + svg { margin-left: -11px !important; }
.chat-li-st svg { width: 18px !important; height: 18px !important; stroke-width: 3 !important; }
.chat-li-st.sent, .chat-li-st.delivered { opacity: .8; }
.chat-li-st.delivered .wl-icon + .wl-icon, .chat-li-st.read .wl-icon + .wl-icon { margin-left: -11px !important; }
.chat-li-st.read { color: #1e90ff !important; opacity: 1; }

/* 1.10.14: крупные галочки не должны менять высоту строки сообщения */
.chat-status { height: 13px; line-height: 13px; overflow: visible; }
.chat-status svg { margin-top: -3px; margin-bottom: -3px; flex: 0 0 auto; }
.chat-li-st { height: 14px; overflow: visible; }
.chat-li-st svg { margin-top: -2px; margin-bottom: -2px; }

/* 1.10.14: выбор нескольких сообщений */
.chat-more { display: none !important; }
.chat-msg { position: relative; }
.chat-sel-box { display: none; }
.chat-selecting #chat-messages .chat-msg { max-width: none !important; width: 100%; align-self: stretch; padding-left: 40px; box-sizing: border-box; -webkit-user-select: none; user-select: none; }
.chat-selecting #chat-messages .chat-msg.own { justify-content: flex-end; }
.chat-selecting #chat-messages .chat-msg:not([data-id]) { padding-left: 0; }
.chat-selecting .chat-sel-box { display: flex; position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--border-strong, #9aa3b2); background: var(--card); align-items: center; justify-content: center; color: transparent; }
.chat-selecting .chat-msg.selected .chat-sel-box { background: var(--primary); border-color: var(--primary); color: #fff; }
.chat-selecting .chat-msg.selected { background: rgba(var(--primary-rgb), .12); border-radius: 12px; }
.chat-selecting #chat-composer-wrap { display: none !important; }
.chat-selecting .chat-readonly { display: none !important; }
.chat-selbar { display: flex; align-items: center; gap: 6px; padding: 6px 8px; border-bottom: 1px solid var(--border); background: var(--card); flex: 0 0 auto; }
.chat-selbar[hidden] { display: none; }
.chat-selbar .chat-sel-n { font-size: 16px; }
.chat-selbar .chat-sel-sp { flex: 1; }
.chat-selbar button { width: 42px; height: 42px; border: 0; border-radius: 50%; background: transparent; color: var(--text); display: inline-flex; align-items: center; justify-content: center; }
.chat-selbar button.danger { color: #e5484d; }
