:root {
  --g1: #0891b2;
  --g2: #0e7490;
  --g3: #164e63;
  --g4: #22d3ee;

  --bg0: #f0f4f8;
  --bg1: #ffffff;
  --bg2: #f0f4f8;
  --bg3: #e2e8f0;
  --bg4: #cbd5e1;

  --bub-in: #e2e8f0;
  --bub-out: #bfefff;
  --bd: #e2e8f0;

  --tx: #1a2535;
  --tx1: var(--tx);
  --tx2: #64748b;
  --tx3: #94a3b8;

  --red: #f15c6d;
  --warn: #f0b429;
  --info: #0891b2;

  --F: "Inter", system-ui, sans-serif;
  --nav-w: 76px;
  --inbox-w: 310px;
  --anim: 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
html,
body {
  height: 100%;
  overflow: hidden;
}
body {
  font-family: var(--F);
  background: var(--bg0);
  color: var(--tx);
  display: flex;
  flex-direction: column;
  font-size: 15px;
}
::-webkit-scrollbar {
  width: 4px;
}
::-webkit-scrollbar-thumb {
  background: var(--bg4);
  border-radius: 2px;
}
#login {
  position: fixed;
  inset: 0;
  background: var(--bg0);
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lbox {
  background: var(--bg1);
  border-radius: 20px;
  padding: 48px 40px;
  width: 380px;
  text-align: center;
  border: 1px solid var(--bg3);
}
.llogo {
  width: 72px;
  height: 72px;
  background: linear-gradient(135deg, var(--g1), var(--g3));
  border-radius: 50%;
  margin: 0 auto 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.llogo svg {
  width: 38px;
  height: 38px;
  fill: #fff;
}
.ltitle {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: 4px;
}
.lsub {
  font-size: 13px;
  color: var(--g1);
  font-weight: 500;
  margin-bottom: 32px;
}
.linput {
  width: 100%;
  background: var(--bg2);
  border: 1.5px solid var(--bd);
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 14px;
  color: var(--tx);
  font-family: var(--F);
  margin-bottom: 10px;
  outline: none;
  transition: border-color var(--anim);
}
.linput:focus {
  border-color: var(--g1);
}
.lbtn {
  width: 100%;
  padding: 14px;
  background: var(--g1);
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  margin-top: 4px;
  transition: all var(--anim);
}
.lbtn:hover {
  background: var(--g2);
  transform: translateY(-1px);
}
#qr {
  position: fixed;
  inset: 0;
  background: var(--bg0);
  z-index: 998;
  display: none;
  align-items: center;
  justify-content: center;
}
.qbox {
  background: var(--bg1);
  border-radius: 20px;
  padding: 40px;
  text-align: center;
  border: 1px solid var(--bg3);
  max-width: 360px;
}
#qr-img {
  width: 240px;
  height: 240px;
  border-radius: 16px;
  background: #fff;
  padding: 10px;
  margin: 20px auto;
  display: block;
}
.qsteps {
  font-size: 13px;
  color: var(--tx2);
  line-height: 2;
  margin-top: 16px;
}
.qsteps b {
  color: var(--g1);
}
@keyframes blink {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.3;
  }
}
.blink {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--warn);
  animation: blink 1.5s infinite;
  margin-right: 6px;
}
.topbar {
  min-height: 64px;
  flex-shrink: 0;
  z-index: 10;

  display: flex;
  align-items: center;
  gap: 14px;

  padding: 8px 16px;

  background: var(--bg1);
  border-bottom: 1px solid var(--bd);
}
.tb-toggle {
  width: 36px;
  height: 36px;
  flex-shrink: 0;

  display: flex;
  align-items: center;
  justify-content: center;

  border: 1px solid var(--bd);
  border-radius: 10px;

  background: var(--bg2);
  color: var(--tx2);

  cursor: pointer;
  transition:
    background var(--anim),
    border-color var(--anim),
    color var(--anim),
    transform var(--anim);
}

.tb-toggle:hover {
  background: var(--bg3);
  border-color: var(--g1);
  color: var(--tx);
  transform: translateY(-1px);
}
.tb-toggle svg {
  width: 18px;
  height: 18px;
}
.logo {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
.topbar-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.logo-image {
  height: 38px;
  display: flex;
  align-items: center;

  padding: 4px 8px;

  border: 1px solid var(--bd);
  border-radius: 10px;

  background: #fff;
}

.logo-image img {
  display: block;
  width: auto;
  height: 100%;
  object-fit: contain;
}
.logo-ic {
  width: 34px;
  height: 34px;
  background: linear-gradient(135deg, var(--g1), var(--g3));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.logo-ic svg {
  width: 18px;
  height: 18px;
  fill: #fff;
}
.logo-name {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.4px;
}
.logo-tag {
  font-size: 10px;
  color: var(--g1);
  font-weight: 600;
  letter-spacing: 0.3px;
  margin-top: -2px;
}
.wa-chip {
  min-height: 34px;

  display: inline-flex;
  align-items: center;
  gap: 7px;

  padding: 0 11px;

  border: 1px solid;
  border-radius: 999px;

  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;

  transition: all var(--anim);
}
.wa-chip.connected {
  border-color: #00a88440;
  background: #00a88415;
  color: var(--g1);
}
.wa-chip.disconnected {
  border-color: #f15c6d40;
  background: #f15c6d15;
  color: var(--red);
}
.wa-chip.qr,
.wa-chip.authenticated {
  border-color: #f0b42940;
  background: #f0b42915;
  color: var(--warn);
}
.wa-status-dot {
  width: 7px;
  height: 7px;
  flex-shrink: 0;

  border-radius: 50%;
  background: currentColor;
}
.stats {
  flex: 1;
  min-width: 0;

  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.stat {
  min-width: 132px;
  height: 44px;

  display: flex;
  align-items: center;
  gap: 9px;

  padding: 6px 11px;

  border: 1px solid var(--bd);
  border-radius: 12px;

  background: var(--bg2);
}
.stat-icon {
  width: 28px;
  height: 28px;
  flex-shrink: 0;

  display: flex;
  align-items: center;
  justify-content: center;

  border-radius: 9px;

  font-size: 12px;
  font-weight: 900;
}

.stat-icon-agents {
  background: rgba(8, 145, 178, 0.11);
  color: var(--g1);
}

.stat-icon-open {
  background: rgba(240, 180, 41, 0.12);
  color: #b7791f;
}

.stat-icon-unassigned {
  background: rgba(241, 92, 109, 0.11);
  color: var(--red);
}

.stat-content {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.stat-content strong {
  overflow: hidden;

  color: var(--tx);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.2;

  text-overflow: ellipsis;
  white-space: nowrap;
}

.stat-content span {
  margin-top: 2px;

  color: var(--tx3);
  font-size: 9px;
  font-weight: 600;
  white-space: nowrap;
}
.me-pill {
  min-width: 190px;
  min-height: 44px;
  flex-shrink: 0;

  display: flex;
  align-items: center;
  gap: 9px;

  padding: 5px 7px 5px 8px;

  border: 1px solid var(--bd);
  border-radius: 12px;

  background: var(--bg2);

  transition:
    border-color var(--anim),
    background var(--anim),
    box-shadow var(--anim);
}

.me-pill:hover {
  border-color: rgba(8, 145, 178, 0.35);
  background: var(--bg1);
}
.me-av {
  width: 30px;
  height: 30px;
  flex-shrink: 0;

  display: flex;
  align-items: center;
  justify-content: center;

  border-radius: 9px;

  font-size: 10px;
  font-weight: 800;
}
.me-nm {
  display: block;
  max-width: 105px;

  overflow: hidden;

  color: var(--tx);
  font-size: 11px;
  font-weight: 800;

  text-overflow: ellipsis;
  white-space: nowrap;
}
.status-sel {
  max-width: 115px;

  padding: 0;

  border: none;
  outline: none;

  background: transparent;
  color: var(--tx2);

  cursor: pointer;

  font-family: var(--F);
  font-size: 9px;
  font-weight: 800;

  transition: color var(--anim);
}
/* Estado disponible */

.me-pill.status-online {
  border-color: rgba(22, 163, 74, 0.28);
  background: rgba(22, 163, 74, 0.07);
  box-shadow: 0 0 0 1px rgba(22, 163, 74, 0.03);
}

.me-pill.status-online .status-sel {
  color: #15803d;
}

.me-pill.status-online .me-av {
  background: rgba(22, 163, 74, 0.14);
  color: #15803d;
}

/* Estado ocupado */

.me-pill.status-busy {
  border-color: rgba(240, 180, 41, 0.38);
  background: rgba(240, 180, 41, 0.09);
  box-shadow: 0 0 0 1px rgba(240, 180, 41, 0.04);
}

.me-pill.status-busy .status-sel {
  color: #b7791f;
}

.me-pill.status-busy .me-av {
  background: rgba(240, 180, 41, 0.16);
  color: #a16207;
}

/* Estado ausente */

.me-pill.status-away {
  border-color: rgba(241, 92, 109, 0.3);
  background: rgba(241, 92, 109, 0.08);
  box-shadow: 0 0 0 1px rgba(241, 92, 109, 0.04);
}

.me-pill.status-away .status-sel {
  color: var(--red);
}

.me-pill.status-away .me-av {
  background: rgba(241, 92, 109, 0.14);
  color: var(--red);
}
.me-data {
  flex: 1;
  min-width: 0;
}

.logout-btn {
  width: 30px;
  height: 30px;
  flex-shrink: 0;

  display: flex;
  align-items: center;
  justify-content: center;

  border: none;
  border-radius: 8px;

  background: transparent;
  color: var(--tx2);

  cursor: pointer;
  font-size: 14px;

  transition:
    background var(--anim),
    color var(--anim);
}

.logout-btn:hover {
  background: rgba(241, 92, 109, 0.1);
  color: var(--red);
}
.workspace {
  display: flex;
  flex: 1;
  overflow: hidden;
}
.search-box input {
  width: 100%;
  background: var(--bg3);
  border: none;
  border-radius: 10px;
  padding: 9px 14px 9px 36px;
  font-size: 14px;
  color: var(--tx);
  font-family: var(--F);
  outline: none;
  transition: background var(--anim);
}
.search-box input:focus {
  background: var(--bg4);
}
.search-box input::placeholder {
  color: var(--tx2);
}
.search-wrap {
  position: relative;
}
.search-wrap svg {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  color: var(--tx2);
}
.sec-label {
  padding: 10px 16px 4px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.9px;
  color: var(--tx3);
}
.agents-grid {
  flex: 1;
  overflow-y: auto;
  padding: 10px;

  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  align-content: start;
}

.ag-card {
  min-width: 0;
  padding: 10px;

  background: var(--bg1);
  border: 1px solid var(--bd);
  border-radius: 13px;

  transition:
    transform var(--anim),
    border-color var(--anim),
    box-shadow var(--anim),
    background var(--anim);
}

.ag-card:hover {
  transform: translateY(-1px);
  border-color: rgba(8, 145, 178, 0.28);
  box-shadow: 0 7px 16px rgba(15, 23, 42, 0.06);
}

.ag-top {
  display: flex;
  align-items: center;
  gap: 8px;

  margin-bottom: 6px;
}

.ag-av {
  width: 34px;
  height: 34px;
  flex-shrink: 0;

  display: flex;
  align-items: center;
  justify-content: center;

  border-radius: 11px;

  font-size: 11px;
  font-weight: 800;
}

.ag-name {
  display: flex;
  align-items: center;
  gap: 4px;

  overflow: hidden;

  color: var(--tx);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.2;
}

.ag-name span {
  flex-shrink: 0;

  color: var(--g1);
  font-size: 9px;
  font-weight: 900;
}

.ag-role {
  margin-top: 2px;

  color: var(--tx2);
  font-size: 9px;
  font-weight: 600;
}

.ag-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;

  margin: 5px 0 7px;
  padding: 3px 7px;

  border-radius: 999px;

  font-size: 9px;
  font-weight: 800;
}

.ag-n {
  color: var(--tx);
  font-size: 22px;
  font-weight: 900;
  line-height: 1;
  text-align: center;
}

.ag-l {
  margin-top: 2px;

  color: var(--tx3);
  font-size: 9px;
  font-weight: 700;
  text-align: center;
}
#dash-panel {
  flex: 1;
  min-width: 0;
  overflow-y: auto;

  display: none;
  flex-direction: column;
  align-items: stretch;
  gap: 16px;

  padding: 24px;

  background: var(--bg0);
}
.dash-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;

  flex-shrink: 0;
}
.dash-kpi {
  position: relative;
  min-width: 0;
  min-height: 132px;
  overflow: hidden;

  padding: 17px 18px;

  border: 1px solid var(--bd);
  border-top: 3px solid var(--g1);
  border-radius: 15px;

  background: var(--bg1);
  box-shadow: 0 5px 16px rgba(15, 23, 42, 0.04);

  transition:
    transform var(--anim),
    border-color var(--anim),
    box-shadow var(--anim);
}

.dash-kpi:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.07);
}
.dash-kpi-label {
  margin-bottom: 9px;

  color: var(--tx3);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.65px;
  text-transform: uppercase;
}
.dash-kpi-val {
  color: var(--tx);
  font-size: 34px;
  font-weight: 900;
  line-height: 1;
  letter-spacing: -1px;
}
.dash-kpi-sub {
  max-width: calc(100% - 54px);
  margin-top: 8px;

  color: var(--tx2);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.4;
}
.dash-kpi-ico {
  position: absolute;
  right: 16px;
  bottom: 16px;

  display: flex;
  align-items: center;
  justify-content: center;

  width: 42px;
  height: 42px;

  border-radius: 13px;

  background: var(--bg2);
  font-size: 20px;
  opacity: 0.55;
}
.dash-row {
  display: grid;
  grid-template-columns: minmax(290px, 0.8fr) minmax(0, 1.8fr);
  gap: 14px;

  flex-shrink: 0;
  align-items: start;
}
.dash-card {
  min-width: 0;
  overflow: hidden;
  flex-shrink: 0;

  border: 1px solid var(--bd);
  border-radius: 15px;

  background: var(--bg1);
  box-shadow: 0 5px 16px rgba(15, 23, 42, 0.04);
}
.dash-card-hdr {
  min-height: 54px;

  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;

  padding: 13px 16px;

  border-bottom: 1px solid var(--bd);

  color: var(--tx);
  font-size: 13px;
  font-weight: 800;
}
.dash-card-hdr span {
  flex-shrink: 0;

  padding: 3px 8px;

  border-radius: 999px;

  background: var(--bg3);
  color: var(--tx2);

  font-size: 9px;
  font-weight: 800;
}
.dash-ag-row {
  display: flex;
  align-items: center;
  gap: 10px;

  min-height: 66px;
  padding: 10px 15px;

  border-bottom: 1px solid var(--bd);

  transition: background var(--anim);
}

.dash-ag-row:last-child {
  border-bottom: 0;
}

.dash-ag-row:hover {
  background: var(--bg2);
}
.dash-c-row {
  display: flex;
  align-items: center;
  gap: 10px;

  min-height: 60px;
  padding: 10px 15px;

  border-bottom: 1px solid var(--bd);

  cursor: pointer;
  transition: background var(--anim);
}

.dash-c-row:last-child {
  border-bottom: 0;
}

