/* Los estilos de navegación usan display:flex; esta regla garantiza que los
   controles marcados como ocultos nunca se rendericen para cuentas restringidas. */
[hidden] {
  display: none !important;
}

/* El acceso se presenta como una experiencia de producto completa. */
body.auth-required {
  min-height: 100vh;
  min-height: 100dvh;
  overflow: hidden;
  background:
    radial-gradient(circle at 12% 18%, rgba(117, 101, 237, .3), transparent 32%),
    radial-gradient(circle at 88% 82%, rgba(49, 177, 196, .18), transparent 30%),
    linear-gradient(135deg, #080b1a 0%, #11152f 48%, #171b3c 100%);
}

body.auth-required::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, .028) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .028) 1px, transparent 1px);
  background-size: 52px 52px;
  -webkit-mask-image: linear-gradient(to bottom, #000, transparent 92%);
  mask-image: linear-gradient(to bottom, #000, transparent 92%);
}

body.auth-required::after {
  content: '';
  position: fixed;
  width: 38vw;
  height: 38vw;
  right: -15vw;
  top: -18vw;
  border: 1px solid rgba(157, 146, 255, .18);
  border-radius: 50%;
  box-shadow: 0 0 0 7vw rgba(117, 101, 237, .025), 0 0 0 14vw rgba(117, 101, 237, .018);
  pointer-events: none;
  animation: auth-ring-drift 16s ease-in-out infinite alternate;
}

body.auth-required .app-shell {
  display: none;
}

body.auth-required #authModal::backdrop {
  background: rgba(6, 8, 23, .34);
  backdrop-filter: blur(1px);
}

#authModal {
  width: min(1120px, calc(100vw - 64px));
  max-width: 1120px;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 28px;
  overflow: hidden;
  background: transparent;
  box-shadow: 0 38px 100px rgba(0, 0, 0, .46), 0 0 0 1px rgba(125, 111, 244, .06);
}

#authModal .auth-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(420px, .92fr);
  min-height: 620px;
  background: #fff;
}

.auth-showcase {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  padding: 42px 48px 36px;
  color: #fff;
  background:
    linear-gradient(145deg, rgba(117, 101, 237, .13), transparent 42%),
    linear-gradient(150deg, #111631 0%, #1a1f49 58%, #28235d 100%);
}

.auth-showcase::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 84% 24%, rgba(121, 223, 220, .19) 0 2px, transparent 3px),
    radial-gradient(circle at 74% 15%, rgba(255, 255, 255, .28) 0 1px, transparent 2px),
    radial-gradient(circle at 90% 42%, rgba(255, 255, 255, .18) 0 1px, transparent 2px);
  background-size: 86px 86px, 62px 62px, 104px 104px;
  opacity: .8;
  animation: auth-stars 24s linear infinite;
}

.auth-showcase::after {
  content: '';
  position: absolute;
  width: 360px;
  height: 360px;
  right: -190px;
  bottom: -160px;
  border: 1px solid rgba(157, 146, 255, .24);
  border-radius: 50%;
  box-shadow: 0 0 0 45px rgba(140, 125, 255, .035), 0 0 0 90px rgba(140, 125, 255, .025);
}

.auth-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(1px);
  pointer-events: none;
}

.auth-orb--one {
  width: 230px;
  height: 230px;
  right: -70px;
  top: 110px;
  background: radial-gradient(circle, rgba(85, 214, 208, .24), transparent 68%);
  animation: auth-orb-one 9s ease-in-out infinite alternate;
}

.auth-orb--two {
  width: 190px;
  height: 190px;
  left: -80px;
  bottom: 22px;
  background: radial-gradient(circle, rgba(133, 111, 255, .3), transparent 68%);
  animation: auth-orb-two 11s ease-in-out infinite alternate;
}

.auth-brand,
.auth-copy,
.auth-conversation,
.auth-benefits {
  position: relative;
  z-index: 1;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: .4px;
}

