#apb-root{--ink:#12202b;--steel:#2e5a78;--mist:#eef2f5;--line:#d5dde3;--brass:#e0a526;--ok:#1e7a46;--warn:#9a6a00;--bad:#a33;font:15px/1.45 system-ui,-apple-system,"Segoe UI",Roboto,Arial,sans-serif;color:var(--ink)}
#apb-root *{box-sizing:border-box}
#apb-root button,#apb-root a{text-transform:none;letter-spacing:normal;min-height:0;box-shadow:none;text-shadow:none;margin:0}
#apb-root button{-webkit-appearance:none;appearance:none;line-height:1.2;font-weight:500}
#apb-root input,#apb-root select,#apb-root textarea{text-transform:none;letter-spacing:normal;min-height:0;box-shadow:none}

#apb-launch{position:fixed;right:18px;bottom:var(--apb-dlift,1cm);z-index:99998;display:flex;align-items:center;gap:10px;height:58px;padding:0 20px 0 7px;border-radius:999px;border:0;border-bottom:3px solid var(--brass);cursor:pointer;background:var(--ink);color:#fff;font:inherit;box-shadow:0 6px 18px rgba(18,32,43,.35)}
#apb-launch svg{width:44px;height:44px;flex:none;display:block}
#apb-launch .apb-lt{text-align:left;line-height:1.2}
#apb-launch .apb-lt b{display:block;font-size:15.5px}
#apb-launch .apb-lt small{display:block;font-size:12px;color:#c4cdd4}
#apb-launch:hover .apb-cage,#apb-root.apb-busy .apb-cage{animation:apb-spin 2.4s linear infinite;transform-origin:32px 32px}
@keyframes apb-spin{to{transform:rotate(360deg)}}
#apb-root button:focus-visible,#apb-root input:focus-visible,#apb-root select:focus-visible,#apb-root textarea:focus-visible,#apb-root a:focus-visible{outline:3px solid var(--brass);outline-offset:2px}

#apb-panel{position:fixed;right:18px;bottom:calc(var(--apb-dlift,1cm) + 72px);z-index:99999;width:400px;max-width:calc(100vw - 24px);height:600px;max-height:calc(100vh - var(--apb-dlift,1cm) - 90px);display:none;flex-direction:column;background:#fff;border:1px solid var(--line);border-radius:14px;overflow:hidden;box-shadow:0 14px 40px rgba(18,32,43,.28)}
#apb-root.apb-open #apb-panel{display:flex}
#apb-root.apb-left #apb-launch{right:auto;left:18px}
#apb-root.apb-left #apb-panel{right:auto;left:18px}
#apb-head{background:var(--ink);color:#fff;padding:12px 16px;display:flex;align-items:center;justify-content:space-between;border-bottom:3px solid var(--brass)}
#apb-head b{font-size:16px}
#apb-head small{display:block;color:#aebdc8;font-size:12.5px}
#apb-close{background:none;border:0;color:#fff;font-size:26px;line-height:1;cursor:pointer;padding:4px 8px}
#apb-log{flex:1;overflow-y:auto;padding:12px;background:var(--mist);display:flex;flex-direction:column;gap:9px}
#apb-root .apb-m{max-width:88%;padding:9px 12px;border-radius:12px;white-space:pre-wrap;word-wrap:break-word}
#apb-root .apb-b{background:#fff;border:1px solid var(--line);border-bottom-left-radius:3px;align-self:flex-start}
#apb-root .apb-u{background:var(--steel);color:#fff;border-bottom-right-radius:3px;align-self:flex-end}
#apb-root .apb-chips{display:flex;flex-wrap:wrap;gap:6px;align-self:flex-start}
#apb-root .apb-chips button,#apb-root .apb-links a,#apb-root .apb-btn{font:inherit;font-size:14px;padding:7px 11px;border-radius:999px;border:1px solid var(--steel);background:#fff;color:var(--steel);cursor:pointer;text-decoration:none;display:inline-block}
#apb-root .apb-chips button:hover,#apb-root .apb-links a:hover,#apb-root .apb-btn:hover{background:var(--steel);color:#fff}
#apb-root .apb-links{display:flex;flex-wrap:wrap;gap:6px;align-self:flex-start}
#apb-bar{display:flex;gap:6px;padding:6px 10px;background:#fff;border-top:1px solid var(--line)}
#apb-bar button{font:inherit;font-size:13.5px;padding:5px 11px;border-radius:999px;border:1px solid var(--line);background:var(--mist);color:var(--ink);cursor:pointer}
#apb-bar button:hover:not(:disabled){border-color:var(--steel);color:var(--steel)}
#apb-bar button:disabled{opacity:.4;cursor:default}
#apb-form{display:flex;gap:8px;padding:10px;border-top:1px solid var(--line);background:#fff}
#apb-in{flex:1;font:inherit;padding:10px 12px;border:1px solid var(--line);border-radius:999px;min-width:0}
#apb-send{font:inherit;font-weight:600;border:0;border-radius:999px;padding:0 16px;background:var(--ink);color:#fff;cursor:pointer}

