/* Copia local y recortada del look del agent, ajustada al recuadro de la portada. */
:root {
  --primary-rgb: 221, 75, 57;
  --primary-color: #dd4b39;
  --header-bg: #dd4b39;
  --agent-header-bg: #dd4b39;
  --agent-header-h: 46px;
  --agent-sidebar-w: 200px;
  --mk-bg: #f0f1f7;
  --mk-card: #fff;
  --mk-ink: #222;
  --mk-muted: #6c757d;
  --mk-line: #e9edf4;
  --font: Inter, system-ui, sans-serif;
}

*,
*::before,
*::after { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  font-family: var(--font);
  font-size: 13px;
  color: var(--mk-ink);
  background: var(--mk-bg);
  pointer-events: none;
  user-select: none;
}

button, input, a { font: inherit; color: inherit; }

.page {
  display: grid;
  grid-template-columns: var(--agent-sidebar-w) minmax(0, 1fr);
  grid-template-rows: var(--agent-header-h) minmax(0, 1fr);
  height: 100%;
  background: var(--mk-bg);
}

/* ===== Header ===== */
.agent-header {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  height: var(--agent-header-h);
  background: var(--agent-header-bg);
  color: #fff;
}

.agent-header__brand {
  width: var(--agent-sidebar-w);
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.16);
  text-decoration: none;
}

.agent-header__brand img {
  height: 28px;
  width: auto;
  display: block;
}

.logo-mini { display: none; }

.agent-header__bar {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-width: 0;
  padding: 0 10px;
}

.agent-header__toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  margin-right: auto;
  color: #fff;
  text-decoration: none;
  border-radius: 8px;
  font-size: 18px;
}

.agent-header__actions {
  display: flex;
  align-items: center;
  gap: 2px;
}

.agent-header__status {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-right: 6px;
  padding: 3px 8px 3px 3px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.28);
}

.agent-header__status-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #22c55e;
  color: #fff;
  font-size: 12px;
}

.agent-header__status-meta { line-height: 1.1; }
.agent-header__status-label { display: block; font-size: 10px; font-weight: 700; }
.agent-header__status-time { display: block; font-size: 9px; opacity: 0.92; font-variant-numeric: tabular-nums; }

.agent-header__btn {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  color: #fff;
  text-decoration: none;
  border-radius: 8px;
  font-size: 15px;
}

.agent-header__profile {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: 6px;
  color: #fff;
  text-decoration: none;
  font-size: 12px;
  font-weight: 600;
}

.agent-header__profile-caret { font-size: 14px; }

