/* Headora.ai — виджет «Ассистент Headora»: плавающая кнопка + панель чата (десктоп) / нижний лист (мобильные). */
.hda-fab{position:fixed;right:20px;bottom:calc(20px + env(safe-area-inset-bottom,0px));z-index:65;display:inline-flex;align-items:center;gap:10px;height:52px;padding:0 20px 0 14px;border-radius:999px;border:1px solid var(--line-2);background:var(--surface-solid);color:var(--text);font:600 15px/1 var(--f-body);cursor:pointer;box-shadow:var(--shadow-lg);transition:transform .2s,border-color .2s,bottom .25s}
.hda-fab:hover{border-color:var(--accent)}
.hda-fab:active{transform:scale(.97)}
.hda-fab .hda-mark{display:grid;place-items:center;width:30px;height:30px;border-radius:50%;background:var(--accent);color:var(--on-accent)}
.hda-fab .hda-mark svg{width:18px;height:18px}
.hda-fab[hidden]{display:none}
/* Подсказка о языке (lang.js) тоже живёт внизу — поднимаем кнопку, чтобы они не перекрывались */
body:has(.lang-hint) .hda-fab{bottom:calc(96px + env(safe-area-inset-bottom,0px))}

.hda-backdrop{position:fixed;inset:0;z-index:79;background:rgba(20,19,17,.32);opacity:0;transition:opacity .2s}
.hda-backdrop.on{opacity:1}

.hda-panel{position:fixed;right:20px;bottom:calc(20px + env(safe-area-inset-bottom,0px));z-index:80;display:flex;flex-direction:column;width:380px;height:min(560px,calc(100vh - 110px));height:min(560px,calc(100dvh - 110px));border-radius:22px;border:1px solid var(--line-2);background:var(--bg);color:var(--text);box-shadow:var(--shadow-lg);overflow:hidden;font:400 15px/1.5 var(--f-body);transform-origin:bottom right;animation:hda-in .22s cubic-bezier(.2,.8,.2,1)}
@keyframes hda-in{from{opacity:0;transform:translateY(10px) scale(.98)}to{opacity:1;transform:none}}
.hda-panel[hidden]{display:none}

