/* CRM034 · Чат для эскалации. Append to / load after style.css. Uses its palette variables with fallbacks. */
.esc-root{font-family:inherit;color:var(--ink,#1b3028)}
.esc-root *{box-sizing:border-box;min-width:0}
.esc-root [hidden]{display:none!important}
.esc-sr{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}

.esc-launch{position:fixed;right:max(20px,env(safe-area-inset-right));bottom:max(20px,env(safe-area-inset-bottom));z-index:30;display:inline-flex;align-items:center;gap:8px;min-height:46px;max-width:calc(100vw - 28px);padding:10px 18px;border-radius:999px;border:1px solid var(--green,#245d48);background:var(--green,#245d48);color:#fff;font-weight:650;box-shadow:0 8px 24px #16302633}
.esc-launch:hover{background:#184936}
.esc-launch-icon{font-size:16px;line-height:1}
.esc-launch.esc-attn::after{content:'';width:9px;height:9px;border-radius:50%;background:#e6b450;border:2px solid #fff;margin-left:2px}

.esc-backdrop{position:fixed;inset:0;z-index:49;background:#142e244d}
.esc-panel{position:fixed;top:0;right:0;bottom:0;z-index:50;width:min(420px,100vw);height:100vh;height:100dvh;display:flex;flex-direction:column;background:var(--white,#fff);border-left:1px solid var(--line,#dce4de);box-shadow:-12px 0 40px #1630261f;overflow-x:hidden}

.esc-head{display:flex;justify-content:space-between;align-items:flex-start;gap:12px;padding:16px 18px 12px;border-bottom:1px solid var(--line,#dce4de);background:#fafbf8}
.esc-head h2{margin:0;font-size:18px}
.esc-sub{margin:2px 0 0;font-size:12px;color:var(--muted,#65736c)}
.esc-close{flex:none;width:42px;font-size:24px;line-height:1;padding:0}

.esc-body{flex:1 1 auto;overflow-y:auto;overscroll-behavior:contain;padding:14px 18px}
.esc-hint{margin:0 0 6px;font-weight:600}
.esc-muted{margin:0 0 8px;font-size:12px;color:var(--muted,#65736c)}
.esc-hist-head{display:flex;justify-content:space-between;align-items:center;gap:10px;margin-top:14px}
.esc-hist-head h3{margin:0}
.esc-refresh{padding:6px 10px}
.esc-more{width:100%;margin-top:10px}

.esc-banner{background:#fbf3e5;border:1px solid #e5d6b7;border-radius:8px;padding:12px;margin:10px 0;font-size:12px}
.esc-banner p{margin:6px 0;overflow-wrap:anywhere}
.esc-actions{display:flex;flex-wrap:wrap;gap:8px;margin-top:8px}
.esc-actions button{font-size:12px;padding:6px 12px}

.esc-list{display:grid;gap:12px;margin-top:8px}
.esc-ticket{border:1px solid var(--line,#dce4de);border-radius:10px;padding:12px;background:#fff}
.esc-t-head{display:flex;justify-content:space-between;align-items:flex-start;gap:8px}
.esc-t-head h4{margin:0;font-size:14px;overflow-wrap:anywhere}
.esc-pill{flex:none;font-size:10px;display:inline-flex;align-items:center;background:var(--green-soft,#edf5ef);color:var(--green,#245d48);padding:3px 8px;border-radius:5px}
.esc-pill.warn{background:#fbf3e5;color:var(--gold,#8c6727)}
.esc-pill.ok{background:#dcefe2;color:#184936}
.esc-note{margin:6px 0 0;font-size:12px}
.esc-meta{margin:4px 0 0;font-size:11px;color:var(--muted,#65736c);overflow-wrap:anywhere}
.esc-msgs{display:grid;gap:8px;margin-top:10px}
.esc-msg{background:#f6f8f5;border-radius:8px;padding:8px 10px}
.esc-msg.esc-staff{background:var(--green-soft,#edf5ef);border-left:3px solid var(--green,#245d48)}
.esc-msg-head{display:flex;flex-wrap:wrap;align-items:center;gap:6px;font-size:12px}
.esc-msg-head small{color:var(--muted,#65736c);font-size:10px}
.esc-msg-text{margin:4px 0 0;font-size:13px;white-space:pre-wrap;overflow-wrap:anywhere}
.esc-atts{display:flex;flex-wrap:wrap;gap:6px;margin-top:6px}
.esc-att{display:block;max-width:100%;border:1px solid var(--line,#dce4de);border-radius:6px;overflow:hidden;background:#fff}
.esc-att img{display:block;max-width:100%;max-height:200px;width:auto;height:auto;object-fit:contain}

.esc-form{flex:none;border-top:1px solid var(--line,#dce4de);padding:12px 18px calc(12px + env(safe-area-inset-bottom));background:#fafbf8;max-height:62%;overflow-y:auto}
.esc-label{margin:0 0 6px}
.esc-text{min-height:96px;max-height:35vh;width:100%;resize:vertical}
.esc-text[readonly]{background:#f1f4f0}
.esc-row{display:flex;flex-wrap:wrap;align-items:center;gap:8px;margin-top:8px}
.esc-row-meta{justify-content:space-between;margin-top:0}
.esc-count{font-size:11px;color:var(--muted,#65736c)}
.esc-cat{width:auto;min-width:130px}
.esc-send{margin-left:auto}
.esc-reply{display:flex;justify-content:space-between;align-items:center;gap:8px;background:var(--green-soft,#edf5ef);border:1px solid #c4dacb;border-radius:8px;padding:6px 10px;margin-bottom:8px;font-size:12px}
.esc-reply button{min-height:34px;padding:4px 10px}
.esc-status{margin:8px 0 0;font-size:12px;color:var(--green,#245d48);overflow-wrap:anywhere}
.esc-status:empty{display:none}
.esc-error{margin:8px 0 0;overflow-wrap:anywhere}

.esc-previews{list-style:none;margin:8px 0 0;padding:0;display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px}
.esc-preview{position:relative;border:1px solid var(--line,#dce4de);border-radius:8px;background:#fff;padding:4px;text-align:center}
.esc-preview img{display:block;width:100%;height:72px;object-fit:cover;border-radius:5px}
.esc-preview-meta{display:block;font-size:10px;color:var(--muted,#65736c);margin-top:2px}
.esc-preview-busy{display:grid;place-items:center;min-height:96px;font-size:11px;color:var(--muted,#65736c)}
.esc-rm{position:absolute;top:2px;right:2px;width:34px;min-height:34px;padding:0;border-radius:50%;font-size:18px;line-height:1;background:#fffffff0}

@media(max-width:680px){
  .esc-launch{right:max(14px,env(safe-area-inset-right));bottom:max(14px,env(safe-area-inset-bottom))}
  .esc-panel{width:100vw;border-left:0}
  .esc-backdrop{display:none}
  .esc-body,.esc-form{padding-left:14px;padding-right:14px}
  .esc-form{max-height:70%}
  .esc-text,.esc-cat{font-size:16px}
  .esc-send{flex:1 1 100%;margin-left:0}
  .esc-attach{flex:1 1 auto}
}
@media(max-width:360px){.esc-previews{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(prefers-reduced-motion:reduce){.esc-panel{animation:none}}
@media(forced-colors:active){.esc-launch,.esc-panel,.esc-ticket,.esc-banner{border:1px solid CanvasText}.esc-launch.esc-attn::after{background:Highlight}}
@media print{.esc-root{display:none}}