.dash-c-row:hover {
  background: var(--bg2);
}
.dash-c-row:hover {
  background: var(--bg2);
}
.dash-ag-avatar {
  position: relative;

  width: 36px;
  height: 36px;
  flex-shrink: 0;

  display: flex;
  align-items: center;
  justify-content: center;

  border-radius: 11px;

  font-size: 12px;
  font-weight: 800;
}

.dash-ag-status-dot {
  position: absolute;
  right: -1px;
  bottom: -1px;

  width: 10px;
  height: 10px;

  border: 2px solid var(--bg1);
  border-radius: 50%;
}

.dash-ag-info {
  flex: 1;
  min-width: 0;
}

.dash-ag-name {
  overflow: hidden;

  color: var(--tx);
  font-size: 12px;
  font-weight: 800;

  text-overflow: ellipsis;
  white-space: nowrap;
}

.dash-ag-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;

  margin-top: 4px;
  padding: 3px 7px;

  border-radius: 999px;

  font-size: 9px;
  font-weight: 800;
}

.dash-ag-status-indicator {
  width: 5px;
  height: 5px;
  flex-shrink: 0;

  border-radius: 50%;
}

.dash-ag-metrics {
  flex-shrink: 0;
  text-align: right;
}

.dash-ag-metrics strong {
  display: block;

  font-size: 18px;
  font-weight: 900;
  line-height: 1;
}

.dash-ag-metrics span {
  display: block;
  margin-top: 3px;

  color: var(--tx3);
  font-size: 9px;
  font-weight: 700;
}

.dash-ag-metrics small {
  display: block;
  margin-top: 4px;

  color: #b7791f;
  font-size: 8px;
  font-weight: 700;
}

.dash-wait-avatar {
  width: 34px;
  height: 34px;
  flex-shrink: 0;

  display: flex;
  align-items: center;
  justify-content: center;

  border-radius: 11px;

  font-size: 11px;
  font-weight: 800;
}

.dash-wait-info {
  flex: 1;
  min-width: 0;
}

.dash-wait-name {
  overflow: hidden;

  color: var(--tx);
  font-size: 12px;
  font-weight: 800;

  text-overflow: ellipsis;
  white-space: nowrap;
}

.dash-wait-message {
  margin-top: 3px;
  overflow: hidden;

  color: var(--tx2);
  font-size: 10px;

  text-overflow: ellipsis;
  white-space: nowrap;
}

.dash-wait-time {
  flex-shrink: 0;

  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.dash-empty {
  min-height: 150px;

  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;

  padding: 24px;

  color: var(--tx3);
  text-align: center;
}

.dash-empty-icon {
  width: 42px;
  height: 42px;

  display: flex;
  align-items: center;
  justify-content: center;

  margin-bottom: 10px;

  border-radius: 13px;

  background: var(--bg2);
  color: var(--g1);

  font-size: 18px;
  font-weight: 900;
}

.dash-empty-title {
  color: var(--tx);
  font-size: 13px;
  font-weight: 800;
}

.dash-empty-text {
  max-width: 300px;
  margin-top: 5px;

  color: var(--tx3);
  font-size: 10px;
  line-height: 1.5;
}

.dash-empty-success .dash-empty-icon {
  background: rgba(22, 163, 74, 0.1);
  color: #15803d;
}
.dash-activity-card {
  grid-column: 1/-1;
}

.dash-alert-card.has-alerts {
  border-color: rgba(241, 92, 109, 0.25);
}

.dash-alert-card.has-alerts .dash-card-hdr {
  background: rgba(241, 92, 109, 0.05);
}

.dash-activity-heading {
  display: flex;
  align-items: center;
  gap: 7px;
}

.dash-activity-heading-icon {
  color: var(--g1);
  font-size: 14px;
}

.dash-activity-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.dash-activity-count {
  min-width: 20px;
  height: 20px;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  padding: 0 6px;

  border-radius: 999px;

  background: var(--bg2);
  color: var(--tx2);

  font-size: 9px;
  font-weight: 800;
}

.dash-activity-clear {
  padding: 4px 7px;

  border: 0;
  border-radius: 7px;

  background: transparent;
  color: var(--tx3);

  cursor: pointer;

  font-family: var(--F);
  font-size: 9px;
  font-weight: 700;

  transition:
    background var(--anim),
    color var(--anim);
}

.dash-activity-clear:hover {
  background: var(--bg2);
  color: var(--tx);
}

.dash-activity-list {
  max-height: 330px;
  overflow-y: auto;
}

.dash-activity-item {
  min-width: 0;

  display: flex;
  align-items: center;
  gap: 10px;

  padding: 10px 14px;

  border-bottom: 1px solid var(--bd);

  transition: background var(--anim);
}

.dash-activity-item:last-child {
  border-bottom: 0;
}

.dash-activity-item.is-clickable {
  cursor: pointer;
}

.dash-activity-item.is-clickable:hover {
  background: var(--bg2);
}

.dash-activity-icon {
  width: 30px;
  height: 30px;
  flex-shrink: 0;

  display: flex;
  align-items: center;
  justify-content: center;

  border-radius: 9px;

  background: var(--bg2);

  font-size: 13px;
}

.dash-activity-content {
  flex: 1;
  min-width: 0;
}

.dash-activity-title {
  overflow: hidden;

  color: var(--tx);
  font-size: 11px;
  font-weight: 800;

  text-overflow: ellipsis;
  white-space: nowrap;
}

.dash-activity-detail {
  margin-top: 3px;
  overflow: hidden;

  color: var(--tx2);
  font-size: 9px;

  text-overflow: ellipsis;
  white-space: nowrap;
}

.dash-activity-time {
  flex-shrink: 0;

  color: var(--tx3);
  font-size: 9px;
  font-weight: 700;
  white-space: nowrap;
}

.dash-activity-empty {
  min-height: 130px;

  display: flex;
  align-items: center;
  justify-content: center;
  gap: 11px;

  padding: 20px;
}

.dash-activity-empty-icon {
  width: 36px;
  height: 36px;
  flex-shrink: 0;

  display: flex;
  align-items: center;
  justify-content: center;

  border-radius: 11px;

  background: var(--bg2);
  color: var(--tx3);

  font-size: 15px;
}

.dash-activity-empty-title {
  color: var(--tx);
  font-size: 11px;
  font-weight: 800;
}

.dash-activity-empty-text {
  margin-top: 3px;

  color: var(--tx3);
  font-size: 9px;
}
.dash-alert-card {
  grid-column: 1 / -1;
  min-width: 0;
}

.dash-alert-count {
  min-width: 22px;
  height: 22px;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  padding: 0 7px;

  border-radius: 999px;

  background: var(--bg2);
  color: var(--tx2);

  font-size: 10px;
  font-weight: 800;
}

.dash-alert-count.has-alerts {
  background: rgba(241, 92, 109, 0.12);
  color: var(--red);
}

.dash-alert-list {
  min-height: 110px;
  display: flex;
  flex-direction: column;
}

.dash-alert-item {
  display: flex;
  align-items: center;
  gap: 12px;

  padding: 12px 16px;

  border-bottom: 1px solid var(--bd);
}

.dash-alert-item:last-child {
  border-bottom: 0;
}

.dash-alert-item.critical {
  background: rgba(241, 92, 109, 0.05);
}

.dash-alert-item.warning {
  background: rgba(240, 180, 41, 0.05);
}

.dash-alert-icon {
  width: 34px;
  height: 34px;
  flex-shrink: 0;

  display: flex;
  align-items: center;
  justify-content: center;

  border-radius: 10px;

  background: var(--bg2);

  font-size: 14px;
}

.dash-alert-content {
  min-width: 0;
}

.dash-alert-title {
  color: var(--tx);

  font-size: 12px;
  font-weight: 800;
}

.dash-alert-detail {
  margin-top: 3px;

  color: var(--tx2);

  font-size: 10px;
  line-height: 1.4;
}

.dash-alert-empty {
  min-height: 90px;

  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;

  padding: 20px;
}

.dash-alert-empty-icon {
  width: 38px;
  height: 38px;

  display: flex;
  align-items: center;
  justify-content: center;

  border-radius: 12px;

  background: rgba(0, 168, 132, 0.12);
  color: var(--green);

  font-size: 18px;
  font-weight: 800;
}

.dash-alert-empty-title {
  color: var(--tx);

  font-size: 12px;
  font-weight: 800;
}

.dash-alert-empty-text {
  margin-top: 3px;

  color: var(--tx3);

  font-size: 10px;
}
.chat-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--bg0);
}
.empty-st {
  flex: 1;
  min-height: 0;

  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;

  padding: 28px;

  color: var(--tx3);
  text-align: center;
}
.empty-st svg {
  width: 34px;
  height: 34px;

  color: var(--g1);
}
.empty-st h3 {
  margin: 5px 0 0;

  color: var(--tx);
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.3px;
}
.empty-st p {
  max-width: 340px;
  margin-top: 7px;

  color: var(--tx2);
  font-size: 13px;
  line-height: 1.55;
}
.empty-st-icon {
  width: 72px;
  height: 72px;

  display: flex;
  align-items: center;
  justify-content: center;

  border: 1px solid rgba(8, 145, 178, 0.16);
  border-radius: 22px;

  background: rgba(8, 145, 178, 0.07);
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.05);
}

.empty-st-content {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.empty-st-label {
  display: inline-flex;
  align-items: center;

  padding: 4px 9px;

  border-radius: 999px;

  background: rgba(8, 145, 178, 0.09);
  color: var(--g1);

  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.45px;
  text-transform: uppercase;
}

.notif-stack {
  position: fixed;
  top: 68px;
  right: 16px;
  z-index: 500;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
@keyframes nIn {
  from {
    transform: translateX(110%);
    opacity: 0;
  }
  to {
    transform: none;
    opacity: 1;
  }
}
.notif {
  background: var(--bg2);
  border-left: 3px solid var(--g1);
  border-radius: 12px;
  padding: 12px 16px;
  min-width: 280px;
  display: flex;
  gap: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  animation: nIn 0.3s ease;
  pointer-events: all;
}
.notif-ic {
  font-size: 20px;
}
.notif-t {
  font-size: 13px;
  font-weight: 600;
}
.notif-s {
  font-size: 12px;
  color: var(--tx2);
  margin-top: 2px;
}
.hist-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  cursor: pointer;
  transition: background var(--anim);
  border-bottom: 1px solid #2a394222;
}
.hist-item:hover {
  background: var(--bg2);
}
.hist-resolved {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 8px;
  background: #00a88420;
  color: var(--g1);
  font-weight: 600;
}
[data-theme="dark"] {
  --bg0: #0a0f14;
  --bg1: #111820;
  --bg2: #172030;
  --bg3: #1e2a3a;
  --bg4: #253447;
  --bub-in: #1a2535;
  --bub-out: #0c3a4a;
  --bd: #253447;
  --tx: #e9edef;
  --tx2: #8696a0;
  --tx3: #3b4a54;
}
[data-theme="light"] {
  --bg0: #f0f4f8;
  --bg1: #ffffff;
  --bg2: #f0f4f8;
  --bg3: #e2e8f0;
  --bg4: #cbd5e1;
  --bub-in: #e2e8f0;
  --bub-out: #bfefff;
  --bd: #e2e8f0;
  --tx: #1a2535;
  --tx2: #64748b;
  --tx3: #94a3b8;
}
.admin-tools-compact {
  grid-column: 1 / -1;

  display: flex;
  align-items: center;
  gap: 14px;

  min-height: 52px;
  padding: 8px 16px;

  border: 1px solid var(--bd);
  border-radius: 15px;
  background: var(--bg1);
  box-shadow: 0 5px 16px rgba(15, 23, 42, 0.04);

  overflow: hidden;
}

.admin-tools-info {
  flex: 1;
  min-width: 0;

  display: flex;
  align-items: center;
  gap: 12px;
}

.admin-tools-icon {
  width: 36px;
  height: 36px;

  border-radius: 10px;

  display: flex;
  align-items: center;
  justify-content: center;

  font-size: 16px;
}

.admin-tools-content {
  min-width: 0;
}

.admin-tools-title {
  margin: 0;

  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
}

.admin-tools-description {
  margin-top: 2px;

  font-size: 11px;
  line-height: 1.2;

  color: var(--tx3);
}

.admin-tools-btn {
  margin-left: auto;

  height: 34px;
  padding: 0 14px;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  background: var(--card); /* antes era rgba(...) */

  border: 1px solid var(--bd);
  border-radius: 10px;

  color: #f15c6d;

  font-size: 12px;
  font-weight: 700;

  cursor: pointer;

  transition: all 0.2s ease;
}

.admin-tools-btn:hover {
  background: #f4c3c3; /* o var(--card) */
  border-color: rgba(241, 92, 109, 0.35);
  color: #e6495c;
}

.admin-tools-btn:active {
  transform: translateY(0);
}

.admin-tools-btn:disabled {
  opacity: 0.55;
  cursor: wait;
  transform: none;
}
/* =========================================================
   ENCUESTAS DE SATISFACCIÓN
   ========================================================= */

#surveys-panel {
  flex: 1;
  min-width: 0;
  height: 100%;
  overflow-y: auto;
  padding: 24px;
  background: var(--bg2);
}

.surveys-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

.surveys-title {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--tx1);
}

.surveys-subtitle {
  margin-top: 4px;
  font-size: 13px;
  color: var(--tx2);
}

.surveys-back-btn {
  border: 1px solid var(--bd);
  background: rgba(35, 138, 228, 0.826);
  color: rgb(249, 249, 251);
  border-radius: 10px;
  padding: 9px 16px;
  font-family: var(--F);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: 0.2s ease;
}

.surveys-back-btn:hover {
  color: var(--tx1);
  border-color: var(--g1);
  transform: translateY(-1px);
}

.surveys-kpis {
  display: grid;
  grid-template-columns: repeat(5, minmax(150px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.survey-kpi {
  position: relative;
  overflow: hidden;
  min-height: 118px;
  padding: 18px;
  border: 1px solid var(--bd);
  border-radius: 14px;
  background: var(--bg1);
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.05);
}

.survey-kpi::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: var(--g1);
}

.survey-kpi-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--tx2);
}

.survey-kpi-value {
  margin-top: 10px;
  font-size: 30px;
  line-height: 1;
  font-weight: 800;
  color: var(--tx1);
}

.survey-kpi-sub {
  margin-top: 8px;
  font-size: 12px;
  color: var(--tx2);
}

.surveys-content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.8fr);
  gap: 16px;
  margin-bottom: 16px;
}

.surveys-card {
  border: 1px solid var(--bd);
  border-radius: 14px;
  background: var(--bg1);
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.05);
}

.surveys-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--bd);
}

.surveys-card-title {
  font-size: 15px;
  font-weight: 800;
  color: var(--tx1);
}

.surveys-card-subtitle {
  margin-top: 3px;
  font-size: 12px;
  color: var(--tx2);
}

#sv-questions,
#sv-classifications {
  min-height: 160px;
  padding: 18px 20px;
}

.surveys-table-card {
  overflow: hidden;
}

.surveys-table-header {
  align-items: center;
  flex-wrap: wrap;
}

