/* ===== ZAPCENTER OMNI — DESIGN SYSTEM ===== */
@import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;600;700;800&family=DM+Sans:wght@300;400;500&display=swap');

:root {
  --bg:       #0a0d13;
  --bg2:      #111520;
  --bg3:      #181d2e;
  --surface:  #1c2235;
  --surface2: #232a40;
  --border:   #2a3250;
  --border2:  #333d5e;
  --text:     #e8eaf0;
  --text2:    #9ba3bf;
  --text3:    #616a8a;

  /* Canal colors */
  --wa:   #25d366;
  --wa2:  #128c4e;
  --tg:   #229ed9;
  --tg2:  #0d7ab5;
  --ms:   #0099ff;
  --ms2:  #006ab8;

  /* Semantic */
  --green:  #00e676;
  --blue:   #4f8ef7;
  --yellow: #ffd740;
  --red:    #ff5252;
  --purple: #b47bff;
  --teal:   #26d7c0;
  --orange: #ff9f43;

  --sidebar-w: 240px;
  --radius:    14px;
  --radius-sm: 8px;
  --font-head: 'Syne', sans-serif;
  --font-body: 'DM Sans', sans-serif;
  --shadow:    0 4px 24px rgba(0,0,0,.4);
}

*, *::before, *::after { box-sizing:border-box; margin:0; padding:0; }
html { font-size:15px; scroll-behavior:smooth; }
body { background:var(--bg); color:var(--text); font-family:var(--font-body); display:flex; min-height:100vh; overflow-x:hidden; }
::-webkit-scrollbar { width:5px; height:5px; }
::-webkit-scrollbar-track { background:var(--bg2); }
::-webkit-scrollbar-thumb { background:var(--border2); border-radius:10px; }

/* ── SIDEBAR ──────────────────────────────────────────────────────────────── */
.sidebar { width:var(--sidebar-w); background:var(--bg2); border-right:1px solid var(--border); display:flex; flex-direction:column; position:fixed; top:0; left:0; bottom:0; z-index:100; transition:transform .3s cubic-bezier(.4,0,.2,1); }
.sidebar.collapsed { transform:translateX(calc(-1 * var(--sidebar-w))); }