.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.avatar-sm { width: 26px; height: 26px; }
.avatar-xs { width: 26px; height: 26px; font-size: 13px; }
.avatar-rounded { border-radius: 50%; }
.bg-light { background: #fff; color: #dd4b39; }

/* ===== Sidebar ===== */
.agent-sidebar {
  background: #fff;
  border-right: 1px solid #f3f3f3;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.agent-sidebar-scroll,
.agent-sidebar__inner {
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
}

.agent-sidebar__inner { padding: 10px; gap: 8px; }

.agent-phone {
  border: 1px solid var(--mk-line);
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
}

.agent-phone__top {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 8px 0;
}

.agent-phone__sip-bar { flex: 1; min-width: 0; }
.agent-phone__sip-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  text-decoration: none;
  color: #333;
}
.agent-phone__sip-status i { color: #22c55e; font-size: 8px; }
.agent-phone__minify {
  border: 0;
  background: transparent;
  color: #8c9097;
  width: 22px;
  height: 22px;
}

.agent-phone__body { padding: 4px 8px 10px; }
.agent-phone__stage { text-align: center; }
.agent-phone__glow { display: none; }
.agent-phone__avatar-wrap {
  width: 52px;
  height: 52px;
  margin: 4px auto 6px;
  position: relative;
  display: grid;
  place-items: center;
}
.agent-phone__ring { display: none; }
.agent-phone__avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #fff;
  border: 2px solid rgba(59, 130, 246, 0.5);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
  color: #3b82f6;
  font-size: 18px;
}
.agent-phone__name { font-size: 12px; font-weight: 700; }
.agent-phone__number-input {
  width: 100%;
  border: 0;
  background: transparent;
  text-align: center;
  font-size: 11px;
  color: #9aa3b2;
  outline: none;
  padding: 2px 0 6px;
}
.agent-phone__idle-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.agent-phone__side-btn {
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 8px;
  background: #f5f7fb;
  color: #536485;
}
.agent-phone__fab {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  color: #fff;
  box-shadow: 0 6px 14px rgba(34, 197, 94, 0.28);
}
.agent-phone__fab--call { background: #22c55e; }

.agent-sidebar__tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  list-style: none;
  margin: 0;
  padding: 0;
  border-bottom: 1px solid var(--mk-line);
}
.agent-sidebar__tabs .nav-item { margin: 0; }
.agent-sidebar__tabs .nav-link {
  width: 100%;
  border: 0;
  background: none;
  padding: 7px 4px;
  font-size: 11px;
  font-weight: 700;
  color: #8c9097;
}
.agent-sidebar__tabs .nav-link.active {
  color: var(--primary-color);
  box-shadow: inset 0 -2px 0 var(--primary-color);
}
.agent-sidebar__tabs i { margin-right: 3px; }

.campana-filtro-input,
.form-control {
  width: 100%;
  border: 1px solid var(--mk-line);
  background: #f8fafc;
  border-radius: 8px;
  padding: 6px 8px;
  font-size: 11px;
  color: #9aa3b2;
}

.agent-sidebar__list {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  overflow: hidden;
}

.campana-card {
  border: 1px solid var(--mk-line);
  border-radius: 10px;
  background: #fff;
  margin-bottom: 8px;
}
.campana-action { padding: 8px; }
.campana-card-row { display: flex; align-items: flex-start; gap: 8px; }
.campana-card-row .avatar {
  width: 28px;
  height: 28px;
  background: rgba(221, 75, 57, 0.1);
  color: var(--primary-color);
}
.campana-nombre { font-size: 11px; font-weight: 700; margin-bottom: 4px; }
.campana-badges { display: flex; flex-wrap: wrap; gap: 3px; }
.badge-tipo,
.badge-canal {
  display: inline-block;
  padding: 1px 5px;
  font-size: 9px;
  font-weight: 700;
  border-radius: 3px;
  color: #fff;
  white-space: nowrap;
}
.badge-saliente { background: #00a65a; }
.badge-blend { background: #605ca8; }
.badge-pbx { background: #f39c12; }
.badge-chat { background: #3c8dbc; }
.badge-mail { background: #dd4b39; }

/* ===== Main ===== */
.main-content {
  min-width: 0;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  padding: 8px;
  display: flex;
  flex-direction: column;
}

.content {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.row.g-3 {
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.1fr) minmax(0, 1.15fr);
  gap: 8px;
  flex: 1;
  min-height: 0;
  height: 100%;
}
.agent-inicio-col-ops,
.agent-inicio-col-dyn,
.agent-inicio-col-log {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.card,
.custom-card {
  background: var(--mk-card);
  border: 1px solid var(--mk-line);
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  overflow: hidden;
}
.card-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  border-bottom: 1px solid var(--mk-line);
}
.card-title { margin: 0; font-size: 12px; font-weight: 700; }
.card-body { padding: 8px 10px; }
.p-0 { padding: 0; }
.p-2 { padding: 8px; }
.p-3 { padding: 10px; }
.py-2 { padding-top: 8px; padding-bottom: 8px; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 6px; }
.mb-3 { margin-bottom: 8px; }
.mt-2 { margin-top: 6px; }
.mt-3 { margin-top: 8px; }
.w-100 { width: 100%; }
.text-center { text-align: center; }
.text-truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.text-muted { color: var(--mk-muted); }
.text-primary { color: var(--primary-color); }
.text-success { color: #16a34a; }
.text-danger { color: #dc2626; }
.text-warning { color: #d97706; }
.text-info { color: #0ea5e9; }
.text-secondary { color: #6c757d; }
.fw-semibold { font-weight: 600; }
.fs-11 { font-size: 10px; }
.fs-12 { font-size: 11px; }
.fs-14 { font-size: 12px; }
.d-flex { display: flex; }
.align-items-center { align-items: center; }
.align-items-top { align-items: flex-start; }
.justify-content-between { justify-content: space-between; }
.flex-fill { flex: 1 1 auto; min-width: 0; }
.flex-shrink-0 { flex-shrink: 0; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 6px; }
.gap-3 { gap: 8px; }
.flex-wrap { flex-wrap: wrap; }
.min-w-0 { min-width: 0; }
.ms-2 { margin-left: 6px; }
.me-1 { margin-right: 3px; }
.me-3 { margin-right: 8px; }
.me-auto { margin-right: auto; }
.op-7 { opacity: 0.7; }
.d-none { display: none !important; }

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}
.bg-primary { background: var(--primary-color); color: #fff; }
.bg-info { background: #0ea5e9; color: #fff; }
.bg-primary-transparent { background: rgba(221, 75, 57, 0.12); color: var(--primary-color); }
.bg-success-transparent { background: #dcfce7; color: #16a34a; }
.bg-info-transparent { background: #dbeafe; color: #2563eb; }
.bg-warning-transparent { background: #fff7ed; color: #c2410c; }
.bg-danger-transparent { background: #fee2e2; color: #dc2626; }
.bg-secondary-transparent { background: #f3f4f6; color: #4b5563; }

/* Welcome */
.agent-welcome-card { position: relative; }
.agent-welcome-body { overflow: hidden; }
.agent-welcome-orb {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}
.agent-welcome-orb--1 {
  width: 90px;
  height: 90px;
  right: -20px;
  top: -30px;
  background: rgba(221, 75, 57, 0.08);
}
.agent-welcome-orb--2 {
  width: 60px;
  height: 60px;
  right: 30px;
  bottom: -24px;
  background: rgba(59, 130, 246, 0.08);
}
.agent-welcome-visual { width: 56px; }
.agent-welcome-illust { width: 56px; height: auto; display: block; }
.agent-welcome-title { margin: 2px 0 2px; font-size: 13px; }
.agent-welcome-sub { margin: 0; }

.list-group { list-style: none; margin: 0; padding: 0; }
.list-group-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-top: 1px solid #f3f4f6;
  font-size: 11px;
}
.contact-hover-btn {
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 6px;
  background: #f5f7fb;
  color: #536485;
}

.agent-op-row { margin-bottom: 6px; }
.agent-op-row:last-child { margin-bottom: 0; }
.progress {
  height: 4px;
  background: #eef2f7;
  border-radius: 99px;
  overflow: hidden;
}
.progress-bar { height: 100%; }
.bg-success { background: #16a34a; }
.bg-primary.progress-bar,
.progress-bar.bg-primary { background: #2563eb; }
.progress-bar.bg-info { background: #0ea5e9; }
.progress-bar.bg-warning { background: #d97706; }
.progress-bar.bg-secondary { background: #94a3b8; }
.progress-bar.bg-danger { background: #dc2626; }

.agent-card-tabs {
  display: flex;
  flex-wrap: nowrap;
  gap: 2px;
  margin-left: auto;
  overflow: hidden;
}
.agent-card-tab {
  border: 1px solid transparent;
  background: transparent;
  border-radius: 6px;
  padding: 2px 6px;
  font-size: 10px;
  font-weight: 600;
  color: #8c9097;
  white-space: nowrap;
}
.agent-card-tab.is-active {
  background: rgba(221, 75, 57, 0.12);
  border-color: rgba(221, 75, 57, 0.35);
  color: var(--primary-color);
}

.agent-kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}
.agent-wide-kpis .agent-kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.agent-kpi {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px;
  border: 1px solid var(--mk-line);
  border-radius: 8px;
  background: rgba(221, 75, 57, 0.02);
  min-width: 0;
  overflow: hidden;
}
.agent-kpi__icon {
  width: 24px;
  height: 24px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  font-size: 13px;
}
.agent-kpi__body {
  min-width: 0;
  overflow: hidden;
}
.agent-kpi__val {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-variant-numeric: tabular-nums;
}
.agent-wide-kpis .agent-kpi {
  gap: 5px;
  padding: 5px 6px;
}
.agent-wide-kpis .agent-kpi__icon {
  width: 22px;
  height: 22px;
  font-size: 12px;
}
.agent-wide-kpis .agent-kpi__val { font-size: 11px; }
.agent-kpi__label {
  font-size: 9px;
  color: var(--mk-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.agent-tab-pane { display: none; }
.agent-tab-pane.is-active { display: block; }

.agent-efectividad-split {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
}
.mock-donut { width: 96px; height: 96px; display: block; margin: 0 auto; }
.agent-efectividad-chips { display: grid; gap: 4px; }
.agent-channel-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #f8fafc;
  border-radius: 7px;
  padding: 4px 7px;
  font-size: 10px;
}
.agent-channel-chip i { color: var(--agent-channel-color, #6c757d); }
.agent-channel-count { margin-left: auto; font-weight: 700; }
.agent-clasif-chip[data-clasif="1"] { --agent-channel-color: #16a34a; }
.agent-clasif-chip[data-clasif="2"] { --agent-channel-color: #dc2626; }
.agent-clasif-chip[data-clasif="3"] { --agent-channel-color: #d97706; }
.agent-clasif-chip[data-clasif="4"] { --agent-channel-color: #ea580c; }
.agent-clasif-chip[data-clasif="5"] { --agent-channel-color: #6b7280; }

/* Log */
.agent-inicio-col-log > .custom-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.agent-inicio-col-log > .custom-card > .card-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 0;
}
#agentInicioTabs,
.agent-inicio-col-log .nav-tabs {
  display: flex;
  flex-wrap: nowrap;
  list-style: none;
  margin: 0;
  padding: 0;
  border-bottom: 1px dashed var(--mk-line);
}
.agent-inicio-col-log .nav-item { flex: 1; min-width: 0; }
.agent-inicio-col-log .nav-link {
  width: 100%;
  border: 0;
  background: none;
  padding: 8px 2px;
  font-size: 10px;
  font-weight: 700;
  color: #8c9097;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.agent-inicio-col-log .nav-link i { display: none; }
.agent-inicio-col-log .nav-link.active {
  color: var(--primary-color);
  box-shadow: inset 0 -2px 0 var(--primary-color);
}
.agent-inicio-col-log .tab-content {
  flex: 1;
  min-height: 0;
  padding: 0 10px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.agent-inicio-col-log .tab-pane {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.agent-log-scroll {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.crm-recent-activity {
  list-style: none;
  margin: 0;
  padding: 2px 0 8px;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.crm-recent-activity-content {
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid #f3f4f6;
}
.crm-recent-activity-content:last-child { border-bottom: 0; }
.crm-recent-activity-content > .d-flex {
  width: 100%;
  align-items: center;
  min-width: 0;
}
.crm-timeline-content { min-width: 0; flex: 1; }
.crm-log-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  min-width: 0;
  margin-bottom: 2px;
}
.crm-timeline-content .fw-semibold {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  line-height: 1.2;
}
.crm-log-contact {
  display: block;
  font-size: 11px;
  line-height: 1.25;
  color: var(--mk-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.crm-log-side {
  flex: 0 0 auto;
  text-align: right;
  margin-left: 8px;
}
.crm-log-side time {
  display: block;
  font-size: 10px;
  color: var(--mk-muted);
  margin-bottom: 3px;
}

.agent-card-flex { flex: 1; min-height: 0; }
.agent-inicio-col-ops .agent-card-flex,
.agent-inicio-col-dyn .agent-card-flex { overflow: auto; }

.position-relative { position: relative; }
.overflow-hidden { overflow: hidden; }

/* ===== Vista móvil: mismo flujo que el agente en celular ===== */
@media (max-width: 719px) {
  html, body {
    overflow: hidden;
    font-size: 12px;
  }

  .page {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
  }

  .agent-header {
    flex: 0 0 var(--agent-header-h);
  }

  .agent-header__brand {
    width: 48px;
    flex: 0 0 48px;
  }

  .logo-lg { display: none; }
  .logo-mini {
    display: block;
  }
  .logo-mini img {
    height: 26px;
    width: 26px;
  }

  .agent-header__toggle { display: inline-flex; }
  .agent-header__btn--desk { display: none; }
  .agent-header__profile-name,
  .agent-header__profile-caret { display: none; }
  .agent-header__status-time { display: none; }
  .agent-header__status {
    padding: 3px 8px 3px 3px;
    margin-right: 2px;
  }

  .agent-sidebar { display: none; }

  .main-content {
    flex: 1 1 auto;
    height: auto;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 8px;
  }

  .content {
    height: auto;
    flex: none;
  }

  .row.g-3 {
    display: flex;
    flex-direction: column;
    height: auto;
    min-height: 0;
    gap: 8px;
  }

  .agent-inicio-col-ops,
  .agent-inicio-col-dyn,
  .agent-inicio-col-log {
    display: block;
    height: auto;
    min-height: 0;
  }

  .agent-card-flex,
  .agent-inicio-col-ops .agent-card-flex,
  .agent-inicio-col-dyn .agent-card-flex,
  .agent-inicio-col-log > .custom-card,
  .agent-inicio-col-log > .custom-card > .card-body,
  .agent-inicio-col-log .tab-content,
  .agent-inicio-col-log .tab-pane,
  .agent-log-scroll,
  .crm-recent-activity {
    flex: none;
    height: auto;
    max-height: none;
    min-height: 0;
    overflow: visible;
  }

  .agent-welcome-visual { display: none; }

  .agent-card-tabs {
    width: 100%;
    margin-left: 0;
    overflow-x: auto;
  }

  .card-header {
    flex-wrap: wrap;
  }

  .agent-wide-kpis .agent-kpi-grid,
  .agent-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .agent-efectividad-split {
    grid-template-columns: 1fr;
    justify-items: center;
  }

  .mock-donut { width: 84px; height: 84px; }

  .agent-inicio-col-log .nav-link i { display: inline; }
}