.surveys-filters {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.surveys-input,
.surveys-select {
  height: 38px;
  border: 1px solid var(--bd);
  border-radius: 9px;
  background: var(--bg2);
  color: var(--tx1);
  font-family: var(--F);
  font-size: 12px;
  outline: none;
  transition: 0.2s ease;
}

.surveys-input {
  width: 250px;
  padding: 0 12px;
}

.surveys-select {
  padding: 0 10px;
  cursor: pointer;
}

.surveys-input:focus,
.surveys-select:focus {
  border-color: var(--g1);
  box-shadow: 0 0 0 3px rgba(0, 168, 132, 0.12);
}

.surveys-table-wrap {
  width: 100%;
  overflow-x: auto;
}

.surveys-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 900px;
}

.surveys-table th {
  padding: 13px 16px;
  background: var(--bg2);
  border-bottom: 1px solid var(--bd);
  text-align: left;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.35px;
  color: var(--tx2);
}

.surveys-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--bd);
  font-size: 13px;
  color: var(--tx1);
  vertical-align: middle;
}

.surveys-table tbody tr:hover {
  background: rgba(0, 168, 132, 0.04);
}

.surveys-empty {
  padding: 30px !important;
  text-align: center;
  color: var(--tx2) !important;
}

@media (max-width: 1200px) {
  .surveys-kpis {
    grid-template-columns: repeat(3, minmax(150px, 1fr));
  }

  .dash-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dash-row {
    grid-template-columns: 1fr;
  }

  .surveys-content-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 800px) {
  #surveys-panel {
    padding: 16px;
  }

  .surveys-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .surveys-kpis {
    grid-template-columns: repeat(2, minmax(130px, 1fr));
  }

  .surveys-filters {
    width: 100%;
    justify-content: flex-start;
  }

  .surveys-input {
    width: 100%;
  }
}

@media (max-width: 520px) {
  .surveys-kpis {
    grid-template-columns: 1fr;
  }
}

.survey-question-row,
.survey-classification-row {
  margin-bottom: 16px;
}

.survey-question-row:last-child,
.survey-classification-row:last-child {
  margin-bottom: 0;
}

.survey-question-top,
.survey-classification-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 7px;
  font-size: 13px;
  color: var(--tx1);
}

.survey-question-top span,
.survey-classification-top span {
  color: var(--tx2);
}

.survey-question-top strong,
.survey-classification-top strong {
  font-size: 13px;
  color: var(--tx1);
}

.survey-progress {
  width: 100%;
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--bg2);
}

.survey-progress-bar {
  height: 100%;
  min-width: 0;
  border-radius: inherit;
  background: var(--g1);
  transition: width 0.3s ease;
}

/* =========================================================
   ENCUESTA PRESENCIAL
   ========================================================= */

.hidden {
  display: none !important;
}

#btn-send-manual-survey {
  width: 100%;
  min-height: 82px;

  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;

  margin: 14px 0 0;
  padding: 10px 5px;

  border: 0;
  border-top: 1px solid var(--bd);
  border-radius: 0;

  background: transparent;
  color: var(--tx2);

  font-family: var(--F);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.15;
  text-align: center;

  cursor: pointer;

  box-shadow: none;

  transition:
    background var(--anim),
    color var(--anim),
    transform var(--anim);
}

#btn-send-manual-survey:hover {
  transform: none;

  background: rgba(8, 145, 178, 0.08);
  color: var(--g1);

  box-shadow: none;
}

#btn-send-manual-survey:active {
  transform: scale(0.98);
}

#btn-send-manual-survey .manual-survey-icon {
  width: 40px;
  height: 40px;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  border-radius: 13px;

  background: rgba(8, 145, 178, 0.1);
  color: var(--g1);

  font-size: 20px;

  transition:
    background var(--anim),
    transform var(--anim);
}

#btn-send-manual-survey:hover .manual-survey-icon {
  transform: translateY(-1px);
  background: rgba(8, 145, 178, 0.16);
}

#btn-send-manual-survey .manual-survey-label {
  display: block;
  max-width: 72px;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 9999;

  display: flex;
  align-items: center;
  justify-content: center;

  padding: 20px;

  background: rgba(15, 23, 42, 0.52);
  backdrop-filter: blur(5px);
}

.modal-content {
  width: min(520px, 100%);
  max-height: calc(100vh - 40px);
  overflow-y: auto;

  padding: 0;

  border: 1px solid var(--bd);
  border-radius: 18px;

  background: var(--bg1);

  box-shadow:
    0 24px 70px rgba(15, 23, 42, 0.25),
    0 8px 24px rgba(15, 23, 42, 0.12);
}

.modal-header {
  min-height: 72px;

  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;

  padding: 20px 22px;

  border-bottom: 1px solid var(--bd);
}

.modal-header h3 {
  margin: 0;

  color: var(--tx1);
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.3px;
}

.modal-close {
  width: 36px;
  height: 36px;
  flex-shrink: 0;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  border: 1px solid var(--bd);
  border-radius: 10px;

  background: var(--bg2);
  color: var(--tx2);

  font-family: var(--F);
  font-size: 22px;
  line-height: 1;

  cursor: pointer;

  transition:
    background var(--anim),
    border-color var(--anim),
    color var(--anim),
    transform var(--anim);
}

.modal-close:hover {
  transform: rotate(3deg);

  border-color: var(--g1);
  background: rgba(8, 145, 178, 0.09);
  color: var(--g1);
}

.modal-body {
  display: flex;
  flex-direction: column;
  gap: 8px;

  padding: 22px;
}

.modal-body label {
  margin-top: 6px;

  color: var(--tx1);
  font-size: 11px;
  font-weight: 800;
}

.modal-body label:first-child {
  margin-top: 0;
}

.modal-body input,
.modal-body select {
  width: 100%;
  min-height: 42px;

  padding: 0 12px;

  border: 1px solid var(--bd);
  border-radius: 10px;
  outline: none;

  background: var(--bg2);
  color: var(--tx1);

  font-family: var(--F);
  font-size: 13px;

  transition:
    border-color var(--anim),
    background var(--anim),
    box-shadow var(--anim);
}

.modal-body input::placeholder {
  color: var(--tx3);
}

.modal-body input:hover,
.modal-body select:hover {
  border-color: rgba(8, 145, 178, 0.35);
}

.modal-body input:focus,
.modal-body select:focus {
  border-color: var(--g1);
  background: var(--bg1);

  box-shadow: 0 0 0 3px rgba(8, 145, 178, 0.11);
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;

  padding: 16px 22px 20px;

  border-top: 1px solid var(--bd);
}

.modal-footer .btn {
  min-height: 40px;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  padding: 0 16px;

  border-radius: 10px;

  font-family: var(--F);
  font-size: 12px;
  font-weight: 800;

  cursor: pointer;

  transition:
    transform var(--anim),
    background var(--anim),
    border-color var(--anim),
    box-shadow var(--anim);
}

.modal-footer .btn:hover {
  transform: translateY(-1px);
}

.modal-footer .btn:active {
  transform: translateY(0);
}

.modal-footer .btn-secondary {
  border: 1px solid var(--bd);

  background: var(--bg2);
  color: var(--tx2);
}

.modal-footer .btn-secondary:hover {
  border-color: var(--g1);

  background: var(--bg3);
  color: var(--tx1);
}

.modal-footer .btn-primary {
  border: 1px solid var(--g1);

  background: var(--g1);
  color: #fff;

  box-shadow: 0 6px 14px rgba(8, 145, 178, 0.2);
}

.modal-footer .btn-primary:hover {
  background: var(--g2);

  box-shadow: 0 9px 18px rgba(8, 145, 178, 0.26);
}

.modal-footer .btn-primary:disabled {
  opacity: 0.55;
  cursor: wait;
  transform: none;
  box-shadow: none;
}

@media (max-width: 560px) {
  .modal {
    align-items: flex-end;
    padding: 10px;
  }

  .modal-content {
    width: 100%;
    max-height: 92vh;

    border-radius: 18px 18px 12px 12px;
  }

  .modal-header,
  .modal-body,
  .modal-footer {
    padding-right: 16px;
    padding-left: 16px;
  }

  .modal-footer {
    flex-direction: column-reverse;
  }

  .modal-footer .btn {
    width: 100%;
  }

  #btn-send-manual-survey {
    width: 100%;
  }
}

/* =========================================================
   MODAL DETALLE DE ENCUESTA
   ========================================================= */

.survey-detail-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1200;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.48);
  backdrop-filter: blur(4px);
}

.survey-detail-overlay.open {
  display: flex;
}

.survey-detail-modal {
  width: min(760px, 100%);
  max-height: calc(100vh - 48px);
  overflow: hidden;
  border: 1px solid var(--bd);
  border-radius: 18px;
  background: var(--bg1);
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.28);
}

.survey-detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 20px 22px;
  border-bottom: 1px solid var(--bd);
}

.survey-detail-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--tx1);
}

.survey-detail-subtitle {
  margin-top: 4px;
  font-size: 12px;
  color: var(--tx2);
}

.survey-detail-close {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border: 1px solid var(--bd);
  border-radius: 10px;
  background: var(--bg2);
  color: var(--tx2);
  font-family: var(--F);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.survey-detail-close:hover {
  color: var(--tx1);
  border-color: var(--g1);
}

.survey-detail-body {
  max-height: calc(100vh - 150px);
  overflow-y: auto;
  padding: 22px;
}

.survey-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.survey-detail-field {
  padding: 14px;
  border: 1px solid var(--bd);
  border-radius: 12px;
  background: var(--bg2);
}

.survey-detail-field-label {
  margin-bottom: 5px;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--tx2);
}

.survey-detail-field-value {
  overflow-wrap: anywhere;
  font-size: 13px;
  font-weight: 700;
  color: var(--tx1);
}

.survey-detail-section {
  margin-top: 18px;
}

.survey-detail-section-title {
  margin-bottom: 10px;
  font-size: 13px;
  font-weight: 800;
  color: var(--tx1);
}

.survey-detail-answer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 52px;
  align-items: center;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--bd);
}

.survey-detail-answer:last-child {
  border-bottom: none;
}

.survey-detail-answer-label {
  font-size: 13px;
  color: var(--tx2);
}

.survey-detail-answer-value {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  border-radius: 10px;
  background: rgba(0, 168, 132, 0.11);
  font-size: 15px;
  font-weight: 800;
  color: var(--g1);
}

.survey-detail-comment {
  min-height: 80px;
  padding: 14px;
  border: 1px solid var(--bd);
  border-radius: 12px;
  background: var(--bg2);
  white-space: pre-wrap;
  font-size: 13px;
  line-height: 1.55;
  color: var(--tx1);
}

.survey-detail-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 18px;
}

.survey-followup-resolve-btn {
  border: none;
  border-radius: 10px;
  padding: 10px 16px;
  background: var(--g1);
  color: #fff;
  font-family: var(--F);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.survey-followup-resolve-btn:hover {
  opacity: 0.9;
}

@media (max-width: 640px) {
  .survey-detail-overlay {
    padding: 12px;
  }

  .survey-detail-grid {
    grid-template-columns: 1fr;
  }

  .survey-detail-body {
    padding: 16px;
  }
}

/* =========================================================
   ENCUESTA - DETALLE VISUAL
   ========================================================= */

.survey-detail-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 20px;
  align-items: center;
  margin-bottom: 22px;
  padding: 20px;
  border: 1px solid var(--bd);
  border-radius: 16px;
  background: linear-gradient(
    135deg,
    rgba(0, 168, 132, 0.1),
    rgba(0, 168, 132, 0.02)
  );
}

.survey-detail-person {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.survey-detail-avatar {
  display: flex;
  width: 52px;
  height: 52px;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  border-radius: 15px;
  background: var(--g1);
  color: #fff;
  font-size: 20px;
  font-weight: 800;
  box-shadow: 0 8px 20px rgba(0, 168, 132, 0.2);
}

.survey-detail-person-data {
  min-width: 0;
}

.survey-detail-person-name {
  overflow: hidden;
  color: var(--tx1);
  font-size: 16px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.survey-detail-person-phone {
  margin-top: 4px;
  color: var(--tx2);
  font-size: 12px;
}

.survey-detail-score {
  min-width: 150px;
  text-align: right;
}

.survey-detail-score-value {
  color: var(--tx1);
  font-size: 28px;
  font-weight: 900;
  line-height: 1;
}

.survey-detail-score-value span {
  color: var(--tx2);
  font-size: 13px;
  font-weight: 700;
}

.survey-detail-stars {
  margin-top: 7px;
  letter-spacing: 2px;
  color: #f4b740;
  font-size: 17px;
}

.survey-detail-score-label {
  margin-top: 5px;
  color: var(--tx2);
  font-size: 11px;
}

.survey-detail-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}

.survey-detail-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 32px;
  padding: 6px 11px;
  border: 1px solid var(--bd);
  border-radius: 999px;
  background: var(--bg2);
  color: var(--tx2);
  font-size: 11px;
  font-weight: 800;
}

.survey-detail-badge.success {
  border-color: rgba(22, 163, 74, 0.25);
  background: rgba(22, 163, 74, 0.09);
  color: #15803d;
}

.survey-detail-badge.warning {
  border-color: rgba(245, 158, 11, 0.3);
  background: rgba(245, 158, 11, 0.1);
  color: #b45309;
}

.survey-detail-badge.danger {
  border-color: rgba(220, 38, 38, 0.25);
  background: rgba(220, 38, 38, 0.08);
  color: #b91c1c;
}

.survey-detail-badge.neutral {
  border-color: rgba(100, 116, 139, 0.25);
  background: rgba(100, 116, 139, 0.08);
  color: #64748b;
}

.survey-detail-answers {
  display: grid;
  gap: 10px;
}

.survey-detail-answer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 14px 16px;
  border: 1px solid var(--bd);
  border-radius: 13px;
  background: var(--bg2);
  transition:
    transform 0.18s ease,
    border-color 0.18s ease,
    box-shadow 0.18s ease;
}

.survey-detail-answer:hover {
  transform: translateY(-1px);
  border-color: rgba(0, 168, 132, 0.3);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.06);
}

.survey-detail-answer-info {
  min-width: 0;
}

.survey-detail-answer-number {
  margin-bottom: 4px;
  color: var(--g1);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.survey-detail-answer-label {
  color: var(--tx1);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.45;
}

.survey-detail-answer-score {
  display: flex;
  min-width: 62px;
  height: 42px;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 900;
}

.survey-detail-answer-score.good {
  background: rgba(22, 163, 74, 0.11);
  color: #15803d;
}

.survey-detail-answer-score.medium {
  background: rgba(245, 158, 11, 0.12);
  color: #b45309;
}

.survey-detail-answer-score.bad {
  background: rgba(220, 38, 38, 0.1);
  color: #b91c1c;
}

.survey-detail-answer-score.empty {
  background: rgba(100, 116, 139, 0.1);
  color: #64748b;
}

.survey-detail-comment {
  position: relative;
  min-height: 90px;
  padding: 18px 18px 18px 44px;
  border: 1px solid var(--bd);
  border-radius: 14px;
  background: var(--bg2);
  color: var(--tx1);
  font-size: 13px;
  font-style: italic;
  line-height: 1.6;
}

.survey-detail-comment::before {
  position: absolute;
  top: 14px;
  left: 17px;
  color: var(--g1);
  font-size: 24px;
  font-style: normal;
  font-weight: 900;
  content: "“";
}

@media (max-width: 640px) {
  .survey-detail-summary {
    grid-template-columns: 1fr;
  }

  .survey-detail-score {
    text-align: left;
  }

  .survey-detail-answer {
    grid-template-columns: minmax(0, 1fr) 56px;
  }
}

/* ===========================
   RANKING DE AGENTES
=========================== */

.surveys-agents-card {
  margin: 18px 0;
}

#sv-agents {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.survey-agent-row {
  display: grid;
  grid-template-columns: 60px 1.8fr repeat(4, 140px);
  align-items: center;
  gap: 16px;

  padding: 16px 18px;

  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;

  background: #fff;

  transition: 0.18s ease;
}