.sidebar-brand { display:flex; align-items:center; gap:10px; padding:20px 16px; border-bottom:1px solid var(--border); }
.brand-icon { width:36px; height:36px; border-radius:10px; display:flex; align-items:center; justify-content:center; flex-shrink:0; }
.brand-name { font-family:var(--font-head); font-weight:800; font-size:1.05rem; letter-spacing:-.5px; }
.brand-sub  { display:inline-block; background:var(--green); color:#000; font-family:var(--font-head); font-weight:700; font-size:.52rem; padding:1px 5px; border-radius:4px; margin-left:3px; vertical-align:middle; }

/* Canal status strip */
.canal-strip { display:flex; flex-direction:column; gap:4px; padding:10px 14px; border-bottom:1px solid var(--border); }
.canal-strip-title { font-size:.65rem; color:var(--text3); text-transform:uppercase; letter-spacing:.06em; margin-bottom:3px; }
.canal-item { display:flex; align-items:center; gap:8px; padding:6px 8px; border-radius:var(--radius-sm); cursor:pointer; transition:background .15s; }
.canal-item:hover { background:var(--surface); }
.canal-dot { width:8px; height:8px; border-radius:50%; flex-shrink:0; }
.canal-dot.on  { animation:pulse 2s infinite; }
.canal-dot.off { opacity:.4; }
.canal-name { font-size:.8rem; font-weight:500; flex:1; }
.canal-badge { font-size:.65rem; font-weight:700; padding:2px 7px; border-radius:20px; }

.sidebar-nav { display:flex; flex-direction:column; gap:2px; padding:12px 10px; flex:1; overflow-y:auto; }
.nav-item { display:flex; align-items:center; gap:10px; padding:9px 12px; border-radius:var(--radius-sm); color:var(--text2); text-decoration:none; font-size:.85rem; font-weight:500; transition:all .2s; position:relative; }
.nav-item svg { width:17px; height:17px; flex-shrink:0; }
.nav-item:hover { background:var(--surface); color:var(--text); }
.nav-item.active { background:linear-gradient(90deg,rgba(0,230,118,.15),rgba(0,230,118,.04)); color:var(--green); border-left:3px solid var(--green); }
.nav-badge { margin-left:auto; background:var(--red); color:#fff; font-size:.62rem; padding:2px 6px; border-radius:20px; font-weight:700; }

.sidebar-user { display:flex; align-items:center; gap:10px; padding:14px 16px; border-top:1px solid var(--border); }
.user-avatar  { width:32px; height:32px; border-radius:50%; display:flex; align-items:center; justify-content:center; font-family:var(--font-head); font-weight:700; font-size:.72rem; }
.user-name    { display:block; font-weight:600; font-size:.8rem; line-height:1.2; }
.user-role    { display:block; font-size:.68rem; color:var(--text3); }
.user-status-dot { width:8px; height:8px; border-radius:50%; margin-left:auto; background:var(--green); box-shadow:0 0 6px var(--green); }

/* ── MAIN ─────────────────────────────────────────────────────────────────── */
.main-content { margin-left:var(--sidebar-w); flex:1; display:flex; flex-direction:column; min-height:100vh; transition:margin-left .3s cubic-bezier(.4,0,.2,1); }
.main-content.expanded { margin-left:0; }

/* ── TOPBAR ───────────────────────────────────────────────────────────────── */
.topbar { background:var(--bg2); border-bottom:1px solid var(--border); display:flex; align-items:center; justify-content:space-between; padding:12px 24px; position:sticky; top:0; z-index:90; }
.topbar-left  { display:flex; align-items:center; gap:12px; }
.topbar-right { display:flex; align-items:center; gap:10px; }
.page-title   { font-family:var(--font-head); font-size:1.2rem; font-weight:700; }
.page-title span { color:var(--green); }

.toggle-btn { background:var(--surface); border:1px solid var(--border); border-radius:var(--radius-sm); padding:6px 8px; cursor:pointer; color:var(--text2); display:flex; align-items:center; transition:all .2s; }
.toggle-btn svg { width:16px; height:16px; }
.toggle-btn:hover { color:var(--text); }

.search-bar { display:flex; align-items:center; gap:8px; background:var(--surface); border:1px solid var(--border); border-radius:30px; padding:6px 14px; transition:border-color .2s; }
.search-bar:focus-within { border-color:var(--green); }
.search-bar svg { width:14px; height:14px; color:var(--text3); flex-shrink:0; }
.search-bar input { background:none; border:none; outline:none; color:var(--text); font-size:.82rem; width:180px; font-family:var(--font-body); }
.search-bar input::placeholder { color:var(--text3); }

.conn-pills { display:flex; gap:6px; }
.conn-pill  { display:flex; align-items:center; gap:6px; background:var(--surface); border:1px solid var(--border); border-radius:30px; padding:5px 12px; font-size:.72rem; color:var(--text2); }
.conn-pill .cdot { width:7px; height:7px; border-radius:50%; animation:pulse 2s infinite; }

.notif-btn { position:relative; background:var(--surface); border:1px solid var(--border); border-radius:var(--radius-sm); padding:6px 8px; cursor:pointer; color:var(--text2); display:flex; align-items:center; transition:all .2s; }
.notif-btn svg { width:16px; height:16px; }
.notif-count { position:absolute; top:-4px; right:-4px; background:var(--red); color:#fff; font-size:.58rem; font-weight:700; width:15px; height:15px; border-radius:50%; display:flex; align-items:center; justify-content:center; }

@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.4} }

/* ── KPI GRID ─────────────────────────────────────────────────────────────── */
.kpi-grid { display:grid; grid-template-columns:repeat(7,1fr); gap:12px; padding:20px 24px 0; }
.kpi-card { background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); padding:14px; display:flex; flex-direction:column; gap:8px; position:relative; overflow:hidden; transition:transform .2s; }
.kpi-card::before { content:''; position:absolute; top:0; left:0; right:0; height:2px; }
.kpi-card:hover { transform:translateY(-2px); }
.kpi-icon { width:32px; height:32px; border-radius:var(--radius-sm); display:flex; align-items:center; justify-content:center; }
.kpi-icon svg { width:17px; height:17px; }
.kpi-value { font-family:var(--font-head); font-weight:800; font-size:1.7rem; line-height:1; display:block; }
.kpi-label { font-size:.7rem; color:var(--text3); }
.kpi-trend { font-size:.68rem; font-weight:600; padding:2px 8px; border-radius:20px; width:fit-content; }
.kpi-trend.up   { color:var(--green);  background:rgba(0,230,118,.1); }
.kpi-trend.warn { color:var(--yellow); background:rgba(255,215,64,.1); }
.kpi-trend.down { color:var(--red);    background:rgba(255,82,82,.1); }