/* карточки товаров */
#apb-root .apb-res{align-self:stretch;display:flex;flex-direction:column;gap:8px}
#apb-root .apb-h{font-weight:600;font-size:14px;margin:4px 0 0}
#apb-root .apb-card{display:flex;gap:10px;background:#fff;border:1px solid var(--line);border-left:3px solid var(--line);border-radius:10px;padding:8px}
#apb-root .apb-card.apb-confirmed{border-left-color:var(--ok)}
#apb-root .apb-card.apb-possible{border-left-color:var(--brass)}
#apb-root .apb-img{width:56px;height:56px;object-fit:contain;flex:none;background:var(--mist);border-radius:6px}
#apb-root .apb-cb{min-width:0;flex:1}
#apb-root .apb-name{color:var(--steel);font-weight:600;text-decoration:none;word-break:break-word}
#apb-root .apb-meta{font-size:12.5px;color:#5b6b78;margin-top:1px}
#apb-root .apb-price{font-weight:600;margin-top:2px}
#apb-root .apb-stock{font-size:13px;margin-top:1px}
#apb-root .apb-s0{color:var(--ok)}#apb-root .apb-s1{color:var(--warn)}#apb-root .apb-s2{color:var(--bad)}
#apb-root .apb-badge{display:inline-block;font-size:12px;padding:1px 8px;border-radius:999px;margin-top:3px}
#apb-root .apb-confirmed .apb-badge{background:#e4f3ea;color:var(--ok)}
#apb-root .apb-possible .apb-badge{background:#fff3d6;color:var(--warn)}
#apb-root .apb-reason{font-size:12.5px;color:#5b6b78;margin-top:2px}
#apb-root .apb-btns{display:flex;flex-wrap:wrap;gap:5px;margin-top:6px}
#apb-root .apb-btns .apb-btn{font-size:12.5px;padding:4px 9px}
#apb-root .apb-sort{display:flex;gap:5px;flex-wrap:wrap;align-items:center;font-size:13px}
#apb-root .apb-sort button{font:inherit;font-size:12.5px;padding:3px 9px;border-radius:999px;border:1px solid var(--line);background:#fff;cursor:pointer}
#apb-root .apb-sort button.apb-on{background:var(--ink);color:#fff;border-color:var(--ink)}