.survey-agent-row:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.08);
}

.survey-agent-position {
  width: 42px;
  height: 42px;

  display: flex;
  align-items: center;
  justify-content: center;

  border-radius: 50%;
  background: #f4f5f7;

  font-size: 20px;
  font-weight: 700;
}

.survey-agent-main {
  display: flex;
  flex-direction: column;
}

.survey-agent-name {
  font-size: 15px;
  font-weight: 700;
  color: #222;
}

.survey-agent-meta {
  margin-top: 4px;
  font-size: 12px;
  color: #7b7b7b;
}

.survey-agent-stat {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.survey-agent-stat span {
  font-size: 11px;
  color: #7b7b7b;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.survey-agent-stat strong {
  font-size: 20px;
  font-weight: 700;
}

.survey-agent-stat strong.good {
  color: #22b573;
}

.survey-agent-stat strong.medium {
  color: #f4a100;
}

.survey-agent-stat strong.bad {
  color: #ef5350;
}

.survey-progress {
  width: 100%;
  height: 7px;

  border-radius: 999px;
  overflow: hidden;

  background: #eceff3;
}

.survey-progress-bar {
  height: 100%;
  border-radius: 999px;

  background: linear-gradient(90deg, #22b573, #5bd59a);
}

@media (max-width: 1200px) {
  .survey-agent-row {
    grid-template-columns: 1fr;
    gap: 12px;
  }
}

@media (max-width: 1200px) {
  .surveys-kpis {
    grid-template-columns: repeat(3, minmax(170px, 1fr));
  }

  .surveys-content-grid {
    grid-template-columns: 1fr;
  }

  .surveys-table-header {
    flex-direction: column;
  }

  .surveys-filters {
    width: 100%;
    justify-content: flex-start;
  }
}

@media (max-width: 760px) {
  #surveys-panel,
  #performance-panel,
  #dash-panel {
    padding: 20px;
  }

  .surveys-header {
    flex-direction: column;
  }

  .surveys-kpis {
    grid-template-columns: 1fr;
  }

  .survey-kpi {
    min-height: auto;
  }

  .dash-grid {
    grid-template-columns: 1fr;
  }

  .dash-kpi {
    min-height: 118px;
  }

  .surveys-input,
  .surveys-select {
    width: 100%;
    min-width: 0;
  }
}

/* =========================================================
   LAYOUT ADMINISTRATIVO COMPLETO
   ========================================================= */

.workspace.admin-layout {
  position: relative;
  display: flex;
  width: 100%;
  min-width: 0;
  overflow: hidden;
}

.workspace.admin-layout > #sidebar,
.workspace.admin-layout > #chat-area,
.workspace.admin-layout > #right-panel {
  display: none !important;
}

.workspace.admin-layout > #dash-panel,
.workspace.admin-layout > #surveys-panel,
.workspace.admin-layout > #performance-panel,
.workspace.admin-layout > #reports-panel,
.workspace.admin-layout > #agent-workspace-panel {
  flex: 1 1 auto;
  width: 100%;
  max-width: none;
  min-width: 0;
  height: 100%;
  margin: 0;

  overflow-x: hidden;
  overflow-y: auto;

  background: var(--bg2);
}

/* Encuestas y rendimiento con la misma distribución */

.workspace.admin-layout > #surveys-panel,
.workspace.admin-layout > #performance-panel,
.workspace.admin-layout > #reports-panel {
  padding: 32px;
}

/* Dashboard usa flex porque su estructura interna depende de ello */

.workspace.admin-layout > #dash-panel {
  padding: 24px;
}

/* Evita que las tarjetas de rendimiento queden limitadas */

#performance-panel .surveys-header,
#performance-panel .surveys-kpis,
#performance-panel .surveys-table-card {
  width: 100%;
  max-width: none;
}

/* El comparativo debe ocupar todo el ancho */

#performance-panel .surveys-table-wrap,
#performance-panel .surveys-table {
  width: 100%;
}

/* Encabezado correctamente alineado */

#performance-panel .surveys-header {
  align-items: flex-start;
  margin-bottom: 28px;
}

/* Tabla con distribución más equilibrada */

#performance-panel .surveys-table {
  table-layout: auto;
}

#performance-panel .surveys-table th:first-child,
#performance-panel .surveys-table td:first-child {
  width: 90px;
  text-align: center;
}

#performance-panel .surveys-table th:nth-child(2),
#performance-panel .surveys-table td:nth-child(2) {
  min-width: 180px;
}

#performance-panel .surveys-table th:last-child,
#performance-panel .surveys-table td:last-child {
  width: 150px;
  text-align: right;
}

@media (max-width: 900px) {
  .workspace.admin-layout > #surveys-panel,
  .workspace.admin-layout > #performance-panel,
  .workspace.admin-layout > #reports-panel,
  .workspace.admin-layout > #dash-panel {
    padding: 20px;
  }
}
/* =========================================================
   DETALLE DE RENDIMIENTO DEL AGENTE
   ========================================================= */

.performance-detail-modal {
  width: min(900px, 100%);
}

.performance-detail-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.performance-detail-kpi {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 94px;
  padding: 16px;
  border: 1px solid var(--bd);
  border-radius: 14px;
  background: var(--bg2);
}

.performance-detail-kpi-icon {
  display: flex;
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: rgba(8, 145, 178, 0.12);
  font-size: 20px;
}

.performance-detail-kpi-content {
  min-width: 0;
}

.performance-detail-kpi-label {
  color: var(--tx2);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.35px;
}

.performance-detail-kpi-value {
  margin-top: 5px;
  color: var(--tx);
  font-size: 24px;
  font-weight: 800;
}

.performance-detail-section {
  margin-top: 22px;
  padding-top: 20px;
  border-top: 1px solid var(--bd);
}

.performance-detail-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.performance-conversations-placeholder {
  padding: 30px 20px;
  border: 1px dashed var(--bd);
  border-radius: 14px;
  background: var(--bg2);
  text-align: center;
}

.performance-placeholder-icon {
  margin-bottom: 8px;
  font-size: 30px;
}

.performance-placeholder-title {
  color: var(--tx);
  font-size: 14px;
  font-weight: 800;
}

.performance-placeholder-text {
  max-width: 520px;
  margin: 6px auto 0;
  color: var(--tx2);
  font-size: 12px;
  line-height: 1.5;
}

.performance-detail-progress {
  display: grid;
  gap: 16px;
  margin-top: 14px;
}

.performance-detail-progress-row > div:first-child {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 7px;
  color: var(--tx2);
  font-size: 13px;
}

.performance-detail-progress-row strong {
  color: var(--tx);
}

.performance-progress-danger {
  background: var(--red);
}

@media (max-width: 760px) {
  .performance-detail-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 480px) {
  .performance-detail-summary {
    grid-template-columns: 1fr;
  }
}

.performance-messages-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
  color: var(--tx2);
  font-size: 12px;
}

.performance-agent-messages {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 520px;
  overflow-y: auto;
  padding: 4px 8px 10px 4px;
}

.performance-agent-message {
  align-self: flex-end;
  width: min(76%, 680px);
  padding: 12px 14px;
  border: 1px solid rgba(37, 211, 102, 0.22);
  border-radius: 14px 14px 4px 14px;
  background: rgba(37, 211, 102, 0.09);
}

.performance-agent-message-body {
  color: var(--tx1);
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.performance-agent-message-time {
  margin-top: 7px;
  color: var(--tx2);
  font-size: 10px;
  text-align: right;
}
/* =========================================================
   WA HUB 2.0 — NAVEGACIÓN LATERAL
   ========================================================= */

.sidebar {
  position: relative;
  width: calc(var(--nav-w) + var(--inbox-w));
  flex-shrink: 0;
  overflow: hidden;
  background: var(--bg1);
  border-right: 1px solid var(--bd);
  transition: width var(--anim);
}

/* Navegación vertical */
.sidebar .sidebar-tabs {
  position: absolute;
  inset: 0 auto 0 0;

  width: var(--nav-w);
  min-width: var(--nav-w);
  min-height: 0;

  display: flex;
  flex-direction: column;
  align-items: stretch;

  padding: 10px 8px;
  overflow-x: hidden;
  overflow-y: auto;

  background: var(--bg1);
  border-right: 1px solid var(--bd);
  border-bottom: none;

  scrollbar-width: none;
}

.sidebar .sidebar-tabs::-webkit-scrollbar {
  display: none;
}

.sidebar .stab {
  position: relative;
  flex: 0 0 auto;

  width: 100%;
  min-width: 0;
  min-height: 58px;

  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;

  margin-bottom: 4px;
  padding: 8px 3px;

  border: none;
  border-radius: 12px;
  background: transparent;
  color: var(--tx2);

  cursor: pointer;
  font-size: 9px;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: 0;
  text-align: center;
  text-transform: none;
  white-space: normal;

  transition:
    color var(--anim),
    background var(--anim),
    transform var(--anim);
}

.sidebar .stab:nth-child(5) {
  margin-top: 14px;
}

.sidebar .stab:nth-child(5)::before {
  content: "";
  position: absolute;
  top: -9px;
  right: 8px;
  left: 8px;
  height: 1px;
  background: var(--bd);
}

.sidebar .stab svg {
  width: 21px;
  height: 21px;
  flex-shrink: 0;
}

.sidebar .stab-label {
  display: block;
  width: 100%;
  overflow: hidden;

  color: inherit;
  font-size: 9px;
  font-weight: 800;
  line-height: 1.15;
  text-align: center;
  text-overflow: ellipsis;
}

.sidebar .stab:hover:not(.active) {
  color: var(--tx);
  background: var(--bg2);
  transform: translateY(-1px);
}

.sidebar .stab.active {
  color: var(--g1);
  background: rgba(8, 145, 178, 0.11);
}

.sidebar .stab.active::after {
  content: "";
  position: absolute;
  top: 13px;
  bottom: 13px;
  left: -8px;
  width: 3px;
  border-radius: 0 4px 4px 0;
  background: var(--g1);
}

/* Buscador */
.sidebar .search-box {
  position: absolute;
  top: 0;
  right: 0;
  left: var(--nav-w);
  z-index: 10;

  width: auto;
  height: 62px;
  min-height: 62px;

  display: flex;
  align-items: center;

  margin: 0;
  padding: 12px;

  background: var(--bg1);
  border-bottom: 1px solid var(--bd);
}

.sidebar .search-wrap {
  width: 100%;
}

/* Contenido de la bandeja */
.sidebar .conv-list,
.sidebar .agents-grid,
.sidebar #history-list {
  position: absolute;
  top: 62px;
  right: 0;
  bottom: 0;
  left: var(--nav-w);

  width: auto;
  height: auto;
  min-height: 0;
  overflow-y: auto;
}

.sidebar .agents-grid {
  grid-template-columns: 1fr 1fr;
  align-content: start;
}

/* Sin buscador */
.sidebar:has(#tab-agents.active) .agents-grid,
.sidebar:has(#tab-history.active) #history-list {
  top: 0;
  bottom: 0;
  height: auto;
}
/* Sidebar colapsada */
.sidebar.collapsed {
  width: var(--nav-w);
}

.sidebar.collapsed .sidebar-tabs {
  width: var(--nav-w);
  min-width: var(--nav-w);
}

.sidebar.collapsed .search-box,
.sidebar.collapsed .conv-list,
.sidebar.collapsed .agents-grid,
.sidebar.collapsed #history-list {
  display: none !important;
}

.sidebar.collapsed .stab-label {
  display: block !important;
}

.sidebar.collapsed .stab {
  width: 100%;
  min-width: 0;
  padding: 8px 3px;
  border: none;
}

@media (max-width: 1150px) {
  :root {
    --inbox-w: 280px;
  }
}

@media (max-width: 900px) {
  :root {
    --nav-w: 68px;
    --inbox-w: 260px;
  }

  .sidebar .stab-label {
    font-size: 8px;
  }

  .sidebar .stab svg {
    width: 19px;
    height: 19px;
  }
}

/* =========================================================
   WA HUB 2.0 — TARJETAS DE CONVERSACIÓN
   ========================================================= */

.sidebar .conv-item {
  position: relative;

  display: flex;
  align-items: flex-start;
  gap: 11px;

  min-width: 0;
  padding: 13px 12px;

  cursor: pointer;
  border-bottom: 1px solid var(--bd);
  border-left: 3px solid transparent;
  background: var(--bg1);

  transition:
    background var(--anim),
    border-color var(--anim),
    transform var(--anim);
}

.sidebar .conv-item:hover {
  background: var(--bg2);
}

.sidebar .conv-item.active {
  background: rgba(8, 145, 178, 0.09);
  border-left-color: var(--g1);
}

.sidebar .conv-item.has-unread {
  background: rgba(8, 145, 178, 0.035);
}

.sidebar .conv-item.has-unread .conv-name {
  font-weight: 800;
}

.sidebar .conv-av {
  width: 42px;
  height: 42px;
  flex-shrink: 0;

  display: flex;
  align-items: center;
  justify-content: center;

  border-radius: 13px;

  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.2px;
}

.sidebar .conv-info {
  flex: 1;
  min-width: 0;
}

.sidebar .conv-main-row,
.sidebar .conv-message-row,
.sidebar .conv-footer {
  display: flex;
  align-items: center;
  min-width: 0;
}

.sidebar .conv-main-row {
  gap: 8px;
  margin-bottom: 4px;
}