.kc-wa  ::before { background:var(--wa); }
.kc-tg  ::before { background:var(--tg); }
.kc-ms  ::before { background:var(--ms); }
.kc-all ::before { background:var(--green); }

/* ── MID GRID ─────────────────────────────────────────────────────────────── */
.mid-grid { display:grid; grid-template-columns:1fr 260px 1fr; gap:14px; padding:16px 24px 0; }

/* ── CARDS ────────────────────────────────────────────────────────────────── */
.card { background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); overflow:hidden; }
.card-header { display:flex; align-items:center; justify-content:space-between; padding:13px 16px; border-bottom:1px solid var(--border); }
.card-header h2 { font-family:var(--font-head); font-size:.9rem; font-weight:700; }
.card-actions { display:flex; align-items:center; gap:6px; }

.btn-sm { background:var(--surface2); border:1px solid var(--border2); border-radius:var(--radius-sm); color:var(--text2); font-size:.72rem; padding:4px 11px; cursor:pointer; font-family:var(--font-body); transition:all .2s; }
.btn-sm:hover { color:var(--green); border-color:rgba(0,230,118,.4); }
.btn-primary { background:var(--green); color:#000; border:none; border-radius:var(--radius-sm); padding:8px 18px; font-family:var(--font-head); font-weight:700; font-size:.82rem; cursor:pointer; transition:all .2s; }
.btn-primary:hover { filter:brightness(1.1); }
.btn-ghost { background:transparent; color:var(--text2); border:1px solid var(--border2); border-radius:var(--radius-sm); padding:8px 18px; font-family:var(--font-body); font-size:.82rem; cursor:pointer; transition:all .2s; }

.badge { font-size:.66rem; font-weight:700; padding:2px 8px; border-radius:20px; }
.badge.red    { background:rgba(255,82,82,.18); color:var(--red); border:1px solid rgba(255,82,82,.25); }
.badge.green  { background:rgba(0,230,118,.12); color:var(--green); border:1px solid rgba(0,230,118,.2); }
.badge.blue   { background:rgba(79,142,247,.15); color:var(--blue); border:1px solid rgba(79,142,247,.2); }
.badge.purple { background:rgba(180,123,255,.15); color:var(--purple); }

/* ── FILA MULTI-CANAL ─────────────────────────────────────────────────────── */
.fila-list { overflow-y:auto; max-height:340px; }
.fila-item { display:flex; align-items:center; gap:8px; padding:9px 14px; border-bottom:1px solid var(--border); cursor:pointer; transition:background .15s; }
.fila-item:hover { background:var(--bg3); }
.fila-avatar { width:30px; height:30px; border-radius:50%; display:flex; align-items:center; justify-content:center; font-size:.68rem; font-weight:700; flex-shrink:0; }
.fila-info { flex:1; min-width:0; }
.fila-name { font-size:.8rem; font-weight:600; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; display:flex; align-items:center; gap:5px; }
.fila-msg  { font-size:.7rem; color:var(--text3); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.fila-meta { text-align:right; flex-shrink:0; }
.fila-time { font-size:.65rem; color:var(--text3); display:block; }
.urgencia { font-size:.58rem; font-weight:700; padding:1px 5px; border-radius:4px; text-transform:uppercase; }
.urgencia-alta   { background:rgba(255,82,82,.2); color:var(--red); }
.urgencia-media  { background:rgba(255,215,64,.2); color:var(--yellow); }
.urgencia-normal { background:rgba(0,230,118,.1); color:var(--green); }

/* ── AGENTES ──────────────────────────────────────────────────────────────── */
.agentes-list { overflow-y:auto; max-height:340px; padding:6px 8px; display:flex; flex-direction:column; gap:3px; }
.agente-item { display:flex; align-items:center; gap:8px; padding:8px 9px; border-radius:var(--radius-sm); transition:background .15s; cursor:pointer; }
.agente-item:hover { background:var(--bg3); }
.agente-avatar-wrap { position:relative; }
.agente-avatar { width:32px; height:32px; border-radius:50%; display:flex; align-items:center; justify-content:center; font-size:.7rem; font-weight:700; }
.agente-sdot { position:absolute; bottom:0; right:0; width:9px; height:9px; border-radius:50%; border:2px solid var(--surface); }
.status-online .agente-sdot { background:var(--green); }
.status-busy   .agente-sdot { background:var(--yellow); }
.status-away   .agente-sdot { background:var(--red); }
.agente-info { flex:1; min-width:0; }
.agente-name { font-size:.8rem; font-weight:600; }
.agente-canais { display:flex; gap:3px; margin-top:2px; }
.agente-canal-dot { width:6px; height:6px; border-radius:50%; }
.load-bar  { height:3px; background:var(--border); border-radius:3px; margin-top:3px; }
.load-fill { height:100%; border-radius:3px; transition:width .6s; }
.load-low  { background:var(--green); }
.load-med  { background:var(--yellow); }
.load-high { background:var(--red); }
.agente-count { font-size:.7rem; font-weight:700; color:var(--text2); background:var(--bg3); padding:2px 6px; border-radius:5px; }

/* ── CHART GROUPED BARS ───────────────────────────────────────────────────── */
.chart-area { padding:14px 16px; height:260px; display:flex; align-items:flex-end; gap:4px; overflow:hidden; }
.chart-group { flex:1; display:flex; flex-direction:column; align-items:center; gap:3px; height:100%; justify-content:flex-end; }
.chart-group-bars { display:flex; gap:1px; align-items:flex-end; width:100%; }
.chart-bar { flex:1; border-radius:2px 2px 0 0; cursor:pointer; min-height:2px; transition:opacity .2s; }
.chart-bar:hover { opacity:.75; }
.chart-label { font-size:.58rem; color:var(--text3); }
.chart-legend { display:flex; gap:10px; padding:6px 16px 10px; }
.chart-legend-item { display:flex; align-items:center; gap:5px; font-size:.72rem; color:var(--text2); }
.chart-legend-dot { width:8px; height:8px; border-radius:2px; }

/* ── POST-ITS ─────────────────────────────────────────────────────────────── */
@keyframes zapPopIn  { from{transform:scale(.45) rotate(-10deg);opacity:0} to{transform:scale(1) rotate(0);opacity:1} }
@keyframes zapShake  { 0%,100%{transform:translateX(0)} 20%{transform:translateX(-8px)} 40%{transform:translateX(8px)} 60%{transform:translateX(-5px)} 80%{transform:translateX(5px)} }
@keyframes flashRed  { 0%,100%{background:var(--bg)} 50%{background:rgba(255,82,82,.07)} }

#zap-postit-canvas { position:relative; width:100%; min-height:500px; background:var(--bg); overflow:hidden; }
#zap-canvas-empty  { position:absolute; inset:0; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:10px; color:var(--text3); font-size:.85rem; pointer-events:none; }
#zap-canvas-empty svg { width:48px; height:48px; opacity:.18; }

.zap-postit { position:absolute; width:230px; border-radius:11px; box-shadow:0 3px 18px rgba(0,0,0,.22); cursor:move; user-select:none; z-index:10; font-family:var(--font-body); animation:zapPopIn .38s cubic-bezier(.34,1.56,.64,1); transition:box-shadow .15s; }
.zap-postit:hover { box-shadow:0 8px 32px rgba(0,0,0,.3) !important; z-index:50 !important; }
.zap-postit.dragging { box-shadow:0 14px 48px rgba(0,0,0,.3) !important; z-index:999 !important; transform:rotate(1.5deg); }
.zap-postit.urgent-shake { animation:zapShake .55s ease; }

.pt-header { display:flex; align-items:center; gap:6px; padding:8px 10px 6px; border-radius:11px 11px 0 0; }
.pt-avatar { width:28px; height:28px; border-radius:50%; display:flex; align-items:center; justify-content:center; font-size:.68rem; font-weight:700; flex-shrink:0; background:rgba(0,0,0,.16); }
.pt-name   { flex:1; font-size:.8rem; font-weight:700; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.pt-badge  { font-size:.6rem; font-weight:700; padding:2px 7px; border-radius:20px; background:rgba(0,0,0,.18); }
.pt-close  { width:18px; height:18px; border-radius:50%; border:none; background:rgba(0,0,0,.2); color:inherit; cursor:pointer; font-size:10px; display:flex; align-items:center; justify-content:center; opacity:.75; transition:opacity .15s; }
.pt-close:hover { opacity:1; }
.pt-channel-bar { display:flex; align-items:center; gap:5px; padding:4px 10px; font-size:.68rem; font-weight:600; border-top:1px solid rgba(0,0,0,.1); }
.pt-body   { padding:8px 10px; }
.pt-dept   { font-size:.68rem; opacity:.7; margin-bottom:4px; }
.pt-msg    { font-size:.8rem; line-height:1.45; margin-bottom:7px; }
.pt-unread { font-size:.68rem; opacity:.75; margin-bottom:7px; }
.pt-actions { display:flex; gap:5px; }
.pt-btn    { flex:1; font-size:.72rem; padding:5px 0; border-radius:7px; border:none; cursor:pointer; font-weight:600; font-family:inherit; transition:opacity .15s; }
.pt-btn:hover { opacity:.85; }
.pt-btn.accept   { background:rgba(255,255,255,.35); color:inherit; }
.pt-btn.transfer { background:rgba(0,0,0,.18); color:inherit; }
.pt-footer { padding:4px 10px 7px; font-size:.65rem; opacity:.6; display:flex; justify-content:space-between; }
.pt-resize { position:absolute; bottom:4px; right:4px; width:13px; height:13px; cursor:se-resize; opacity:.35; }

/* Post-it color themes */
.pt-urgente    { background:#e63946; color:#fff; }
.pt-urgente    .pt-header { background:rgba(0,0,0,.14); }
.pt-urgente    .pt-channel-bar { background:rgba(0,0,0,.1); }
.pt-normal     { background:#e9c46a; color:#2d2d0a; }
.pt-normal     .pt-header { background:rgba(0,0,0,.1); }
.pt-normal     .pt-channel-bar { background:rgba(0,0,0,.07); }
.pt-vip        { background:#2a9d8f; color:#fff; }
.pt-vip        .pt-header { background:rgba(0,0,0,.12); }
.pt-vip        .pt-channel-bar { background:rgba(0,0,0,.09); }
.pt-novo       { background:#457b9d; color:#fff; }
.pt-novo       .pt-header { background:rgba(0,0,0,.14); }
.pt-novo       .pt-channel-bar { background:rgba(0,0,0,.1); }
.pt-bot        { background:#7b2d8b; color:#fff; }
.pt-bot        .pt-header { background:rgba(0,0,0,.18); }
.pt-bot        .pt-channel-bar { background:rgba(0,0,0,.12); }
.pt-aguardando { background:#f4a261; color:#fff; }
.pt-aguardando .pt-header { background:rgba(0,0,0,.12); }
.pt-aguardando .pt-channel-bar { background:rgba(0,0,0,.08); }

/* ── CANVAS TOOLBAR ───────────────────────────────────────────────────────── */
.canvas-toolbar { display:flex; gap:6px; align-items:center; padding:8px 14px; background:var(--bg2); border-top:1px solid var(--border); flex-wrap:wrap; }
.canvas-toolbar .ct-label { font-size:.7rem; color:var(--text3); margin-right:4px; }
.ct-tag { font-size:.7rem; padding:3px 11px; border-radius:20px; cursor:pointer; border:1px solid transparent; transition:all .15s; }
.ct-tag:hover { filter:brightness(1.15); }
.ct-stat { margin-left:auto; font-size:.7rem; color:var(--text2); }
.sound-btn { display:flex; align-items:center; gap:5px; font-size:.72rem; color:var(--text2); background:var(--surface2); border:1px solid var(--border); border-radius:20px; padding:4px 12px; cursor:pointer; font-family:var(--font-body); transition:all .2s; }
.sound-btn:hover { color:var(--text); }

/* ── TABLE ────────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x:auto; }
.data-table { width:100%; border-collapse:collapse; }
.data-table th { background:var(--bg3); color:var(--text3); font-size:.68rem; font-weight:600; text-transform:uppercase; letter-spacing:.05em; padding:10px 14px; text-align:left; white-space:nowrap; }
.data-table td { padding:11px 14px; font-size:.8rem; border-bottom:1px solid var(--border); vertical-align:middle; }
.data-table tr:last-child td { border-bottom:none; }
.data-table tr:hover td { background:rgba(255,255,255,.015); }

.td-contato { display:flex; align-items:center; gap:8px; }
.td-avatar  { width:28px; height:28px; border-radius:50%; display:flex; align-items:center; justify-content:center; font-size:.62rem; font-weight:700; flex-shrink:0; }
.td-name { font-weight:600; }
.td-num  { font-size:.68rem; color:var(--text3); }

.status-tag { display:inline-flex; align-items:center; gap:4px; font-size:.68rem; font-weight:600; padding:2px 8px; border-radius:20px; }
.st-em-atendimento { background:rgba(79,142,247,.15); color:var(--blue); }
.st-aguardando     { background:rgba(255,215,64,.15); color:var(--yellow); }
.st-finalizado     { background:rgba(0,230,118,.1); color:var(--green); }
.st-bot            { background:rgba(180,123,255,.15); color:var(--purple); }

.action-btns { display:flex; gap:4px; }
.action-btn { background:var(--surface2); border:1px solid var(--border2); border-radius:6px; padding:3px 8px; cursor:pointer; color:var(--text2); font-size:.7rem; transition:all .2s; font-family:var(--font-body); }
.action-btn:hover { color:var(--green); border-color:rgba(0,230,118,.3); }
.action-btn.danger:hover { color:var(--red); border-color:rgba(255,82,82,.3); }

/* ── RECENT SECTION ───────────────────────────────────────────────────────── */
.recent-card { margin:14px 24px 24px; }

/* ── POSTIT SECTION HEADER ────────────────────────────────────────────────── */
.postit-section { margin:14px 24px 0; }

/* ── ANIMATIONS ───────────────────────────────────────────────────────────── */
@keyframes fadeInUp { from{opacity:0;transform:translateY(18px)} to{opacity:1;transform:translateY(0)} }
.kpi-card { animation:fadeInUp .4s ease both; }
.kpi-card:nth-child(1){animation-delay:.04s} .kpi-card:nth-child(2){animation-delay:.08s}
.kpi-card:nth-child(3){animation-delay:.12s} .kpi-card:nth-child(4){animation-delay:.16s}
.kpi-card:nth-child(5){animation-delay:.20s} .kpi-card:nth-child(6){animation-delay:.24s}
.kpi-card:nth-child(7){animation-delay:.28s}

/* ── RESPONSIVE ───────────────────────────────────────────────────────────── */
@media(max-width:1400px){ .kpi-grid{grid-template-columns:repeat(4,1fr)} }
@media(max-width:1100px){ .mid-grid{grid-template-columns:1fr 1fr}; .chart-card{grid-column:span 2} }
@media(max-width:768px) { .sidebar{transform:translateX(calc(-1 * var(--sidebar-w)))} .sidebar.open{transform:translateX(0)} .main-content{margin-left:0} .kpi-grid{grid-template-columns:repeat(2,1fr)} .mid-grid{grid-template-columns:1fr} }

/* ── NOTIFICATION TOAST ───────────────────────────────────────────────────── */
.zap-toast { position:fixed; bottom:22px; right:22px; z-index:99999; background:var(--surface2); border-radius:12px; padding:11px 16px; font-size:.82rem; box-shadow:0 8px 32px rgba(0,0,0,.35); display:flex; align-items:center; gap:10px; max-width:300px; animation:fadeInUp .3s cubic-bezier(.34,1.56,.64,1); }
.zap-toast-dot { width:8px; height:8px; border-radius:50%; flex-shrink:0; }