/* формы */
#apb-root .apb-fc{align-self:stretch;background:#fff;border:1px solid var(--line);border-radius:12px;padding:12px;display:flex;flex-direction:column;gap:8px}
#apb-root .apb-fc input,#apb-root .apb-fc select,#apb-root .apb-fc textarea{font:inherit;padding:9px 10px;border:1px solid var(--line);border-radius:8px;width:100%;min-width:0;background:#fff;color:var(--ink)}
#apb-root .apb-fc label{font-size:13px;color:#4b5a66}
#apb-root .apb-row{display:flex;gap:6px}
#apb-root .apb-row>*{flex:1}
#apb-root .apb-fc button[type=submit]{font:inherit;font-weight:600;padding:10px;border:0;border-radius:8px;background:var(--brass);color:var(--ink);cursor:pointer}
#apb-root .apb-fc small{color:#5b6b78;font-size:12.5px}
#apb-root .apb-fc .apb-chk{display:flex;gap:8px;align-items:flex-start;font-size:13px}
#apb-root .apb-fc .apb-chk input{width:auto;margin-top:3px}
#apb-root .apb-hp{position:absolute!important;left:-9999px!important;height:0;overflow:hidden}
#apb-root .apb-seg{display:flex;gap:6px}
#apb-root .apb-seg button{font:inherit;font-size:13px;padding:5px 12px;border-radius:999px;border:1px solid var(--line);background:#fff;cursor:pointer}
#apb-root .apb-seg button.apb-on{background:var(--ink);color:#fff;border-color:var(--ink)}
#apb-root .apb-line{display:flex;gap:6px;align-items:center;font-size:13.5px}
#apb-root .apb-line span{flex:1;min-width:0;word-break:break-word}
#apb-root .apb-line input{width:78px;flex:none}
#apb-root .apb-line button{border:0;background:none;color:var(--bad);font-size:18px;cursor:pointer}

/* таблица результатов Excel */
#apb-root .apb-tw{align-self:stretch;overflow-x:auto;background:#fff;border:1px solid var(--line);border-radius:10px}
#apb-root .apb-t{border-collapse:collapse;font-size:12.5px;line-height:1.3;width:100%}
#apb-root .apb-t th,#apb-root .apb-t td{padding:6px 7px;text-align:left;border-bottom:1px solid var(--line);vertical-align:top}
#apb-root .apb-t th{background:var(--ink);color:#fff;white-space:nowrap}
#apb-root .apb-t a{color:var(--steel);font-weight:600;text-decoration:none}

/* чат с менеджером */
#apb-root .apb-mgr{background:#e8f1f7;border:1px solid #c7dbe9;border-bottom-left-radius:3px;align-self:flex-start}
#apb-root .apb-who{display:block;font-size:12px;color:#4b5a66;margin-bottom:1px}
#apb-root .apb-sys{align-self:center;background:none;border:0;font-size:12.5px;color:#5b6b78;text-align:center;max-width:94%}
#apb-launch.apb-unread::after{content:'';position:absolute;top:4px;right:6px;width:13px;height:13px;border-radius:50%;background:#e03131;border:2px solid #fff}
#apb-bar .apb-end{color:var(--bad);margin-left:auto}

/* компактные карточки товаров */
#apb-root .apb-res{gap:6px}
#apb-root .apb-h{font-size:13.5px;margin:2px 0 0}
#apb-root .apb-card{gap:8px;padding:6px 8px;border-radius:8px}
#apb-root .apb-img{width:44px;height:44px;border-radius:5px}
#apb-root .apb-name{display:block;font-size:14px;line-height:1.25}
#apb-root .apb-meta{font-size:12px;margin-top:1px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
#apb-root .apb-meta b{color:var(--ink);font-weight:600}
#apb-root .apb-ps{font-size:13px;margin-top:1px}
#apb-root .apb-badge{font-size:11.5px;padding:0 7px;margin-top:2px}
#apb-root .apb-reason{font-size:11.5px;margin-top:1px}
#apb-root .apb-btns{gap:4px;margin-top:4px}
#apb-root .apb-btns .apb-btn,#apb-root .apb-btns a.apb-btn{font-size:12px;padding:3px 9px;line-height:1.2}

@media (max-width:480px){
  #apb-launch{right:12px;left:auto;bottom:calc(12px + var(--apb-lift,3cm) + env(safe-area-inset-bottom,0px))}
  #apb-root.apb-left #apb-launch{left:12px;right:auto}
  #apb-panel,#apb-root.apb-left #apb-panel{left:8px;right:8px;top:8px;bottom:8px;width:auto;max-width:none;height:auto;max-height:none}
  #apb-root.apb-open #apb-launch{display:none}
}
@media (prefers-reduced-motion:reduce){#apb-launch:hover .apb-cage,#apb-root.apb-busy .apb-cage{animation:none}}