.sidebar .conv-name {
  flex: 1;
  min-width: 0;

  overflow: hidden;

  color: var(--tx);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.25;

  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar .conv-date {
  flex-shrink: 0;

  color: var(--tx3);
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
}

.sidebar .conv-message-row {
  gap: 8px;
}

.sidebar .conv-prev {
  flex: 1;
  min-width: 0;

  overflow: hidden;

  color: var(--tx2);
  font-size: 12px;
  line-height: 1.35;

  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar .cbadge {
  min-width: 20px;
  height: 20px;
  flex-shrink: 0;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  padding: 0 6px;
  border-radius: 999px;

  background: var(--g1);
  color: #fff;

  font-size: 10px;
  font-weight: 800;
}

.sidebar .conv-footer {
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
}

.sidebar .conv-assignment {
  display: inline-flex;
  align-items: center;
  gap: 5px;

  min-width: 0;
  max-width: 145px;

  overflow: hidden;

  color: var(--tx2);
  font-size: 10px;
  font-weight: 700;

  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar .conv-assignment-dot {
  width: 6px;
  height: 6px;
  flex-shrink: 0;
  border-radius: 50%;
}

.sidebar .conv-assignment.assigned .conv-assignment-dot {
  background: #16a34a;
}

.sidebar .conv-assignment.unassigned {
  color: var(--red);
}

.sidebar .conv-assignment.unassigned .conv-assignment-dot {
  background: var(--red);
}

.sidebar .conv-alert {
  flex-shrink: 0;

  display: inline-flex;
  align-items: center;

  padding: 3px 7px;
  border-radius: 999px;

  font-size: 9px;
  font-weight: 800;
  white-space: nowrap;
}

.sidebar .conv-alert.warning {
  background: rgba(240, 180, 41, 0.13);
  color: #b7791f;
}

.sidebar .conv-alert.critical {
  background: rgba(241, 92, 109, 0.13);
  color: var(--red);
}

.sidebar .conv-empty {
  height: 100%;

  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;

  padding: 24px;
  text-align: center;
}

.sidebar .conv-empty-icon {
  margin-bottom: 10px;
  font-size: 28px;
  opacity: 0.55;
}

.sidebar .conv-empty-title {
  color: var(--tx);
  font-size: 13px;
  font-weight: 800;
}

.sidebar .conv-empty-text {
  max-width: 210px;
  margin-top: 5px;

  color: var(--tx3);
  font-size: 11px;
  line-height: 1.5;
}
/* =========================================================
   WA HUB 2.0 — ENCABEZADO DEL CHAT
   ========================================================= */

.chat-hdr {
  min-height: 68px;
  flex-shrink: 0;

  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;

  padding: 12px 18px;

  background: var(--bg1);
  border-bottom: 1px solid var(--bd);
}

.chat-contact {
  flex: 1;
  min-width: 0;

  display: flex;
  align-items: center;
  gap: 12px;
}

.chat-hdr .hdr-av {
  width: 46px;
  height: 46px;
  flex-shrink: 0;

  display: flex;
  align-items: center;
  justify-content: center;

  border-radius: 14px;

  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.3px;
}

.chat-hdr .hdr-info {
  flex: 1;
  min-width: 0;
}

.chat-hdr .hdr-main-row {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.chat-hdr .hdr-name {
  min-width: 0;
  overflow: hidden;

  color: var(--tx);
  font-size: 15px;
  font-weight: 800;
  line-height: 1.25;

  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-hdr .hdr-status {
  flex-shrink: 0;

  display: inline-flex;
  align-items: center;
  gap: 5px;

  padding: 3px 7px;
  border-radius: 999px;

  background: rgba(22, 163, 74, 0.1);
  color: #15803d;

  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.35px;
}

.chat-hdr .hdr-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #22c55e;
}

.chat-hdr .hdr-sub {
  margin-top: 3px;

  color: var(--tx2);
  font-size: 11px;
  line-height: 1.35;
}

.chat-hdr .hdr-tags-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;

  min-height: 0;
  margin-top: 6px;
}

.chat-hdr .hdr-tags-row:empty {
  display: none;
}

.chat-hdr .hdr-btns {
  flex-shrink: 0;

  display: flex;
  align-items: center;
  gap: 8px;
}

.chat-hdr .hbtn {
  height: 36px;

  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;

  padding: 0 13px;
  border: 1px solid transparent;
  border-radius: 10px;

  cursor: pointer;

  font-family: inherit;
  font-size: 11px;
  font-weight: 800;

  transition:
    background var(--anim),
    border-color var(--anim),
    color var(--anim),
    transform var(--anim),
    box-shadow var(--anim);
}

.chat-hdr .hbtn:hover {
  transform: translateY(-1px);
}

.chat-hdr .hbtn:active {
  transform: translateY(0);
}

.chat-hdr .hbtn-o {
  background: var(--bg2);
  border-color: var(--bd);
  color: var(--tx);
}

.chat-hdr .hbtn-o:hover {
  background: var(--bg3);
  border-color: var(--g1);
}

.chat-hdr .hbtn-p {
  background: var(--g1);
  color: #fff;
  box-shadow: 0 5px 12px rgba(8, 145, 178, 0.18);
}

.chat-hdr .hbtn-p:hover {
  filter: brightness(0.96);
  box-shadow: 0 7px 16px rgba(8, 145, 178, 0.24);
}

.chat-hdr .hbtn-icon {
  font-size: 12px;
  line-height: 1;
}

@media (max-width: 900px) {
  .chat-hdr {
    gap: 10px;
    padding: 10px 12px;
  }

  .chat-hdr .hdr-av {
    width: 42px;
    height: 42px;
  }

  .chat-hdr .hbtn {
    width: 36px;
    padding: 0;
  }

  .chat-hdr .hbtn span:last-child {
    display: none;
  }
}
/* =========================================================
   WA HUB 2.0 — MENSAJES Y BURBUJAS
   ========================================================= */

.messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;

  display: flex;
  flex-direction: column;

  padding: 16px 20px 20px;

  background:
    radial-gradient(
      circle at top left,
      rgba(8, 145, 178, 0.035),
      transparent 32%
    ),
    var(--bg2);

  scroll-behavior: smooth;
}

.msg-row {
  width: 100%;
  display: flex;
  margin-bottom: 8px;
}

.msg-row.in {
  justify-content: flex-start;
}

.msg-row.out {
  justify-content: flex-end;
}

.msg-row.note {
  justify-content: center;
  margin: 14px 0;
}

.msg-bub {
  position: relative;

  max-width: min(72%, 620px);
  padding: 10px 12px 7px;

  border: 1px solid var(--bd);
  border-radius: 14px;

  background: var(--bg1);
  color: var(--tx);

  box-shadow: 0 3px 10px rgba(15, 23, 42, 0.05);

  font-size: 13px;
  line-height: 1.45;

  animation: msg-enter 0.16s ease-out;
}

.msg-row.in .msg-bub {
  border-bottom-left-radius: 5px;
}

.msg-row.out .msg-bub {
  border-color: rgba(8, 145, 178, 0.16);
  border-bottom-right-radius: 5px;

  background: rgba(8, 145, 178, 0.1);
}

.msg-row.note .msg-bub {
  max-width: min(76%, 680px);
  padding: 10px 13px;

  border: 1px dashed rgba(217, 119, 6, 0.35);
  border-radius: 12px;

  background: rgba(245, 158, 11, 0.08);
  color: var(--tx);
  box-shadow: none;
}

.msg-text {
  overflow-wrap: anywhere;
  white-space: normal;
}

.msg-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;

  margin-top: 5px;

  color: var(--tx3);
  font-size: 9px;
  line-height: 1;
}

.msg-ag {
  max-width: 140px;
  margin-right: auto;

  overflow: hidden;

  color: var(--g1);
  font-weight: 800;

  text-overflow: ellipsis;
  white-space: nowrap;
}

.msg-ag.bot {
  color: #7c3aed;
}

.msg-time {
  white-space: nowrap;
}

.msg-ck {
  color: var(--g1);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: -2px;
}

.msg-note-label {
  display: flex;
  align-items: center;
  gap: 6px;

  margin-bottom: 5px;

  color: #b45309;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.35px;
}

.msg-date {
  display: flex;
  justify-content: center;
  margin: 12px 0 18px;
}

.msg-date span {
  padding: 5px 10px;
  border: 1px solid var(--bd);
  border-radius: 999px;

  background: var(--bg1);
  color: var(--tx3);

  font-size: 10px;
  font-weight: 700;

  box-shadow: 0 2px 7px rgba(15, 23, 42, 0.04);
}

@keyframes msg-enter {
  from {
    opacity: 0;
    transform: translateY(3px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 900px) {
  .messages {
    padding: 16px 12px 22px;
  }

  .msg-bub {
    max-width: 84%;
  }

  .msg-row.note .msg-bub {
    max-width: 90%;
  }
}
/* =========================================================
   WA HUB 2.0 — COMPOSER
   ========================================================= */

.input-area {
  flex-shrink: 0;

  padding: 14px 18px 16px;

  background: var(--bg1);

  border-top: 1px solid var(--bd);
}

.input-top {
  display: flex;
  align-items: center;
  gap: 10px;

  margin-bottom: 10px;
}

.input-top span {
  font-size: 12px;
  font-weight: 700;
  color: var(--tx2);
}

.assign-sel {
  min-width: 210px;

  height: 36px;

  padding: 0 12px;

  border: 1px solid var(--bd);
  border-radius: 10px;

  background: var(--bg1);

  color: var(--tx);

  transition: 0.18s;
}

.assign-sel:hover {
  border-color: var(--g1);
}

.assign-sel:focus {
  outline: none;
  border-color: var(--g1);
  box-shadow: 0 0 0 3px rgba(8, 145, 178, 0.12);
}
.tpls {
  display: flex;
  gap: 8px;

  margin-bottom: 10px;

  flex-wrap: wrap;
}

.tpl {
  height: 32px;

  padding: 0 11px;

  border: 1px solid var(--bd);
  border-radius: 999px;

  background: var(--bg2);

  color: var(--tx);

  font-size: 11px;
  font-weight: 700;

  transition: 0.18s;
}

.tpl:hover {
  background: var(--g1);
  color: #fff;

  border-color: var(--g1);

  transform: translateY(-1px);
}
.input-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

.msg-ta {
  flex: 1;

  min-height: 48px;
  max-height: 150px;

  padding: 12px 14px;

  resize: none;

  border: 1px solid var(--bd);
  border-radius: 14px;

  background: var(--bg2);

  color: var(--tx);

  font-size: 13px;
  line-height: 1.5;

  transition: 0.18s;
}

.msg-ta:focus {
  outline: none;

  border-color: var(--g1);

  background: #fff;

  box-shadow: 0 0 0 3px rgba(8, 145, 178, 0.12);
}

.msg-ta::placeholder {
  color: var(--tx3);
}
.send-btn {
  width: 46px;
  height: 46px;

  flex-shrink: 0;

  border: none;
  border-radius: 14px;

  background: var(--g1);

  color: #fff;

  cursor: pointer;

  display: flex;
  align-items: center;
  justify-content: center;

  box-shadow: 0 8px 18px rgba(8, 145, 178, 0.2);

  transition: 0.18s;
}

.send-btn svg {
  width: 18px;
  height: 18px;

  fill: currentColor;
}

.send-btn:hover {
  transform: translateY(-2px);

  box-shadow: 0 12px 22px rgba(8, 145, 178, 0.3);
}

.send-btn:active {
  transform: scale(0.96);
}
/* =========================================================
   WA HUB 2.0 — PANEL DERECHO CRM
   ========================================================= */

.right-panel {
  width: 300px;
  flex-shrink: 0;

  display: flex;
  flex-direction: column;

  overflow: hidden;

  background: var(--bg1);
  border-left: 1px solid var(--bd);

  transition:
    width var(--anim),
    transform var(--anim);
}

.right-panel.collapsed {
  width: 0;
  border-left: 0;
}

.rp-hdr {
  min-height: 68px;
  flex-shrink: 0;

  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;

  padding: 12px 14px;

  border-bottom: 1px solid var(--bd);
  background: var(--bg1);
}

.rp-hdr-title {
  min-width: 0;

  display: flex;
  align-items: center;
  gap: 10px;
}

.rp-hdr-icon {
  width: 36px;
  height: 36px;
  flex-shrink: 0;

  display: flex;
  align-items: center;
  justify-content: center;

  border-radius: 11px;

  background: rgba(8, 145, 178, 0.1);
  font-size: 16px;
}

.rp-hdr-main {
  color: var(--tx);
  font-size: 13px;
  font-weight: 800;
}

.rp-hdr-sub {
  margin-top: 2px;

  color: var(--tx3);
  font-size: 10px;
  font-weight: 600;
}

.rp-toggle-btn {
  width: 32px;
  height: 32px;
  flex-shrink: 0;

  display: flex;
  align-items: center;
  justify-content: center;

  border: 1px solid var(--bd);
  border-radius: 9px;

  background: var(--bg2);
  color: var(--tx2);

  cursor: pointer;
  font-size: 20px;
  line-height: 1;

  transition:
    background var(--anim),
    color var(--anim),
    border-color var(--anim);
}

.rp-toggle-btn:hover {
  background: var(--bg3);
  color: var(--tx);
  border-color: var(--g1);
}

.rp-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.rp-profile {
  display: flex;
  align-items: center;
  gap: 12px;

  padding: 18px 16px;

  background: linear-gradient(
    135deg,
    rgba(8, 145, 178, 0.08),
    rgba(8, 145, 178, 0.015)
  );
  border-bottom: 1px solid var(--bd);
}

.rp-profile-avatar {
  width: 50px;
  height: 50px;
  flex-shrink: 0;

  display: flex;
  align-items: center;
  justify-content: center;

  border-radius: 15px;

  background: rgba(8, 145, 178, 0.13);
  color: var(--g1);

  font-size: 15px;
  font-weight: 900;
  letter-spacing: 0.3px;
}

.rp-profile-content {
  min-width: 0;
}

.rp-profile-name {
  overflow: hidden;

  color: var(--tx);
  font-size: 14px;
  font-weight: 800;

  text-overflow: ellipsis;
  white-space: nowrap;
}

.rp-profile-phone {
  margin-top: 3px;

  color: var(--tx2);
  font-size: 11px;
}

.rp-profile-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;

  margin-top: 7px;
  padding: 3px 7px;

  border-radius: 999px;

  background: rgba(22, 163, 74, 0.09);
  color: #15803d;

  font-size: 9px;
  font-weight: 800;
}

.rp-profile-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #22c55e;
}

.rp-sec {
  padding: 16px;
  border-bottom: 1px solid var(--bd);
}

.rp-sec-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;

  margin-bottom: 11px;
}

.rp-sec-t {
  margin: 0;

  color: var(--tx);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.45px;
  text-transform: uppercase;
}

.rp-sec-help {
  color: var(--tx3);
  font-size: 9px;
}

.rp-info-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.rp-info-card {
  min-width: 0;

  display: flex;
  align-items: flex-start;
  gap: 8px;

  padding: 10px;

  border: 1px solid var(--bd);
  border-radius: 11px;

  background: var(--bg2);
}

.rp-info-card-wide {
  grid-column: 1 / -1;
}

.rp-info-icon {
  flex-shrink: 0;
  font-size: 13px;
}

.rp-info-card .rp-l {
  margin-bottom: 3px;

  color: var(--tx3);
  font-size: 9px;
  font-weight: 700;
}

.rp-info-card .rp-v {
  max-width: none;

  overflow: hidden;

  color: var(--tx);
  font-size: 11px;
  font-weight: 800;
  text-align: left;

  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Etiquetas activas */

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;

  min-height: 0;
  margin-bottom: 10px;
}

.tag-list:empty {
  display: none;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;

  padding: 5px 9px;

  border-radius: 999px;

  font-size: 10px;
  font-weight: 800;
}

/* Etiquetas rápidas */

.tag-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;

  margin-bottom: 11px;
}

.tag-preset {
  min-height: 29px;

  display: inline-flex;
  align-items: center;
  gap: 5px;

  padding: 0 9px;

  border: 1px solid var(--bd);
  border-radius: 999px;

  background: var(--bg1);

  cursor: pointer;

  font-family: inherit;
  font-size: 9px;
  font-weight: 800;

  opacity: 1;

  transition:
    transform var(--anim),
    background var(--anim),
    border-color var(--anim);
}

.tag-preset:hover {
  transform: translateY(-1px);
}

.tag-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.tag-preset-danger {
  color: #dc4759;
  border-color: rgba(241, 92, 109, 0.32);
}

.tag-preset-danger .tag-dot {
  background: var(--red);
}

.tag-preset-danger:hover {
  background: rgba(241, 92, 109, 0.08);
}