.hda-head{flex:none;display:flex;align-items:center;gap:10px;padding:14px 12px 12px 16px;border-bottom:1px solid var(--line);background:var(--surface-solid)}
.hda-head .hda-mark{flex:none;display:grid;place-items:center;width:32px;height:32px;border-radius:50%;background:var(--accent-soft);color:var(--accent)}
.hda-head .hda-mark svg{width:18px;height:18px}
.hda-ttl{flex:1;min-width:0;display:grid;gap:2px}
.hda-ttl b{font:600 15px/1.2 var(--f-body)}
.hda-ttl small{font-size:12px;line-height:1.2;color:var(--dim);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.hda-ib{flex:none;display:grid;place-items:center;width:34px;height:34px;border:0;border-radius:50%;background:transparent;color:var(--muted);cursor:pointer;transition:background .2s,color .2s}
.hda-ib:hover{background:var(--surface-2);color:var(--text)}
.hda-ib svg{width:18px;height:18px}
.hda-ib[hidden]{display:none}

.hda-log{flex:1;overflow-y:auto;overscroll-behavior:contain;padding:16px 14px 8px;display:flex;flex-direction:column;gap:10px;scrollbar-width:thin}
.hda-msg{max-width:88%;padding:10px 14px;border-radius:18px;font-size:14.5px;line-height:1.5;overflow-wrap:anywhere}
.hda-msg.u{align-self:flex-end;background:#EAE6DC;white-space:pre-wrap}
.hda-msg.a{align-self:flex-start;background:var(--surface-2)}
.hda-msg.u{background:#23232B}
.hda-msg p{margin:0}
.hda-msg p+p,.hda-msg p+ul,.hda-msg ul+p{margin-top:8px}
.hda-msg ul{margin:0;padding-left:18px}
.hda-msg li+li{margin-top:3px}
.hda-msg a{color:var(--accent);text-underline-offset:3px}
.hda-msg strong{font-weight:600}

.hda-chips{display:flex;flex-wrap:wrap;gap:8px;padding:2px 0 4px}
.hda-chip{height:34px;padding:0 14px;border-radius:999px;border:1px solid var(--line-2);background:var(--surface);color:var(--text);font:500 13.5px/1 var(--f-body);cursor:pointer;transition:border-color .2s,background .2s}
.hda-chip:hover{border-color:var(--accent);background:var(--accent-soft)}

.hda-typing{align-self:flex-start;display:inline-flex;gap:5px;padding:14px 16px;border-radius:18px;background:var(--surface-2)}
.hda-typing i{width:6px;height:6px;border-radius:50%;background:var(--muted);animation:hda-blink 1s infinite}
.hda-typing i:nth-child(2){animation-delay:.15s}.hda-typing i:nth-child(3){animation-delay:.3s}
@keyframes hda-blink{0%,100%{opacity:.25}50%{opacity:1}}

.hda-err{align-self:stretch;display:grid;gap:10px;padding:12px 14px;border-radius:14px;border:1px solid color-mix(in srgb,var(--danger) 35%,transparent);background:color-mix(in srgb,var(--danger) 7%,transparent);font-size:14px;line-height:1.45}
.hda-err a{color:var(--accent)}
.hda-err button{justify-self:start;height:32px;padding:0 14px;border-radius:999px;border:1px solid var(--line-2);background:var(--surface);color:var(--text);font:500 13px/1 var(--f-body);cursor:pointer}
.hda-err button:hover{border-color:var(--accent)}

.hda-form{flex:none;margin:8px 10px 0;padding:8px 8px 8px 14px;display:flex;align-items:flex-end;gap:8px;border-radius:22px;border:1px solid var(--line-2);background:var(--surface-solid);box-shadow:var(--shadow);transition:border-color .2s}
.hda-form:focus-within{border-color:var(--accent)}
.hda-form textarea{flex:1;min-width:0;min-height:36px;max-height:132px;padding:8px 0;border:0;background:transparent;color:var(--text);font:400 15px/1.35 var(--f-body);resize:none;outline:none}
.hda-form textarea::placeholder{color:var(--dim)}
.hda-send{flex:none;display:grid;place-items:center;width:36px;height:36px;border:0;border-radius:50%;background:var(--accent);color:var(--on-accent);cursor:pointer;transition:opacity .2s}
.hda-send:disabled{opacity:.35;cursor:default}
.hda-send svg{width:16px;height:16px}
.hda-foot{flex:none;padding:6px 16px 10px;font-size:11.5px;line-height:1.3;color:var(--dim);text-align:center}

/* Мобильные: круглая кнопка и нижний лист на 85% высоты */
@media (max-width:640px){
  .hda-fab{right:16px;bottom:calc(16px + env(safe-area-inset-bottom,0px));width:56px;height:56px;padding:0;justify-content:center}
  .hda-fab .hda-lbl{display:none}
  .hda-fab .hda-mark{width:36px;height:36px}
  .hda-fab .hda-mark svg{width:22px;height:22px}
  .hda-panel{left:0;right:0;bottom:0;width:auto;height:85vh;height:85dvh;border-radius:22px 22px 0 0;border-bottom:0;padding-bottom:env(safe-area-inset-bottom,0px);transform-origin:bottom center;animation-name:hda-up}
  .hda-form textarea{font-size:16px}
  html.hda-lock,html.hda-lock body{overflow:hidden}
}
@keyframes hda-up{from{transform:translateY(24px);opacity:.6}to{transform:none;opacity:1}}
@media (prefers-reduced-motion:reduce){.hda-panel{animation:none}}
/* Плавающая кнопка не должна закрывать ссылки подвала в самом низу страницы */
.ftr{padding-bottom:calc(96px + env(safe-area-inset-bottom,0px))}