.auth-brand b { color: #a89cff; }

.auth-brand__mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 11px;
  color: #fff;
  background: linear-gradient(135deg, #8373f5, #5a49d8);
  box-shadow: 0 8px 24px rgba(85, 69, 214, .35);
}

.auth-copy { margin-top: 54px; max-width: 500px; }
.auth-kicker { color: #aaa3ee; font-size: 10px; font-weight: 800; letter-spacing: 1.35px; }
.auth-copy h1 { margin: 13px 0 15px; font-size: clamp(34px, 3.25vw, 49px); line-height: 1.04; letter-spacing: -1.9px; }
.auth-copy p { max-width: 430px; margin: 0; color: #b8bdd8; font-size: 15px; line-height: 1.65; }

.auth-conversation {
  width: min(100%, 490px);
  margin-top: 34px;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 19px;
  background: rgba(255, 255, 255, .075);
  box-shadow: 0 22px 48px rgba(5, 8, 28, .24);
  backdrop-filter: blur(13px);
  transform: rotate(-1deg);
  animation: auth-card-float 7s ease-in-out infinite;
}

.auth-conversation__header { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.auth-conversation__header strong, .auth-conversation__header small { display: block; }
.auth-conversation__header strong { font-size: 12px; }
.auth-conversation__header small { margin-top: 2px; color: #aeb4d0; font-size: 9px; }
.auth-conversation__header small i { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: #45d99c; box-shadow: 0 0 0 4px rgba(69, 217, 156, .1); }
.auth-bot-avatar { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; color: #fff; background: linear-gradient(135deg, #8b7bff, #6657df); }
.auth-channel { margin-left: auto; padding: 5px 8px; border-radius: 20px; color: #68ddae; background: rgba(48, 194, 137, .12); font-size: 9px; font-weight: 700; }

.auth-message { width: fit-content; max-width: 82%; padding: 9px 12px; border-radius: 12px; font-size: 10px; line-height: 1.45; }
.auth-message--client { margin-left: auto; border-bottom-right-radius: 3px; color: #fff; background: linear-gradient(135deg, #7464ed, #6656df); }
.auth-message--bot { display: flex; align-items: flex-end; gap: 9px; margin-top: 9px; border-bottom-left-radius: 3px; color: #dfe2f3; background: rgba(255, 255, 255, .1); }
.auth-typing { display: inline-flex; gap: 2px; padding-bottom: 2px; }
.auth-typing i { width: 3px; height: 3px; border-radius: 50%; background: #a79cff; animation: auth-dot 1.15s ease-in-out infinite; }
.auth-typing i:nth-child(2) { animation-delay: .16s; }
.auth-typing i:nth-child(3) { animation-delay: .32s; }

.auth-benefits { display: flex; flex-wrap: wrap; gap: 9px 18px; margin-top: auto; padding-top: 24px; color: #abb1d0; font-size: 10px; }
.auth-benefits span { display: inline-flex; align-items: center; gap: 6px; }
.auth-benefits i { display: grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; color: #54d7ab; background: rgba(67, 208, 160, .11); font-style: normal; font-size: 9px; }

#authModal .auth-form {
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: auto;
  padding: 58px 54px;
  background: #fff;
}

.auth-form__brand { display: none; }
#authModal .auth-form .modal-heading { padding: 0; }
#authModal .auth-form .modal-heading h2 { margin: 7px 0 9px; color: #11152c; font-size: 31px; letter-spacing: -.9px; }
#authModal .auth-form .modal-heading p:not(.eyebrow) { color: #747a90; font-size: 13px; line-height: 1.55; }
#authModal .auth-form .eyebrow { color: #7465ed; letter-spacing: 1.15px; }
#authModal .auth-form .form-grid { grid-template-columns: 1fr; gap: 17px; margin-top: 30px; }
#authModal .auth-form .form-grid label { gap: 8px; color: #3f445b; font-size: 12px; }
#authModal .auth-form input {
  height: 50px;
  border: 1px solid #dfe2ec;
  border-radius: 10px;
  padding: 0 15px;
  color: #20243a;
  background: #f8f9fc;
  font-size: 14px;
  transition: border-color .2s, box-shadow .2s, background .2s;
}
#authModal .auth-form input:hover { border-color: #c9c7ea; }
#authModal .auth-form input:focus { border-color: #8173ee; outline: 0; background: #fff; box-shadow: 0 0 0 4px rgba(117, 101, 237, .11); }
#authModal .auth-form .modal-actions { margin-top: 24px; }
#authModal .auth-form .modal-actions button { min-height: 46px; border-radius: 10px; }
#authModal #loginSubmitButton { width: 100%; min-width: 145px; background: linear-gradient(135deg, #7d6bf2, #6251df); box-shadow: 0 10px 22px rgba(99, 81, 224, .24); }
#authModal #loginSubmitButton:hover { transform: translateY(-1px); box-shadow: 0 13px 25px rgba(99, 81, 224, .31); }
.auth-security { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 28px 0 0; color: #a0a4b2; font-size: 10px; }
.auth-security span { color: #6f62dc; font-size: 15px; transform: rotate(-32deg); }

@keyframes auth-card-float { 0%, 100% { transform: translateY(0) rotate(-1deg); } 50% { transform: translateY(-7px) rotate(-.35deg); } }
@keyframes auth-dot { 0%, 60%, 100% { transform: translateY(0); opacity: .45; } 30% { transform: translateY(-3px); opacity: 1; } }
@keyframes auth-stars { to { background-position: 86px 86px, -62px 62px, 104px -104px; } }
@keyframes auth-orb-one { to { transform: translate(-35px, 25px) scale(1.12); } }
@keyframes auth-orb-two { to { transform: translate(48px, -22px) scale(.9); } }
@keyframes auth-ring-drift { to { transform: translate(-3vw, 4vw) scale(1.08); } }

@media (max-width: 860px) {
  body.auth-required { overflow-y: auto; }
  #authModal { width: min(720px, calc(100vw - 28px)); max-height: calc(100dvh - 28px); border-radius: 22px; }
  #authModal .auth-layout { grid-template-columns: 1fr; }
  .auth-showcase { min-height: 260px; padding: 28px 34px; }
  .auth-copy { margin-top: 34px; max-width: 560px; }
  .auth-copy h1 { margin: 9px 0 10px; font-size: clamp(28px, 6vw, 39px); }
  .auth-copy p { font-size: 13px; }
  .auth-conversation { display: none; }
  .auth-benefits { margin-top: 22px; padding-top: 0; }
  #authModal .auth-form { padding: 38px 42px; }
}

@media (max-width: 520px) {
  #authModal { width: calc(100vw - 20px); max-width: none; max-height: calc(100dvh - 20px); border-radius: 18px; }
  .auth-showcase { min-height: 205px; padding: 24px; }
  .auth-brand { font-size: 13px; }
  .auth-brand__mark { width: 32px; height: 32px; }
  .auth-copy { margin-top: 24px; }
  .auth-kicker { font-size: 8px; }
  .auth-copy h1 { font-size: 27px; letter-spacing: -1px; }
  .auth-copy p { line-height: 1.45; }
  .auth-benefits { display: none; }
  #authModal .auth-form { padding: 30px 24px 25px; }
  #authModal .auth-form .modal-heading h2 { font-size: 27px; }
  #authModal .auth-form .form-grid { margin-top: 23px; }
  #authModal .auth-form .modal-actions { display: grid; grid-template-columns: 1fr; }
  #authModal .auth-form .modal-actions button { width: 100%; }
  #authModal #loginSubmitButton { grid-row: 1; }
  .auth-security { margin-top: 19px; }
}

@media (prefers-reduced-motion: reduce) {
  body.auth-required::after,
  .auth-showcase::before,
  .auth-orb,
  .auth-conversation,
  .auth-typing i {
    animation: none !important;
  }
}

#loginSubmitButton.is-loading {
  min-width: 156px;
  opacity: .88;
  cursor: wait;
}

#loginSubmitButton.is-loading::before {
  content: '';
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-right: 8px;
  vertical-align: -2px;
  border: 2px solid rgba(255, 255, 255, .42);
  border-top-color: #fff;
  border-radius: 50%;
  animation: login-spin .65s linear infinite;
}

@keyframes login-spin {
  to { transform: rotate(360deg); }
}

.help-steps {
  margin: 22px 0 0;
  padding-left: 22px;
  color: #626779;
  line-height: 1.55;
}

.help-steps li + li {
  margin-top: 10px;
}

.notification-list {
  display: grid;
  gap: 8px;
  margin-top: 20px;
  max-height: 310px;
  overflow: auto;
}

.notification-item {
  display: grid;
  grid-template-columns: 30px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid #ececf3;
  border-radius: 8px;
}

.notification-item__icon {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #eeeaff;
  color: #7161ef;
  font-weight: 800;
}

.notification-item--alert {
  border-color: #ffd9bc;
  background: #fffaf5;
}

.notification-item--alert .notification-item__icon {
  background: #fff0e3;
  color: #d8782e;
}

.notification-item strong,
.notification-item p {
  display: block;
  margin: 0;
}

.notification-item strong {
  color: #34384f;
  font-size: 12px;
}

.notification-item p,
.notification-item time {
  color: #85899a;
  font-size: 11px;
}

.notification-item p {
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 260px;
}

.chat-control-button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-left: auto;
  padding: 9px 13px;
  border: 0;
  border-radius: 8px;
  background: linear-gradient(135deg, #7868ef, #5e50d6);
  color: #fff;
  box-shadow: 0 5px 13px rgba(113, 97, 239, .25);
  cursor: pointer;
  font: 700 12px/1 inherit;
  transition: transform .16s ease, box-shadow .16s ease, background .16s ease;
}

.chat-control-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(113, 97, 239, .32);
  background: linear-gradient(135deg, #6b5bea, #5144c8);
}

.chat-control-button:focus-visible {
  outline: 3px solid rgba(113, 97, 239, .24);
  outline-offset: 2px;
}

.chat-control-button__icon {
  display: grid;
  place-items: center;
  width: 16px;
  height: 16px;
  border-radius: 5px;
  background: rgba(255, 255, 255, .18);
  font-size: 11px;
}

.chat-control-button.is-active {
  background: #e8f8ef;
  color: #178457;
  box-shadow: none;
}

.chat-control-button.is-active:hover {
  background: #d9f3e5;
  box-shadow: 0 5px 13px rgba(33, 169, 115, .14);
}

.chat-control-button.is-active .chat-control-button__icon {
  background: #c8efd9;
}

#logoutButton {
  background: #fff0f1;
  color: #d83d4d;
  border: 1px solid #ffd4d8;
  box-shadow: none;
  transition: transform .16s ease, background .16s ease, box-shadow .16s ease;
}

#logoutButton:hover {
  background: #e94e5f;
  border-color: #e94e5f;
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(216, 61, 77, .22);
}

#logoutButton:focus-visible {
  outline: 3px solid rgba(233, 78, 95, .22);
  outline-offset: 2px;
}

/* Simple agency directories: actions belong to their page, never the global bar. */
.directory-view .section-heading {
  align-items: center;
  margin-bottom: 34px;
}

.directory-view .eyebrow {
  color: #6557d6;
}

.directory-toolbar {
  align-items: end;
  margin-bottom: 28px;
}

.directory-toolbar .search {
  flex: 0 1 500px;
  width: min(500px, 100%);
  height: 46px;
}

.directory-filter {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 10px;
  color: #555a6c;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.directory-filter select {
  flex: none;
  min-width: 190px;
  height: 46px;
}

.directory-view .agent-card-top {
  padding-right: 92px;
}

.configure-agent {
  position: absolute;
  top: 16px;
  right: 16px;
  min-height: 34px;
  padding: 7px 11px;
  border: 1px solid #dcd9f7;
  border-radius: 7px;
  background: #f7f6ff;
  color: #6255cf;
  cursor: pointer;
  font: 700 11px/1 inherit;
}

.configure-agent:hover {
  border-color: #bbb4f1;
  background: #eeebff;
}

.directory-table {
  border-style: solid;
}

.directory-empty {
  display: grid;
  min-height: 320px;
  place-items: center;
  align-content: center;
  padding: 42px 24px;
  border: 1px dashed #d9dbe6;
  border-radius: 11px;
  background: #fff;
  text-align: center;
}

.directory-empty[hidden] {
  display: none;
}

.directory-empty__icon {
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  margin-bottom: 17px;
  border-radius: 18px;
  background: #eeecff;
  color: #6557d6;
  font-size: 25px;
}

.directory-empty h2,
.directory-empty p {
  margin: 0;
}

.directory-empty h2 {
  color: #24283f;
  font-size: 16px;
}

.directory-empty p {
  margin-top: 8px;
  color: #85899a;
  font-size: 12px;
}

.directory-empty .new-agent {
  margin-top: 20px;
}

.integration-icon.access {
  background: #eeecff;
  color: #6557d6;
}

@media (max-width: 760px) {
  .directory-view .section-heading {
    align-items: stretch;
    flex-direction: column;
    margin-bottom: 22px;
  }

  .directory-view .section-heading .new-agent {
    align-self: flex-start;
  }

  .directory-toolbar,
  .directory-filter {
    align-items: stretch;
    flex-direction: column;
    width: 100%;
  }

  .directory-filter select {
    width: 100%;
  }

  .directory-view .agent-card-top {
    padding-right: 0;
  }

  .configure-agent {
    position: static;
    width: 100%;
    margin-bottom: 14px;
  }

  .directory-empty {
    min-height: 270px;
  }
}

.inbox-filter {
  align-items: center;
  gap: 10px;
}

/* Keep the inbox inside the viewport; only the two history panes scroll. */
#inboxView.active {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  height: calc(100vh - 80px);
  height: calc(100dvh - 80px);
  min-height: 0;
  padding-top: 24px;
  padding-bottom: 20px;
  overflow: hidden;
}
#inboxView .section-heading { margin-bottom: 18px; }
#inboxView .inbox-layout { min-height: 0; min-width: 0; grid-template-columns: 320px minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); }
#inboxView .conversation-list { min-height: 0; min-width: 0; display: flex; flex-direction: column; overflow: hidden; }
#inboxView .inbox-filter { flex-shrink: 0; flex-wrap: wrap; }
#conversationList { min-height: 0; overflow-y: auto; overscroll-behavior-y: contain; scrollbar-gutter: stable; }
#inboxView .chat { min-height: 0; min-width: 0; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; overflow: hidden; }
#inboxView .chat-head { min-width: 0; flex-wrap: wrap; overflow-wrap: anywhere; }
#liveMessages { min-height: 0; overflow-y: auto; overscroll-behavior-y: contain; scrollbar-gutter: stable; overflow-wrap: anywhere; }
#liveMessages .message { flex-shrink: 0; }
#liveMessages .message-content { display: block; white-space: pre-wrap; }
#liveMessages .message-timestamp { display: block; margin-top: 6px; text-align: right; font-size: 10px; line-height: 1.2; white-space: nowrap; font-variant-numeric: tabular-nums; opacity: .72; }
#inboxView .chat-input { min-width: 0; background: #fff; }
#humanMessage { min-width: 0; }

.inbox-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 14px;
  margin: -4px 0 14px;
}

.inbox-toolbar label {
  display: grid;
  gap: 6px;
  color: #555a6c;
  font-size: 11px;
  font-weight: 700;
}

.inbox-toolbar select {
  width: 190px;
  height: 40px;
}

.inbox-list-tools {
  flex-shrink: 0;
  border-bottom: 1px solid #ececf3;
  background: #fff;
}

.inbox-search {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 42px;
  margin: 14px 14px 8px;
  padding: 0 11px;
  border: 1px solid #dde1ea;
  border-radius: 8px;
  color: #7d8496;
  background: #fff;
}

.inbox-search:focus-within {
  border-color: #968aed;
  box-shadow: 0 0 0 3px rgba(113, 97, 239, .09);
}

.inbox-search input {
  min-width: 0;
  width: 100%;
  border: 0;
  outline: 0;
  color: #30354b;
  background: transparent;
  font: 12px inherit;
}

.inbox-search input::placeholder { color: #a0a6b8; }

.inbox-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2px;
  padding: 0 10px 8px;
}

.inbox-tabs button {
  min-width: 0;
  border: 0;
  border-radius: 16px;
  padding: 7px 6px;
  color: #657087;
  background: transparent;
  font: 700 10px inherit;
  cursor: pointer;
  white-space: nowrap;
}

.inbox-tabs button:hover { background: #f1f3f8; }
.inbox-tabs button.active { color: #fff; background: #121b35; }

#inboxCount {
  display: block;
  padding: 0 15px 9px;
  color: #9297a8;
  font-size: 10px;
  font-weight: 600;
}

.conversation.is-unread strong { color: #171c31; font-weight: 800; }
.conversation time { display: grid; justify-items: end; align-content: start; gap: 3px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.conversation-unread { width: 7px; height: 7px; border-radius: 50%; background: #7161ef; box-shadow: 0 0 0 3px rgba(113, 97, 239, .12); }

.inbox-empty {
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 30px 18px;
  color: #8990a2;
  text-align: center;
}

.inbox-empty span { font-size: 24px; color: #7768e8; }
.inbox-empty strong { color: #4b5268; font-size: 12px; }
.inbox-empty p { margin: 0; font-size: 11px; }
@media (max-width: 760px) {
  #inboxView.active { height: calc(100vh - 65px); height: calc(100dvh - 65px); padding: 12px 12px 12px; }
  #inboxView .section-heading { margin-bottom: 12px; }
  #inboxView .section-heading h1 { font-size: 23px; }
  #inboxView .inbox-layout { grid-template-columns: minmax(0, 1fr); }
  #inboxView .conversation-list { display: none; }
  #liveMessages { padding: 14px; }
  #liveMessages .message { max-width: 88%; }
  #inboxView .chat-input { padding: 12px; }
  .inbox-toolbar { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px; }
  .inbox-toolbar select { width: 100%; }
}

.inbox-business-filter {
  min-width: 132px;
  height: 32px;
  max-width: 165px;
  color: #626779;
  font-size: 11px;
}

.company-conversation-group + .company-conversation-group {
  border-top: 1px solid #ececf3;
}

.company-conversation-group__heading {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 15px 8px;
  background: #fbfbfe;
}

.company-conversation-group__avatar {
  display: grid;
  place-items: center;
  width: 25px;
  height: 25px;
  border-radius: 7px;
  background: #eeeaff;
  color: #6557d6;
  font-size: 9px;
  font-weight: 800;
}

.company-conversation-group__heading strong,
.company-conversation-group__heading small {
  display: block;
}

.company-conversation-group__heading strong {
  color: #44495e;
  font-size: 11px;
}

.company-conversation-group__heading small {
  margin-top: 1px;
  color: #969aa9;
  font-size: 10px;
}

.company-conversation-group .conversation {
  border-bottom: 0;
}

.chat-company-tag {
  display: inline-block;
  margin-left: 5px;
  padding: 2px 6px;
  border-radius: 10px;
  background: #f0eeff;
  color: #665ad0;
  font-size: 10px;
  font-style: normal;
  font-weight: 700;
}

@media (max-width: 760px) {
  .inbox-business-filter {
    max-width: 145px;
  }
}

.conversation.needs-human {
  box-shadow: inset 3px 0 #ee9a47;
}

.human-alert-chip,
.chat-human-alert {
  display: inline-flex;
  align-items: center;
  width: max-content;
  margin-top: 5px;
  padding: 2px 6px;
  border-radius: 10px;
  background: #fff2e7;
  color: #c66c24;
  font-size: 9px;
  font-weight: 800;
}

.chat-human-alert {
  margin: 0 0 0 5px;
  vertical-align: 1px;
}

.chat-control-button.is-alert {
  background: linear-gradient(135deg, #f0a452, #df7c39);
  box-shadow: 0 5px 13px rgba(223, 124, 57, .25);
}

.chat-control-button.is-alert:hover {
  background: linear-gradient(135deg, #e79443, #cc6828);
}

.usage-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 17px;
  margin-bottom: 20px;
}

.usage-metric {
  min-height: 132px;
}

.usage-metric > span {
  color: #777c8e;
  font-size: 12px;
}

.usage-metric strong {
  display: block;
  margin: 13px 0 5px;
  color: #222743;
  font-size: 28px;
  letter-spacing: -1px;
}

.usage-metric small,
.usage-caption {
  color: #8c90a0;
  font-size: 10px;
}

.usage-table-card {
  overflow: auto;
}

.usage-table-head {
  padding: 20px 20px 5px;
}

.usage-table-head h2,
.usage-table-head p {
  margin: 0;
}

.usage-table-head h2 {
  color: #30354d;
  font-size: 15px;
}

.usage-table-head p {
  margin-top: 4px;
  color: #85899a;
  font-size: 11px;
}

.plan-select {
  min-width: 98px;
  height: 32px;
  color: #6458cf;
  font-size: 11px;
  font-weight: 700;
}

.usage-progress {
  width: 112px;
  height: 6px;
  overflow: hidden;
  border-radius: 10px;
  background: #ececf4;
}

.usage-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: #7565ed;
}

.usage-progress.is-medium span {
  background: #e6a04e;
}

.usage-progress.is-high span {
  background: #e35d6c;
}

.usage-empty {
  padding: 24px !important;
  color: #85899a !important;
  text-align: center;
}

#agentConfigModal {
  max-height: calc(100vh - 28px);
}

#agentConfigModal .modal-card {
  max-height: calc(100vh - 28px);
  overflow-y: auto;
}

#agentConfigModal {
  width: min(1060px, calc(100vw - 32px));
}

#agentConfigModal .agent-editor {
  width: 100%;
  padding: 26px;
  background: #f7f9fc;
}

.agent-editor > .modal-heading {
  margin-bottom: 18px;
}

.agent-editor-section {
  display: grid;
  grid-template-columns: minmax(160px, 250px) minmax(0, 1fr);
  gap: 28px;
  margin-top: 14px;
  padding: 22px;
  border: 1px solid #dfe5ec;
  border-radius: 11px;
  background: #fff;
  box-shadow: 0 3px 10px rgba(28, 43, 62, .035);
}

.agent-editor-section__intro h3,
.agent-editor-section__intro p {
  margin: 0;
}

.agent-editor-section__intro h3 {
  color: #172a3e;
  font-size: 15px;
}

.agent-editor-section__intro p {
  margin-top: 7px;
  color: #69798c;
  font-size: 12px;
  line-height: 1.55;
}

.agent-editor-section .form-grid textarea {
  min-height: 86px;
  height: auto;
}

.agent-editor-section #agentInstructions {
  min-height: 190px;
}

.form-grid .ai-credentials-card {
  display: block;
  padding: 16px;
  border-color: #d8ddf5;
  background: #f8f9ff;
}

.ai-credentials-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.ai-credentials-grid label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  color: #555a6c;
  font-size: 12px;
  font-weight: 700;
}

.ai-credentials-grid input,
.ai-credentials-grid select {
  width: 100%;
  min-width: 0;
  min-height: 40px;
  padding: 0 11px;
  border: 1px solid #dddfe8;
  border-radius: 7px;
  color: var(--ink);
  background: #fff;
  font: 13px inherit;
}

.ai-config-status {
  margin-bottom: 14px;
  padding: 11px 13px;
  border: 1px solid #e1e4ed;
  border-radius: 8px;
  color: #687286;
  background: #f7f8fb;
  font-size: 12px;
  font-weight: 700;
}

.ai-config-status.configured {
  border-color: #bfe8d9;
  color: #087f69;
  background: #e9f8f3;
}

.optional-label {
  color: #8e92a2;
  font-size: 10px;
  font-style: normal;
  font-weight: 500;
}

.text-danger-button {
  margin-top: 12px;
  padding: 0;
  border: 0;
  color: #bb3646;
  background: transparent;
  font: 700 12px inherit;
  cursor: pointer;
}

.agent-greeting {
  margin: 2px 0 0;
  padding: 11px 13px;
  border-radius: 8px;
  color: #087f69;
  background: #e5f6f1;
  font-size: 12px;
  font-weight: 700;
}

.agent-editor-actions {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  position: sticky;
  bottom: -26px;
  z-index: 2;
  margin: 20px -26px -26px;
  padding: 15px 26px;
  border-top: 1px solid #dfe5ec;
  background: rgba(255, 255, 255, .96);
  backdrop-filter: blur(8px);
}

.danger-button {
  border: 0;
  border-radius: 7px;
  padding: 10px 15px;
  color: #fff;
  background: #cc3e4e;
  font: 700 13px inherit;
  cursor: pointer;
}

.danger-button:hover { background: #b92f40; }
.delete-agent-warning { margin-top: 18px; padding: 13px; border-radius: 8px; color: #8b3340; background: #fff0f2; font-size: 12px; line-height: 1.5; }

@media (max-width: 760px) {
  #agentConfigModal .agent-editor { padding: 22px 16px; }
  .agent-editor-section { grid-template-columns: 1fr; gap: 15px; padding: 17px; }
  .agent-editor-actions { grid-template-columns: 1fr 1fr; bottom: -22px; margin: 18px -16px -22px; padding: 12px 16px; }
  .agent-editor-actions span { display: none; }
  .agent-editor-actions .danger-button { grid-column: 1 / -1; }
  .ai-credentials-grid { grid-template-columns: 1fr; }
  .ai-credentials-grid .full { grid-column: 1; }
}

.knowledge-builder {
  padding: 16px;
  border: 1px solid #e5e3f5;
  border-radius: 9px;
  background: linear-gradient(135deg, #fcfbff, #f8f8fe);
}

.knowledge-builder__heading h3,
.knowledge-builder__heading p {
  margin: 0;
}

.knowledge-builder__heading h3 {
  color: #434760;
  font-size: 13px;
}

.knowledge-builder__heading p {
  margin-top: 4px;
  color: #85899a;
  font-size: 11px;
  line-height: 1.45;
}

.knowledge-builder .form-grid {
  margin-top: 14px;
}

.knowledge-builder__actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
}

.knowledge-list {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.knowledge-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 11px;
  border: 1px solid #e7e7f0;
  border-radius: 8px;
  background: #fff;
}

.knowledge-item__kind {
  display: inline-block;
  margin-right: 7px;
  padding: 2px 6px;
  border-radius: 10px;
  background: #efedff;
  color: #665ad3;
  font-size: 9px;
  font-weight: 800;
}

.knowledge-item strong {
  color: #42465c;
  font-size: 12px;
}

.knowledge-item p {
  margin: 5px 0 0;
  color: #777c8e;
  font-size: 11px;
  line-height: 1.4;
}

.knowledge-item a {
  display: inline-block;
  margin-top: 5px;
  color: #675ad5;
  font-size: 11px;
  font-weight: 700;
  text-decoration: none;
}

.knowledge-item__delete {
  width: 26px;
  height: 26px;
  flex: 0 0 auto;
  border: 0;
  border-radius: 7px;
  background: #fff0f1;
  color: #d95160;
  cursor: pointer;
  font-size: 17px;
  line-height: 1;
}

.knowledge-item__delete:hover {
  background: #e94e5f;
  color: #fff;
}

.human-alert-settings {
  border-color: #f0dec9;
  background: linear-gradient(135deg, #fffdfb, #fff8f1);
}

.integration-icon.alert {
  background: #fff0df;
  color: #dd7d37;
  font-weight: 900;
}

.calendar-settings {
  border-color: #d8e5fc;
  background: linear-gradient(135deg, #fdfefe, #f5f9ff);
}

#calendarMount { max-width: 720px; }
.calendar-working-days { margin: 0; padding: 12px; border: 1px solid #d8e5fc; border-radius: 8px; }
.calendar-working-days legend { padding: 0 5px; color: #363b50; font-size: 14px; font-weight: 700; }
.calendar-days-grid { display: grid; gap: 8px; }
.calendar-day-row { display: grid; grid-template-columns: minmax(105px, 1fr) repeat(2, minmax(0, 1fr)); align-items: center; gap: 10px; padding: 10px; background: #fff; border: 1px solid #e3e5ef; border-radius: 8px; }
#calendarView .calendar-day-check { display: flex; flex-direction: row; align-items: center; gap: 8px; min-height: 44px; font-size: 14px; cursor: pointer; }
#calendarView .calendar-day-check input { width: 18px; height: 18px; margin: 0; accent-color: #7564ed; }
#calendarView .calendar-day-time { font-size: 14px; min-width: 0; }
#calendarView .calendar-day-time input { min-width: 0; width: 100%; padding: 8px; }
.calendar-day-row:has(input[type="checkbox"]:checked) { border-color: #b9b1f6; }
.calendar-day-time input:disabled { opacity: .5; }
@media (max-width: 520px) { .calendar-day-row { grid-template-columns: repeat(2, minmax(0, 1fr)); } .calendar-day-check { grid-column: 1 / -1; } }
.calendar-working-days p { margin: 10px 0 0; font-size: 13px; line-height: 1.5; color: #687187; }
#calendarView .calendar-settings label,
#calendarView .calendar-settings select,
#calendarView .calendar-settings input,
#calendarView .calendar-connect-button,
#calendarView .calendar-connection-note { font-size: 14px; }
#calendarView .calendar-settings .form-note { font-size: 13px; line-height: 1.5; }

/* Datos de identidad solicitados al crear un cliente. */
#clientModal .modal-card {
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
}

.client-logo-picker {
  position: relative;
  display: grid !important;
  grid-template-columns: 68px minmax(0, 1fr);
  align-items: center;
  gap: 14px !important;
  min-height: 106px;
  padding: 14px;
  border: 1px solid #dfe2eb;
  border-radius: 10px;
  cursor: pointer;
  background: #fbfcfe;
  transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}

.client-logo-picker:hover,
.client-logo-picker:focus-within {
  border-color: #9f94f3;
  background: #fff;
  box-shadow: 0 0 0 4px rgba(113, 97, 239, .08);
}

.client-logo-picker > input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.client-logo-preview {
  display: grid;
  place-items: center;
  width: 68px;
  height: 68px;
  overflow: hidden;
  border: 1px dashed #b9d1dc;
  border-radius: 10px;
  color: #176b91;
  background: #edf7fa;
  font-size: 24px;
  font-weight: 700;
}

.client-logo-preview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #fff;
}

.client-logo-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.client-logo-copy strong {
  color: #30354b;
  font-size: 13px;
}

.client-logo-copy strong em {
  margin-left: 6px;
  color: #8e92a2;
  font-size: 10px;
  font-style: normal;
  font-weight: 600;
}

#clientLogoName {
  overflow: hidden;
  color: #6f7487;
  font-size: 11px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.company-cell .avatar img {
  width: 100%;
  height: 100%;
  border-radius: inherit;
  object-fit: cover;
  background: #fff;
}

.directory-edit-button {
  min-width: 104px;
  border: 1px solid #d8d3fb;
  border-radius: 7px;
  padding: 8px 11px;
  color: #5f53cf;
  background: #f5f3ff;
  font: 700 11px inherit;
  cursor: pointer;
  white-space: nowrap;
}

.directory-edit-button:hover,
.directory-edit-button:focus-visible {
  border-color: #9184ef;
  outline: 0;
  background: #ece9ff;
}

.directory-row-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
}

.directory-delete-button {
  min-width: 104px;
  border: 1px solid #f1c9cf;
  border-radius: 7px;
  padding: 8px 11px;
  color: #b93445;
  background: #fff6f7;
  font: 700 11px inherit;
  cursor: pointer;
  white-space: nowrap;
}

.directory-delete-button:hover,
.directory-delete-button:focus-visible {
  border-color: #d77885;
  outline: 0;
  background: #ffecef;
}

/* Playground aislado para probar la configuración actual del agente. */
.sr-only { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; }
.playground-heading { align-items: center; }
.playground-safety { padding: 7px 11px; border: 1px solid #bfe8d9; border-radius: 18px; color: #087f69; background: #e9f8f3; font-size: 11px; font-weight: 800; }
.playground-workspace { display: grid; grid-template-columns: 270px minmax(0, 1fr); height: min(680px, calc(100dvh - 190px)); min-height: 520px; padding: 0; overflow: hidden; }
.playground-sidebar { display: flex; flex-direction: column; min-width: 0; border-right: 1px solid #e6e8ef; background: #fbfcfe; }
.playground-selectors { display: grid; gap: 14px; padding: 18px; border-bottom: 1px solid #e6e8ef; }
.playground-selectors label { display: grid; gap: 6px; color: #43495f; font-size: 11px; font-weight: 800; }
.playground-selectors select { width: 100%; height: 42px; }
.playground-sessions-heading { display: flex; align-items: center; justify-content: space-between; padding: 17px 16px 11px; color: #30364d; font-size: 12px; }
.playground-sessions-heading button { display: grid; width: 31px; height: 31px; place-items: center; border: 1px solid #dfe2eb; border-radius: 8px; color: #6557d6; background: #fff; font-size: 18px; cursor: pointer; }
.playground-sessions { display: grid; gap: 6px; padding: 0 10px 14px; overflow-y: auto; }
.playground-session { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px; align-items: center; width: 100%; padding: 11px; border: 0; border-radius: 8px; color: #566078; background: transparent; text-align: left; cursor: pointer; }
.playground-session:hover, .playground-session.active { color: #252a42; background: #efedff; }
.playground-session strong { overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.playground-session small { color: #9399aa; font-size: 9px; }
.playground-no-sessions { margin: 20px 12px; color: #949aaa; font-size: 11px; line-height: 1.5; text-align: center; }
.playground-chat { display: grid; grid-template-rows: auto minmax(0, 1fr) auto auto; min-width: 0; background: #fff; }
.playground-chat-head { display: flex; align-items: center; gap: 11px; min-height: 68px; padding: 13px 18px; border-bottom: 1px solid #e6e8ef; }
.playground-agent-icon { display: grid; width: 38px; height: 38px; place-items: center; border-radius: 10px; color: #6557d6; background: #eeecff; font-size: 17px; }
.playground-chat-head strong, .playground-chat-head small { display: block; }
.playground-chat-head strong { color: #22283f; font-size: 13px; }
.playground-chat-head small { margin-top: 4px; color: #8a91a3; font-size: 10px; }
.playground-chat-head small.ready { color: #159268; }
.playground-reset { margin-left: auto; border: 0; color: #6557d6; background: transparent; font: 700 11px inherit; cursor: pointer; }
.playground-reset:disabled { opacity: .45; cursor: default; }
.playground-messages { display: flex; flex-direction: column; gap: 11px; min-height: 0; padding: 24px; overflow-y: auto; background: linear-gradient(145deg, #fdfdff, #f7f8fc); }
.playground-empty { display: grid; justify-items: center; align-content: center; height: 100%; color: #7c8498; text-align: center; }
.playground-empty span { display: grid; width: 50px; height: 50px; place-items: center; margin-bottom: 14px; border-radius: 15px; color: #6557d6; background: #eeecff; font-size: 23px; }
.playground-empty strong { color: #282e45; font-size: 15px; }
.playground-empty p { max-width: 390px; margin: 8px 0 0; font-size: 11px; line-height: 1.55; }
.playground-message { width: fit-content; max-width: min(680px, 78%); padding: 11px 14px; border-radius: 12px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 12px; line-height: 1.55; }
.playground-message.user { align-self: flex-end; border-bottom-right-radius: 3px; color: #fff; background: linear-gradient(135deg, #7565ed, #6251dc); }
.playground-message.assistant { align-self: flex-start; border: 1px solid #e6e7ee; border-bottom-left-radius: 3px; color: #34394e; background: #fff; }
.playground-message small { display: block; margin-top: 8px; padding-top: 7px; border-top: 1px solid #f0cbd1; color: #a83b4b; font-size: 9px; font-weight: 800; }
.playground-message.typing { display: flex; gap: 4px; padding: 14px 16px; }
.playground-message.typing i { width: 5px; height: 5px; border-radius: 50%; background: #8175d8; animation: playground-dot 1.1s ease-in-out infinite; }
.playground-message.typing i:nth-child(2) { animation-delay: .14s; }
.playground-message.typing i:nth-child(3) { animation-delay: .28s; }
.playground-composer { display: flex; align-items: flex-end; gap: 10px; margin: 13px 18px 7px; padding: 7px 8px 7px 13px; border: 1px solid #dfe2eb; border-radius: 12px; background: #fff; }
.playground-composer:focus-within { border-color: #9c91ef; box-shadow: 0 0 0 3px rgba(113, 97, 239, .09); }
.playground-composer textarea { flex: 1; min-width: 0; max-height: 110px; border: 0; outline: 0; resize: vertical; color: #30364d; font: 12px/1.5 inherit; }
.playground-composer button { display: grid; width: 38px; height: 38px; flex: none; place-items: center; border: 0; border-radius: 9px; color: #fff; background: #6557d6; cursor: pointer; }
.playground-composer button:disabled { background: #b7b9c7; cursor: default; }
.playground-footnote { margin: 0 18px 10px; color: #969bad; font-size: 9px; text-align: center; }
@keyframes playground-dot { 0%, 60%, 100% { transform: translateY(0); opacity: .35; } 30% { transform: translateY(-3px); opacity: 1; } }

@media (max-width: 760px) {
  .playground-heading { align-items: flex-start; }
  .playground-workspace { grid-template-columns: 1fr; height: auto; min-height: 0; overflow: visible; }
  .playground-sidebar { border-right: 0; border-bottom: 1px solid #e6e8ef; }
  .playground-selectors { grid-template-columns: 1fr 1fr; }
  .playground-sessions-heading, .playground-sessions { display: none; }
  .playground-chat { min-height: calc(100dvh - 300px); }
  .playground-messages { min-height: 340px; padding: 16px; }
  .playground-message { max-width: 88%; }
}

@media (max-width: 460px) {
  .playground-safety { display: none; }
  .playground-selectors { grid-template-columns: 1fr; gap: 10px; padding: 13px; }
  .playground-chat-head { padding: 11px 13px; }
  .playground-reset { font-size: 10px; }
  .playground-messages { min-height: 320px; }
  .playground-composer { margin-inline: 10px; }
  .playground-footnote { margin-inline: 10px; }
}

@media (prefers-reduced-motion: reduce) { .playground-message.typing i { animation: none; } }

.integration-icon.calendar {
  background: #e8f0fe;
  color: #4285f4;
  font-size: 13px;
}

.calendar-connection-note {
  padding: 10px 12px;
  border: 1px solid #dce7f8;
  border-radius: 8px;
  background: #fff;
  color: #687187;
  font-size: 11px;
  line-height: 1.45;
}

.calendar-connect-button {
  align-self: flex-start;
  padding: 10px 14px;
  border: 1px solid #c9dafc;
  border-radius: 7px;
  background: #fff;
  color: #3267c8;
  cursor: pointer;
  font: 700 12px inherit;
}

.calendar-connect-button:hover {
  background: #edf4ff;
}

.calendar-fields {
  display: grid;
  gap: 14px;
}

.calendar-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.calendar-settings select,
.calendar-settings input[type="time"] {
  height: 40px;
  width: 100%;
  border: 1px solid #dddfe8;
  border-radius: 7px;
  padding: 0 11px;
  background: #fff;
  color: #363b50;
  font: 13px inherit;
  outline-color: #8eaeef;
}

.calendar-toggle {
  border-color: #d8e5fc;
}

.calendar-toggle input {
  accent-color: #4285f4;
}

.calendar-sql-link {
  color: #3d72d2;
  font-weight: 800;
  text-decoration: none;
}

.calendar-sql-link:hover {
  text-decoration: underline;
}

@media (max-width: 760px) {
  .calendar-form-grid {
    grid-template-columns: 1fr;
  }
}

.alert-toggle {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 12px;
  border: 1px solid #eadfce;
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
}

.alert-toggle input {
  width: 16px;
  height: 16px;
  margin: 1px 0 0;
  accent-color: #e58a40;
}

.alert-toggle strong,
.alert-toggle small {
  display: block;
}

.alert-toggle strong {
  color: #4a4650;
  font-size: 12px;
}

.alert-toggle small {
  margin-top: 3px;
  color: #85899a;
  font-size: 10px;
  line-height: 1.35;
}

#humanAlertForm code {
  color: #b5642e;
  font-weight: 800;
}

@media (max-width: 760px) {
  .usage-summary {
    grid-template-columns: 1fr;
  }

  .knowledge-builder__actions {
    align-items: flex-start;
    flex-direction: column;
  }
}