.tag-preset-warning {
  color: #b7791f;
  border-color: rgba(240, 180, 41, 0.35);
}

.tag-preset-warning .tag-dot {
  background: var(--warn);
}

.tag-preset-warning:hover {
  background: rgba(240, 180, 41, 0.09);
}

.tag-preset-info {
  color: var(--g1);
  border-color: rgba(8, 145, 178, 0.3);
}

.tag-preset-info .tag-dot {
  background: var(--g1);
}

.tag-preset-info:hover {
  background: rgba(8, 145, 178, 0.08);
}

.tag-preset-success {
  color: #15803d;
  border-color: rgba(22, 163, 74, 0.28);
}

.tag-preset-success .tag-dot {
  background: #22c55e;
}

.tag-preset-success:hover {
  background: rgba(22, 163, 74, 0.08);
}

.tag-preset-vip {
  color: #7c3aed;
  border-color: rgba(124, 58, 237, 0.3);
}

.tag-preset-vip:hover {
  background: rgba(124, 58, 237, 0.08);
}

/* Agregar etiqueta */

.tag-add {
  display: flex;
  align-items: center;
  gap: 7px;
}

.tag-in {
  flex: 1;
  min-width: 0;
  height: 36px;

  padding: 0 11px;

  border: 1px solid var(--bd);
  border-radius: 10px;

  background: var(--bg2);
  color: var(--tx);

  font-family: inherit;
  font-size: 11px;
  outline: none;

  transition:
    border-color var(--anim),
    box-shadow var(--anim),
    background var(--anim);
}

.tag-in:focus {
  border-color: var(--g1);
  background: var(--bg1);
  box-shadow: 0 0 0 3px rgba(8, 145, 178, 0.1);
}

.tag-btn {
  width: 36px;
  height: 36px;
  flex-shrink: 0;

  display: flex;
  align-items: center;
  justify-content: center;

  border: 0;
  border-radius: 10px;

  background: var(--g1);
  color: #fff;

  cursor: pointer;
  font-size: 18px;
  font-weight: 700;

  transition:
    background var(--anim),
    transform var(--anim);
}

.tag-btn:hover {
  background: var(--g2);
  transform: translateY(-1px);
}

/* Actividad */

.rp-activity-section {
  min-height: 220px;
  border-bottom: 0;
}

.act-feed {
  padding: 0;
}

.act-item {
  position: relative;

  display: flex;
  gap: 10px;

  padding: 10px 0;
}

.act-item:not(:last-child) {
  border-bottom: 1px solid var(--bd);
}

.act-item:not(:last-child)::after {
  display: none;
}

.act-icon {
  width: 30px;
  height: 30px;
  flex-shrink: 0;

  display: flex;
  align-items: center;
  justify-content: center;

  border-radius: 10px;

  background: var(--bg2);

  font-size: 13px;
}

.act-title {
  color: var(--tx);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.45;
}

.act-sub {
  margin-top: 3px;

  color: var(--tx2);
  font-size: 10px;
  line-height: 1.4;
}

.act-time {
  margin-top: 4px;

  color: var(--tx3);
  font-size: 9px;
}

.act-empty {
  padding: 24px 10px;

  color: var(--tx3);
  font-size: 11px;
  text-align: center;
}

/* Botón para volver a mostrar el panel */

.rp-show-btn {
  position: fixed;
  top: 50%;
  right: 0;
  z-index: 100;

  display: none;

  width: 30px;
  height: 48px;

  align-items: center;
  justify-content: center;

  padding: 0;

  border: 1px solid var(--bd);
  border-right: 0;
  border-radius: 10px 0 0 10px;

  background: var(--bg1);
  color: var(--tx2);

  cursor: pointer;
  font-size: 19px;

  transform: translateY(-50%);
  box-shadow: -4px 4px 14px rgba(15, 23, 42, 0.07);
}

.rp-show-btn:hover {
  color: var(--g1);
}

@media (max-width: 1150px) {
  .right-panel {
    width: 270px;
  }
}
@media (max-width: 1100px) {
  .stat {
    min-width: 112px;
  }

  .stat-content span {
    display: none;
  }

  .me-pill {
    min-width: 165px;
  }
}

@media (max-width: 900px) {
  .stats {
    justify-content: flex-end;
  }

  .stat {
    min-width: auto;
    height: 36px;
    padding: 4px 8px;
  }

  .stat-icon {
    width: 24px;
    height: 24px;
  }

  .stat-content strong {
    font-size: 9px;
  }

  .logo-image {
    display: none;
  }

  .me-pill {
    min-width: auto;
  }

  .me-data {
    display: none;
  }
}

/* =========================================================
   WA HUB 2.0 — CENTRO DE TRABAJO DEL AGENTE
   ========================================================= */

#agent-workspace-panel {
  flex: 1;
  width: 100%;
  min-width: 0;
  height: 100%;

  overflow-x: hidden;
  overflow-y: auto;

  background: var(--bg2);
}

.agent-workspace-container {
  width: 100%;
  max-width: 1400px;

  margin: 0 auto;
  padding: 24px;
}

/* =========================================================
   ENCABEZADO
   ========================================================= */

.agent-workspace-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;

  margin-bottom: 22px;
}

.agent-workspace-eyebrow {
  margin-bottom: 6px;

  color: var(--g1);

  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.85px;
  text-transform: uppercase;
}

.agent-workspace-header h1 {
  margin: 0;

  color: var(--tx);

  font-size: 26px;
  font-weight: 900;
  letter-spacing: -0.55px;
  line-height: 1.2;
}

.agent-workspace-header p {
  margin: 6px 0 0;

  color: var(--tx2);

  font-size: 13px;
  line-height: 1.45;
}

.agent-workspace-status {
  min-height: 38px;
  flex-shrink: 0;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  padding: 0 14px;

  border: 1px solid rgba(22, 163, 74, 0.28);
  border-radius: 999px;

  background: rgba(22, 163, 74, 0.08);
  color: #15803d;

  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

/* =========================================================
   INDICADORES PERSONALES
   ========================================================= */

.agent-workspace-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.agent-metric-card {
  position: relative;

  min-width: 0;
  min-height: 128px;

  display: flex;
  align-items: flex-start;
  gap: 14px;

  padding: 17px 18px;

  border: 1px solid var(--bd);
  border-top: 3px solid var(--g1);
  border-radius: 15px;

  background: var(--bg1);

  box-shadow: 0 5px 16px rgba(15, 23, 42, 0.04);

  transition:
    transform var(--anim),
    border-color var(--anim),
    box-shadow var(--anim);
}

.agent-metric-card:hover {
  transform: translateY(-2px);

  border-color: rgba(8, 145, 178, 0.3);

  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.07);
}

.agent-metric-alert {
  border-top-color: var(--red);
}

.agent-metric-icon {
  width: 42px;
  height: 42px;
  flex-shrink: 0;

  display: flex;
  align-items: center;
  justify-content: center;

  border-radius: 13px;

  background: rgba(8, 145, 178, 0.1);
  color: var(--g1);

  font-size: 19px;
}

.agent-metric-alert .agent-metric-icon {
  background: rgba(241, 92, 109, 0.1);
  color: var(--red);
}

.agent-metric-card > div:last-child {
  flex: 1;
  min-width: 0;

  display: flex;
  flex-direction: column;
}

.agent-metric-label {
  overflow: hidden;

  color: var(--tx3);

  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.55px;
  line-height: 1.3;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.agent-metric-card strong {
  margin-top: 7px;

  color: var(--tx);

  font-size: 32px;
  font-weight: 900;
  letter-spacing: -1px;
  line-height: 1;
}

.agent-metric-card small {
  margin-top: 8px;

  color: var(--tx2);

  font-size: 10px;
  font-weight: 600;
  line-height: 1.4;
}

/* =========================================================
   CONTENIDO INFERIOR
   ========================================================= */

.agent-workspace-grid {
  display: grid;
  grid-template-columns:
    minmax(0, 1.45fr)
    minmax(320px, 0.75fr);
  gap: 14px;

  margin-top: 14px;
}

.agent-workspace-section {
  min-width: 0;
  overflow: hidden;

  border: 1px solid var(--bd);
  border-radius: 15px;

  background: var(--bg1);

  box-shadow: 0 5px 16px rgba(15, 23, 42, 0.04);
}

.agent-section-header {
  min-height: 64px;

  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;

  padding: 14px 17px;

  border-bottom: 1px solid var(--bd);
}

.agent-section-header > div {
  min-width: 0;
}

.agent-section-header h2 {
  margin: 0;

  color: var(--tx);

  font-size: 14px;
  font-weight: 800;
}

.agent-section-header p {
  margin: 4px 0 0;

  color: var(--tx2);

  font-size: 10px;
  line-height: 1.4;
}

.agent-section-link {
  min-height: 32px;
  flex-shrink: 0;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  padding: 0 11px;

  border: 1px solid rgba(8, 145, 178, 0.25);
  border-radius: 9px;

  background: rgba(8, 145, 178, 0.07);
  color: var(--g1);

  cursor: pointer;

  font-family: var(--F);
  font-size: 10px;
  font-weight: 800;

  transition:
    background var(--anim),
    border-color var(--anim),
    transform var(--anim);
}

.agent-section-link:hover {
  transform: translateY(-1px);

  border-color: var(--g1);
  background: rgba(8, 145, 178, 0.12);
}

.agent-section-link {
  min-height: 36px;
  flex-shrink: 0;

  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;

  padding: 0 13px;

  border: 1px solid rgba(8, 145, 178, 0.28);
  border-radius: 10px;

  background: rgba(8, 145, 178, 0.08);
  color: var(--g1);

  cursor: pointer;

  font-family: var(--F);
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;

  transition:
    background var(--anim),
    border-color var(--anim),
    color var(--anim),
    transform var(--anim),
    box-shadow var(--anim);
}

.agent-section-link > span {
  font-size: 17px;
  font-weight: 500;
  line-height: 1;
}

.agent-section-link:hover {
  transform: translateY(-1px);

  border-color: var(--g1);
  background: var(--g1);
  color: #fff;

  box-shadow: 0 6px 14px rgba(8, 145, 178, 0.2);
}

.agent-section-link:active {
  transform: translateY(0);
}

.agent-section-link:focus-visible {
  outline: none;

  box-shadow:
    0 0 0 3px rgba(8, 145, 178, 0.15),
    0 6px 14px rgba(8, 145, 178, 0.16);
}

/* =========================================================
   CONVERSACIONES PRIORITARIAS VACÍAS
   ========================================================= */

.agent-workspace-empty {
  min-height: 230px;

  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;

  padding: 30px 24px;

  color: var(--tx3);
  text-align: center;
}

.agent-empty-icon {
  width: 46px;
  height: 46px;

  display: flex;
  align-items: center;
  justify-content: center;

  margin-bottom: 12px;

  border-radius: 14px;

  background: rgba(8, 145, 178, 0.08);
  color: var(--g1);

  font-size: 21px;
}

.agent-workspace-empty strong {
  color: var(--tx);

  font-size: 13px;
  font-weight: 800;
}

.agent-workspace-empty span {
  max-width: 340px;

  margin-top: 6px;

  color: var(--tx3);

  font-size: 10px;
  line-height: 1.55;
}

/* =========================================================
   RECORDATORIOS
   ========================================================= */

.agent-reminders-list {
  display: flex;
  flex-direction: column;
}

.agent-reminder-card {
  display: flex;
  align-items: flex-start;
  gap: 14px;

  padding: 16px 18px;

  border-bottom: 1px solid var(--bd);

  transition:
    background var(--anim),
    transform var(--anim);
}

.agent-reminder-card:last-child {
  border-bottom: 0;
}

.agent-reminder-card:hover {
  background: var(--bg2);
}

.agent-reminder-icon {
  width: 42px;
  height: 42px;
  flex-shrink: 0;

  display: flex;
  align-items: center;
  justify-content: center;

  border-radius: 12px;

  background: rgba(8, 145, 178, 0.1);
  color: var(--g1);

  font-size: 18px;
}

.agent-reminder-content {
  flex: 1;
  min-width: 0;
}

.agent-reminder-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.agent-reminder-header strong {
  color: var(--tx);

  font-size: 13px;
  font-weight: 800;
}

.agent-reminder-date {
  flex-shrink: 0;

  padding: 4px 8px;

  border-radius: 999px;

  background: rgba(240, 180, 41, 0.12);
  color: #b7791f;

  font-size: 10px;
  font-weight: 800;
}

.agent-reminder-content p {
  margin-top: 6px;

  color: var(--tx2);

  font-size: 12px;
  line-height: 1.45;
}

.agent-reminder-actions {
  display: flex;
  gap: 8px;
}

.agent-reminder-actions button {
  width: 34px;
  height: 34px;

  border: 1px solid var(--bd);
  border-radius: 10px;

  background: var(--bg1);

  cursor: pointer;

  font-size: 15px;

  transition: all var(--anim);
}

.agent-reminder-complete {
  color: #15803d;
}

.agent-reminder-complete:hover {
  background: rgba(22, 163, 74, 0.1);
  border-color: rgba(22, 163, 74, 0.35);
}

.agent-reminder-delete {
  color: var(--red);
}

.agent-reminder-delete:hover {
  background: rgba(241, 92, 109, 0.1);
  border-color: rgba(241, 92, 109, 0.35);
}

/* =========================================================
   MODAL DE RECORDATORIOS
   ========================================================= */

.agent-reminder-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;

  display: flex;
  align-items: center;
  justify-content: center;

  padding: 20px;
}

.agent-reminder-modal.hidden {
  display: none;
}

.agent-reminder-modal-backdrop {
  position: absolute;
  inset: 0;

  background: rgba(15, 23, 42, 0.54);
  backdrop-filter: blur(5px);
}

.agent-reminder-modal-content {
  position: relative;
  z-index: 1;

  width: min(520px, 100%);
  max-height: calc(100vh - 40px);
  overflow-y: auto;

  border: 1px solid var(--bd);
  border-radius: 18px;

  background: var(--bg1);

  box-shadow:
    0 28px 80px rgba(15, 23, 42, 0.28),
    0 10px 28px rgba(15, 23, 42, 0.14);

  animation: agent-reminder-modal-enter 0.2s ease;
}

