/* h-chat.css — client<->manager chat (DEV3-CHAT-WHATSAPP-FULL-REDESIGN · Phases 1-4)
   WhatsApp light. Icons Lucide. FAB сохранён. */
:root { --hc-acc: #e87b00; --hc-acc2: #ff9a30; --hc-wa-bg: #efe7dd; --hc-in: #ffffff; --hc-out: #ffe7cc; --hc-tick: #34b7f1; --hc-ink: #1f2430; --hc-mut: #8a94a6; --hc-line: #e6e1da; }
/* все иконки виджета — контурные Lucide (серые через currentColor родителя), НЕ чёрная заливка.
   ic() срезает fill/stroke у исходного svg → задаём презентацию здесь. */
.hc-ic { display: block; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.hc-ic--solid { fill: currentColor; stroke: none; } /* play/pause — залитые треугольник/паузы */

/* 🔴 P0 — honor the [hidden] attribute for ALL widget overlays.
   Class rules like .hc-lightbox/.hc-panel/.hc-attpop{display:flex/grid} have the same
   specificity as the UA [hidden]{display:none} and come later → they defeat `hidden`,
   leaving an invisible full-viewport .hc-lightbox (z-index 8300, pointer-events:auto)
   that swallows every click site-wide for logged-in users. This honors `hidden` again. */
#h-chat-root [hidden] { display: none !important; }
/* DEV1-CABINET-CHAT-CLEANSTATE-FIX-V1: в инлайн-режиме (кабинет «Сообщения») mountInline переносит
   #h-chat-panel ИЗ #h-chat-root в контейнер кабинета → правило выше перестаёт применяться, и базовые
   .hc-emoji{display:grid}/.hc-recbar{display:flex} перебивают [hidden] → эмодзи-панель и полоса записи
   «висят» поверх переписки. Чиним: honor [hidden] и ВНУТРИ панели, где бы она ни была смонтирована
   (floating в root — правило дублируется, безвредно). _resetChatUiState уже ставит hidden=true. */
#h-chat-panel [hidden] { display: none !important; }

/* ── FAB ── */
#h-chat-fab { position: fixed; right: 24px; bottom: 24px; z-index: 8100; width: 60px; height: 60px; border-radius: 50%; border: 0; cursor: pointer; background: linear-gradient(135deg, #e87b00, #ff9a30); color: #fff; box-shadow: 0 10px 30px rgba(232,123,0,.45); display: flex; align-items: center; justify-content: center; padding: 0; outline: none; transform: translateY(8px) scale(.6); opacity: 0; animation: hc-fab-in .35s cubic-bezier(0.34,1.56,0.64,1) .15s forwards; transition: transform .25s cubic-bezier(0.22,1,0.36,1), box-shadow .25s; }
@keyframes hc-fab-in { to { transform: translateY(0) scale(1); opacity: 1; } }
#h-chat-fab:hover { transform: translateY(-3px); box-shadow: 0 16px 38px rgba(232,123,0,.55); }
#h-chat-fab:active { transform: translateY(-1px) scale(.96); }
.hc-fab-ico { position: absolute; display: flex; align-items: center; justify-content: center; transition: opacity .2s, transform .3s cubic-bezier(0.34,1.56,0.64,1); }
.hc-fab-ico--close { opacity: 0; transform: rotate(-90deg) scale(.5); }
#h-chat-fab.is-active .hc-fab-ico--open { opacity: 0; transform: rotate(90deg) scale(.5); }
#h-chat-fab.is-active .hc-fab-ico--close { opacity: 1; transform: rotate(0) scale(1); }
.hc-fab-badge { position: absolute; top: -3px; right: -3px; min-width: 20px; height: 20px; padding: 0 5px; background: #ff3b5c; color: #fff; border-radius: 11px; border: 2px solid #0e1116; font: 700 11px/1 'Onest', system-ui, sans-serif; display: flex; align-items: center; justify-content: center; }
.hc-fab-badge.hc-pulse { animation: hc-badge-pulse .8s cubic-bezier(0.22,1,0.36,1); }
@keyframes hc-badge-pulse { 0% { transform: scale(1); } 35% { transform: scale(1.45); } 100% { transform: scale(1); } }
#chat-bdg { display: none; }

/* ── Backdrop ── */
.hc-backdrop { position: fixed; inset: 0; z-index: 8150; background: rgba(6,9,13,.5); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); opacity: 0; transition: opacity .3s cubic-bezier(0.22,1,0.36,1); }
.hc-backdrop.is-open { opacity: 1; }

/* ── Panel ── */
.hc-panel { position: fixed; right: 20px; bottom: 20px; z-index: 8200; width: 384px; max-width: calc(100vw - 32px); height: 640px; max-height: calc(100dvh - 40px); background: var(--hc-wa-bg); border: 1px solid #d9d2c8; border-radius: 18px; overflow: hidden; display: flex; flex-direction: column; box-shadow: 0 30px 80px rgba(0,0,0,.45); font-family: 'Onest', -apple-system, system-ui, sans-serif; color: var(--hc-ink); transform: translateY(24px) scale(.97); opacity: 0; transform-origin: bottom right; transition: transform .34s cubic-bezier(0.22,1,0.36,1), opacity .26s ease; pointer-events: none; }
.hc-panel.is-open { transform: translateY(0) scale(1); opacity: 1; pointer-events: auto; }

/* head */
.hc-head { display: flex; align-items: center; gap: 9px; padding: 10px 10px 10px 13px; background: #fff; border-bottom: 1px solid var(--hc-line); flex: none; z-index: 5; }
.hc-head-av { width: 40px; height: 40px; border-radius: 50%; flex: none; background: linear-gradient(135deg, var(--hc-acc), var(--hc-acc2)); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 15px; position: relative; }
.hc-head-av .hc-od { position: absolute; right: -1px; bottom: -1px; width: 11px; height: 11px; border-radius: 50%; background: #22c55e; border: 2px solid #fff; }
.hc-head-meta { flex: 1; min-width: 0; }
.hc-head-name { font-size: 15px; font-weight: 700; letter-spacing: -.2px; color: var(--hc-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hc-head-sub { font-size: 11.5px; color: var(--hc-acc); margin-top: 1px; }
.hc-hbtn { width: 34px; height: 34px; border-radius: 9px; border: 0; background: transparent; color: #54606e; cursor: pointer; display: flex; align-items: center; justify-content: center; flex: none; transition: background .15s, color .15s; }
.hc-hbtn:hover { background: #f1efe9; color: var(--hc-ink); }

/* search bar */
.hc-searchbar { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: #fff; border-bottom: 1px solid var(--hc-line); flex: none; z-index: 4; }
.hc-searchbar .hc-sb-ic { color: var(--hc-mut); display: flex; }
.hc-searchbar input { flex: 1; border: 0; outline: none; font: 13.5px 'Onest', system-ui, sans-serif; color: var(--hc-ink); background: transparent; }
.hc-sb-count { font-size: 11px; color: var(--hc-mut); white-space: nowrap; }
.hc-sb-x { border: 0; background: #f1efe9; color: #54606e; width: 24px; height: 24px; border-radius: 7px; cursor: pointer; display: flex; align-items: center; justify-content: center; }

/* more menu */
.hc-more-menu { position: absolute; top: 56px; right: 12px; z-index: 30; background: #fff; border-radius: 12px; box-shadow: 0 12px 38px rgba(0,0,0,.22); padding: 6px; min-width: 232px; }
.hc-mm-item { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: transparent; padding: 10px 11px; font: 13px 'Onest', system-ui, sans-serif; color: var(--hc-ink); cursor: pointer; border-radius: 8px; text-align: left; }
.hc-mm-item:hover { background: #f5f2ec; }
.hc-mm-item .hc-ic { color: var(--hc-acc); flex: none; }

/* order bar */
.hc-ordbar { display: none; align-items: center; gap: 8px; margin: 8px 10px 0; padding: 7px 11px; background: #fff; border-left: 3px solid var(--hc-line); border-radius: 8px;   /* DEV1-UI-ORANGE-AND-FLASH-V1: декоративная линия ordbar -> нейтральная (была оранжевая) */ font-size: 11.5px; color: #7a5a2a; z-index: 2; box-shadow: 0 1px 3px rgba(0,0,0,.06); flex: none; text-decoration: none; }
.hc-ordbar.is-on { display: flex; }
.hc-ordbar b { color: #9a6a1e; }
.hc-ordbar .hc-ord-lk { margin-left: auto; color: var(--hc-acc); font-weight: 600; display: flex; align-items: center; gap: 3px; white-space: nowrap; }
.hc-ordbar .hc-ic { color: var(--hc-acc); flex: none; }

/* body */
.hc-body { flex: 1; overflow-y: auto; padding: 12px 10px 6px; display: flex; flex-direction: column; justify-content: flex-end; gap: 7px; scrollbar-width: thin; position: relative; }  /* DEV3-CHAT-FIX-V1: переписка прижата к низу (к полю ввода), как в Telegram */
.hc-body::before { content: ""; position: absolute; inset: 0; background-image: radial-gradient(rgba(0,0,0,.03) 1px, transparent 1px); background-size: 18px 18px; pointer-events: none; }
.hc-body::-webkit-scrollbar { width: 6px; } .hc-body::-webkit-scrollbar-thumb { background: #cfc7bb; border-radius: 4px; }
.hc-loading, .hc-uploading { color: #7c8696; font-size: 12.5px; text-align: center; padding: 8px; position: relative; z-index: 1; }
.hc-chip { align-self: center; font-size: 10.5px; color: #54606e; background: #fff; border-radius: 8px; padding: 3px 12px; margin: 4px 0; box-shadow: 0 1px 2px rgba(0,0,0,.06); position: relative; z-index: 1; }
.hc-greet { background: #fff; border-radius: 9px; border-top-left-radius: 2px; padding: 8px 11px; font-size: 13px; line-height: 1.45; color: var(--hc-ink); max-width: 84%; align-self: flex-start; box-shadow: 0 1px 1px rgba(0,0,0,.07); position: relative; z-index: 1; }

/* bubbles */
.hc-msg { max-width: 80%; padding: 6px 9px 5px; border-radius: 9px; font-size: 13px; line-height: 1.4; position: relative; word-wrap: break-word; overflow-wrap: anywhere; white-space: pre-wrap; box-shadow: 0 1px 1px rgba(0,0,0,.07); z-index: 1; }
.hc-msg--mgr { background: var(--hc-in); align-self: flex-start; border-top-left-radius: 2px; color: var(--hc-ink); }
.hc-msg--me { background: var(--hc-out); align-self: flex-end; border-top-right-radius: 2px; color: var(--hc-ink); }
.hc-msg.hc-hit { box-shadow: 0 0 0 2px var(--hc-acc); }
.hc-msg mark { background: #ffe08a; color: inherit; border-radius: 2px; }
.hc-msg-tx { display: inline; }
.hc-msg-tm { font-size: 9.5px; color: #8a93a0; float: right; margin: 6px 0 0 8px; display: inline-flex; align-items: center; gap: 3px; white-space: nowrap; }
.hc-msg-tm .hc-tick { color: #9aa3b0; } .hc-msg-tm .hc-tick.is-read { color: var(--hc-tick); }
/* DEV1-HCHAT-CLIENT-FIXES-V1 (FIX1): статусы своей отправки — отправляется (часики) / ошибка (!) */
.hc-msg-tm .hc-tick--pend { font-size: 10px; opacity: .65; line-height: 1; }
.hc-msg-tm .hc-tick--fail { color: #e2474a; font-weight: 800; font-size: 12px; line-height: 1; cursor: pointer; }

/* attachments in bubbles */
.hc-att-img { display: block; cursor: pointer; } .hc-att-img img { display: block; max-width: 210px; max-height: 220px; border-radius: 7px; margin-bottom: 3px; }
.hc-att-vid { display: block; position: relative; cursor: pointer; width: 210px; max-width: 100%; } .hc-att-vid video { display: block; width: 100%; max-height: 220px; border-radius: 7px; background: #000; object-fit: cover; }
.hc-att-vid .hc-vplay { position: absolute; inset: 0; margin: auto; width: 42px; height: 42px; border-radius: 50%; background: rgba(0,0,0,.55); color: #fff; display: flex; align-items: center; justify-content: center; }
.hc-att-file { display: flex; align-items: center; gap: 9px; padding: 6px 4px; text-decoration: none; color: var(--hc-ink); max-width: 230px; }
.hc-att-file .hc-fi { width: 34px; height: 34px; border-radius: 8px; background: #fff; display: flex; align-items: center; justify-content: center; color: var(--hc-acc); flex: none; box-shadow: 0 1px 2px rgba(0,0,0,.1); }
.hc-att-file .hc-fmeta { min-width: 0; } .hc-att-file .hc-fn { font-size: 12.5px; font-weight: 600; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .hc-att-file .hc-fs { font-size: 10px; color: #8a93a0; }
/* audio player */
.hc-att-aud { display: flex; align-items: center; gap: 9px; padding: 3px 2px; min-width: 184px; }
.hc-aud-play { width: 34px; height: 34px; border-radius: 50%; border: 0; background: linear-gradient(135deg, var(--hc-acc), var(--hc-acc2)); color: #fff; cursor: pointer; flex: none; display: flex; align-items: center; justify-content: center; }
.hc-aud-wave { display: flex; align-items: center; gap: 2px; height: 22px; flex: 1; }
.hc-aud-wave i { width: 2.5px; background: #b9c0cc; border-radius: 2px; transition: background .08s; } .hc-aud-wave i.on { background: var(--hc-acc); }
.hc-aud-t { font-size: 9.5px; color: #667; min-width: 26px; text-align: right; }

/* empty */
.hc-empty { text-align: center; padding: 40px 18px; margin: auto 0; display: flex; flex-direction: column; align-items: center; position: relative; z-index: 1; }
.hc-empty-ic { width: 64px; height: 64px; border-radius: 18px; background: rgba(232,123,0,.12); color: var(--hc-acc); display: flex; align-items: center; justify-content: center; margin-bottom: 16px; }
.hc-empty-b { font-size: 15px; font-weight: 700; color: var(--hc-ink); margin-bottom: 7px; }
.hc-empty-s { font-size: 12.5px; color: #7c8696; line-height: 1.5; max-width: 280px; }
.hc-empty-cta { margin-top: 18px; font-size: 13px; font-weight: 600; color: #fff; background: linear-gradient(135deg, var(--hc-acc), var(--hc-acc2)); border-radius: 11px; padding: 9px 18px; text-decoration: none; }

/* typing row */
.hc-typing-row { padding: 0 10px 4px; flex: none; }
.hc-typing { display: inline-flex; gap: 4px; background: #fff; border-radius: 9px; border-top-left-radius: 2px; padding: 9px 12px; box-shadow: 0 1px 1px rgba(0,0,0,.07); }
.hc-typing i { width: 6px; height: 6px; border-radius: 50%; background: #b9c0cc; animation: hc-typ 1.2s infinite; }
.hc-typing i:nth-child(2) { animation-delay: .2s; } .hc-typing i:nth-child(3) { animation-delay: .4s; }
@keyframes hc-typ { 0%,60%,100% { opacity: .3; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }

/* attach popup */
.hc-attpop { position: absolute; bottom: 70px; left: 12px; z-index: 25; width: 268px; background: #fff; border-radius: 16px; box-shadow: 0 16px 44px rgba(0,0,0,.28); padding: 16px; display: grid; grid-template-columns: repeat(3,1fr); gap: 14px; }
.hc-ap { display: flex; flex-direction: column; align-items: center; gap: 7px; border: 0; background: transparent; cursor: pointer; font: 11.5px 'Onest', system-ui, sans-serif; color: var(--hc-ink); }
.hc-ap-c { width: 50px; height: 50px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #fff; }
.hc-ap-c.b1 { background: #7c4dff; } .hc-ap-c.b2 { background: #e91e63; } .hc-ap-c.b3 { background: #0d9488; } .hc-ap-c.b4 { background: #ff8f00; } .hc-ap-c.b5 { background: #2196f3; } .hc-ap-c.b6 { background: #00bcd4; }
.hc-ap:active .hc-ap-c { transform: scale(.92); }

/* emoji */
.hc-emoji { position: absolute; bottom: 70px; left: 12px; right: 12px; z-index: 25; background: #fff; border-radius: 14px; box-shadow: 0 16px 44px rgba(0,0,0,.24); padding: 10px; display: grid; grid-template-columns: repeat(8,1fr); gap: 3px; max-height: 168px; overflow-y: auto; }
.hc-em { border: 0; background: transparent; font-size: 21px; cursor: pointer; padding: 4px; border-radius: 8px; line-height: 1; }
.hc-em:hover { background: #f3f0ea; }

/* input row */
.hc-input { display: flex; align-items: flex-end; gap: 8px; padding: 9px 10px calc(9px + env(safe-area-inset-bottom, 0px)); background: var(--hc-wa-bg); flex: none; }
.hc-pill { flex: 1; display: flex; align-items: flex-end; gap: 4px; background: #fff; border: 1px solid var(--hc-line); border-radius: 22px; padding: 5px 6px; box-shadow: 0 2px 8px rgba(0,0,0,.06); min-width: 0; }
.hc-field { flex: 1; min-width: 0; max-height: 120px; height: 24px; line-height: 24px; background: transparent; border: 0; padding: 0 2px; margin: 0; color: var(--hc-ink); font: 13.5px/24px 'Onest', system-ui, sans-serif; outline: none; resize: none; overflow-y: auto; scrollbar-width: thin; }
.hc-field::placeholder { color: #9aa3b2; }
.hc-ibtn { width: 32px; height: 32px; border-radius: 50%; border: 0; background: transparent; color: #8a93a0; cursor: pointer; flex: none; display: flex; align-items: center; justify-content: center; transition: color .15s; }
.hc-ibtn:hover { color: var(--hc-acc); }
.hc-micsend { width: 46px; height: 46px; border-radius: 50%; border: 0; background: linear-gradient(135deg, var(--hc-acc), var(--hc-acc2)); color: #fff; cursor: pointer; flex: none; display: flex; align-items: center; justify-content: center; transition: transform .12s, filter .15s; box-shadow: 0 4px 12px rgba(232,123,0,.4); touch-action: none; }
.hc-micsend:hover { filter: brightness(1.08); } .hc-micsend:active { transform: scale(.93); }

/* record bar */
.hc-recbar { position: absolute; left: 10px; right: 10px; bottom: 10px; z-index: 26; display: flex; align-items: center; gap: 10px; background: #fff; border: 1px solid var(--hc-line); border-radius: 24px; padding: 11px 14px; box-shadow: 0 4px 14px rgba(0,0,0,.14); }
.hc-rec-dot { width: 11px; height: 11px; border-radius: 50%; background: #ef4444; animation: hc-recpulse 1s infinite; flex: none; }
@keyframes hc-recpulse { 0%,100% { opacity: 1; } 50% { opacity: .3; } }
.hc-rec-t { font-size: 13px; font-weight: 600; color: var(--hc-ink); font-variant-numeric: tabular-nums; min-width: 34px; }
.hc-rec-slide { flex: 1; text-align: center; color: #9aa3b2; font-size: 12.5px; display: flex; align-items: center; justify-content: center; gap: 4px; }
.hc-rec-cancel { border: 0; background: #fdecec; color: #ef4444; width: 30px; height: 30px; border-radius: 50%; cursor: pointer; display: flex; align-items: center; justify-content: center; flex: none; }

/* lightbox */
.hc-lightbox { position: fixed; inset: 0; z-index: 8300; background: rgba(8,10,14,.92); display: flex; align-items: center; justify-content: center; opacity: 0; transition: opacity .25s; padding: 20px; }
.hc-lightbox.is-open { opacity: 1; }
.hc-lb-x { position: absolute; top: 16px; right: 16px; width: 42px; height: 42px; border-radius: 50%; border: 0; background: rgba(255,255,255,.14); color: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.hc-lb-content { max-width: 92vw; max-height: 86vh; display: flex; }
.hc-lb-content img, .hc-lb-content video { max-width: 92vw; max-height: 86vh; border-radius: 10px; }
.hc-medlist { background: #fff; border-radius: 14px; width: min(420px, 92vw); max-height: 80vh; overflow-y: auto; padding: 14px; }
.hc-ml-h { font-size: 14px; font-weight: 700; color: var(--hc-ink); margin-bottom: 10px; }
.hc-ml-empty { color: #8a93a0; font-size: 13px; padding: 20px 0; text-align: center; }
.hc-ml-row { display: flex; align-items: center; gap: 11px; padding: 8px; border-radius: 9px; text-decoration: none; color: var(--hc-ink); }
.hc-ml-row:hover { background: #f5f2ec; }
.hc-ml-th { width: 42px; height: 42px; border-radius: 8px; background: #f1efe9; display: flex; align-items: center; justify-content: center; overflow: hidden; flex: none; } .hc-ml-th img { width: 100%; height: 100%; object-fit: cover; } .hc-mlt-ic { color: var(--hc-acc); }
.hc-ml-tx { font-size: 13px; display: flex; flex-direction: column; } .hc-ml-dt { font-size: 10.5px; color: #8a93a0; }

.hc-toast { position: fixed; bottom: 96px; left: 50%; transform: translateX(-50%); background: #1b2129; color: #e7ebf0; padding: 10px 18px; border-radius: 12px; font: 13px 'Onest', system-ui, sans-serif; z-index: 9999; opacity: 0; transition: opacity .25s; pointer-events: none; max-width: 90vw; text-align: center; }
.hc-toast.show { opacity: 1; }

/* mobile */
@media (max-width: 640px) {
  #h-chat-fab { right: 16px; bottom: calc(72px + env(safe-area-inset-bottom, 0px)); width: 54px; height: 54px; }
  .hc-panel { left: 0; right: 0; bottom: 0; width: 100%; max-width: 100%; height: 100dvh; max-height: 100dvh; border-radius: 0; border-left: 0; border-right: 0; border-bottom: 0; transform-origin: bottom center; transform: translateY(100%); opacity: 1; transition: transform .30s cubic-bezier(0.22,1,0.36,1); }   /* DEV1-UI-ORANGE-AND-FLASH-V1: opacity:1 + только transform -> без белой вспышки */   /* DEV1-CHAT-EDGE-FINAL-V4 УЛИКА1: left:0 И right:0 + width:100% (НЕ 100vw — на дробном DPR Android округлялся → микро-щель слева с бэкдропом) + radius:0 */
  .hc-panel.is-open { transform: translateY(0); }
  .hc-emoji { grid-template-columns: repeat(7,1fr); }
}
@media (prefers-reduced-motion: reduce) { #h-chat-fab, .hc-panel, .hc-backdrop, .hc-fab-ico { animation: none !important; transition: opacity .15s !important; } }
.dh-ai-chips{display:flex;flex-wrap:wrap;gap:6px;margin-top:10px}
.dh-ai-chip{padding:7px 12px;border:1px solid #e87b00;background:#fff8f1;color:#e87b00;border-radius:999px;font:inherit;font-size:12.5px;cursor:pointer}
.dh-ai-chip:hover{background:#e87b00;color:#fff}
.ai-acc-header{font-size:14px;font-weight:700;color:#1d1d1f;margin:0 0 8px}
.ai-acc-say{margin:0 0 12px;line-height:1.45}
.ai-acc-gt{font-size:11px;font-weight:600;color:#8a8a8e;text-transform:uppercase;letter-spacing:.4px;margin:14px 0 6px}
.ai-acc-row{display:grid;grid-template-columns:repeat(auto-fill,minmax(120px,1fr));gap:8px}
.ai-acc-all{display:inline-block;margin:8px 0 4px;color:#e87b00;font-weight:600;font-size:13px;text-decoration:none}

/* ===== DEV3-CHAT-REDESIGN-V1: убрать фаб, список тредов слева ===== */
#h-chat-fab { display: none !important; }                                   /* убран старый оранжевый плавающий пузырь */
@media (min-width: 769px) { #h-chat-btn { display: none !important; } }      /* десктоп: единственный вход = «Сообщения» в правом сайдбаре */
.hc-panel { width: 568px; }                                                 /* шире — под список тредов слева */
.hc-main { display: flex; flex: 1; min-height: 0; overflow: hidden; }
.hc-conv { flex: 1; min-width: 0; display: flex; flex-direction: column; position: relative; }
.hc-threads { width: 176px; flex: none; border-right: 1px solid var(--hc-line); overflow-y: auto; background: #faf9f7; padding: 7px 6px; display: flex; flex-direction: column; gap: 3px; }
.hc-th { display: flex; align-items: center; gap: 8px; width: 100%; border: 0; background: transparent; padding: 8px; border-radius: 10px; cursor: pointer; text-align: left; color: var(--hc-ink); }
.hc-th:hover { background: #f0ece5; }
.hc-th.is-on { background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.09); }
.hc-th-ic { flex: none; width: 30px; height: 30px; border-radius: 8px; background: #efe9df; color: #8a6a32; display: flex; align-items: center; justify-content: center; }
.hc-th.is-on .hc-th-ic { background: linear-gradient(135deg, var(--hc-acc), var(--hc-acc2)); color: #fff; }
.hc-th-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.hc-th-t { font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hc-th-p { font-size: 10.5px; color: #8a8576; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.hc-th-p--mut { color: #b3ad9f; font-style: italic; }
@media (max-width: 600px) { .hc-panel { width: 384px; } .hc-threads { width: 122px; } .hc-th-ic { width: 24px; height: 24px; } .hc-th-t { font-size: 12px; } }

/* ════ DEV1-CHAT-PREMIUM-REDESIGN-V1 — премиум-вид по эталону Бека (центр-модал, стекло, мишка-фавикон) ════ */
/* DEV1-CHAT-MATCH-GATE-V1: фон/материал чата = 1:1 как у гейта «Войдите» (.otc-gate-bd / .otc-gate в otc-sidebar.js).
   Бэкдроп = ЗАТЕМНЕНИЕ поверх ЖИВОГО сайта → страница видна и приглушена позади (НЕ светлый экран на всю). */
#h-chat-root .hc-backdrop { background: rgba(20,22,30,.5);
  -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }

/* панель — по центру; стекло = ровно как .otc-gate (та же gradient+rgba+blur+border+shadow) */
.hc-panel { left: 50%; right: auto; top: 50%; bottom: auto; width: 795px; max-width: calc(100vw - 32px);
  height: 648px; max-height: calc(100dvh - 40px); border-radius: 24px;
  background: linear-gradient(180deg,rgba(255,255,255,.6) 0%,rgba(255,255,255,0) 22%,rgba(255,255,255,0) 78%,rgba(255,255,255,.4) 100%),rgba(255,255,255,.74);
  -webkit-backdrop-filter: blur(30px) saturate(170%); backdrop-filter: blur(30px) saturate(170%);
  border: 1px solid rgba(255,255,255,.7); box-shadow: 0 30px 72px rgba(20,20,30,.28);
  transform-origin: center; transform: translate(-50%, -50%) scale(.97); }
.hc-panel.is-open { transform: translate(-50%, -50%) scale(1); }
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) { .hc-panel { background: #fff; } }

/* шапка */
.hc-head { background: transparent; border-bottom: 1px solid rgba(40,50,70,.08); padding: 15px 18px; gap: 13px; }
.hc-head-av { width: 48px; height: 48px; flex: 0 0 48px; background: #0b0b0d; border: 1px solid #0b0b0d; overflow: hidden; font-size: 0; display: flex; align-items: center; justify-content: center; }   /* AVATAR-POLISH: чистый ЧЁРНЫЙ круг (жёлтая подложка убрана) */
/* DEV1-CHAT-MATCH-GATE-V1: мишка строго по центру кружка (contain — как плитка гейта, без смещения вправо) */
.hc-head-av .hc-head-bear { width: 100%; height: 100%; object-fit: cover; object-position: center; display: block; }   /* AVATAR-POLISH: мишка-арт заполняет круг, чёрный фон иконки до краёв — ободков нет */
.hc-head-av .hc-od { width: 12px; height: 12px; background: #27c266; border: 2.5px solid #fff; right: 0; bottom: 0; }
.hc-head-name { font-size: 15.5px; font-weight: 700; color: #19191c; }
.hc-head-sub { font-size: 12.5px; color: #27a259; font-weight: 500; }
.hc-hbtn { color: #7a7a82; border-radius: 10px; }
.hc-hbtn:hover { background: rgba(40,50,70,.06); color: #19191c; }

/* тело прозрачное (видно стекло) */
.hc-body { background: transparent; }
.hc-body::before { display: none; }
.hc-threads { background: rgba(255,255,255,.35); border-right: 1px solid rgba(40,50,70,.08); width: 232px; flex: 0 0 232px; padding: 10px 8px; }

/* треды по эталону: квадрат-аватар, «N сообщений», бейдж непрочитанных */
.hc-th { gap: 11px; padding: 11px 10px; border-radius: 13px; }
.hc-th.is-on { background: #fff; box-shadow: 0 4px 14px rgba(20,20,30,.06); }
.hc-th-ic { width: 38px; height: 38px; flex: 0 0 38px; border-radius: 11px; background: #e87b00; color: #fff; }
.hc-th-ic--gen { background: #3a3a42; color: #fff; }
.hc-th.is-on .hc-th-ic { background: #e87b00; }
.hc-th.is-on .hc-th-ic--gen { background: #3a3a42; }
.hc-th-t { font-size: 14px; font-weight: 600; color: #1c1c1f; }
.hc-th-p { font-size: 12.5px; color: #8a8a90; margin-top: 2px; }
.hc-th-badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: #e8472b; color: #fff; font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex: none; margin-left: auto; }

/* пузыри по эталону */
.hc-msg { font-size: 14px; padding: 9px 13px; border-radius: 16px; box-shadow: none; line-height: 1.4; }
.hc-msg--mgr { background: #fff; border: 1px solid rgba(40,50,70,.07); border-top-left-radius: 16px; border-bottom-left-radius: 6px; }
.hc-msg--me { background: #ffedd9; border: 1px solid rgba(232,123,0,.18); border-top-right-radius: 16px; border-bottom-right-radius: 6px; }
.hc-msg-tm .hc-tick.is-read { color: #e87b00; }   /* галочки прочтения — оранжевые (эталон) */
.hc-chip, .hc-day { background: rgba(255,255,255,.7); border: 1px solid rgba(40,50,70,.06); color: #8a8a90; box-shadow: none; }
.hc-greet { background: #fff; }

/* инпут по эталону */
.hc-input { background: transparent; border-top: 1px solid rgba(40,50,70,.08); padding: 12px 16px; align-items: flex-end; }
/* DEV1-CHAT-INPUT-AUTOGROW-V1: пилюля растёт с текстом (min-height вместо fixed height) */
.hc-pill { border-radius: 23px; min-height: 46px; height: auto; background: #fff; border: 1px solid rgba(40,50,70,.1); align-items: center; }
/* DEV1-CHAT-INPUT-POLISH-V1: текст по центру пилюли; иконки (смайл/скрепка) прижаты к низу при росте поля */
.hc-pill .hc-ibtn { align-self: flex-end; }
.hc-field { max-height: 140px; }
.hc-micsend { background: #e87b00; box-shadow: 0 8px 18px rgba(232,123,0,.3); }
/* DEV1-CHAT-INPUT-POLISH-V1: на десктопе только скрепка (камера — дубль меню вложений); мобайл не трогаем */
@media (min-width: 641px) { #hc-camera { display: none; } }
/* раскладка: растёт инпут → ужимается ТЕЛО (не перекрывает); тело прижато к низу И ЛИСТАЕТСЯ вверх к истории */
.hc-conv { min-height: 0; }
.hc-body { min-height: 0; justify-content: flex-start; }
.hc-body > :first-child { margin-top: auto; }
/* кнопка «отправить голосовое» в рек-баре */
.hc-rec-send { border: 0; background: #e87b00; color: #fff; width: 34px; height: 34px; border-radius: 50%; cursor: pointer; display: flex; align-items: center; justify-content: center; flex: none; }

/* mobile — на весь экран снизу */
@media (max-width: 640px) {
  .hc-panel { left: 0; right: 0; top: auto; bottom: 0; width: 100%; max-width: 100%; height: 100dvh; max-height: 100dvh; border-radius: 0; transform-origin: bottom center; transform: translateY(100%); opacity: 1; transition: transform .30s cubic-bezier(0.22,1,0.36,1); }   /* DEV1-UI-ORANGE-AND-FLASH-V1 */   /* DEV1-CHAT-EDGE-FINAL-V4 УЛИКА1: 100vw→100% + radius:0 (без щели ни при каком DPR) */
  .hc-panel.is-open { transform: translateY(0); }
  .hc-threads { width: 122px; flex: 0 0 122px; }
}

/* CABINET-CHAT-FROZEN-V1 (DEV1): инлайн-режим чата в кабинете (HChat.mountInline). КЛЮЧ — position:relative:
   absolute-оверлеи (.hc-emoji/.hc-recbar/.hc-attpop/.hc-more-menu) позиционируются ВНУТРИ панели, а не улетают в низ
   страницы (это и был фриз при прежнем position:static). Размер по карточке, без fixed/тени/анимации/центр-transform. */
body.hc-inline-on #h-chat-panel {
  position: relative !important;
  left: auto !important; top: auto !important; right: auto !important; bottom: auto !important;
  transform: none !important; transition: none !important;
  width: 100% !important; max-width: none !important;
  height: clamp(430px, 70vh, 760px) !important; max-height: none !important;
  box-shadow: none !important; border-radius: 14px !important;
  opacity: 1 !important; pointer-events: auto !important; z-index: auto !important;
}
body.hc-inline-on #h-chat-fab, body.hc-inline-on #h-chat-backdrop { display: none !important; }
body.hc-inline-on .hc-head-x { display: none !important; }   /* инлайн — закрывать нечего */

/* DEV1-MOB-CHAT-PAGE-V1 (D): на МОБ список тредов = левая ☰-шторка (Gemini). Только витрина-оверлей (body:is(:not(.hc-inline-on), .hc-page-on)) → кабинет-инлайн DEV3 НЕ трогаем; десктоп — инлайн-сайдбар. */
.hc-threads-btn { display: none; }   /* десктоп/инлайн: ☰ нет (треды видны сайдбаром) */
.hc-th-bd { display: none; }
@media (max-width: 640px) {
  body:is(:not(.hc-inline-on), .hc-page-on) .hc-main { position: relative; }
  body:is(:not(.hc-inline-on), .hc-page-on) .hc-threads { position: absolute; top: 0; bottom: 0; left: 0; z-index: 30; width: 82%; max-width: 300px; transform: translateX(-100%); transition: transform .28s cubic-bezier(.22,1,.36,1); box-shadow: 6px 0 30px rgba(0,0,0,.20); border-right: 0; overscroll-behavior: contain; }
  body:is(:not(.hc-inline-on), .hc-page-on) .hc-threads.hc-th-open { transform: translateX(0); }
  body:is(:not(.hc-inline-on), .hc-page-on) .hc-conv { width: 100%; }
  body:is(:not(.hc-inline-on), .hc-page-on) .hc-th-bd { display: block; position: absolute; inset: 0; z-index: 25; background: rgba(20,16,30,.42); opacity: 0; pointer-events: none; transition: opacity .28s; }
  body:is(:not(.hc-inline-on), .hc-page-on) .hc-th-bd.hc-th-open { opacity: 1; pointer-events: auto; }
  body:is(:not(.hc-inline-on), .hc-page-on) .hc-threads-btn { display: flex; }
}

/* ════════ DEV1-MOB-CHAT-V8-REBUILD-V1 (2026-07-02): моб-чат до уровня ИИ-окна. §8 стекло долой (Huawei), V8-стабильность,
   компакт-шапка одной строкой, поле ≥16px. ТОЛЬКО витрина-оверлей (body:is(:not(.hc-inline-on), .hc-page-on)) → кабинет-инлайн (DEV3) не трогаем. ════════ */
@media (max-width: 640px) {
  /* (1) СТЕКЛО ДОЛОЙ: моб-панель наследовала backdrop blur(30px) от десктоп-правила (fullscreen-стекло = Huawei-убийца) → solid #fff */
  body:is(:not(.hc-inline-on), .hc-page-on) #h-chat-panel{
    background:#fff !important; -webkit-backdrop-filter:none !important; backdrop-filter:none !important;
    height:100vh !important; height:100dvh !important; box-shadow:none !important; border:0 !important;
  }
  body:is(:not(.hc-inline-on), .hc-page-on) #h-chat-backdrop{ -webkit-backdrop-filter:none !important; backdrop-filter:none !important; background:rgba(8,10,14,.5) !important; }
  /* (3) закрытый чат = СКВОЗНОЙ (урок ИИ-призрака: не перехватывает тапы под собой) */
  body:is(:not(.hc-inline-on), .hc-page-on) #h-chat-panel:not(.is-open){ visibility:hidden !important; pointer-events:none !important; }
  /* тело светлое (стекло убрано) + скроллится ТОЛЬКО оно */
  body:is(:not(.hc-inline-on), .hc-page-on) .hc-body{ background:#f4f3ef !important; overscroll-behavior:contain; -webkit-overflow-scrolling:touch; }
  body:is(:not(.hc-inline-on), .hc-page-on) .hc-body::before{ display:none !important; }
  body:is(:not(.hc-inline-on), .hc-page-on) .hc-msg--mgr{ background:#fff !important; }
  body:is(:not(.hc-inline-on), .hc-page-on) .hc-input{ background:#fff !important; }
  /* (2) поле ≥16px — iOS не зумит при фокусе */
  body:is(:not(.hc-inline-on), .hc-page-on) .hc-field{ font-size:16px !important; line-height:22px !important; }   /* POLISH-V2 #6: убран height:22px!important — он ПЕРЕБИВАЛ inline-height autoGrow → поле не росло, текст уходил вверх. Теперь растёт как WA */
  /* (4) КОМПАКТ-ШАПКА одной строкой: аватар 32 + «Менеджер» + статус серым 12px inline (nowrap), справа кнопки. Системные шрифты. */
  body:is(:not(.hc-inline-on), .hc-page-on) .hc-head{ background:#fff !important; padding:8px 6px 8px 12px !important; gap:9px !important; font-family:-apple-system,"Roboto",system-ui,sans-serif !important; }
  body:is(:not(.hc-inline-on), .hc-page-on) .hc-head-av{ width:35px !important; height:35px !important; flex:0 0 35px !important; }   /* CHAT-AVATAR-10: моб 32->35 (+10%) */
  body:is(:not(.hc-inline-on), .hc-page-on) .hc-head-av .hc-head-bear{ width:26px !important; height:26px !important; }
  body:is(:not(.hc-inline-on), .hc-page-on) .hc-head-name{ font-size:14.5px !important; line-height:1.15 !important; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
  body:is(:not(.hc-inline-on), .hc-page-on) .hc-head-sub{ font-size:12px !important; color:#8a8a90 !important; font-weight:400 !important; line-height:1.15 !important; margin-top:1px !important; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
  body:is(:not(.hc-inline-on), .hc-page-on) .hc-hbtn{ width:40px !important; height:40px !important; }
  body:is(:not(.hc-inline-on), .hc-page-on) .hc-threads-btn{ width:34px !important; height:40px !important; }
  body:is(:not(.hc-inline-on), .hc-page-on) #hc-search-btn{ display:none !important; }   /* 🔍 → меню ⋮ (data-mm=search); место статусу */
  /* POLISH-V2 #1: УГЛЫ-ДЫРКИ — панель fullscreen без скруглённых верхних углов → тап в угол не проваливается на сайт */
  body:is(:not(.hc-inline-on), .hc-page-on) #h-chat-panel{ border-radius:0 !important; left:0 !important; right:0 !important; width:100% !important; max-width:100% !important; }   /* УЛИКА1: id-специфичность гарантирует inset+width:100% (без щели) */
  /* POLISH-V2 #2: имя 14px, ⋮ ровно 40×40 с иконкой 20 (была «огромная») */
  body:is(:not(.hc-inline-on), .hc-page-on) .hc-head-name{ font-size:14px !important; }
  body:is(:not(.hc-inline-on), .hc-page-on) .hc-hbtn svg{ width:20px !important; height:20px !important; }
  /* POLISH-V2 #7: набор → камера прячется, скрепка ужимается (transform/opacity), место тексту; пусто → возвращаются */
  /* POLISH-V2 #7 (уточнён Беком, WhatsApp 1:1): набор → КАМЕРА исчезает полностью, СКРЕПКА поворачивается в вертикаль (компактнее); пусто → возврат. Плавно. */
  body:is(:not(.hc-inline-on), .hc-page-on) #hc-camera{ transition:opacity .2s, max-width .2s, margin .2s, padding .2s; }
  body:is(:not(.hc-inline-on), .hc-page-on) #hc-attach{ transition:transform .22s cubic-bezier(.34,1.4,.5,1); }
  body:is(:not(.hc-inline-on), .hc-page-on) #hc-input-row.hc-typing-on #hc-camera{ opacity:0; max-width:0 !important; width:0 !important; margin:0 !important; padding:0 !important; overflow:hidden; pointer-events:none; }
  body:is(:not(.hc-inline-on), .hc-page-on) #hc-input-row.hc-typing-on #hc-attach{ transform:rotate(-90deg); }   /* скрепка → вертикаль (WhatsApp) */
  /* POLISH-V2 #3: МЕНЮ ТРЕДОВ ☰ — НЕПРОЗРАЧНАЯ компактная панель (был прозрачный фон): solid #fff, 78%, скругление справа, тень; затемнение solid БЕЗ blur */
  body:is(:not(.hc-inline-on), .hc-page-on) .hc-threads{ background:#fff !important; width:78% !important; max-width:320px !important; border-radius:0 16px 16px 0 !important; box-shadow:8px 0 34px rgba(10,12,16,.28) !important; }
  body:is(:not(.hc-inline-on), .hc-page-on) .hc-th-bd{ background:rgba(10,12,16,.38) !important; -webkit-backdrop-filter:none !important; backdrop-filter:none !important; }
  body:is(:not(.hc-inline-on), .hc-page-on) .hc-th{ border-radius:12px !important; }
}
/* DEV1-MOB-CHAT-V8-REBUILD-V1 плашка «↓ Новое сообщение» (мессенджер-рефлекс: пришло новое пока листаешь историю) */
.hc-newmsg{ position:absolute; left:50%; bottom:14px; transform:translateX(-50%) translateY(8px); z-index:6; display:inline-flex; align-items:center; gap:6px; background:#e87b00; color:#fff; font-size:12.5px; font-weight:600; padding:8px 14px; border-radius:999px; box-shadow:0 4px 14px rgba(232,123,0,.4); cursor:pointer; border:0; opacity:0; pointer-events:none; transition:opacity .2s, transform .2s; -webkit-tap-highlight-color:transparent; font-family:-apple-system,"Roboto",system-ui,sans-serif; }
.hc-newmsg.show{ opacity:1; transform:translateX(-50%) translateY(0); pointer-events:auto; }
.hc-newmsg svg{ width:15px; height:15px; }
@media(min-width:641px){ .hc-newmsg{ display:none !important; } }   /* десктоп-чат 0: плашка только моб */

/* ════ DEV1-AI-CHAT-STREAMING-V1 (2026-07-02): ИИ-чат тайпрайтер — «думает»+живой статус, печать по словам, ⏹ стоп, карточки-появление, «↓» якорь ════ */
.h-ai-thinking{ display:inline-flex; align-items:center; gap:9px; }
.h-ai-dots{ display:inline-flex; gap:4px; }
.h-ai-dots i{ width:6px; height:6px; border-radius:50%; background:#e87b00; animation:aiThink 1.1s infinite; }
.h-ai-dots i:nth-child(2){ animation-delay:.18s; } .h-ai-dots i:nth-child(3){ animation-delay:.36s; }
@keyframes aiThink{ 0%,60%,100%{ opacity:.3; transform:translateY(0);} 30%{ opacity:1; transform:translateY(-3px);} }
.h-ai-think-st{ font-size:13px; color:#8a8a8e; }
.h-ai-typing{ white-space:pre-wrap; }
.h-ai-typing::after{ content:"\258B"; color:#e87b00; margin-left:1px; animation:aiCaret 1s steps(1) infinite; }
@keyframes aiCaret{ 50%{ opacity:0; } }
.ai-cards-in{ animation:aiCardsIn .32s ease both; }
@keyframes aiCardsIn{ from{ opacity:0; transform:translateY(6px);} to{ opacity:1; transform:none; } }
@media(prefers-reduced-motion:reduce){ .ai-cards-in,.h-ai-typing::after,.h-ai-dots i{ animation:none; } }
#ai-send.is-stop svg, #ai-send.is-stop::before{ display:none !important; }
#ai-send.is-stop::after{ content:""; display:block; width:13px; height:13px; background:currentColor; border-radius:3px; }
.ai-down{ position:absolute; left:50%; bottom:14px; transform:translateX(-50%) translateY(8px); z-index:6; width:38px; height:38px; border-radius:50%; background:#fff; border:1px solid #e6e6ea; box-shadow:0 5px 16px rgba(0,0,0,.16); color:#e87b00; display:flex; align-items:center; justify-content:center; cursor:pointer; opacity:0; pointer-events:none; transition:opacity .2s, transform .2s; }
.ai-down.show{ opacity:1; transform:translateX(-50%) translateY(0); pointer-events:auto; }
.ai-down svg{ width:20px; height:20px; }

/* ════ DEV1-MOB-CHAT-TAILS-V3 (2026-07-02): WhatsApp-ряды тредов в моб-шторке ☰ (аватар 42, «Заявка №63», плашка статуса, превью, бейдж, «Общий» закреплён, секция, шапка «Чаты») ════ */
body:is(:not(.hc-inline-on), .hc-page-on) .hc-threads .hc-th-hd{ display:flex; align-items:center; justify-content:space-between; padding:calc(12px + env(safe-area-inset-top)) 14px 10px; border-bottom:1px solid #eceaef; position:sticky; top:0; background:#fff; z-index:2; }
body:is(:not(.hc-inline-on), .hc-page-on) .hc-th-hd-t{ font-size:17px; font-weight:600; color:#15141a; }
body:is(:not(.hc-inline-on), .hc-page-on) .hc-th-hd-x{ width:34px; height:34px; border:0; background:#f4f4f6; border-radius:10px; color:#1c1a22; display:flex; align-items:center; justify-content:center; cursor:pointer; }
body:is(:not(.hc-inline-on), .hc-page-on) .hc-th-list{ padding:6px; }
body:is(:not(.hc-inline-on), .hc-page-on) .hc-th-sec{ font-size:11px; font-weight:700; letter-spacing:.04em; color:#a8a4b0; padding:14px 10px 6px; }
body:is(:not(.hc-inline-on), .hc-page-on) .hc-threads .hc-th{ display:flex; align-items:center; gap:11px; width:100%; padding:9px 8px; border:0; background:none; border-radius:13px; text-align:left; cursor:pointer; -webkit-tap-highlight-color:transparent; }
body:is(:not(.hc-inline-on), .hc-page-on) .hc-threads .hc-th.is-on{ background:#f3f0ea; }
body:is(:not(.hc-inline-on), .hc-page-on) .hc-threads .hc-th--gen{ background:#fff7ef; box-shadow:inset 3px 0 0 #e87b00; }
body:is(:not(.hc-inline-on), .hc-page-on) .hc-threads .hc-th--gen.is-on{ background:#ffefd9; }
body:is(:not(.hc-inline-on), .hc-page-on) .hc-th-av{ width:42px; height:42px; flex:0 0 42px; display:flex; align-items:center; justify-content:center; }
body:is(:not(.hc-inline-on), .hc-page-on) .hc-th-av svg{ width:20px; height:20px; }
body:is(:not(.hc-inline-on), .hc-page-on) .hc-th-av--gen{ border-radius:50%; background:#e87b00; color:#fff; }
body:is(:not(.hc-inline-on), .hc-page-on) .hc-th-av--ord{ border-radius:12px; background:#fdf1e3; color:#c96f04; }
body:is(:not(.hc-inline-on), .hc-page-on) .hc-th-mid{ flex:1 1 auto; min-width:0; display:flex; flex-direction:column; gap:3px; }
body:is(:not(.hc-inline-on), .hc-page-on) .hc-th-top{ display:flex; align-items:center; gap:7px; }
body:is(:not(.hc-inline-on), .hc-page-on) .hc-threads .hc-th-t{ font-size:14px; font-weight:600; color:#1c1c1f; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
body:is(:not(.hc-inline-on), .hc-page-on) .hc-th-st{ flex:0 0 auto; font-size:10px; font-weight:600; color:#9a5b00; background:#fff3e0; border:1px solid #f3d9b3; border-radius:6px; padding:1px 6px; white-space:nowrap; }
body:is(:not(.hc-inline-on), .hc-page-on) .hc-th-tm{ margin-left:auto; flex:0 0 auto; font-size:11px; color:#a8a4b0; }
body:is(:not(.hc-inline-on), .hc-page-on) .hc-th-btm{ display:flex; align-items:center; gap:8px; }
body:is(:not(.hc-inline-on), .hc-page-on) .hc-th-pv{ flex:1 1 auto; min-width:0; font-size:12.5px; color:#8a8a90; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
body:is(:not(.hc-inline-on), .hc-page-on) .hc-th-pv--empty{ font-style:italic; color:#b3ad9f; }
body:is(:not(.hc-inline-on), .hc-page-on) .hc-threads .hc-th-badge{ flex:0 0 auto; min-width:20px; height:20px; padding:0 6px; border-radius:10px; background:#e8472b; color:#fff; font-size:11px; font-weight:700; display:flex; align-items:center; justify-content:center; }

/* ════ DEV1-MOB-KEYBOARD-SMOOTH-V1 (2026-07-02): инпут-бар плавно «приклеен» к клаве. iOS — JS transform (_v8pin, inline перебивает env). Android — env(keyboard-inset-height) при navigator.virtualKeyboard.overlaysContent=true; старый Chromium env=0 → фолбэк (interactive-widget). Панель НЕ ужимается (без вспышки). ════ */
/* #1 SPEED-V3 (2026-07-02) + K2: 🔴 ПРАВИЛО — панель ВСЕГДА inset:0 полная (шапку/окно НЕ трогаем). ANDROID: бар+лента следуют env НАПРЯМУЮ transform:translateY(-env) (КОМПОЗИТОР, БЕЗ transition — Chromium анимирует env синхронно с клавой сам; наш transition поверх = 2-я анимация = тормоз ×20). iOS (env=0, двигает JS _v8pin) — transition ТОЛЬКО там (html.otc-ios), события дискретные. Шапка (z-index:5, solid) кроет верх сдвинутой ленты. */
body:is(:not(.hc-inline-on), .hc-page-on) #hc-input-row, body:is(:not(.hc-inline-on), .hc-page-on) #hc-body{ transform: translateY(calc(env(keyboard-inset-height, 0px) * -1)); }
html.otc-ios body:is(:not(.hc-inline-on), .hc-page-on) #hc-input-row, html.otc-ios body:is(:not(.hc-inline-on), .hc-page-on) #hc-body{ transition: transform .25s cubic-bezier(.25,.1,.25,1); }
body:is(:not(.hc-inline-on), .hc-page-on) #hc-body{ min-height: 0; }

/* ════ DEV1-CHAT-AI-SHELL-V1 (2026-07-03): чат = оконная дисциплина ИИ. 🔴 БЕЗ БЭКДРОПА НА МОБЕ ВООБЩЕ — свой .hc-backdrop убираем из раскладки (нет элемента → нечему ловить тап у края / ghost-click; EDGE-V4 гейтил клик, но элемент оставался за панелью на дробном DPR). Панель inset:0 непрозрачная кроет всё; закрытие ТОЛЬКО ✕ + системный back (KBD-V3 history, одно чистое без переоткрытия); fab display:none. Десктоп-бэкдроп (клик-закрытие) НЕ трогаем. ════ */
@media (max-width: 760px) {
  body:is(:not(.hc-inline-on), .hc-page-on) #h-chat-backdrop { display: none !important; pointer-events: none !important; }
}

/* ═══ DEV1-CHAT-TYPO-META-V1 (замер PM 04.07): мета-тексты чата ниже порога читаемости. ТОЛЬКО МОБ ≤760 —
   классы общие с десктопом, там размеры свои (не задеваем). Блок в конце файла = каскад-победа. ═══ */
@media (max-width:760px){
  .hc-msg-tm{ font-size:11px; }                                   /* время сообщений 9.5→11 */
  .hc-aud-t{ font-size:11px; min-width:30px; }                    /* таймер голосового 9.5→11 */
  body:is(:not(.hc-inline-on), .hc-page-on) .hc-th-st{ font-size:11px; }            /* статус треда 10→11 */
  .hc-chip{ font-size:11.5px; }                                   /* чип дня 10.5→11.5 */
  body:is(:not(.hc-inline-on), .hc-page-on) .hc-th-tm{ font-size:11px; }            /* время треда — выровнено с мета (11) */
  /* play голосового: ХИТ-ЗОНА 34→40, ВИД И LAYOUT 1:1 — видимый круг остаётся 34 (background-clip:padding-box),
     прозрачный бордер добирает зону, margin:-3px компенсирует габарит в строке (wave не сдвигается) */
  .hc-aud-play{ width:40px; height:40px; border:3px solid transparent; background-clip:padding-box; margin:-3px; }
}

/* ═══ DEV1-CHAT-TYPO-META-V1 ДОХВАТ (замер PM 04.07): хит-зоны 40×40 приёмом play (вид/layout 1:1 —
   прозрачный бордер + background-clip:padding-box + отрицательный margin) + кегли. ТОЛЬКО МОБ ≤760. ═══ */
@media (max-width:760px){
  /* инпут-бар: эмодзи/скрепка/камера 32→40 (фон прозрачный — вид не меняется), margin −4 держит layout строки */
  #hc-emoji-btn, #hc-attach, #hc-camera{ width:40px; height:40px; margin:-4px; }
  /* ☰ тредов: 34×40 → 40×40 (высота была 40) */
  body:is(:not(.hc-inline-on), .hc-page-on) .hc-threads-btn{ width:40px !important; }
  /* ✕ шторки тредов 34→40: видимый квадрат #f4f4f6 остаётся 34 (padding-box), хит 40, посадка та же */
  body:is(:not(.hc-inline-on), .hc-page-on) .hc-th-hd-x{ width:40px; height:40px; border:3px solid transparent; background-clip:padding-box; margin:-3px; }
  /* «Показать раньше» h34→40 (кнопка стилизована инлайн в JS → !important) */
  #hcHistMore{ min-height:40px !important; }
  /* полоса заявки: хит-строка h29→≥40 */
  .hc-ordbar{ min-height:40px; box-sizing:border-box; }
  /* кегли */
  .hc-att-file .hc-fs{ font-size:11px; }                                   /* размер файла 10→11 */
  .hc-panel span.s{ font-size:11px !important; }                           /* PM-замер «span.s 9.8» — класса в коде чата НЕТ; страховочный селектор зоны панели (нужен DOM-путь от PM, см. COMMS) */
}

/* DEV1-CHAT-NEWMSG-TAP: плашка «↓ Новое сообщение» — хит-зона h33→40 (моб; inline-flex центрует, вид почти прежний) */
@media (max-width:760px){
  .hc-newmsg{ min-height:40px; box-sizing:border-box; }
}


/* ═══ DEV1-CHAT-PAGE-MODE-V2 ЧАСТЬ A: PAGE-режим витрины (моб) — панель В ПОТОКЕ на весь вьюпорт,
   те же inline-правила hc-inline-on (эталон кабинета); ✕ ВИДЕН (в page это выход из чата);
   высота = вьюпорт минус таб-бар (инпут-бар над таб-баром, как в кабинете). ═══ */
@media (max-width:760px){
  #hc-page-wrap{ display:none; }
  body.hc-page-on #hc-page-wrap{ display:block; background:#fff; }
  body.hc-page-on #h-chat-panel{ height:100svh !important; height:100dvh !important; border-radius:0 !important; width:100vw !important; max-width:100vw !important; }  /* LOOK-V4: БЕЗ overflow-x:hidden — клип замораживал композитный транзишн шторки (Chromium: слой вне клипа не тикает) */
  body.hc-page-on .hc-head-x{ display:flex !important; }
}



/* === DEV1-CHAT-PAGE-LOOK-V4: page-режим = СТАРЫЙ ВИТРИННЫЙ вид (лента на всю ширину, треды — шторка ☰,
   таб-бар скрыт пока чат открыт). Механика page (клава/края/back) не тронута. === */
@media (max-width:760px){
  body.hc-page-on .otc-tabbar{ display:none !important; }
  body.hc-page-on .hc-conv{ width:100% !important; }
}

/* === DEV1-AI-PAGE-MODE-B: ИИ в page-режиме (моб) — панель в ПОТОКЕ, без transform/visibility-гейтов оверлея.
   Специфичность body.ai-page-on #h-ai-drawer (1,1,1) бьёт #h-ai-drawer:not([data-open]) (1,1,0). === */
@media (max-width:760px){
  #ai-page-wrap{ display:none; }
  body.ai-page-on #ai-page-wrap{ display:block; background:#fff; }
  body.ai-page-on #h-ai-drawer{ position:relative !important; inset:auto !important; transform:none !important;
    visibility:visible !important; pointer-events:auto !important; width:100% !important; max-width:none !important;
    height:100svh !important; height:100dvh !important; border-radius:0 !important; }
  body.ai-page-on #h-ai-bd{ display:none !important; }
}

/* DEV1-DESKTOP-CHAT-SCROLL-FIX-V1: десктоп-бэкдроп чата не ловит клики (закрытие ТОЛЬКО по ✕; затемнение живо) */
@media (min-width:761px){ #h-chat-backdrop{ pointer-events:none !important; } }

/* === DEV1-CHAT-AVATAR-THREADS-POLISH-V1: десктоп-шторка чатов = как моб (белая непрозрачная, «Заявка №NN»
   целиком + превью + статус; резалось до «З…» из-за 232px + rgba-фона). === */
@media (min-width:761px){
  body:is(:not(.hc-inline-on), .hc-page-on) .hc-threads{ background:#fff !important; width:300px !important; flex:0 0 300px !important; box-shadow:6px 0 30px rgba(0,0,0,.14); }
}

/* === DEV1-AI-DESKTOP-WINDOW-CHAT-V1: ЕДИНОЕ десктоп-окно — ИИ в ТОЙ ЖЕ рамке, что чат (значения премиум
   .hc-panel 1:1: центр 795x648, radius 24, стекло blur30, та же тень/анимация). Общий класс .otc-deskwin;
   моб не тронут (@min-761). Закрытие ТОЛЬКО ✕ (бэкдроп глух, анти-close гард в JS как у чата). === */
@media (min-width:761px){
  #h-ai-drawer.otc-deskwin{ position:fixed; left:50%; right:auto; top:50%; bottom:auto; width:795px; max-width:calc(100vw - 32px);
    height:648px; max-height:calc(100dvh - 40px); border-radius:24px; z-index:8200;
    background:linear-gradient(180deg,rgba(255,255,255,.6) 0%,rgba(255,255,255,0) 22%,rgba(255,255,255,0) 78%,rgba(255,255,255,.4) 100%),rgba(255,255,255,.74);
    -webkit-backdrop-filter:blur(30px) saturate(170%); backdrop-filter:blur(30px) saturate(170%);
    border:1px solid rgba(255,255,255,.7); box-shadow:0 30px 72px rgba(20,20,30,.28);
    overflow:hidden; display:flex; flex-direction:column;
    transform-origin:center; transform:translate(-50%,-50%) scale(.97); opacity:0; pointer-events:none;
    transition:transform .34s cubic-bezier(.22,1,.36,1), opacity .26s ease; }
  #h-ai-drawer.otc-deskwin:not([data-open]){ visibility:hidden; }
  #h-ai-drawer.otc-deskwin[data-open]{ visibility:visible; transform:translate(-50%,-50%) scale(1); opacity:1; pointer-events:auto; }
  @supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))){ #h-ai-drawer.otc-deskwin{ background:#fff; } }
  #h-ai-bd{ pointer-events:none !important; }
  #h-ai-drawer .ai-acc-row{ display:grid; grid-template-columns:repeat(auto-fill,minmax(230px,1fr)); gap:10px; }
  /* нижний бар в широком окне: колонка Gemini на всю ширину (поле сверху, ряд [+ ... 🎤] снизу) */
  #h-ai-drawer .dh-ai-input-row{ display:flex; flex-direction:column; gap:6px; width:auto; padding:12px 16px 14px; background:#fff; border-radius:0; box-shadow:0 -5px 18px rgba(0,0,0,.06); }
  #h-ai-drawer .dh-ai-input-row #ai-input{ width:100%; max-width:none; border:0; background:transparent; box-shadow:none; outline:none; padding:0; margin:0 0 10px; }
  #h-ai-drawer .dh-ai-input-btns{ display:flex; align-items:center; width:100%; }
  #h-ai-drawer .ai-inbar__right{ margin-left:auto; display:flex; gap:8px; }
}

/* DEV1-CHAT-X-UNIFY-V1 п.1: десктоп-«Чаты» — компактный заголовок (~30px, 13.5/500), ✕ панели УБРАН (список — часть окна) */
@media (min-width:761px){
  body:is(:not(.hc-inline-on), .hc-page-on) .hc-threads .hc-th-hd{ padding:6px 12px !important; min-height:30px; }
  body:is(:not(.hc-inline-on), .hc-page-on) .hc-threads .hc-th-hd-t{ font-size:13.5px !important; font-weight:500 !important; }
  body:is(:not(.hc-inline-on), .hc-page-on) .hc-threads .hc-th-hd-x{ display:none !important; }
}

/* DEV1-AI-CLOSE-TRAP-V1: тачпад-жест «назад» (deltaX) над ИИ-окном НЕ уводит браузер в history-back —
   главный кандидат «закрытия от скролла» на десктопе (то же для чат-окна). */
@media (min-width:761px){
  #h-ai-drawer, #ai-messages, #h-chat-panel, #hc-body{ overscroll-behavior-x:none; overscroll-behavior-y:contain; }
}
