:root{
  --bg:#FFF8F4;
  --card:#FFFDFB;
  --card2:#FBE9DE;
  --text:#4E3429;
  --muted:#7A5C4D;
  --line:#E8D8CE;
  --line2:#DDC8BC;
  --brand:#F3C6AC;
  --brand2:#D9A98D;
  --blue:#BE7F61;
  --danger:#C65A4B;
  --shadow:0 14px 32px rgba(111,69,52,.10);
  --shadow2:0 8px 18px rgba(111,69,52,.08);
  --r:16px;
  --r2:12px;
  --font: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, "Noto Sans", "Liberation Sans", sans-serif;
}
*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family:var(--font);
  color:var(--text);
  background:
    radial-gradient(1200px 650px at 10% -10%, rgba(65,105,225,.14), transparent 55%),
    radial-gradient(900px 500px at 90% 0%, rgba(39,79,199,.10), transparent 52%),
    var(--bg);
}

a{color:inherit}
.muted{color:var(--muted)}
.row{display:flex;gap:10px}
.badge{
  display:inline-flex;align-items:center;gap:6px;
  font-size:12px;font-weight:700;
  padding:6px 10px;border-radius:999px;
  border:1px solid var(--line2);
  background:linear-gradient(180deg,#fff,#FBE9DE);
  color:var(--muted);
}
.kbd{
  font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono",monospace;
  font-size:12px;color:var(--muted);
  padding:2px 8px;border:1px solid var(--line2);border-radius:10px;background:#fff;
}

.btn{
  display:inline-flex;align-items:center;justify-content:center;
  gap:8px;
  height:38px;
  padding:0 12px;
  border-radius:12px;
  border:1px solid var(--line2);
  background:linear-gradient(180deg,#fff,var(--card2));
  box-shadow:var(--shadow2);
  cursor:pointer;
  text-decoration:none;
  font-weight:800;
  font-size:13px;
}
.btn:hover{border-color:#cfd8e7}
.btn.primary{
  border-color:rgba(65,105,225,.28);
  background:linear-gradient(180deg,rgba(65,105,225,.16),rgba(65,105,225,.08));
  color:#16306f;
}
.btn.blue{
  border-color:rgba(39,79,199,.28);
  background:linear-gradient(180deg,rgba(39,79,199,.16),rgba(39,79,199,.08));
  color:#16306f;
}
.btn.danger{
  border-color:rgba(198,90,75,.28);
  background:linear-gradient(180deg,rgba(198,90,75,.12),rgba(198,90,75,.06));
  color:#8B2F25;
}

.input, textarea{
  width:100%;
  border:1px solid var(--line2);
  background:#fff;
  border-radius:12px;
  padding:10px 12px;
  outline:none;
  font:inherit;
}
.input:focus, textarea:focus{
  border-color:rgba(65,105,225,.35);
  box-shadow:0 0 0 4px rgba(65,105,225,.12);
}

.topbar{
  position:sticky;top:0;z-index:50;
  background:rgba(245,247,251,.85);
  backdrop-filter:blur(10px);
  border-bottom:1px solid var(--line);
}
.topbar-inner{
  max-width:1520px;margin:0 auto;
  padding:10px 14px;
  display:flex;align-items:center;justify-content:space-between;gap:14px;
}
.brand{
  display:flex;align-items:center;gap:10px;
  font-weight:1000;letter-spacing:.2px;
}
.logo{
  width:34px;height:34px;border-radius:10px;
  background:
    radial-gradient(16px 16px at 30% 30%, rgba(255,255,255,.85), transparent 60%),
    radial-gradient(14px 14px at 70% 70%, rgba(255,255,255,.5), transparent 65%),
    linear-gradient(135deg,var(--brand),var(--brand2));
  box-shadow: 0 10px 20px rgba(65,105,225,.18);
  border:1px solid rgba(65,105,225,.25);
}
.brand small{display:block;color:var(--muted);font-weight:800;font-size:12px;margin-top:1px}

.nav{
  display:flex;gap:8px;flex-wrap:wrap;align-items:center;
}
.nav a{
  text-decoration:none;
  padding:8px 10px;
  border-radius:12px;
  border:1px solid transparent;
  font-weight:900;font-size:13px;
  color:var(--muted);
}
.nav a:hover{border-color:var(--line2);background:#fff;color:var(--text)}
.nav a.active{
  color:var(--text);
  border-color:rgba(65,105,225,.25);
  background:linear-gradient(180deg,rgba(65,105,225,.12),rgba(65,105,225,.05));
}

.layout{
  max-width:1520px;
  margin:0 auto;
  padding:14px;
}
.grid{
  display:grid;
  grid-template-columns: 330px minmax(620px, 1fr) 360px;
  gap:14px;
}
@media (max-width:1200px){
  .grid{grid-template-columns: 320px 1fr; grid-template-areas:"left main" "right right";}
  .left{grid-area:left}
  .main{grid-area:main}
  .right{grid-area:right}
}
@media (max-width:900px){
  .grid{grid-template-columns: 1fr; grid-template-areas:"left" "main" "right";}
}

.card{
  background:linear-gradient(180deg,#fff,var(--card2));
  border:1px solid var(--line);
  border-radius:var(--r);
  box-shadow:var(--shadow);
  overflow:hidden;
}
.card .hd{
  padding:12px 14px;
  border-bottom:1px solid var(--line);
  display:flex;align-items:center;justify-content:space-between;gap:10px;
}
.card .hd h3{
  margin:0;
  font-size:13px;
  letter-spacing:.5px;
  text-transform:uppercase;
  color:var(--muted);
  font-weight:1000;
}
.card .bd{padding:12px 14px}

.item{
  display:flex;align-items:flex-start;justify-content:space-between;gap:10px;
  padding:10px 10px;border-radius:14px;
  border:1px solid var(--line);
  background:#fff;
}
.item:hover{border-color:#cfd8e7;background:var(--card2)}
.item .t{margin:0;font-weight:1000;font-size:14px}
.item .s{margin:4px 0 0;color:var(--muted);font-size:12px}
.item .meta{display:flex;flex-direction:column;align-items:flex-end;gap:6px}

.pill{
  display:inline-flex;align-items:center;gap:6px;
  padding:6px 10px;border-radius:999px;
  border:1px solid rgba(65,105,225,.22);
  background:rgba(65,105,225,.10);
  color:#1b3f9a;
  font-weight:900;font-size:12px;
}
.timer{
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size:12px;
  color:var(--muted);
  border:1px solid var(--line2);
  background:#fff;
  padding:4px 8px;
  border-radius:12px;
}

.footer{
  max-width:1520px;margin:10px auto 18px;padding:0 14px;
  display:flex;justify-content:space-between;gap:10px;
  color:var(--muted);font-size:12px;
}
.footer a{color:var(--muted);text-decoration:none}
.footer a:hover{color:var(--text)}

/* CHAT_AGENT_STYLE */
.msg-out .msg-header, .msg-out .sender-name { color: #0b5ed7 !important; font-weight: 600; }
.msg-in  .msg-header, .msg-in  .sender-name { color: #198754 !important; font-weight: 600; }

/* SENDER_STYLE_V1 */
p.s, p.t { font-weight: 800; font-size: 1.05rem; }
p.s.s-agent { color:#0b5ed7 !important; }   /* atendente */
p.t { color:#198754 !important; }           /* cliente (lista/inbox) */



/* CHAT_CENTER_NAME_V2 (ajuste fino)
   - Centro: aumentar nome nas bolhas
   - Esquerda/direita: não inflar demais (mantém menor)
*/
.thread .msg .s,
.thread .bubble .s,
.chat .msg .s,
.chat .bubble .s{
  font-weight: 800 !important;
  font-size: 1.12rem !important; /* + centro */
  line-height: 1.15 !important;
}

/* cores diferentes no centro */
.thread .msg .s.s-agent,
.thread .bubble .s.s-agent,
.chat .msg .s.s-agent,
.chat .bubble .s.s-agent{
  color:#0b5ed7 !important;
}
.thread .msg .s:not(.s-agent),
.thread .bubble .s:not(.s-agent),
.chat .msg .s:not(.s-agent),
.chat .bubble .s:not(.s-agent){
  color:#198754 !important;
}

/* quadros laterais: reduzir um pouco (participantes/lista) */
.sidebar .s,
.participants .s,
.left-pane .s,
.right-pane .s,
.list .s{
  font-size: 0.98rem !important;
  font-weight: 700 !important;
}

/* QM_MODAL_FIX_V1 */
.modal{ z-index: 2055 !important; }
.modal-backdrop{ z-index: 2040 !important; opacity:.55 !important; }
.modal-dialog{ pointer-events:auto !important; }

/* FR_PANEL_V1 */
.fr-panel{
  position: absolute;
  right: 12px;
  bottom: 56px;
  width: 360px;
  max-width: calc(100vw - 24px);
  max-height: 55vh;
  background: #fff;
  border: 1px solid rgba(0,0,0,.12);
  border-radius: 14px;
  box-shadow: 0 12px 34px rgba(0,0,0,.18);
  z-index: 9999;
  display: none;
  overflow: hidden;
}
.fr-panel.show{ display:block; }
.fr-panel .fr-head{
  display:flex; align-items:center; justify-content:space-between;
  padding:10px 12px;
  border-bottom:1px solid rgba(0,0,0,.08);
  font-weight:700;
}
.fr-panel .fr-body{ padding:10px 12px; overflow:auto; max-height: calc(55vh - 44px); }
.fr-panel input.fr-q{
  width:100%; padding:10px 12px; border-radius:12px;
  border:1px solid rgba(0,0,0,.14); outline:none;
}
.fr-panel .fr-item{
  padding:10px 12px; border-radius:12px; cursor:pointer;
  border:1px solid rgba(0,0,0,.06); margin-top:10px;
}
.fr-panel .fr-item:hover{ border-color: rgba(0,0,0,.18); }
.fr-panel .fr-title{ font-weight:700; margin-bottom:4px; }
.fr-panel .fr-text{ font-size: 14px; opacity:.85; white-space:pre-wrap; }
.fr-panel .fr-hint{ font-size: 13px; opacity:.8; margin-top:10px; }
.fr-btn{ position: relative; }

/* FR_PANEL_V2 */
.fr2-btn-fixed{
  position: fixed;
  right: 14px;
  bottom: 78px;
  z-index: 99999;
  border-radius: 999px;
  padding: 8px 12px;
  border: 1px solid rgba(0,0,0,.12);
  background: #fff;
  box-shadow: 0 10px 24px rgba(0,0,0,.18);
  font-weight: 700;
}
.fr2-panel{
  position: fixed;
  right: 14px;
  bottom: 126px;
  width: 380px;
  max-width: calc(100vw - 28px);
  max-height: 55vh;
  background: #fff;
  border: 1px solid rgba(0,0,0,.12);
  border-radius: 14px;
  box-shadow: 0 14px 38px rgba(0,0,0,.22);
  z-index: 999999;
  display: none;
  overflow: hidden;
}
.fr2-panel.show{ display:block; }
.fr2-head{
  display:flex; align-items:center; justify-content:space-between;
  padding:10px 12px;
  border-bottom:1px solid rgba(0,0,0,.08);
  font-weight:800;
}
.fr2-body{ padding:10px 12px; overflow:auto; max-height: calc(55vh - 44px); }
.fr2-q{
  width:100%; padding:10px 12px; border-radius:12px;
  border:1px solid rgba(0,0,0,.14); outline:none;
}
.fr2-item{
  padding:10px 12px; border-radius:12px; cursor:pointer;
  border:1px solid rgba(0,0,0,.06); margin-top:10px;
}
.fr2-item:hover{ border-color: rgba(0,0,0,.18); }
.fr2-title{ font-weight:800; margin-bottom:4px; }
.fr2-text{ font-size:14px; opacity:.85; white-space:pre-wrap; }
.fr2-hint{ font-size:13px; opacity:.8; margin-top:10px; }