@keyframes agent-reminder-modal-enter {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.agent-reminder-modal-header {
  min-height: 76px;

  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;

  padding: 18px 20px;

  border-bottom: 1px solid var(--bd);
}

.agent-reminder-modal-heading {
  min-width: 0;

  display: flex;
  align-items: center;
  gap: 12px;
}

.agent-reminder-modal-icon {
  width: 42px;
  height: 42px;
  flex-shrink: 0;

  display: flex;
  align-items: center;
  justify-content: center;

  border-radius: 13px;

  background: rgba(8, 145, 178, 0.11);
  color: var(--g1);

  font-size: 19px;
}

.agent-reminder-modal-heading h3 {
  margin: 0;

  color: var(--tx);

  font-size: 17px;
  font-weight: 900;
  letter-spacing: -0.3px;
}

.agent-reminder-modal-heading p {
  margin: 4px 0 0;

  color: var(--tx2);

  font-size: 11px;
  line-height: 1.4;
}

.agent-reminder-modal-close {
  width: 36px;
  height: 36px;
  flex-shrink: 0;

  display: flex;
  align-items: center;
  justify-content: center;

  border: 1px solid var(--bd);
  border-radius: 10px;

  background: var(--bg2);
  color: var(--tx2);

  cursor: pointer;

  font-family: var(--F);
  font-size: 22px;
  line-height: 1;

  transition:
    background var(--anim),
    border-color var(--anim),
    color var(--anim);
}

.agent-reminder-modal-close:hover {
  border-color: rgba(241, 92, 109, 0.35);

  background: rgba(241, 92, 109, 0.09);
  color: var(--red);
}

.agent-reminder-modal-body {
  display: flex;
  flex-direction: column;
  gap: 18px;

  padding: 22px;
}

.agent-reminder-field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.agent-reminder-field label {
  color: var(--tx);

  font-size: 11px;
  font-weight: 800;
}

.agent-reminder-field label span {
  color: var(--red);
}

.agent-reminder-field input,
.agent-reminder-field textarea {
  width: 100%;

  border: 1px solid var(--bd);
  border-radius: 11px;
  outline: none;

  background: var(--bg2);
  color: var(--tx);

  font-family: var(--F);
  font-size: 13px;

  transition:
    border-color var(--anim),
    background var(--anim),
    box-shadow var(--anim);
}

.agent-reminder-field input {
  min-height: 44px;
  padding: 0 13px;
}

.agent-reminder-field textarea {
  min-height: 100px;
  padding: 12px 13px;

  line-height: 1.5;
  resize: vertical;
}

.agent-reminder-field input::placeholder,
.agent-reminder-field textarea::placeholder {
  color: var(--tx3);
}

.agent-reminder-field input:hover,
.agent-reminder-field textarea:hover {
  border-color: rgba(8, 145, 178, 0.35);
}

.agent-reminder-field input:focus,
.agent-reminder-field textarea:focus {
  border-color: var(--g1);
  background: var(--bg1);

  box-shadow: 0 0 0 3px rgba(8, 145, 178, 0.11);
}

.agent-reminder-field small {
  color: var(--tx3);

  font-size: 9px;
  line-height: 1.4;
}

.agent-reminder-modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;

  padding: 16px 22px 20px;

  border-top: 1px solid var(--bd);
}

.agent-reminder-modal-btn {
  min-height: 40px;

  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;

  padding: 0 16px;

  border-radius: 10px;

  cursor: pointer;

  font-family: var(--F);
  font-size: 11px;
  font-weight: 800;

  transition:
    transform var(--anim),
    background var(--anim),
    border-color var(--anim),
    box-shadow var(--anim);
}

.agent-reminder-modal-btn:hover {
  transform: translateY(-1px);
}

.agent-reminder-modal-btn:active {
  transform: translateY(0);
}

.agent-reminder-modal-btn-secondary {
  border: 1px solid var(--bd);

  background: var(--bg2);
  color: var(--tx2);
}

.agent-reminder-modal-btn-secondary:hover {
  border-color: var(--g1);

  background: var(--bg3);
  color: var(--tx);
}

.agent-reminder-modal-btn-primary {
  border: 1px solid var(--g1);

  background: var(--g1);
  color: #fff;

  box-shadow: 0 7px 16px rgba(8, 145, 178, 0.2);
}

.agent-reminder-modal-btn-primary:hover {
  background: var(--g2);

  box-shadow: 0 10px 20px rgba(8, 145, 178, 0.26);
}

.agent-reminder-modal-btn-primary:disabled {
  opacity: 0.55;
  cursor: wait;
  transform: none;
  box-shadow: none;
}

.agent-reminder-save-icon {
  font-size: 14px;
}

body.agent-reminder-modal-open {
  overflow: hidden;
}

@media (max-width: 560px) {
  .agent-reminder-modal {
    align-items: flex-end;
    padding: 10px;
  }

  .agent-reminder-modal-content {
    width: 100%;
    max-height: 92vh;

    border-radius: 18px 18px 12px 12px;
  }

  .agent-reminder-modal-footer {
    flex-direction: column-reverse;
  }

  .agent-reminder-modal-btn {
    width: 100%;
  }
}

/* =========================================================
   PLANTILLAS RÁPIDAS
   ========================================================= */

.agent-quick-templates {
  display: grid;
  gap: 8px;

  padding: 14px;
}

.agent-template-button {
  width: 100%;
  min-width: 0;
  min-height: 58px;

  display: flex;
  align-items: center;
  gap: 11px;

  padding: 10px 12px;

  border: 1px solid var(--bd);
  border-radius: 11px;

  background: var(--bg2);
  color: inherit;

  cursor: pointer;
  text-align: left;

  font-family: var(--F);

  transition:
    background var(--anim),
    border-color var(--anim),
    box-shadow var(--anim),
    transform var(--anim);
}

.agent-template-button:hover {
  transform: translateY(-1px);

  border-color: rgba(8, 145, 178, 0.35);
  background: rgba(8, 145, 178, 0.06);

  box-shadow: 0 6px 14px rgba(15, 23, 42, 0.05);
}

.agent-template-button > span {
  width: 36px;
  height: 36px;
  flex-shrink: 0;

  display: flex;
  align-items: center;
  justify-content: center;

  border-radius: 10px;

  background: rgba(8, 145, 178, 0.1);

  font-size: 17px;
}

.agent-template-button div {
  flex: 1;
  min-width: 0;

  display: flex;
  flex-direction: column;
  gap: 3px;
}

.agent-template-button strong {
  overflow: hidden;

  color: var(--tx);

  font-size: 11px;
  font-weight: 800;

  text-overflow: ellipsis;
  white-space: nowrap;
}

.agent-template-button small {
  overflow: hidden;

  color: var(--tx2);

  font-size: 9px;
  line-height: 1.3;

  text-overflow: ellipsis;
  white-space: nowrap;
}

/* =========================================================
   CONVERSACIONES PRIORITARIAS
   Para cuando carguemos información desde el backend
   ========================================================= */

.agent-priority-list {
  display: flex;
  flex-direction: column;
}

.agent-priority-item {
  min-width: 0;

  display: flex;
  align-items: center;
  gap: 11px;

  padding: 12px 16px;

  border-bottom: 1px solid var(--bd);

  cursor: pointer;

  transition: background var(--anim);
}

.agent-priority-item:last-child {
  border-bottom: 0;
}

.agent-priority-item:hover {
  background: var(--bg2);
}

.agent-priority-avatar {
  width: 38px;
  height: 38px;
  flex-shrink: 0;

  display: flex;
  align-items: center;
  justify-content: center;

  border-radius: 11px;

  background: rgba(8, 145, 178, 0.11);
  color: var(--g1);

  font-size: 11px;
  font-weight: 900;
}

.agent-priority-info {
  flex: 1;
  min-width: 0;
}

.agent-priority-name {
  overflow: hidden;

  color: var(--tx);

  font-size: 12px;
  font-weight: 800;

  text-overflow: ellipsis;
  white-space: nowrap;
}

.agent-priority-message {
  margin-top: 3px;
  overflow: hidden;

  color: var(--tx2);

  font-size: 10px;

  text-overflow: ellipsis;
  white-space: nowrap;
}

.agent-priority-time {
  flex-shrink: 0;

  padding: 4px 8px;

  border-radius: 999px;

  background: rgba(240, 180, 41, 0.11);
  color: #b7791f;

  font-size: 9px;
  font-weight: 800;
  white-space: nowrap;
}

.agent-priority-item.critical {
  background: rgba(241, 92, 109, 0.03);
}

.agent-priority-item.critical .agent-priority-time {
  background: rgba(241, 92, 109, 0.11);
  color: var(--red);
}

.agent-priority-item.high {
  border-left: 4px solid #f0b429;
}

.agent-priority-item.critical {
  border-left: 4px solid #f15c6d;
}

.agent-priority-item.high .agent-priority-time {
  color: #b7791f;
  font-weight: 800;
}

.agent-priority-item.critical .agent-priority-time {
  color: #d6455d;
  font-weight: 800;
}

.agent-priority-item:hover {
  border-color: var(--g1);
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
}

/* =========================================================
   RESPONSIVE
   ========================================================= */

@media (max-width: 1100px) {
  .agent-workspace-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .agent-workspace-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .agent-workspace-container {
    padding: 18px;
  }

  .agent-workspace-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .agent-workspace-status {
    min-height: 34px;
  }

  .agent-workspace-metrics {
    grid-template-columns: 1fr;
  }

  .agent-metric-card {
    min-height: 112px;
  }
}

@media (max-width: 480px) {
  .agent-workspace-container {
    padding: 14px;
  }

  .agent-workspace-header h1 {
    font-size: 22px;
  }

  .agent-section-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .agent-section-link {
    width: 100%;
  }
}

/* =========================================================
   MÓDULO DE INFORMES
   ========================================================= */

#reports-panel {
  flex: 1;
  width: 100%;
  min-width: 0;
  height: 100%;

  display: none;
  overflow-x: hidden;
  overflow-y: auto;

  background: var(--bg2);
}

/* =========================================================
   ENCABEZADO
   ========================================================= */

.reports-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;

  margin-bottom: 22px;
}

.reports-header > div:first-child {
  min-width: 0;
}

.reports-header h2 {
  margin: 0;

  color: var(--tx);
  font-size: 24px;
  font-weight: 900;
  letter-spacing: -0.5px;
  line-height: 1.2;
}

.reports-header p {
  max-width: 680px;
  margin: 5px 0 0;

  color: var(--tx2);
  font-size: 13px;
  line-height: 1.5;
}

.reports-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 9px;

  flex-shrink: 0;
}

/* =========================================================
   BOTONES
   ========================================================= */

.reports-btn {
  min-height: 40px;

  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;

  padding: 0 15px;

  border: 1px solid transparent;
  border-radius: 10px;

  cursor: pointer;

  font-family: var(--F);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;

  transition:
    transform var(--anim),
    background var(--anim),
    border-color var(--anim),
    color var(--anim),
    box-shadow var(--anim),
    opacity var(--anim);
}

.reports-btn:hover {
  transform: translateY(-1px);
}

.reports-btn:active {
  transform: translateY(0);
}

.reports-btn:disabled {
  opacity: 0.55;
  cursor: wait;
  transform: none;
  box-shadow: none;
}

.reports-btn-primary {
  border-color: var(--g1);

  background: var(--g1);
  color: #fff;

  box-shadow: 0 7px 16px rgba(8, 145, 178, 0.2);
}

.reports-btn-primary:hover {
  background: var(--g2);

  box-shadow: 0 10px 20px rgba(8, 145, 178, 0.26);
}

.reports-btn-excel {
  border-color: rgba(22, 163, 74, 0.28);

  background: rgba(22, 163, 74, 0.1);
  color: #15803d;
}

.reports-btn-excel:hover {
  border-color: #16a34a;

  background: #16a34a;
  color: #fff;

  box-shadow: 0 7px 16px rgba(22, 163, 74, 0.2);
}

.reports-btn-pdf {
  border-color: rgba(241, 92, 109, 0.3);

  background: rgba(241, 92, 109, 0.1);
  color: var(--red);
}

.reports-btn-pdf:hover {
  border-color: var(--red);

  background: var(--red);
  color: #fff;

  box-shadow: 0 7px 16px rgba(241, 92, 109, 0.22);
}

/* =========================================================
   FILTROS
   ========================================================= */

.reports-filters {
  display: grid;
  grid-template-columns:
    minmax(180px, 1.1fr)
    repeat(2, minmax(145px, 0.75fr))
    minmax(170px, 1fr)
    minmax(145px, 0.8fr)
    minmax(190px, 1.2fr)
    minmax(150px, 0.75fr);
  gap: 12px;
  align-items: end;

  margin-bottom: 18px;
  padding: 18px;

  border: 1px solid var(--bd);
  border-radius: 15px;

  background: var(--bg1);

  box-shadow: 0 5px 16px rgba(15, 23, 42, 0.04);
}

.reports-field {
  min-width: 0;

  display: flex;
  flex-direction: column;
  gap: 7px;
}

.reports-field label {
  color: var(--tx2);

  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.4px;
  text-transform: uppercase;
}

.reports-field input,
.reports-field select {
  width: 100%;
  min-width: 0;
  min-height: 40px;

  padding: 0 11px;

  border: 1px solid var(--bd);
  border-radius: 10px;
  outline: none;

  background: var(--bg2);
  color: var(--tx);

  font-family: var(--F);
  font-size: 12px;

  transition:
    border-color var(--anim),
    background var(--anim),
    box-shadow var(--anim);
}

.reports-field input::placeholder {
  color: var(--tx3);
}

.reports-field input:hover,
.reports-field select:hover {
  border-color: rgba(8, 145, 178, 0.35);
}

.reports-field input:focus,
.reports-field select:focus {
  border-color: var(--g1);
  background: var(--bg1);

  box-shadow: 0 0 0 3px rgba(8, 145, 178, 0.11);
}

.reports-filter-action {
  min-width: 0;

  display: flex;
  align-items: flex-end;
}

.reports-filter-action .reports-btn {
  width: 100%;
}

/* =========================================================
   ESTADO DE CARGA Y MENSAJES
   ========================================================= */

.reports-status {
  min-height: 24px;

  display: flex;
  align-items: center;
  gap: 9px;

  margin-bottom: 10px;

  color: var(--tx2);
  font-size: 11px;
  font-weight: 700;
}

#reports-loading {
  color: var(--g1);
  font-weight: 800;
}

#reports-loading::before {
  content: "";

  display: inline-block;

  width: 10px;
  height: 10px;

  margin-right: 7px;

  border: 2px solid rgba(8, 145, 178, 0.2);
  border-top-color: var(--g1);
  border-radius: 50%;

  vertical-align: -1px;

  animation: reports-spin 0.75s linear infinite;
}

@keyframes reports-spin {
  to {
    transform: rotate(360deg);
  }
}

#reports-message.report-error {
  color: var(--red);
}

#reports-message.report-success {
  color: #15803d;
}

/* =========================================================
   INDICADORES
   ========================================================= */

.reports-kpis {
  display: grid;
  grid-template-columns: repeat(6, minmax(145px, 1fr));
  gap: 12px;

  margin-bottom: 18px;
}

.report-kpi {
  position: relative;

  min-width: 0;
  min-height: 118px;
  overflow: hidden;

  padding: 17px 18px;

  border: 1px solid var(--bd);
  border-top: 3px solid var(--g1);
  border-radius: 15px;

  background: var(--bg1);

  box-shadow: 0 5px 16px rgba(15, 23, 42, 0.04);

  transition:
    transform var(--anim),
    border-color var(--anim),
    box-shadow var(--anim);
}

.report-kpi:hover {
  transform: translateY(-2px);

  border-color: rgba(8, 145, 178, 0.3);

  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.07);
}

.report-kpi-label {
  display: block;

  color: var(--tx3);

  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.5px;
  line-height: 1.35;
  text-transform: uppercase;
}

.report-kpi strong {
  display: block;

  margin-top: 12px;

  color: var(--tx);

  font-size: 30px;
  font-weight: 900;
  letter-spacing: -0.8px;
  line-height: 1;
}

/* Colores diferenciados sin romper el diseño */

.report-kpi:nth-child(2) {
  border-top-color: #16a34a;
}

.report-kpi:nth-child(3) {
  border-top-color: var(--g1);
}

.report-kpi:nth-child(4) {
  border-top-color: var(--warn);
}

.report-kpi:nth-child(5) {
  border-top-color: #7c3aed;
}

