:root{
  --navy-1:#071a2e; --navy-2:#061629; --cyan:#16a9df; --cyan-2:#43c6f5;
  --bg:#f4f8fc; --border:#dceaf6; --ink:#16324a; --muted:#6b87a0;
  --green:#22a565; --red:#d9534f; --amber:#e8a13a; --card:#ffffff;
}
*{box-sizing:border-box; margin:0; padding:0}
html,body{height:100%}
body{font-family:"Segoe UI",system-ui,-apple-system,Roboto,Arial,sans-serif; background:var(--bg); color:var(--ink); font-size:14px}
.hidden{display:none !important}

/* ───────── Layout ───────── */
.app{display:flex; min-height:100vh}
.main{flex:1; display:flex; flex-direction:column; min-width:0}

/* ───────── Sidebar ───────── */
.sidebar{width:248px; flex:0 0 248px; background:linear-gradient(180deg,var(--navy-1),var(--navy-2)); color:#dbeefb; display:flex; flex-direction:column; position:sticky; top:0; height:100vh}
.brand{display:flex; gap:10px; align-items:center; justify-content:center; padding:16px 16px 12px}
.brand-logo{background:#fff; border-radius:10px; padding:8px 12px; width:200px; height:56px; display:flex; align-items:center; justify-content:center}
.brand-logo img{max-width:100%; max-height:100%}
.agent-mini{display:flex; align-items:center; gap:10px; margin:6px 14px 14px; padding:10px; background:rgba(255,255,255,.06); border:1px solid rgba(255,255,255,.08); border-radius:12px}
.avatar{width:36px; height:36px; border-radius:50%; background:var(--cyan); color:#fff; font-weight:700; display:flex; align-items:center; justify-content:center; font-size:13px}
.agent-mini-name{font-size:13px; color:#fff; font-weight:600}
.agent-mini-id{font-size:11px; color:#9fc6de}
.status-dot{margin-left:auto; width:11px; height:11px; border-radius:50%; background:var(--green); box-shadow:0 0 0 3px rgba(34,165,101,.25)}
.status-dot.pausa{background:var(--amber); box-shadow:0 0 0 3px rgba(232,161,58,.25)}
.status-dot.llamada{background:var(--cyan-2); box-shadow:0 0 0 3px rgba(67,198,245,.25)}
.nav{display:flex; flex-direction:column; gap:4px; padding:4px 12px}
.nav-item{display:flex; align-items:center; gap:10px; padding:11px 12px; border:0; border-radius:10px; background:transparent; color:#cfe7f7; font-size:14px; cursor:pointer; text-align:left; font-family:inherit}
.nav-item:hover{background:rgba(255,255,255,.07)}
.nav-item.active{background:var(--cyan); color:#fff; font-weight:600}
.nav-ico{font-size:15px}
.sidebar-foot{margin-top:auto; padding:14px 16px; display:flex; flex-direction:column; gap:8px}
.demo-badge{background:rgba(232,161,58,.16); border:1px solid rgba(232,161,58,.5); color:#ffd9a0; font-size:11px; font-weight:700; text-align:center; padding:6px 8px; border-radius:8px; letter-spacing:.4px}
.sidebar-version{font-size:11px; color:#7fa8c4; text-align:center}

/* ───────── Topbar ───────── */
.topbar{display:flex; align-items:center; justify-content:space-between; padding:14px 22px; background:#fff; border-bottom:1px solid var(--border); position:sticky; top:0; z-index:5}
.topbar-title{font-size:18px; font-weight:700; color:var(--navy-1)}
.topbar-right{display:flex; align-items:center; gap:12px}
.webrtc-chip{background:#eef7fd; border:1px solid var(--border); border-radius:999px; padding:5px 12px; font-size:12px; color:var(--muted)}
.webrtc-chip strong{color:var(--green)}
.state-pill{border-radius:999px; padding:5px 14px; font-weight:700; font-size:12.5px; background:#e4f5ec; color:#177a4c; border:1px solid #bfe6d2}
.state-pill.pausa{background:#fdf1de; color:#9a6714; border-color:#f3ddba}
.state-pill.llamada{background:#e2f4fd; color:#0c6f9c; border-color:#bfe6f8}
.state-pill.wrapup{background:#f3e8fd; color:#6a3aa0; border-color:#e2ccf8}
.clock{font-variant-numeric:tabular-nums; color:var(--muted); font-size:13px}

/* ───────── Views ───────── */
.view{display:none; padding:20px 22px 30px}
.view.active{display:block}
.agent-grid{display:grid; grid-template-columns:minmax(400px,5fr) minmax(420px,6fr); gap:18px; align-items:start}
.col{display:flex; flex-direction:column; gap:18px; min-width:0}
.two-col{display:grid; grid-template-columns:1fr 1fr; gap:18px; align-items:start}

.card{background:var(--card); border:1px solid var(--border); border-radius:14px; padding:16px 18px; box-shadow:0 1px 3px rgba(7,26,46,.05)}
.card-head{display:flex; align-items:center; justify-content:space-between; margin-bottom:10px}
.card-head h3{font-size:15.5px; color:var(--navy-1)}
.tag{font-size:11.5px; background:#eef7fd; color:#0c6f9c; border:1px solid var(--border); padding:3px 10px; border-radius:999px}
.hint{font-size:12.5px; color:var(--muted); margin-bottom:10px}

/* ───────── Teléfono ───────── */
.phone-card{border-top:4px solid var(--cyan)}
.phone-line{font-size:12px; color:var(--muted)}
.phone-display{background:var(--navy-1); color:#fff; border-radius:12px; padding:14px 16px; margin-bottom:12px}
.phone-display-name{font-size:17px; font-weight:700}
.phone-display-number{font-size:15px; color:var(--cyan-2); font-variant-numeric:tabular-nums; margin-top:2px}
.phone-display-meta{display:flex; justify-content:space-between; align-items:center; margin-top:8px; font-size:12.5px; color:#9fc6de}
.call-timer{font-size:19px; font-weight:700; color:#fff; font-variant-numeric:tabular-nums}
.ringing-banner{display:flex; align-items:center; justify-content:space-between; background:#fdf1de; border:1px solid #f3ddba; color:#9a6714; border-radius:10px; padding:9px 12px; margin-bottom:12px; font-weight:600; animation:pulse 1s infinite}
@keyframes pulse{50%{background:#fbe7c3}}
.keypad{display:grid; grid-template-columns:repeat(3,1fr); gap:7px; margin-bottom:10px}
.keypad button{padding:9px 0; font-size:15px; font-weight:600; border:1px solid var(--border); background:#fbfdfe; border-radius:9px; cursor:pointer; color:var(--navy-1); font-family:inherit}
.keypad button:hover{background:#eef7fd; border-color:var(--cyan)}
.dial-input{width:100%; padding:9px 12px; border:1px solid var(--border); border-radius:9px; margin-bottom:12px; font-size:14px; font-family:inherit}
.phone-actions{display:flex; gap:8px; margin-bottom:9px; flex-wrap:wrap; align-items:center}
.pause-reason{margin-left:auto; padding:8px; border:1px solid var(--border); border-radius:9px; font-family:inherit; font-size:13px; color:var(--ink); background:#fff}

/* ───────── Botones ───────── */
.btn{border:0; border-radius:9px; padding:9px 15px; font-size:13.5px; font-weight:600; cursor:pointer; font-family:inherit}
.btn:disabled{opacity:.45; cursor:not-allowed}
.btn-sm{padding:6px 11px; font-size:12.5px}
.btn-green{background:var(--green); color:#fff}
.btn-red{background:var(--red); color:#fff}
.btn-amber{background:var(--amber); color:#fff}
.btn-cyan{background:var(--cyan); color:#fff}
.btn-ghost{background:#fff; border:1px solid var(--border); color:var(--navy-1)}
.btn-ghost:hover:not(:disabled){border-color:var(--cyan)}
.btn-link{background:none; border:0; color:var(--cyan); cursor:pointer; font-size:12.5px; padding:2px; font-family:inherit; text-decoration:underline}

/* ───────── Cliente ───────── */
.client-empty{color:var(--muted); font-size:13.5px; background:#fbfdfe; border:1px dashed var(--border); border-radius:10px; padding:14px}
.client-name{font-size:17px; font-weight:700; color:var(--navy-1); margin-bottom:8px}
.client-rows{display:grid; grid-template-columns:1fr 1fr; gap:7px 16px; margin-bottom:12px}
.client-rows div{display:flex; justify-content:space-between; border-bottom:1px solid #eef4fa; padding-bottom:5px}
.client-rows span{color:var(--muted); font-size:12.5px}
.client-rows strong{font-size:13px}
.script-box,.notes-box{border-radius:10px; padding:11px 13px; margin-bottom:9px; font-size:13.5px; line-height:1.45}
.script-box{background:#eef7fd; border:1px solid var(--border)}
.notes-box{background:#fffaf0; border:1px solid #f3e5c3}
.script-title{font-size:11px; font-weight:700; letter-spacing:.6px; text-transform:uppercase; color:#0c6f9c; margin-bottom:4px}
.notes-box .script-title{color:#9a6714}

/* ───────── Disposiciones ───────── */
.dispo-grid{display:grid; grid-template-columns:1fr 1fr; gap:8px}
.dispo{padding:10px 8px; border:1px solid var(--border); background:#fbfdfe; border-radius:10px; font-size:13px; font-weight:600; cursor:pointer; color:var(--navy-1); font-family:inherit; text-align:left}
.dispo:hover:not(:disabled){border-color:var(--cyan); background:#eef7fd}
.dispo:disabled{opacity:.45; cursor:not-allowed}

/* ───────── Fila de trabajo ───────── */
.queue-list{display:flex; flex-direction:column; gap:9px}
.q-item{display:flex; align-items:center; gap:12px; border:1px solid var(--border); border-radius:11px; padding:10px 12px; background:#fff}
.q-item.incall{border-color:var(--cyan); background:#eef7fd; box-shadow:0 0 0 2px rgba(22,169,223,.18)}
.q-item.done{opacity:.55; background:#f6faf7}
.q-prio{font-size:10.5px; font-weight:800; letter-spacing:.4px; padding:4px 8px; border-radius:6px; text-transform:uppercase; white-space:nowrap}
.prio-alta{background:#fde8e8; color:#a92c2c}
.prio-media{background:#fdf1de; color:#9a6714}
.prio-baja{background:#e8f1f8; color:#40627e}
.q-main{flex:1; min-width:0}
.q-name{font-weight:700; font-size:13.5px}
.q-sub{font-size:12px; color:var(--muted)}
.q-status{font-size:11.5px; font-weight:700; white-space:nowrap}
.q-status.pend{color:#9a6714}.q-status.call{color:#0c6f9c}.q-status.done{color:#177a4c}

/* ───────── Mi día / actividad ───────── */
.day-stats{display:grid; grid-template-columns:repeat(3,1fr); gap:10px; margin-bottom:14px}
.day-stat{background:#fbfdfe; border:1px solid var(--border); border-radius:10px; padding:10px; text-align:center}
.day-stat strong{display:block; font-size:19px; color:var(--navy-1)}
.day-stat span{font-size:11.5px; color:var(--muted)}
.activity-title{font-size:12px; font-weight:700; letter-spacing:.5px; text-transform:uppercase; color:var(--muted); margin-bottom:6px}
.activity{list-style:none; display:flex; flex-direction:column; gap:6px; font-size:13px}
.activity em{color:var(--muted); font-style:normal}
.act-time{color:var(--cyan); font-weight:700; margin-right:6px; font-variant-numeric:tabular-nums}

/* ───────── Tablas y métricas ───────── */
.table{width:100%; border-collapse:collapse; font-size:13.5px}
.table th{text-align:left; color:var(--muted); font-size:12px; text-transform:uppercase; letter-spacing:.4px; padding:8px 10px; border-bottom:2px solid var(--border)}
.table td{padding:9px 10px; border-bottom:1px solid #eef4fa}
.badge{font-size:11.5px; font-weight:700; padding:3px 10px; border-radius:999px}
.badge-on{background:#e4f5ec; color:#177a4c}
.badge-pause{background:#fdf1de; color:#9a6714}
.badge-off{background:#eef1f4; color:#66788a}
.progress{background:#e8f1f8; border-radius:999px; height:8px; min-width:90px; overflow:hidden; display:inline-block; vertical-align:middle; margin-right:7px; width:110px}
.progress i{display:block; height:100%; background:var(--cyan); border-radius:999px}
.progress.big{flex:1; height:12px; width:auto}
.metric-row{display:grid; grid-template-columns:repeat(5,1fr); gap:14px; margin-bottom:18px}
.metric{background:#fff; border:1px solid var(--border); border-top:4px solid var(--cyan); border-radius:12px; padding:14px 16px}
.metric span{font-size:12px; color:var(--muted); display:block}
.metric strong{font-size:24px; color:var(--navy-1); display:block; margin:3px 0}
.metric em{font-size:12px; color:var(--muted); font-style:normal}
.metric em.up{color:#177a4c}
.bar-row{display:flex; align-items:center; gap:12px; margin-bottom:13px}
.bar-row span{width:150px; font-size:13px}
.bar-row strong{font-size:13px; color:var(--navy-1)}
.search-row{display:flex; gap:12px; flex-wrap:wrap; align-items:end; margin-bottom:14px}
.search-row label{display:flex; flex-direction:column; gap:4px; font-size:12px; color:var(--muted); font-weight:600}
.search-row input,.search-row select{padding:8px 10px; border:1px solid var(--border); border-radius:8px; font-family:inherit; font-size:13.5px; color:var(--ink)}
.player{display:flex; align-items:center; gap:12px; margin-top:14px; background:var(--navy-1); color:#fff; border-radius:10px; padding:11px 14px; font-size:13px}
.player-bar{flex:1; background:rgba(255,255,255,.2); height:8px; border-radius:999px; overflow:hidden}
.player-bar i{display:block; height:100%; width:0; background:var(--cyan-2)}
.admin-list{list-style:none; display:flex; flex-direction:column}
.admin-list li{display:flex; flex-direction:column; padding:10px 2px; border-bottom:1px solid #eef4fa}
.admin-list li span{font-weight:600; font-size:13.5px}
.admin-list li em{color:var(--muted); font-style:normal; font-size:12.5px}

.toast{position:fixed; bottom:22px; left:50%; transform:translateX(-50%); background:var(--navy-1); color:#fff; padding:12px 20px; border-radius:10px; font-size:13.5px; box-shadow:0 8px 24px rgba(7,26,46,.3); z-index:50}

/* ───────── Responsive ───────── */
@media (max-width:1180px){
  .agent-grid{grid-template-columns:1fr}
  .metric-row{grid-template-columns:repeat(2,1fr)}
  .two-col{grid-template-columns:1fr}
}
@media (max-width:760px){
  .sidebar{width:70px; flex-basis:70px}
  .brand{padding:12px 8px 8px}
  .brand-logo{width:52px; height:52px; padding:5px}
  .agent-mini div,.nav-item{font-size:0}
  .nav-item .nav-ico{font-size:19px}
  .agent-mini{justify-content:center}
  .status-dot{display:none}
  .metric-row{grid-template-columns:1fr}
}