.report-kpi:nth-child(6) {
  border-top-color: #f4b740;
}

/* =========================================================
   TARJETA Y TABLA
   ========================================================= */

.reports-table-card {
  min-width: 0;
  overflow: hidden;

  border: 1px solid var(--bd);
  border-radius: 15px;

  background: var(--bg1);

  box-shadow: 0 5px 16px rgba(15, 23, 42, 0.04);
}

.reports-table-header {
  min-height: 66px;

  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;

  padding: 16px 18px;

  border-bottom: 1px solid var(--bd);
}

.reports-table-header > div {
  min-width: 0;
}

.reports-table-header h3 {
  margin: 0;

  color: var(--tx);
  font-size: 14px;
  font-weight: 900;
}

.reports-table-header p {
  margin: 4px 0 0;

  color: var(--tx2);
  font-size: 10px;
  line-height: 1.4;
}

#reports-row-count {
  min-height: 26px;
  flex-shrink: 0;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  padding: 0 10px;

  border-radius: 999px;

  background: var(--bg2);
  color: var(--tx2);

  font-size: 9px;
  font-weight: 800;
  white-space: nowrap;
}

.reports-table-container {
  width: 100%;
  overflow-x: auto;
}

.reports-table {
  width: 100%;
  min-width: 920px;

  border-collapse: collapse;
}

.reports-table th {
  padding: 13px 15px;

  border-bottom: 1px solid var(--bd);

  background: var(--bg2);
  color: var(--tx2);

  text-align: left;

  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.35px;
  text-transform: uppercase;
  white-space: nowrap;
}

.reports-table td {
  padding: 14px 15px;

  border-bottom: 1px solid var(--bd);

  color: var(--tx);

  font-size: 12px;
  line-height: 1.4;
  vertical-align: middle;
}

.reports-table tbody tr {
  transition: background var(--anim);
}

.reports-table tbody tr:hover {
  background: rgba(8, 145, 178, 0.04);
}

.reports-table tbody tr:last-child td {
  border-bottom: 0;
}

.reports-empty {
  height: 150px;

  padding: 32px !important;

  color: var(--tx3) !important;
  text-align: center !important;
}

/* =========================================================
   RESPONSIVE
   ========================================================= */

@media (max-width: 1400px) {
  .reports-filters {
    grid-template-columns: repeat(4, minmax(160px, 1fr));
  }

  .reports-kpis {
    grid-template-columns: repeat(3, minmax(160px, 1fr));
  }
}

@media (max-width: 1000px) {
  #reports-panel {
    padding: 24px;
  }

  .reports-filters {
    grid-template-columns: repeat(2, minmax(150px, 1fr));
  }

  .reports-kpis {
    grid-template-columns: repeat(2, minmax(150px, 1fr));
  }
}

@media (max-width: 700px) {
  #reports-panel {
    padding: 18px;
  }

  .reports-header {
    flex-direction: column;
  }

  .reports-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .reports-actions .reports-btn {
    flex: 1;
  }

  .reports-filters {
    grid-template-columns: 1fr;
  }

  .reports-kpis {
    grid-template-columns: 1fr;
  }

  .reports-table-header {
    align-items: flex-start;
    flex-direction: column;
  }

  #reports-row-count {
    align-self: flex-start;
  }
}

@media (max-width: 480px) {
  .reports-actions {
    flex-direction: column;
  }

  .reports-actions .reports-btn {
    width: 100%;
  }
}

/* =========================================================
   HEATMAP SEMANAL
   ========================================================= */

.reports-heatmap-card {
  min-width: 0;
  margin-bottom: 18px;
  overflow: hidden;

  border: 1px solid var(--bd);
  border-radius: 15px;

  background: var(--bg1);

  box-shadow: 0 5px 16px rgba(15, 23, 42, 0.04);
}

.reports-heatmap-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;

  padding: 17px 18px;

  border-bottom: 1px solid var(--bd);
}

.reports-heatmap-header h3 {
  margin: 0;

  color: var(--tx);
  font-size: 14px;
  font-weight: 900;
}

.reports-heatmap-header p {
  margin: 4px 0 0;

  color: var(--tx2);
  font-size: 10px;
}

.reports-heatmap-legend {
  display: flex;
  align-items: center;
  gap: 8px;

  color: var(--tx3);
  font-size: 9px;
  font-weight: 700;
  white-space: nowrap;
}

.heatmap-legend-scale {
  display: flex;
  gap: 3px;
}

.heatmap-legend-scale i {
  width: 17px;
  height: 12px;

  border: 1px solid rgba(8, 145, 178, 0.08);
  border-radius: 3px;
}

.heatmap-legend-scale i[data-level="0"],
.heatmap-cell[data-level="0"] {
  background: var(--bg2);
}

.heatmap-legend-scale i[data-level="1"],
.heatmap-cell[data-level="1"] {
  background: rgba(8, 145, 178, 0.13);
}

.heatmap-legend-scale i[data-level="2"],
.heatmap-cell[data-level="2"] {
  background: rgba(8, 145, 178, 0.28);
}

.heatmap-legend-scale i[data-level="3"],
.heatmap-cell[data-level="3"] {
  background: rgba(8, 145, 178, 0.48);
}

.heatmap-legend-scale i[data-level="4"],
.heatmap-cell[data-level="4"] {
  background: rgba(8, 145, 178, 0.7);
}

.heatmap-legend-scale i[data-level="5"],
.heatmap-cell[data-level="5"] {
  background: var(--g1);
}

.reports-heatmap-scroll {
  width: 100%;
  padding: 18px;
  overflow-x: auto;
}

.reports-weekly-heatmap {
  display: grid;
  grid-template-columns:
    72px
    repeat(7, minmax(86px, 1fr));
  gap: 5px;

  min-width: 760px;
}

.heatmap-corner,
.heatmap-day,
.heatmap-hour,
.heatmap-cell {
  min-height: 31px;

  display: flex;
  align-items: center;
  justify-content: center;

  border-radius: 6px;
}

.heatmap-corner {
  color: var(--tx3);
  font-size: 9px;
  font-weight: 900;
  text-transform: uppercase;
}

.heatmap-day {
  color: var(--tx2);
  background: var(--bg2);

  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.heatmap-hour {
  justify-content: flex-end;
  padding-right: 9px;

  color: var(--tx3);

  font-size: 9px;
  font-weight: 800;
}

.heatmap-cell {
  position: relative;

  min-height: 31px;

  border: 1px solid rgba(8, 145, 178, 0.08);

  color: var(--tx);
  cursor: default;

  font-size: 9px;
  font-weight: 900;

  transition:
    transform var(--anim),
    border-color var(--anim),
    box-shadow var(--anim);
}

.heatmap-cell:hover {
  z-index: 2;

  transform: scale(1.07);

  border-color: var(--g1);

  box-shadow: 0 6px 16px rgba(8, 145, 178, 0.2);
}

.heatmap-cell[data-level="4"],
.heatmap-cell[data-level="5"] {
  color: #fff;
}

.heatmap-cell[data-count="0"] {
  color: var(--tx3);
}

.reports-heatmap-summary {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;

  padding: 0 18px 18px;

  color: var(--tx2);
  font-size: 10px;
  font-weight: 700;
}

.heatmap-summary-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;

  padding: 7px 10px;

  border-radius: 999px;

  background: var(--bg2);
}

.heatmap-summary-item strong {
  color: var(--tx);
}

@media (max-width: 760px) {
  .reports-heatmap-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .reports-heatmap-legend {
    white-space: normal;
  }
}

/* =========================================================
   TENDENCIA POR HORA
   ========================================================= */

.reports-hourly-trend-card {
  margin-bottom: 18px;
  overflow: hidden;

  border: 1px solid var(--bd);
  border-radius: 15px;

  background: var(--bg1);

  box-shadow: 0 5px 16px rgba(15, 23, 42, 0.04);
}

.reports-hourly-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;

  padding: 17px 18px;

  border-bottom: 1px solid var(--bd);
}

.reports-hourly-header h3 {
  margin: 0;

  color: var(--tx);
  font-size: 14px;
  font-weight: 900;
}

.reports-hourly-header p {
  margin: 4px 0 0;

  color: var(--tx2);
  font-size: 10px;
}

#reports-hourly-total {
  padding: 7px 11px;

  border-radius: 999px;

  background: var(--bg2);
  color: var(--tx2);

  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
}

.reports-hourly-chart {
  display: flex;
  flex-direction: column;
  gap: 9px;

  padding: 20px 18px;
}

.hourly-trend-row {
  display: grid;
  grid-template-columns: 58px 1fr 44px;
  gap: 10px;
  align-items: center;
}

.hourly-trend-label {
  color: var(--tx2);

  font-size: 10px;
  font-weight: 800;
  text-align: right;
}

.hourly-trend-track {
  position: relative;

  height: 26px;
  overflow: hidden;

  border-radius: 7px;

  background: var(--bg2);
}

.hourly-trend-bar {
  min-width: 0;
  height: 100%;

  display: flex;
  align-items: center;
  justify-content: flex-end;

  padding-right: 7px;

  border-radius: 7px;

  background: linear-gradient(90deg, rgba(8, 145, 178, 0.35), var(--g1));

  color: #fff;

  font-size: 9px;
  font-weight: 900;

  transition:
    width 0.35s ease,
    filter var(--anim);
}

.hourly-trend-row:hover .hourly-trend-bar {
  filter: brightness(1.08);
}

.hourly-trend-count {
  color: var(--tx);

  font-size: 10px;
  font-weight: 900;
  text-align: right;
}

.reports-hourly-summary {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;

  padding: 0 18px 18px;
}

.hourly-summary-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;

  padding: 7px 10px;

  border-radius: 999px;

  background: var(--bg2);
  color: var(--tx2);

  font-size: 10px;
  font-weight: 700;
}

.hourly-summary-item strong {
  color: var(--tx);
}

@media (max-width: 700px) {
  .reports-hourly-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .hourly-trend-row {
    grid-template-columns: 48px 1fr 34px;
  }
}
/* =====================================================
   PLANTILLAS PERSONALES DEL AGENTE
   ===================================================== */

.agent-template-modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.agent-template-modal.hidden {
  display: none;
}

.agent-template-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.48);
  backdrop-filter: blur(4px);
}

.agent-template-modal-content {
  position: relative;
  z-index: 1;
  width: min(620px, 100%);
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  background: var(--bg1);
  border: 1px solid var(--bd);
  border-radius: 18px;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.25);
}

.agent-template-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 24px;
  border-bottom: 1px solid var(--bd);
}

.agent-template-modal-heading {
  display: flex;
  align-items: center;
  gap: 14px;
}

.agent-template-modal-icon {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(8, 145, 178, 0.12);
  border-radius: 14px;
  font-size: 23px;
}

.agent-template-modal-heading h3 {
  margin: 0 0 5px;
  color: var(--tx1);
  font-size: 18px;
  font-weight: 800;
}

.agent-template-modal-heading p {
  margin: 0;
  color: var(--tx2);
  font-size: 13px;
  line-height: 1.45;
}

.agent-template-modal-close {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border: 1px solid var(--bd);
  border-radius: 10px;
  background: transparent;
  color: var(--tx2);
  font-size: 23px;
  line-height: 1;
  cursor: pointer;
}

.agent-template-modal-close:hover {
  background: rgba(241, 92, 109, 0.1);
  border-color: rgba(241, 92, 109, 0.3);
  color: #f15c6d;
}

.agent-template-modal-body {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 24px;
}

.agent-template-fields-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 110px;
  gap: 14px;
}

.agent-template-field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.agent-template-field label {
  color: var(--tx1);
  font-size: 13px;
  font-weight: 700;
}

.agent-template-field label span {
  color: #f15c6d;
}

.agent-template-field input,
.agent-template-field textarea {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid var(--bd);
  border-radius: 11px;
  background: var(--bg2);
  color: var(--tx1);
  font-family: var(--F);
  font-size: 14px;
  outline: none;
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

.agent-template-field input {
  min-height: 44px;
  padding: 10px 12px;
}

.agent-template-field textarea {
  min-height: 150px;
  padding: 12px;
  resize: vertical;
  line-height: 1.5;
}

.agent-template-field input:focus,
.agent-template-field textarea:focus {
  border-color: #0891b2;
  box-shadow: 0 0 0 3px rgba(8, 145, 178, 0.12);
}

.agent-template-icon-field input {
  text-align: center;
  font-size: 22px;
}

.agent-template-field small,
.agent-template-field-footer {
  color: var(--tx2);
  font-size: 11px;
}

.agent-template-field-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

#agent-template-counter {
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

.agent-template-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 18px 24px;
  border-top: 1px solid var(--bd);
}

.agent-template-modal-btn {
  min-height: 42px;
  padding: 10px 18px;
  border-radius: 11px;
  font-family: var(--F);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.agent-template-modal-btn-secondary {
  border: 1px solid var(--bd);
  background: transparent;
  color: var(--tx2);
}

.agent-template-modal-btn-secondary:hover {
  background: var(--bg2);
  color: var(--tx1);
}

.agent-template-modal-btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: none;
  background: #0891b2;
  color: #fff;
}

.agent-template-modal-btn-primary:hover {
  background: #087d9a;
}

.agent-template-modal-btn-primary:disabled {
  opacity: 0.65;
  cursor: wait;
}

body.agent-template-modal-open {
  overflow: hidden;
}

/* Tarjetas */

.agent-template-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
}

.agent-template-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 14px 15px;
  border: 1px solid var(--bd);
  border-radius: 14px;
  background: var(--bg2);
  transition:
    transform 0.18s ease,
    border-color 0.18s ease,
    box-shadow 0.18s ease;
}

.agent-template-card:hover {
  transform: translateY(-1px);
  border-color: rgba(8, 145, 178, 0.32);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
}

.agent-template-card-main {
  min-width: 0;
  width: 100%;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.agent-template-card-icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 13px;
  background: rgba(8, 145, 178, 0.11);
  font-size: 23px;
}

.agent-template-card-content {
  min-width: 0;
  display: block;
}

.agent-template-card-content strong {
  display: block;
  margin-bottom: 5px;
  overflow: hidden;
  color: var(--tx1);
  font-size: 14px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agent-template-card-preview {
  display: block;
  overflow: hidden;
  color: var(--tx2);
  font-size: 12px;
  line-height: 1.45;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agent-template-card-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.agent-template-action {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--bd);
  border-radius: 9px;
  background: var(--bg1);
  color: var(--tx2);
  cursor: pointer;
}

.agent-template-action:hover {
  border-color: rgba(8, 145, 178, 0.35);
  color: #0891b2;
}

.agent-template-action-delete:hover {
  border-color: rgba(241, 92, 109, 0.35);
  background: rgba(241, 92, 109, 0.08);
  color: #f15c6d;
}

@media (max-width: 640px) {
  .agent-template-modal {
    padding: 10px;
  }

  .agent-template-fields-row {
    grid-template-columns: 1fr;
  }

  .agent-template-icon-field {
    max-width: 140px;
  }

  .agent-template-modal-header,
  .agent-template-modal-body,
  .agent-template-modal-footer {
    padding-left: 18px;
    padding-right: 18px;
  }

  .agent-template-card {
    grid-template-columns: 1fr;
  }

  .agent-template-card-actions {
    justify-content: flex-end;
  }
}
