@import url("https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&display=swap");

:root {
  --bg: #f3f7fb;
  --bg-alt: #e8f0f8;
  --surface: #ffffff;
  --surface-strong: #ffffff;
  --surface-soft: #f5f9fd;
  --ink: #1b2a41;
  --ink-soft: #33506b;
  --muted: #6d8298;
  --accent: #1fb6cf;
  --accent-dark: #1493a9;
  --accent-soft: #eafaff;
  --success-soft: #e8f7ef;
  --line: #d9e4ef;
  --line-strong: #c7d6e4;
  --bubble-in: #ffffff;
  --bubble-out: #edf8ff;
  --shadow: 0 22px 54px rgba(17, 38, 73, 0.08);
  --shadow-soft: 0 14px 32px rgba(17, 38, 73, 0.06);
}

body[data-ui-theme="ocean"] {
  --bg: #eef7fb;
  --bg-alt: #e3f0f7;
  --surface-soft: #f4fbff;
  --ink: #10324f;
  --ink-soft: #21506d;
  --muted: #557188;
  --accent: #0f9db6;
  --accent-dark: #0c8398;
  --accent-soft: #e8f8fb;
  --success-soft: #e8f7f3;
  --line: #cfe0eb;
  --line-strong: #bfd5e2;
  --bubble-out: #e7f6fb;
}

body[data-ui-theme="graphite"] {
  --bg: #eef1f6;
  --bg-alt: #e5eaf1;
  --surface-soft: #f5f7fa;
  --ink: #1f2a37;
  --ink-soft: #334155;
  --muted: #5f6b7b;
  --accent: #6366f1;
  --accent-dark: #4f46e5;
  --accent-soft: #eef2ff;
  --success-soft: #e8f5ee;
  --line: #d5ddea;
  --line-strong: #c2ccda;
  --bubble-out: #eef2ff;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body.bootstrap-chat-shell {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  overflow-y: auto;
  color: var(--ink);
  font-family: "Manrope", "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(31, 182, 207, 0.09), transparent 26%),
    radial-gradient(circle at 100% 0, rgba(66, 153, 225, 0.1), transparent 22%),
    linear-gradient(180deg, #f7fbff 0%, #f1f6fb 100%);
}

body.chat-shell {
  background: #111b21;
  overflow: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

.app-topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  padding: 12px 0 10px;
  background: linear-gradient(180deg, rgba(243, 247, 251, 0.96), rgba(243, 247, 251, 0.74));
  backdrop-filter: blur(12px);
}

.topbar-frame {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 18px;
  align-items: center;
  padding: 14px 20px;
  border-radius: 22px;
  background:
    linear-gradient(135deg, rgba(17, 38, 73, 0.98), rgba(28, 66, 107, 0.94));
  color: #f7fbff;
  box-shadow: 0 18px 42px rgba(17, 38, 73, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 46px;
  height: 46px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #21c1d6, #1b7fce);
  font-size: 18px;
  color: white;
  box-shadow: 0 14px 24px rgba(31, 182, 207, 0.28);
}

.topbar-brand h1,
.topbar-brand p {
  margin: 0;
}

.topbar-brand h1 {
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.1;
}

.topbar-brand p {
  color: rgba(232, 241, 249, 0.76);
  font-size: 0.8rem;
  line-height: 1.1;
}

.topbar-nav {
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

.topbar-nav a {
  padding: 9px 14px;
  border-radius: 12px;
  color: rgba(232, 241, 249, 0.72);
  font-weight: 700;
  font-size: 0.92rem;
  transition: 0.2s ease;
}

.topbar-nav a.active,
.topbar-nav a:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

.chat-app-grid {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr) 320px;
  grid-template-areas: "sidebar conversation tools";
  gap: 18px;
  align-items: start;
  min-height: 0;
  flex: 1;
  overflow: hidden;
}

body.chat-shell .app-topbar {
  display: none;
}

body.chat-shell .chat-desktop-shell {
  height: 100dvh;
  padding: 0 !important;
}

body.chat-shell .chat-hero-shell {
  display: none;
}

body.chat-shell .chat-app-grid {
  grid-template-columns: 72px 420px minmax(0, 1fr) 320px;
  grid-template-areas: "rail sidebar conversation tools";
  gap: 0;
  height: 100%;
  background: #111b21;
}

body.chat-shell .chat-rail {
  grid-area: rail;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 10px 12px;
  background: #202c33;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
}

body.chat-shell .chat-list-meta.compact {
  display: block;
  margin-top: 6px;
}

body.chat-shell .chat-list-meta.compact span {
  font-size: 0.8rem;
}

body.chat-shell .chat-rail-top,
body.chat-shell .chat-rail-bottom {
  display: grid;
  gap: 12px;
  justify-items: center;
}

body.chat-shell .chat-rail-item,
body.chat-shell .chat-rail-profile {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  color: #aebac1;
  background: transparent;
  transition: background 0.2s ease, color 0.2s ease;
}

body.chat-shell .chat-rail-item:hover,
body.chat-shell .chat-rail-item.active {
  background: rgba(255, 255, 255, 0.08);
  color: #e9edef;
}

body.chat-shell .chat-rail-profile {
  background: #374248;
  color: #e9edef;
  font-weight: 800;
}

body.chat-shell .chat-card {
  border-radius: 0;
  border: none;
  box-shadow: none;
}

body.chat-shell .sidebar-header,
body.chat-shell .conversation-header {
  background: #202c33;
}

body.chat-shell .sidebar-header {
  padding: 14px 18px 10px;
  border-bottom: none;
}

body.chat-shell .sidebar-header-copy h2 {
  margin: 0;
  color: #e9edef;
  font-size: 1.9rem;
  font-weight: 700;
}

body.chat-shell .sidebar-header-copy p {
  margin: 6px 0 0;
  color: #8696a0;
  font-size: 0.84rem;
}

body.chat-shell .sidebar-header-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

body.chat-shell .sidebar-card {
  background: #111b21;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
}

body.chat-shell .chat-search {
  padding: 10px 16px 8px;
  background: #111b21;
}

body.chat-shell .chat-search i {
  left: 30px;
  color: #8696a0;
}

body.chat-shell .chat-search input {
  border-radius: 10px;
  border: none;
  background: #202c33;
  color: #d1d7db;
  padding-top: 11px;
  padding-bottom: 11px;
}

body.chat-shell .chat-search input::placeholder {
  color: #8696a0;
}

body.chat-shell .sidebar-tabs {
  gap: 8px;
  padding: 0 16px 12px;
  background: #111b21;
  border-bottom: none;
}

body.chat-shell .sidebar-tab {
  min-height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 0.82rem;
  background: transparent;
  color: #aebac1;
  border: 1px solid #2f3b43;
}

body.chat-shell .sidebar-tab.active {
  background: #103529;
  color: #d9fdd3;
  border-color: #144d37;
}

body.chat-shell .sidebar-tab.icon-tab {
  width: 30px;
  padding: 0;
}

body.chat-shell .chat-list-item {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  text-decoration: none !important;
  box-shadow: none;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}

body.chat-shell .chat-list-item:hover,
body.chat-shell .chat-list-item.active {
  background: #202c33;
}

body.chat-shell .chat-list-item.has-unread {
  background: rgba(32, 44, 51, 0.8);
}

body.chat-shell .chat-avatar {
  width: 48px;
  height: 48px;
  font-size: 0.96rem;
  background: linear-gradient(135deg, #3b4a54, #2a3942);
  box-shadow: none;
}

body.chat-shell .chat-list-top strong {
  color: #e9edef;
  font-weight: 600;
  text-decoration: none !important;
}

body.chat-shell .chat-list-top span,
body.chat-shell .chat-list-meta span,
body.chat-shell .chat-list-copy p {
  color: #8696a0;
  text-decoration: none !important;
}

body.chat-shell .chat-list-copy p {
  font-size: 0.92rem;
  margin-bottom: 0;
  border-bottom: none !important;
  box-shadow: none !important;
}

body.chat-shell .chat-list-meta.compact {
  margin-top: 4px;
}

body.chat-shell .chat-unread-badge {
  background: #25d366;
  color: #0b141a;
}

body.chat-shell .chat-list-item *,
body.chat-shell .chat-list-item:hover *,
body.chat-shell .chat-list-item:focus *,
body.chat-shell .chat-list-item:active * {
  text-decoration: none !important;
}

body.chat-shell .conversation-card {
  background: #0b141a;
  border-right: 1px solid rgba(255, 255, 255, 0.04);
}

body.chat-shell .conversation-header {
  padding: 14px 16px;
  border-bottom-color: rgba(255, 255, 255, 0.06);
}

body.chat-shell .conversation-header h2 {
  font-size: 1rem;
  color: #e9edef;
}

body.chat-shell .conversation-meta {
  font-size: 0.83rem;
  color: #8696a0;
}

body.chat-shell .action-icon-chip {
  width: 34px;
  height: 34px;
  background: transparent;
  border-color: rgba(255, 255, 255, 0.08);
  color: #aebac1;
}

body.chat-shell .chat-thread {
  padding: 18px;
  gap: 10px;
  background:
    linear-gradient(rgba(11, 20, 26, 0.98), rgba(11, 20, 26, 0.98)),
    radial-gradient(circle at 1px 1px, rgba(255, 255, 255, 0.03) 1px, transparent 0);
  background-size: auto, 26px 26px;
}

body.chat-shell .bubble {
  max-width: min(78%, 640px);
}

body.chat-shell .bubble-body {
  padding: 10px 12px 8px;
  border-radius: 12px;
  box-shadow: none;
  border: 1px solid rgba(255, 255, 255, 0.03);
}

body.chat-shell .bubble.inbound .bubble-body {
  background: #202c33;
}

body.chat-shell .bubble.outbound .bubble-body {
  background: #005c4b;
}

body.chat-shell .bubble-author {
  color: #86e6c7;
}

body.chat-shell .bubble p,
body.chat-shell .bubble span,
body.chat-shell .bubble-body {
  color: #e9edef;
}

body.chat-shell .chat-compose {
  padding: 12px 14px;
  background: #202c33;
  border-top-color: rgba(255, 255, 255, 0.06);
}

body.chat-shell .compose-box {
  border-radius: 10px;
  border: none;
  background: #2a3942;
}

body.chat-shell .compose-box textarea,
body.chat-shell .compose-box textarea::placeholder,
body.chat-shell .compose-box i,
body.chat-shell .compose-icon-button {
  color: #d1d7db;
}

body.chat-shell .compose-send {
  min-width: 96px;
  background: linear-gradient(135deg, #25d366, #00a884);
  box-shadow: none;
  color: #0b141a;
}

body.chat-shell .compose-ai {
  min-width: 74px;
  background: #2a3942;
  border-color: rgba(255, 255, 255, 0.08);
  color: #d1d7db;
}

body.chat-shell .compose-ai:hover,
body.chat-shell .compose-ai:focus {
  background: #33454f;
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.14);
}

body.chat-shell .tool-card,
body.chat-shell .tools-accordion .accordion-item {
  border-radius: 0;
}

body.chat-shell .tools-accordion .accordion-button {
  padding: 14px 16px;
  background: #202c33;
  color: #e9edef;
}

body.chat-shell .accordion-title-text {
  font-size: 0.98rem;
  color: #e9edef;
}

body.chat-shell .tools-stack {
  background: #111b21;
}

body.chat-shell .info-spotlight-card,
body.chat-shell .tools-accordion .accordion-item,
body.chat-shell .tool-card,
body.chat-shell .tools-accordion .accordion-button:not(.collapsed) {
  background: #111b21;
  color: #e9edef;
}

body.chat-shell .stack .form-control,
body.chat-shell .stack .form-select {
  background: #202c33;
  border-color: #2f3b43;
  color: #e9edef;
}

body.chat-shell .stack .form-control::placeholder {
  color: #8696a0;
}

body.chat-shell .stack .form-label,
body.chat-shell .contact-spotlight-copy p,
body.chat-shell .payment-item span,
body.chat-shell .payment-item p,
body.chat-shell .eyebrow {
  color: #8696a0;
}

body.chat-shell .payment-item {
  background: #202c33;
  border-color: #2f3b43;
}

body.chat-shell .whatsapp-empty {
  min-height: 100%;
  display: grid;
  place-items: center;
  background: #0b141a;
}

body.chat-shell .whatsapp-empty-card {
  width: min(360px, 100%);
  padding: 28px;
  border-radius: 22px;
  text-align: center;
  background: #202c33;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

body.chat-shell .whatsapp-empty-card h2 {
  margin: 18px 0 8px;
  color: #e9edef;
  font-size: 1.6rem;
}

body.chat-shell .whatsapp-empty-card p {
  color: #8696a0;
  margin: 0;
}

body.chat-shell .whatsapp-empty-visual {
  width: 96px;
  height: 96px;
  margin: 0 auto;
  border-radius: 28px;
  background: linear-gradient(135deg, rgba(37, 211, 102, 0.18), rgba(0, 168, 132, 0.14));
  color: #25d366;
}

body.chat-shell .theme-picker {
  background: #202c33;
  border-color: #2f3b43;
  color: #d1d7db;
}

body.chat-shell .theme-picker .form-select,
body.chat-shell .theme-picker i {
  color: #d1d7db;
}

.chat-flash-banner {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 12px 0 0 88px;
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(37, 211, 102, 0.12);
  border: 1px solid rgba(37, 211, 102, 0.2);
  color: #d9fdd3;
  font-size: 0.9rem;
}

.prefactura-lookup-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.prefactura-lookup-state {
  margin-top: 8px;
  font-size: 0.83rem;
  color: #8696a0;
}

.wisphub-status-card,
.payment-section-card {
  padding: 16px;
  border-radius: 18px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(255, 255, 255, 0.04);
}

.wisphub-status-card {
  margin: 0 22px 18px;
}

.wisphub-status-card.is-connected {
  border-color: rgba(37, 211, 102, 0.22);
  background: rgba(37, 211, 102, 0.06);
}

.wisphub-status-card.is-warning {
  border-color: rgba(245, 158, 11, 0.26);
  background: rgba(245, 158, 11, 0.08);
}

.wisphub-status-head,
.payment-section-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
}

.wisphub-status-head strong,
.payment-section-head h3 {
  color: #e9edef;
}

.wisphub-status-meta {
  display: grid;
  gap: 6px;
  margin-top: 10px;
}

.wisphub-status-meta span,
.payment-section-head p {
  color: #aebac1;
  font-size: 0.86rem;
  margin: 6px 0 0;
}

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

.payment-form-grid-wide {
  grid-column: 1 / -1;
}

.payment-helper-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.helper-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(148, 163, 184, 0.16);
  color: #cdd7dd;
  font-size: 0.82rem;
  font-weight: 700;
}

.prefactura-lookup-card {
  margin-top: 10px;
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(16, 24, 32, 0.55);
  border: 1px solid rgba(71, 85, 105, 0.42);
}

.prefactura-lookup-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 10px;
}

.prefactura-lookup-head strong {
  color: #e9edef;
}

.prefactura-lookup-head span {
  color: #d9fdd3;
  font-size: 0.82rem;
  font-weight: 700;
}

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

.prefactura-lookup-grid span {
  color: #aebac1;
  font-size: 0.84rem;
}

.form-shell textarea.form-control {
  min-height: 140px;
}

.chat-desktop-shell {
  height: calc(100dvh - 86px);
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chat-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow-soft);
}

.sidebar-card,
.conversation-card {
  overflow: hidden;
}

.sidebar-card {
  grid-area: sidebar;
}

.conversation-card {
  grid-area: conversation;
}

.tools-stack {
  grid-area: tools;
}

.sidebar-card,
.conversation-card,
.tools-stack {
  height: 100%;
  min-height: 0;
  align-self: start;
}

.sidebar-card {
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr);
}

.sidebar-card,
.conversation-card,
.tool-card,
.chat-list,
.chat-thread {
  scrollbar-width: thin;
  scrollbar-color: rgba(18, 52, 77, 0.18) transparent;
}

.chat-list::-webkit-scrollbar,
.chat-thread::-webkit-scrollbar {
  width: 7px;
}

.chat-list::-webkit-scrollbar-thumb,
.chat-thread::-webkit-scrollbar-thumb {
  background: rgba(95, 116, 136, 0.18);
  border-radius: 999px;
  border: 1px solid transparent;
  background-clip: padding-box;
}

.chat-list::-webkit-scrollbar-track,
.chat-thread::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar-header,
.conversation-header,
.tool-card-head {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 14px;
  padding: 18px 20px 16px;
  border-bottom: 1px solid var(--line);
}

.conversation-header {
  position: sticky;
  top: 0;
  z-index: 2;
  background: rgba(240, 242, 245, 0.96);
  box-shadow: 0 1px 0 rgba(17, 27, 33, 0.08);
  backdrop-filter: blur(10px);
  padding-top: 20px;
  padding-bottom: 18px;
}

.sidebar-header h2,
.conversation-header h2,
.tool-card-head h3 {
  margin: 0;
  font-weight: 700;
}

.sidebar-header p,
.tool-card-head p,
.conversation-meta,
.eyebrow {
  margin: 0;
  color: var(--muted);
}

.eyebrow {
  display: inline-block;
  margin-bottom: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.soft-badge,
.count-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
}

.soft-badge.success {
  color: #1f7a4f;
  background: var(--success-soft);
}

.count-chip {
  min-width: 42px;
  justify-content: center;
}

.chat-search {
  position: relative;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.chat-search i {
  position: absolute;
  top: 50%;
  left: 34px;
  transform: translateY(-50%);
  color: var(--muted);
}

.chat-search input {
  width: 100%;
  padding: 12px 14px 12px 42px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #fff;
  outline: none;
}

.sidebar-tabs {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 10px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(252, 253, 255, 0.94));
  overflow-x: auto;
  scrollbar-width: none;
}

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

.sidebar-tab {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 14px;
  background: #f5f8fc;
  color: var(--muted);
  font-weight: 700;
  font-size: 0.84rem;
  border-radius: 12px;
  white-space: nowrap;
  border: 1px solid rgba(215, 227, 239, 0.95);
}

.sidebar-tab.active {
  background: linear-gradient(135deg, #12344d, #274b6a);
  color: white;
  border-color: transparent;
}

.chat-list {
  display: grid;
  min-height: 0;
  max-height: none;
  overflow: auto;
  background: rgba(255, 255, 255, 0.92);
}

.chat-list-item {
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: 14px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  transition: background 0.18s ease, transform 0.18s ease;
}

.chat-list-item:hover,
.chat-list-item.active {
  background: linear-gradient(180deg, #f9fbff 0%, #f2f8ff 100%);
}

.chat-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #f97362, #ff7a59);
  color: white;
  font-weight: 700;
  font-size: 1rem;
  box-shadow: 0 10px 18px rgba(255, 122, 89, 0.18);
}

.chat-avatar.large {
  width: 58px;
  height: 58px;
  border-radius: 50%;
}

.chat-list-copy {
  min-width: 0;
}

.chat-list-top,
.chat-list-meta,
.payment-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.chat-list-top strong,
.chat-list-meta span,
.chat-list-copy p {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-list-top span,
.chat-list-meta span,
.chat-list-copy p {
  color: var(--muted);
  font-size: 0.8rem;
}

.chat-list-copy p {
  margin: 6px 0 0;
}

.chat-list-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 4px;
}

.chat-list-bottom p {
  margin: 0;
}

.chat-time.unread {
  color: #00a884;
  font-weight: 700;
}

.chat-list-item.has-unread {
  background: #ebfff5;
}

.chat-unread-badge {
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: #25d366;
  color: white;
  font-size: 0.75rem;
  font-weight: 800;
  line-height: 1;
}

.conversation-card {
  height: 100%;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  background:
    linear-gradient(180deg, #f8fbff 0%, #f4f8fc 100%);
  border-radius: 24px;
}

.conversation-stage {
  min-height: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  position: relative;
}

.conversation-contact {
  display: flex;
  align-items: center;
  gap: 14px;
}

.conversation-header h2 {
  font-size: 1.15rem;
  margin-bottom: 4px;
}

.conversation-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 6px;
  font-size: 0.9rem;
}

.conversation-meta span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.tiny-dot {
  font-size: 0.45rem;
}

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

.conversation-action-icons {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-right: 4px;
}

.action-icon-chip {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(134, 150, 160, 0.22);
  color: #54656f;
  transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.action-icon-chip:hover {
  background: #ffffff;
  color: #12344d;
  transform: translateY(-1px);
}

.chat-thread {
  display: grid;
  gap: 12px;
  padding: 24px;
  overflow: auto;
  align-content: start;
  min-height: 0;
  background:
    radial-gradient(circle at top right, rgba(255, 122, 89, 0.08), transparent 18%),
    linear-gradient(180deg, rgba(248, 251, 255, 0.96), rgba(244, 248, 252, 0.96));
}

.bubble {
  max-width: min(72%, 620px);
}

.bubble-body {
  padding: 12px 14px 10px;
  border-radius: 12px;
  box-shadow: 0 1px 0 rgba(17, 27, 33, 0.08), 0 1px 2px rgba(17, 27, 33, 0.06);
  border: 1px solid rgba(215, 227, 239, 0.45);
  position: relative;
}

.bubble.inbound {
  justify-self: start;
}

.bubble.inbound .bubble-body {
  background: #ffffff;
  border-top-left-radius: 4px;
}

.bubble.outbound {
  justify-self: end;
}

.bubble.outbound .bubble-body {
  background: linear-gradient(180deg, #eff8ff 0%, #e8f3ff 100%);
  border-top-right-radius: 4px;
}

.bubble p {
  margin: 0 0 8px;
  white-space: pre-wrap;
}

.bubble-author {
  margin-bottom: 6px;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  color: #0b6155;
}

.chat-image-link {
  display: block;
  margin-bottom: 10px;
}

.chat-image {
  display: block;
  max-width: min(100%, 320px);
  width: 100%;
  height: auto;
  border-radius: 16px;
  border: 1px solid rgba(15, 23, 42, 0.08);
}

.chat-media-card {
  margin-bottom: 10px;
  padding: 10px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(18, 52, 77, 0.08);
}

.audio-card {
  min-width: min(100%, 320px);
}

.bubble-media-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--ink-soft);
}

.chat-video {
  width: min(100%, 360px);
  border-radius: 14px;
  background: #0f172a;
  display: block;
}

.chat-audio {
  width: min(100%, 320px);
  display: block;
}

.chat-file-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  margin-bottom: 10px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid rgba(18, 52, 77, 0.08);
  color: var(--ink);
  font-weight: 700;
}

.chat-file-chip i {
  color: var(--accent);
  font-size: 1.1rem;
}

.bubble span {
  display: block;
  text-align: right;
  color: #667781;
  font-size: 0.76rem;
}

.bubble-check {
  color: #53bdeb;
  font-size: 0.92rem;
  vertical-align: middle;
}

.chat-compose {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  padding: 16px 20px 14px;
  border-top: 1px solid var(--line);
  background: rgba(240, 242, 245, 0.96);
  position: sticky;
  bottom: 0;
  z-index: 2;
}

.compose-box {
  display: flex;
  align-items: end;
  gap: 12px;
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid rgba(134, 150, 160, 0.24);
  background: #fff;
}

.compose-box i {
  color: var(--muted);
  margin-bottom: 8px;
}

.compose-icon-button {
  color: var(--muted);
  cursor: pointer;
  margin-bottom: 6px;
  font-size: 1.1rem;
  transition: color 0.18s ease, transform 0.18s ease;
}

.compose-icon-button:hover {
  color: #008069;
  transform: translateY(-1px);
}

/* Tarjeta de ubicacion (mensaje de ubicacion de WhatsApp) */
.chat-location-card {
  display: flex;
  flex-direction: column;
  gap: 0;
  max-width: 260px;
  border-radius: 12px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  text-decoration: none;
  transition: border-color 0.18s ease, transform 0.18s ease;
}

.chat-location-card:hover {
  border-color: #3ecf8e;
  transform: translateY(-1px);
}

.chat-location-thumb {
  width: 100%;
  max-height: 140px;
  object-fit: cover;
  display: block;
}

.chat-location-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px;
}

.chat-location-title {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  font-size: 0.86rem;
  color: #e9edef;
}

.chat-location-title i {
  color: #ff6b5c;
}

.chat-location-open {
  font-size: 0.76rem;
  color: #8ee7f1;
}

/* Transcripcion de nota de voz (audio del cliente) */
.audio-transcription {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.82rem;
  line-height: 1.35;
  color: #dfe9f2;
}

.audio-transcription i {
  color: #8ee7f1;
  margin-top: 2px;
  flex-shrink: 0;
}

/* Banner de conversacion en solo lectura (no asignada al usuario) */
.readonly-compose {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 4px 0 2px;
  padding: 14px 16px;
  border-radius: 14px;
  background: rgba(255, 176, 32, 0.1);
  border: 1px solid rgba(255, 176, 32, 0.3);
  color: #d8e2ec;
  font-size: 0.86rem;
}

.readonly-compose i {
  color: #ffca6b;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.readonly-compose strong {
  color: #f4f8fc;
}

/* Boton de microfono (dictado por voz) */
button.compose-icon-button {
  border: none;
  background: transparent;
  padding: 0;
  line-height: 1;
  display: inline-flex;
  align-items: center;
}

.compose-mic.is-unavailable {
  opacity: 0.45;
}

.compose-mic.is-transcribing {
  color: #8ee7f1;
  animation: mic-spin 0.9s linear infinite;
}

@keyframes mic-spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.compose-mic.is-recording {
  color: #ff4d4f;
  animation: mic-pulse 1.1s ease-in-out infinite;
}

.compose-mic.is-recording:hover {
  color: #ff4d4f;
}

@keyframes mic-pulse {
  0% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.18);
    opacity: 0.6;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.compose-box textarea {
  width: 100%;
  min-height: 28px;
  max-height: 140px;
  padding: 0;
  border: none;
  background: transparent;
  outline: none;
  resize: none;
}

.compose-send {
  min-width: 122px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: linear-gradient(135deg, #00a884, #008069);
  border: none;
  box-shadow: 0 10px 18px rgba(0, 128, 105, 0.2);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.compose-ai {
  min-width: 86px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.compose-send:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(0, 128, 105, 0.26);
}

.chat-notice {
  min-height: 22px;
  padding: 0 22px 18px;
  color: #54656f;
  font-size: 0.88rem;
}

.subtle-notice {
  color: #6b7c8f;
  font-size: 0.84rem;
}

.image-preview {
  padding: 0 22px 18px;
}

.image-preview-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 16px;
  background: #fff;
  border: 1px solid rgba(134, 150, 160, 0.2);
}

.image-preview-card strong,
.image-preview-card span {
  display: block;
}

.image-preview-card span {
  color: var(--muted);
  font-size: 0.82rem;
}

.attachment-preview-icon {
  width: 74px;
  height: 74px;
  display: grid;
  place-items: center;
  border-radius: 20px;
  background: linear-gradient(135deg, var(--accent-soft), rgba(255, 255, 255, 0.95));
  color: var(--accent-dark);
  font-size: 1.6rem;
  flex: 0 0 auto;
}

.tools-stack {
  display: grid;
  gap: 18px;
  align-content: start;
  overflow: auto;
  padding-right: 4px;
  scrollbar-width: none;
}

.tools-stack::-webkit-scrollbar {
  display: none;
}

.tools-accordion {
  display: grid;
  gap: 18px;
}

.tools-accordion .accordion-item {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.tools-accordion .accordion-header {
  margin: 0;
}

.tools-accordion .accordion-button {
  border-radius: 20px;
  padding: 18px 20px 16px;
  background: transparent;
  box-shadow: none;
  align-items: start;
  gap: 12px;
}

.tools-accordion .accordion-button:not(.collapsed) {
  background: linear-gradient(180deg, #ffffff 0%, #f9fbfd 100%);
  color: var(--ink);
  box-shadow: none;
}

.tools-accordion .accordion-button::after {
  margin-left: auto;
}

.accordion-title-wrap {
  display: grid;
  gap: 4px;
  text-align: left;
}

.accordion-title-text {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--ink);
  line-height: 1.15;
}

.tools-accordion .accordion-body {
  padding: 0;
}

.info-spotlight-card {
  background: linear-gradient(180deg, #fbfdff 0%, #f6f9fd 100%);
}

.contact-spotlight {
  padding: 22px;
  display: grid;
  grid-template-columns: 68px minmax(0, 1fr);
  gap: 16px;
  align-items: center;
}

.contact-spotlight-avatar {
  width: 68px;
  height: 68px;
  border-radius: 22px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #ff8d6f, #ff6b4a);
  color: white;
  font-size: 1.4rem;
  font-weight: 800;
  box-shadow: 0 14px 28px rgba(255, 122, 89, 0.24);
}

.contact-spotlight-copy {
  min-width: 0;
}

.contact-spotlight-copy h3,
.contact-spotlight-copy p {
  margin: 0;
}

.contact-spotlight-copy h3 {
  font-size: 1.2rem;
  margin-bottom: 8px;
}

.contact-spotlight-copy p {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.92rem;
  margin-top: 6px;
}

.tool-card {
  padding: 0;
  overflow: visible;
  height: auto;
  min-height: 0;
}

.tool-card-head {
  padding-bottom: 14px;
}

.tool-card-head i {
  font-size: 1.2rem;
  color: var(--accent);
}

.stack {
  display: grid;
  gap: 12px;
  padding: 0 22px 22px;
}

.stack > div,
.payment-list,
.payment-item,
.contact-spotlight-copy {
  min-width: 0;
}

.compact-stack {
  padding: 0;
}

.status-banner {
  display: flex;
  justify-content: flex-start;
}

.stack .form-label {
  margin-bottom: 6px;
  font-size: 0.9rem;
  font-weight: 600;
}

.stack .form-control,
.stack .form-select {
  border-radius: 16px;
  border-color: rgba(148, 163, 184, 0.35);
  padding: 12px 14px;
  width: 100%;
  min-width: 0;
}

.stack .form-control:focus,
.stack .form-select:focus,
.chat-search input:focus {
  border-color: rgba(15, 118, 110, 0.45);
  box-shadow: 0 0 0 0.2rem rgba(15, 118, 110, 0.12);
}

.payment-list {
  display: grid;
  gap: 12px;
  padding: 0 22px 22px;
}

.payment-item {
  display: grid;
  gap: 6px;
  padding: 16px;
  border-radius: 16px;
  background: linear-gradient(180deg, #ffffff 0%, #f7fbff 100%);
  border: 1px solid var(--line);
  box-shadow: 0 10px 22px rgba(17, 38, 73, 0.05);
}

.payment-item span,
.payment-item p {
  color: var(--muted);
  margin: 0;
  font-size: 0.88rem;
}

.payment-empty,
.chat-empty,
.chat-empty-mini {
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--muted);
}

.payment-empty {
  gap: 10px;
  padding: 20px;
}

.payment-empty i {
  font-size: 1.8rem;
}

.chat-empty {
  min-height: 420px;
  gap: 12px;
  padding: 32px;
}

.empty-visual {
  width: 84px;
  height: 84px;
  border-radius: 24px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, rgba(255, 122, 89, 0.12), rgba(18, 52, 77, 0.1));
  color: var(--accent-dark);
  font-size: 2rem;
}

.chat-empty-mini {
  min-height: 180px;
  padding: 24px;
}

.page,
.auth-card {
  width: min(1100px, calc(100% - 32px));
  margin: 0 auto;
}

.page-shell {
  padding: 22px;
  border-radius: 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-soft);
}

.dashboard-hero,
.chat-hero-shell {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  background:
    radial-gradient(circle at top right, rgba(34, 211, 238, 0.2), transparent 22%),
    linear-gradient(135deg, #15263f 0%, #1f4d78 100%);
  color: #f7fbff;
}

.dashboard-hero-copy {
  max-width: 720px;
}

.dashboard-hero-copy h2 {
  margin: 0;
  font-size: clamp(1.35rem, 2.4vw, 1.95rem);
  line-height: 1.08;
}

.chat-hero-shell .eyebrow {
  margin-bottom: 4px;
}

.chat-hero-shell .section-subcopy {
  margin-top: 8px;
  font-size: 0.94rem;
  line-height: 1.45;
}

.dashboard-hero .eyebrow,
.dashboard-hero .section-subcopy,
.chat-hero-shell .eyebrow,
.chat-hero-shell .section-subcopy {
  color: rgba(241, 248, 255, 0.82);
}

.dashboard-hero .soft-badge,
.chat-hero-shell .soft-badge {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.12);
  color: #f7fbff;
}

.dashboard-hero-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
}

.notif-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid rgba(142, 231, 241, 0.4);
  background: rgba(142, 231, 241, 0.14);
  color: #ffffff;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.18s ease, transform 0.18s ease;
}

.notif-toggle:hover {
  background: rgba(142, 231, 241, 0.24);
  transform: translateY(-1px);
}

.notif-toggle i {
  color: #8ee7f1;
}

.notif-toggle.is-blocked {
  border-color: rgba(255, 139, 125, 0.4);
  background: rgba(255, 139, 125, 0.14);
  cursor: not-allowed;
}

.notif-toggle.is-blocked i {
  color: #ff8b7d;
}

/* Selector de proveedor de WhatsApp (Evolution vs Meta) */
.provider-switch-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

.provider-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px;
  border-radius: 16px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
}

.provider-card.is-active {
  border-color: #12b389;
  box-shadow: 0 0 0 0.18rem rgba(18, 179, 137, 0.12);
}

.provider-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.provider-card-head i {
  font-size: 1.3rem;
  color: #12b389;
}

.provider-card-head strong {
  flex: 1;
  color: #0f2138;
}

.provider-card p {
  margin: 0;
  color: #64748b;
  font-size: 0.86rem;
}

.chat-flash-banner.flash-error {
  border-color: #ffb4a8;
  color: #a4271a;
}

.wwebjs-qr-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px;
  border-radius: 12px;
  background: #f6f8fb;
  border: 1px dashed #cbd5e1;
}

.wwebjs-qr-box img {
  width: 200px;
  height: 200px;
  image-rendering: pixelated;
}

.wwebjs-qr-box small {
  color: #64748b;
}

.wwebjs-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Gestion de agentes en DataTable */
.dt-agent-name {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.mini-avatar.sm {
  width: 30px;
  height: 30px;
  font-size: 0.8rem;
}

.dt-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
}

.dt-badge.ok {
  color: #0f766e;
  background: rgba(18, 179, 137, 0.14);
}

.dt-badge.off {
  color: #64748b;
  background: rgba(100, 116, 139, 0.14);
}

/* simple-datatables sobre el tema claro del panel admin */
.datatable-wrapper .datatable-top,
.datatable-wrapper .datatable-bottom {
  padding: 10px 0;
}

.datatable-wrapper .datatable-input,
.datatable-wrapper .datatable-selector {
  background: #ffffff;
  border: 1px solid #d7dee8;
  color: #0f2138;
  border-radius: 10px;
  padding: 8px 12px;
  outline: none;
}

.datatable-wrapper .datatable-input::placeholder {
  color: #94a3b8;
}

.datatable-wrapper .datatable-selector option {
  background-color: #ffffff;
  color: #0f2138;
}

.agents-datatable {
  width: 100%;
  color: #0f2138;
  border-collapse: collapse;
}

.agents-datatable th,
.agents-datatable td {
  padding: 12px 12px;
  border-bottom: 1px solid #e2e8f0;
  text-align: left;
  vertical-align: middle;
}

.agents-datatable thead th {
  color: #64748b;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  cursor: pointer;
}

.agents-datatable tbody tr:hover {
  background: #f6f8fb;
}

.datatable-wrapper .datatable-pagination a {
  color: #334155;
  border-radius: 8px;
  padding: 6px 11px;
}

.datatable-wrapper .datatable-pagination a:hover {
  background: #eef2f8;
}

.datatable-wrapper .datatable-pagination .datatable-active a {
  background: #12b389;
  color: #fff;
}

.datatable-wrapper .datatable-info,
.datatable-wrapper .datatable-top {
  color: #64748b;
  font-size: 0.82rem;
}

/* Modal de edicion (tema claro, coherente con el panel admin) */
.agent-modal-content {
  background: #ffffff;
  color: #0f2138;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
}

.agent-modal-content .modal-header,
.agent-modal-content .modal-footer {
  border-color: #e2e8f0;
}

.agent-modal-content .form-control,
.agent-modal-content .form-select {
  background: #ffffff;
  border: 1px solid #d7dee8;
  color: #0f2138;
}

.agent-modal-content .form-select option {
  background-color: #ffffff;
  color: #0f2138;
}

.agent-modal-content .form-label {
  color: #64748b;
}

/* Pagina de Historial (busqueda por nombre o numero) */
.history-search-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border-radius: 14px;
  background: #ffffff;
  border: 1px solid #d7dee8;
}

.history-search-bar i {
  color: #12b389;
  font-size: 1.1rem;
}

.history-search-bar input {
  flex: 1;
  border: none;
  background: transparent;
  color: #0f2138;
  font-size: 1rem;
  outline: none;
}

.history-search-bar input::placeholder {
  color: #94a3b8;
}

.history-clear-btn {
  border: none;
  background: transparent;
  color: #64748b;
  cursor: pointer;
  padding: 4px;
}

.history-clear-btn:hover {
  color: #0f2138;
}

.history-state {
  margin: 16px 2px;
  color: #64748b;
  font-size: 0.9rem;
}

.history-results {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
  margin-top: 8px;
}

.history-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 6px 18px rgba(15, 33, 56, 0.05);
}

.history-card-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.history-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #0b8b6f, #12b389);
  color: #fff;
  font-weight: 800;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.history-card-copy {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.history-card-copy strong {
  color: #0f2138;
  font-size: 0.98rem;
}

.history-card-copy span {
  color: #64748b;
  font-size: 0.82rem;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.history-conv-count {
  font-size: 0.72rem;
  font-weight: 700;
  color: #0f766e;
  background: rgba(18, 179, 137, 0.12);
  padding: 4px 10px;
  border-radius: 999px;
  flex-shrink: 0;
}

.history-conv-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.history-conv {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #f6f8fb;
  border: 1px solid #e2e8f0;
  text-decoration: none;
  transition: border-color 0.18s ease, transform 0.18s ease;
}

.history-conv:hover {
  border-color: #12b389;
  transform: translateY(-1px);
}

.history-conv-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  align-self: flex-start;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
}

.history-conv-status.open {
  color: #4fd18b;
  background: rgba(37, 211, 102, 0.16);
}

.history-conv-status.closed {
  color: #8696a0;
  background: rgba(134, 150, 160, 0.16);
}

.history-conv-preview {
  color: #334155;
  font-size: 0.82rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-conv-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 0.72rem;
  color: #64748b;
}

.history-conv-meta span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.history-empty-mini {
  color: #8696a0;
  font-size: 0.82rem;
  padding: 6px 2px;
}

/* Historial de chats por contacto */
.contact-history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 340px;
  overflow-y: auto;
}

.contact-history-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 14px;
  border-radius: 12px;
  background: #202c33;
  border: 1px solid #2f3b43;
  text-decoration: none;
  color: #e9edef;
  transition: border-color 0.18s ease, transform 0.18s ease, background 0.18s ease;
}

.contact-history-item:hover {
  border-color: #3ecf8e;
  transform: translateY(-1px);
}

.contact-history-item.is-current {
  border-color: #3ecf8e;
  background: rgba(62, 207, 142, 0.1);
}

.contact-history-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.contact-history-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
}

.contact-history-status.open {
  color: #4fd18b;
  background: rgba(37, 211, 102, 0.16);
}

.contact-history-status.closed {
  color: #8696a0;
  background: rgba(134, 150, 160, 0.16);
}

.contact-history-date {
  font-size: 0.72rem;
  color: #8696a0;
}

.contact-history-preview {
  margin: 0;
  font-size: 0.82rem;
  color: #c4ced4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.contact-history-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 0.72rem;
  color: #8696a0;
}

.contact-history-meta span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.contact-history-current-tag {
  color: #4fd18b !important;
  font-weight: 700;
}

.theme-picker {
  min-width: 190px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.1);
  color: rgba(241, 248, 255, 0.82);
}

.theme-picker i {
  color: #8ee7f1;
}

.theme-picker .form-select {
  min-width: 0;
  border: none;
  background-color: transparent;
  color: #ffffff;
  font-weight: 700;
  box-shadow: none;
  padding-left: 0;
  padding-right: 1.6rem;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 22px;
}

.section-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.report-filters {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 22px;
  padding: 18px;
  border-radius: 20px;
  background:
    linear-gradient(180deg, #fbfdff 0%, #f4f8fc 100%);
  border: 1px solid var(--line);
}

.report-filter-actions {
  display: flex;
  align-items: end;
  gap: 10px;
  flex-wrap: wrap;
}

.section-heading h2 {
  margin: 0;
  font-size: 1.45rem;
}

.section-subcopy {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.94rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
}

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

.chart-card {
  min-height: 320px;
  padding: 20px 20px 12px;
  border-radius: 22px;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-soft);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.chart-card:hover,
.metric-card:hover,
.page-shell:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 36px rgba(17, 38, 73, 0.09);
}

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

.chart-card-head {
  margin-bottom: 12px;
}

.chart-card-head h3 {
  margin: 0;
  font-size: 1rem;
}

.chart-card-copy {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.chart-card canvas {
  width: 100% !important;
  height: 240px !important;
}

.facturas-hero-copy {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 22px;
  width: 100%;
}

.facturas-hero-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: end;
}

.dashboard-hero {
  background:
    radial-gradient(circle at top right, rgba(34, 211, 238, 0.22), transparent 20%),
    radial-gradient(circle at left bottom, rgba(96, 165, 250, 0.16), transparent 22%),
    linear-gradient(135deg, #15263f 0%, #1f4d78 100%);
}

.metric-card {
  min-height: 116px;
}

.metric-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 22px;
  border-radius: 22px;
  background: linear-gradient(180deg, #ffffff 0%, #f9fbff 100%);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-soft);
  position: relative;
  overflow: hidden;
}

.metric-card::after {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: linear-gradient(180deg, var(--accent), #3b82f6);
}

.metric-card h3,
.metric-card p {
  margin: 0;
}

.metric-card h3 {
  font-size: 1.65rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.metric-card p {
  color: var(--muted);
}

.metric-icon {
  width: 54px;
  height: 54px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  font-size: 1.25rem;
  color: white;
}

.metric-icon.teal {
  background: linear-gradient(135deg, #ff8d6f, #ff6b4a);
}

.metric-icon.amber {
  background: linear-gradient(135deg, #ff9f43, #ff7a59);
}

.metric-icon.green {
  background: linear-gradient(135deg, #0ea5a1, #14b8a6);
}

.metric-icon.blue {
  background: linear-gradient(135deg, #12344d, #345b79);
}

.opticom-hero {
  background:
    radial-gradient(circle at top right, rgba(255, 122, 89, 0.16), transparent 22%),
    linear-gradient(135deg, #12344d, #1f4f73);
  color: white;
  border-color: rgba(255, 255, 255, 0.06);
}

.opticom-hero .eyebrow,
.opticom-hero .section-subcopy,
.opticom-hero .soft-badge {
  color: rgba(255, 255, 255, 0.82);
}

.opticom-hero .soft-badge {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.14);
}

.opticom-hero h2 {
  color: white;
}

.opticom-panel {
  background: linear-gradient(180deg, #ffffff 0%, #f9fbfd 100%);
}

.agent-cards-grid {
  display: grid;
  gap: 18px;
}

.agent-edit-card {
  padding: 20px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: #fff;
  box-shadow: var(--shadow-soft);
}

.agent-edit-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  margin-bottom: 16px;
}

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

.agent-switches {
  display: grid;
  gap: 10px;
  align-content: center;
}

.agent-edit-actions {
  display: flex;
  justify-content: end;
  margin-top: 16px;
}

.table-shell {
  overflow: hidden;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: #fff;
}

.table-shell .ui-table {
  margin-bottom: 0;
}

.evolution-status-shell {
  padding: 24px;
}

.evolution-status-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.evolution-status-card {
  padding: 18px 20px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, #ffffff 0%, #f9fbfd 100%);
}

.evolution-status-card h3,
.evolution-status-card p {
  margin: 0;
}

.evolution-status-card h3 {
  margin-bottom: 8px;
  font-size: 1.15rem;
}

.evolution-status-card p {
  color: var(--muted);
  word-break: break-word;
}

.ui-table thead th {
  background: linear-gradient(180deg, #f8fbfe 0%, #f1f6fb 100%);
  color: #6d8298;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--line);
}

.ui-table tbody tr {
  transition: background-color 0.18s ease;
}

.ui-table tbody tr:hover {
  background: rgba(31, 182, 207, 0.045);
}

.ui-table tbody tr:last-child td {
  border-bottom: none;
}

.ui-table tbody td {
  padding-top: 16px;
  padding-bottom: 16px;
}

.validation-stack {
  min-width: 220px;
}

.validation-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.38rem 0.8rem;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.validation-coincide {
  background: rgba(25, 135, 84, 0.15);
  color: #0f7a4b;
}

.validation-diferencia,
.validation-error {
  background: rgba(220, 53, 69, 0.14);
  color: #b42318;
}

.validation-sin_registro {
  background: rgba(255, 193, 7, 0.18);
  color: #9a6700;
}

@media (max-width: 991px) {
  .facturas-hero-copy {
    flex-direction: column;
    align-items: stretch;
  }

  .facturas-hero-actions {
    justify-content: stretch;
  }

  .facturas-hero-actions .btn {
    width: 100%;
  }

  .payment-form-grid,
  .prefactura-lookup-grid {
    grid-template-columns: 1fr;
  }
}

.mini-avatar {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #ff8d6f, #ff6b4a);
  color: white;
  font-weight: 700;
}

.dual-shell {
  display: grid;
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
  gap: 18px;
}

.form-shell {
  padding: 0;
}

.auth-screen {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
}

.auth-split {
  width: min(1180px, 100%);
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 20px;
  align-items: stretch;
}

.auth-hero,
.auth-panel-card {
  border-radius: 24px;
  box-shadow: var(--shadow-soft);
}

.auth-hero {
  background: linear-gradient(135deg, #12344d, #1f4f73);
  color: white;
  padding: 24px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.auth-hero-card {
  height: 100%;
  min-height: 560px;
  border-radius: 26px;
  padding: 42px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  background:
    radial-gradient(circle at top right, rgba(255, 255, 255, 0.18), transparent 24%),
    rgba(255, 255, 255, 0.06);
}

.auth-hero-card h1 {
  margin: 0 0 16px;
  font-size: clamp(2rem, 4vw, 3.2rem);
  line-height: 1.05;
}

.auth-hero-card p {
  max-width: 560px;
  color: rgba(255, 255, 255, 0.82);
}

.auth-feature-list {
  display: grid;
  gap: 14px;
  margin-top: 28px;
}

.auth-feature-list div {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.auth-panel {
  display: grid;
  place-items: center;
}

.auth-panel-card {
  width: 100%;
  max-width: 460px;
  padding: 34px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--line);
}

.auth-panel-card h2,
.auth-panel-card p {
  margin: 0;
}

.auth-panel-card p {
  color: var(--muted);
  margin-top: 8px;
}

.grid {
  display: grid;
  gap: 16px;
}

.stats {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.two-col {
  display: grid;
  gap: 16px;
  grid-template-columns: 1fr 1.2fr;
}

.card,
.auth-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 24px;
  box-shadow: var(--shadow);
}

.auth-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
}

.auth-card {
  max-width: 420px;
}

input,
select,
textarea,
button {
  font: inherit;
}

.btn {
  font-weight: 700;
  border-radius: 14px !important;
  padding-top: 0.7rem;
  padding-bottom: 0.7rem;
}

.btn-dark {
  background: linear-gradient(135deg, #1b7fce, #1fb6cf);
  border-color: transparent;
  box-shadow: 0 12px 24px rgba(31, 182, 207, 0.22);
}

.btn-dark:hover,
.btn-dark:focus {
  background: linear-gradient(135deg, #176bb0, #1999af);
  border-color: transparent;
}

.btn-success {
  background: linear-gradient(135deg, #1fb6cf, #1493a9);
  border-color: transparent;
  box-shadow: 0 12px 24px rgba(31, 182, 207, 0.2);
}

.btn-success:hover,
.btn-success:focus {
  background: linear-gradient(135deg, #199db3, #117e91);
  border-color: transparent;
}

.btn-outline-light {
  border-color: rgba(217, 228, 239, 0.96);
  color: var(--ink);
  background: #fff;
}

.btn-outline-light:hover,
.btn-outline-light:focus {
  color: var(--accent-dark);
  background: var(--accent-soft);
  border-color: #ffd3c6;
}

.btn-outline-secondary,
.btn-outline-dark,
.btn-outline-success {
  background: #fff;
  border-color: var(--line);
  color: var(--ink);
}

.btn-outline-secondary:hover,
.btn-outline-dark:hover,
.btn-outline-success:hover {
  background: var(--accent-soft);
  border-color: #b8e8f1;
  color: var(--accent-dark);
}

button.ghost {
  background: transparent;
  color: var(--accent-dark);
  border: 1px solid var(--line);
}

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

.checkbox input {
  width: 18px;
}

.alert {
  padding: 12px 14px;
  border-radius: 12px;
  background: #fde7ec;
  color: #a11d33;
  border: 1px solid #f6c7d2;
}

.login-help {
  margin-top: 16px;
  color: var(--muted);
  font-size: 14px;
}

.login-help p {
  margin: 6px 0 0;
}

table {
  width: 100%;
  border-collapse: collapse;
}

.toast-stack {
  position: fixed;
  right: 22px;
  top: 106px;
  z-index: 1100;
  display: grid;
  gap: 10px;
  width: min(360px, calc(100vw - 32px));
}

.incoming-toast {
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid #ffd9ce;
  box-shadow: 0 18px 40px rgba(18, 52, 77, 0.12);
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 0.24s ease, transform 0.24s ease;
  cursor: pointer;
}

.admin-inline-stats {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}

.admin-stat-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #f7fbff;
  font-weight: 700;
}

.customer-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.customer-summary-grid .metric-card h3 {
  font-size: 1.45rem;
}

.incoming-toast.show {
  opacity: 1;
  transform: translateY(0);
}

.incoming-toast:hover {
  transform: translateY(0) scale(1.01);
  border-color: #ffb7a3;
}

.incoming-toast:focus-visible {
  outline: 3px solid rgba(255, 122, 89, 0.18);
  outline-offset: 2px;
}

.incoming-toast-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.incoming-toast-head span,
.incoming-toast p {
  color: var(--muted);
}

.incoming-toast p {
  margin: 0;
}

.action-toast {
  border: 1px solid #b6ebd2;
  border-left: 4px solid #12b389;
  cursor: default;
}

.action-toast .incoming-toast-head {
  margin-bottom: 0;
}

.action-toast .incoming-toast-head strong {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #0b7a5f;
}

th,
td {
  text-align: left;
  padding: 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.streaming-dashboard-body {
  background:
    radial-gradient(circle at top, rgba(255, 143, 77, 0.14), transparent 26%),
    radial-gradient(circle at 85% 15%, rgba(45, 212, 191, 0.1), transparent 18%),
    linear-gradient(180deg, #070b14 0%, #0d1321 45%, #121826 100%);
  color: #f4f6fb;
}

.streaming-topbar {
  background: linear-gradient(180deg, rgba(7, 11, 20, 0.96), rgba(7, 11, 20, 0.7));
}

.streaming-frame {
  background: rgba(10, 15, 27, 0.84);
  border-color: rgba(255, 255, 255, 0.08);
  color: #f4f6fb;
  box-shadow: 0 24px 56px rgba(0, 0, 0, 0.3);
}

.streaming-brand-mark {
  background: linear-gradient(135deg, #ff8f4d, #ff4d6d);
  box-shadow: 0 14px 26px rgba(255, 77, 109, 0.25);
}

.streaming-frame .topbar-brand p,
.streaming-nav a {
  color: rgba(244, 246, 251, 0.68);
}

.streaming-nav a.active,
.streaming-nav a:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.streaming-main {
  display: grid;
  gap: 26px;
}

.streaming-hero,
.streaming-shell,
.streaming-rail {
  border-radius: 28px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.24);
}

.streaming-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.9fr);
  gap: 24px;
  padding: 34px;
  min-height: 420px;
  background:
    linear-gradient(90deg, rgba(7, 11, 20, 0.9) 0%, rgba(7, 11, 20, 0.48) 50%, rgba(7, 11, 20, 0.8) 100%),
    radial-gradient(circle at 20% 20%, rgba(255, 143, 77, 0.18), transparent 24%),
    url("https://images.unsplash.com/photo-1524985069026-dd778a71c7b4?auto=format&fit=crop&w=1600&q=80") center/cover;
}

.streaming-hero-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 18px;
  max-width: 720px;
}

.streaming-kicker {
  display: inline-flex;
  width: fit-content;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.streaming-hero h2 {
  margin: 0;
  font-size: clamp(2.6rem, 6vw, 4.6rem);
  line-height: 0.94;
  letter-spacing: -0.04em;
}

.streaming-hero p {
  margin: 0;
  max-width: 620px;
  color: rgba(244, 246, 251, 0.76);
  font-size: 1.05rem;
}

.streaming-hero-actions,
.streaming-badges {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.streaming-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(244, 246, 251, 0.82);
  font-size: 0.88rem;
}

.streaming-hero-panel,
.streaming-shell,
.streaming-rail {
  background: rgba(9, 13, 24, 0.76);
  backdrop-filter: blur(14px);
}

.streaming-hero-panel {
  padding: 22px;
  align-self: end;
  border-radius: 24px;
}

.streaming-panel-head,
.streaming-section-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}

.streaming-panel-head span,
.streaming-section-head .eyebrow {
  color: rgba(244, 246, 251, 0.58);
}

.streaming-panel-head strong,
.streaming-section-head h3 {
  color: #ffffff;
}

.streaming-spotlight-grid,
.streaming-card-row,
.streaming-chart-grid {
  display: grid;
  gap: 18px;
}

.streaming-spotlight-grid {
  margin-top: 18px;
}

.streaming-spotlight-card,
.streaming-poster-card,
.streaming-message-card,
.streaming-chart-card {
  border-radius: 24px;
  overflow: hidden;
}

.streaming-spotlight-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.streaming-spotlight-card h3,
.streaming-spotlight-card p,
.streaming-poster-card h4,
.streaming-poster-card strong,
.streaming-poster-card p,
.streaming-message-body p,
.streaming-message-meta strong,
.streaming-message-meta span {
  margin: 0;
}

.streaming-spotlight-card p,
.streaming-poster-card p,
.streaming-message-body p,
.streaming-message-meta span,
.streaming-message-body small {
  color: rgba(244, 246, 251, 0.7);
}

.streaming-spotlight-icon {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.12);
  font-size: 1.2rem;
}

.streaming-spotlight-card.sun {
  background: linear-gradient(135deg, rgba(255, 143, 77, 0.28), rgba(255, 94, 98, 0.16));
}

.streaming-spotlight-card.ocean {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.2), rgba(45, 212, 191, 0.18));
}

.streaming-spotlight-card.lime {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.2), rgba(132, 204, 22, 0.14));
}

.streaming-shell,
.streaming-rail {
  padding: 24px;
}

.streaming-filters {
  margin-bottom: 0;
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.08);
}

.streaming-filters .form-label {
  color: rgba(244, 246, 251, 0.76);
}

.streaming-filters .form-control,
.streaming-filters .form-select {
  color: #f4f6fb;
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.08);
}

.streaming-filters .form-control::-webkit-calendar-picker-indicator {
  filter: invert(1);
}

.streaming-card-row {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.streaming-poster-card {
  position: relative;
  min-height: 240px;
  display: flex;
  flex-direction: column;
  justify-content: end;
  gap: 10px;
  padding: 22px;
  background:
    linear-gradient(180deg, rgba(7, 11, 20, 0.06), rgba(7, 11, 20, 0.9)),
    radial-gradient(circle at top, rgba(255, 255, 255, 0.14), transparent 24%),
    linear-gradient(135deg, #1e293b, #111827);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.streaming-poster-card.featured {
  background:
    linear-gradient(180deg, rgba(7, 11, 20, 0.05), rgba(7, 11, 20, 0.92)),
    url("https://images.unsplash.com/photo-1517604931442-7e0c8ed2963c?auto=format&fit=crop&w=1000&q=80") center/cover;
}

.streaming-poster-card.midnight {
  background:
    linear-gradient(180deg, rgba(7, 11, 20, 0.2), rgba(7, 11, 20, 0.94)),
    linear-gradient(135deg, #1d4ed8, #0f172a);
}

.streaming-poster-card.lime {
  background:
    linear-gradient(180deg, rgba(7, 11, 20, 0.16), rgba(7, 11, 20, 0.9)),
    linear-gradient(135deg, #15803d, #052e16);
}

.streaming-poster-card.ember {
  background:
    linear-gradient(180deg, rgba(7, 11, 20, 0.16), rgba(7, 11, 20, 0.9)),
    linear-gradient(135deg, #ea580c, #431407);
}

.streaming-poster-card strong {
  font-size: 2rem;
  line-height: 1;
}

.streaming-poster-tag {
  position: absolute;
  top: 18px;
  left: 18px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.14);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.message-row {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.streaming-message-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.streaming-message-cover {
  min-height: 130px;
  padding: 18px;
  display: flex;
  align-items: end;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.streaming-message-cover.cover-1 {
  background: linear-gradient(135deg, #fb7185, #7c3aed);
}

.streaming-message-cover.cover-2 {
  background: linear-gradient(135deg, #38bdf8, #0f766e);
}

.streaming-message-cover.cover-3 {
  background: linear-gradient(135deg, #f59e0b, #ea580c);
}

.streaming-message-cover.cover-4 {
  background: linear-gradient(135deg, #34d399, #166534);
}

.streaming-message-body {
  display: grid;
  gap: 12px;
  padding: 18px;
}

.streaming-message-meta {
  display: grid;
  gap: 4px;
}

.streaming-message-body p {
  min-height: 66px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

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

.streaming-chart-card {
  min-height: 320px;
  padding: 20px;
  background:
    linear-gradient(180deg, rgba(17, 24, 39, 0.96), rgba(8, 11, 19, 0.96));
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.streaming-chart-card-wide {
  grid-column: 1 / -1;
}

.streaming-chart-card .chart-card-head h3 {
  color: #ffffff;
}

.streaming-table-shell,
.streaming-table-shell .ui-table {
  background: transparent;
}

.streaming-table-shell {
  border-color: rgba(255, 255, 255, 0.08);
}

.streaming-table-shell .ui-table thead th {
  background: rgba(255, 255, 255, 0.04);
  color: rgba(244, 246, 251, 0.62);
  border-bottom-color: rgba(255, 255, 255, 0.08);
}

.streaming-table-shell .ui-table tbody td {
  color: #f4f6fb;
  border-bottom-color: rgba(255, 255, 255, 0.06);
}

@media (max-width: 1399px) {
  .chat-app-grid {
    grid-template-columns: 280px minmax(0, 1fr) 300px;
  }

  .streaming-card-row,
  .message-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 1199px) {
  body.bootstrap-chat-shell {
    height: auto;
    overflow: auto;
  }

  body.chat-shell .app-topbar {
    display: block;
  }

  body.chat-shell .chat-hero-shell {
    display: flex;
  }

  body.chat-shell .chat-rail {
    display: none;
  }

  body.chat-shell .chat-app-grid {
    grid-template-columns: 320px minmax(0, 1fr);
    grid-template-areas:
      "sidebar conversation"
      "tools tools";
  }

  .topbar-frame {
    grid-template-columns: 1fr;
    justify-items: start;
  }

  .topbar-nav {
    justify-content: start;
  }

  .chat-app-grid {
    grid-template-columns: 320px minmax(0, 1fr);
    grid-template-areas:
      "sidebar conversation"
      "tools tools";
    min-height: auto;
    flex: initial;
    overflow: visible;
  }

  .stats-grid,
  .customer-summary-grid,
  .charts-grid,
  .dual-shell,
  .auth-split,
  .report-filters,
  .agent-edit-grid,
  .evolution-status-grid {
    grid-template-columns: 1fr;
  }

  .chat-list {
    max-height: none;
  }

  .conversation-card {
    height: 72vh;
  }

  .sidebar-card,
  .tools-stack {
    height: auto;
  }

  .sidebar-card {
    height: 72vh;
  }

  .tools-stack {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
    overflow: visible;
    padding-right: 0;
  }

  .streaming-hero {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .streaming-chart-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 991px) {
  body.bootstrap-chat-shell {
    overflow: auto;
  }

  body.chat-shell .app-topbar {
    display: block;
  }

  body.chat-shell .chat-hero-shell {
    display: flex;
  }

  .chat-app-grid {
    grid-template-columns: 1fr;
    grid-template-areas:
      "conversation"
      "sidebar"
      "tools";
    overflow: visible;
    flex: initial;
  }

  .conversation-card,
  .sidebar-card {
    height: auto;
    min-height: 60vh;
  }

  .tools-stack {
    grid-template-columns: 1fr;
    overflow: visible;
    padding-right: 0;
  }

  .chat-list {
    max-height: 420px;
  }

  .streaming-card-row,
  .message-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 767px) {
  body.bootstrap-chat-shell {
    overflow: auto;
  }

  .app-topbar {
    padding: 12px 0;
  }

  .topbar-frame,
  .sidebar-header,
  .conversation-header,
  .tool-card-head,
  .stack,
  .payment-list,
  .page-shell,
  .auth-hero,
  .auth-panel-card {
    padding-left: 16px;
    padding-right: 16px;
  }

  .chat-compose,
  .chat-notice,
  .chat-thread {
    padding-left: 16px;
    padding-right: 16px;
  }

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

  .conversation-meta {
    flex-direction: column;
    gap: 6px;
  }

  .chat-compose {
    grid-template-columns: 1fr;
  }

  .compose-send {
    width: 100%;
  }

  .bubble {
    max-width: 90%;
  }

  .conversation-card {
    min-height: 58vh;
    height: auto;
  }

  .sidebar-card {
    min-height: auto;
    height: auto;
  }

  .chat-list {
    max-height: 360px;
  }

  .tools-stack {
    gap: 14px;
    padding-bottom: 10px;
    overflow: visible;
  }

  .tool-card,
  .info-spotlight-card {
    overflow: visible;
  }

  .tool-card-head {
    flex-wrap: wrap;
    align-items: center;
  }

  .contact-spotlight {
    grid-template-columns: 56px minmax(0, 1fr);
    padding: 18px 16px;
  }

  .contact-spotlight-avatar {
    width: 56px;
    height: 56px;
    border-radius: 18px;
    font-size: 1.1rem;
  }

  .contact-spotlight-copy h3 {
    font-size: 1rem;
    line-height: 1.2;
  }

  .toast-stack {
    top: auto;
    bottom: 16px;
    right: 16px;
    left: 16px;
    width: auto;
  }

  .streaming-hero,
  .streaming-shell,
  .streaming-rail {
    padding: 18px;
    border-radius: 22px;
  }

  .streaming-hero h2 {
    font-size: 2.35rem;
  }
}

body.admin-shell {
  background: #eef2f8;
  color: #0f2138;
}

.crm-shell {
  display: flex;
  min-height: 100vh;
  background:
    radial-gradient(circle at top right, rgba(31, 99, 214, 0.08), transparent 24%),
    radial-gradient(circle at left top, rgba(18, 179, 166, 0.08), transparent 22%),
    #eef2f8;
}

.crm-sidebar {
  width: 288px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #0d1b2e 0%, #132843 100%);
  color: #d9e4f2;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 40;
}

.crm-sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 22px 20px 24px;
}

.crm-sidebar-mark {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #12b3a6, #1f63d6);
  color: #fff;
  box-shadow: 0 12px 24px rgba(18, 179, 166, 0.28);
}

.crm-sidebar-brand strong {
  display: block;
  font-size: 1.12rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.03em;
}

.crm-sidebar-brand span,
.crm-sidebar-user span {
  display: block;
  color: #7c93b2;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.crm-sidebar-nav {
  flex: 1;
  padding: 0 12px 16px;
  overflow-y: auto;
}

.crm-nav-group + .crm-nav-group {
  margin-top: 18px;
}

.crm-nav-title {
  padding: 0 12px 8px;
  color: #5c7391;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.crm-nav-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  color: #c6d3e2;
  font-size: 0.94rem;
  font-weight: 700;
  transition: 0.2s ease;
}

.crm-nav-link i {
  font-size: 1.05rem;
}

.crm-nav-link:hover,
.crm-nav-link.active {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.crm-nav-link.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 10px;
  bottom: 10px;
  width: 3px;
  border-radius: 0 4px 4px 0;
  background: #12b3a6;
}

.crm-sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.crm-sidebar-user {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
}

.crm-sidebar-avatar {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #f1955a, #e06d3f);
  color: #fff;
  font-weight: 800;
}

.crm-sidebar-user strong {
  display: block;
  color: #fff;
  font-size: 0.92rem;
  font-weight: 700;
}

.crm-main {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.crm-topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  min-height: 72px;
  padding: 14px 24px;
  background: rgba(255, 255, 255, 0.82);
  border-bottom: 1px solid #dde7f0;
  backdrop-filter: blur(16px);
}

.crm-topbar-head,
.crm-topbar-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.crm-sidebar-toggle {
  width: 42px;
  height: 42px;
  display: none;
  align-items: center;
  justify-content: center;
  border: 1px solid #d9e4ef;
  border-radius: 12px;
  background: #fff;
  color: #0f2138;
}

.crm-topbar-copy h1,
.crm-topbar-copy p {
  margin: 0;
}

.crm-topbar-copy h1 {
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.crm-topbar-copy p {
  color: #7a8aa0;
  font-size: 0.8rem;
  font-weight: 600;
}

.crm-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  border-radius: 999px;
  background: #e4f7f4;
  border: 1px solid #bee9e3;
  color: #0c7a70;
  font-size: 0.78rem;
  font-weight: 800;
}

.crm-main-content {
  flex: 1;
  padding: 22px 24px 28px;
}

.crm-content-wrap {
  width: min(100%, 1560px);
}

.admin-shell .app-topbar {
  display: none;
}

.admin-shell .page-shell,
.admin-shell .chart-card,
.admin-shell .metric-card,
.admin-shell .tool-card,
.admin-shell .info-spotlight-card,
.admin-shell .opticom-panel,
.admin-shell .conversation-card,
.admin-shell .sidebar-card,
.admin-shell .tools-stack {
  border-radius: 18px;
  border: 1px solid #e5eaf2;
  box-shadow: 0 6px 24px rgba(16, 33, 56, 0.06);
}

.admin-shell .page-shell,
.admin-shell .chart-card,
.admin-shell .tool-card,
.admin-shell .info-spotlight-card,
.admin-shell .opticom-panel,
.admin-shell .conversation-card,
.admin-shell .sidebar-card,
.admin-shell .tools-stack {
  background: #fff;
}

.admin-shell .dashboard-hero,
.admin-shell .opticom-hero,
.admin-shell .chat-hero-shell,
.admin-shell .evolution-status-shell {
  background: linear-gradient(135deg, #ffffff 0%, #f8fbff 100%);
}

.admin-shell .metric-card {
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}

.admin-shell .section-heading h2,
.admin-shell .dashboard-hero-copy h2,
.admin-shell .chat-hero-shell h2,
.admin-shell .topbar-brand h1 {
  color: #0f2138;
}

.admin-shell .eyebrow {
  color: #1f63d6;
}

.admin-shell .soft-badge {
  background: #f3f7fb;
  border: 1px solid #e2eaf3;
  color: #46617f;
}

.admin-shell .soft-badge.success {
  background: #e4f7f4;
  border-color: #bee9e3;
  color: #0c7a70;
}

.admin-shell .btn-dark {
  background: linear-gradient(135deg, #0f2138, #1f63d6);
  border-color: transparent;
}

.admin-shell .btn-success {
  background: linear-gradient(135deg, #12b3a6, #1f63d6);
  border-color: transparent;
}

.admin-shell .table-shell,
.admin-shell .table.ui-table {
  background: transparent;
}

.admin-shell .ui-table thead th {
  background: #f6f9fd;
}

.admin-shell .ui-table tbody tr:hover {
  background: rgba(31, 99, 214, 0.03);
}

.admin-shell .form-control,
.admin-shell .form-select {
  border-color: #dde7f0;
  background: #f9fbfd;
}

.admin-shell .form-control:focus,
.admin-shell .form-select:focus {
  border-color: rgba(31, 99, 214, 0.45);
  box-shadow: 0 0 0 0.2rem rgba(31, 99, 214, 0.12);
}

.admin-shell.chat-shell {
  background: #eef2f8;
  overflow: hidden;
}

.admin-shell.chat-shell .crm-main-content {
  padding-top: 20px;
  overflow: hidden;
}

.admin-shell.chat-shell .crm-content-wrap {
  width: 100%;
  max-width: none;
  height: calc(100vh - 116px);
}

.admin-shell.chat-shell .chat-desktop-shell {
  height: 100%;
  padding: 0 !important;
}

.admin-shell.chat-shell .chat-hero-shell {
  margin-bottom: 16px !important;
}

.admin-shell.chat-shell .chat-app-grid {
  grid-template-columns: minmax(320px, 380px) minmax(0, 1fr) minmax(300px, 340px);
  grid-template-areas: "sidebar conversation tools";
  gap: 16px;
  height: calc(100% - 148px);
  background: transparent;
}

.admin-shell.chat-shell .chat-rail {
  display: none;
}

.admin-shell.chat-shell .sidebar-card,
.admin-shell.chat-shell .conversation-card,
.admin-shell.chat-shell .tools-stack {
  height: 100%;
}

.crm-sidebar-backdrop {
  display: none;
}

@media (max-width: 1199.98px) {
  .crm-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    transform: translateX(-100%);
    transition: transform 0.24s ease;
  }

  body.crm-sidebar-open .crm-sidebar {
    transform: translateX(0);
  }

  .crm-sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(9, 24, 45, 0.5);
    backdrop-filter: blur(2px);
    z-index: 35;
  }

  body.crm-sidebar-open .crm-sidebar-backdrop {
    display: block;
  }

  .crm-sidebar-toggle {
    display: inline-flex;
  }

  .crm-topbar {
    padding-inline: 18px;
  }

  .crm-main-content {
    padding-inline: 18px;
  }

  .admin-shell.chat-shell .crm-content-wrap {
    height: auto;
  }

  .admin-shell.chat-shell .chat-app-grid {
    height: auto;
    grid-template-columns: 1fr;
    grid-template-areas:
      "sidebar"
      "conversation"
      "tools";
  }
}

@media (max-width: 767.98px) {
  .crm-topbar {
    padding: 14px 16px;
  }

  .crm-topbar-actions .crm-status-pill {
    display: none;
  }

  .crm-main-content {
    padding: 16px;
  }

  .crm-topbar-copy h1 {
    font-size: 0.94rem;
  }

  .crm-topbar-copy p {
    font-size: 0.75rem;
  }
}

.admin-shell.chat-shell .crm-topbar {
  min-height: 82px;
  padding: 14px 22px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(247, 250, 255, 0.9));
}

.admin-shell.chat-shell .crm-topbar-copy h1 {
  font-size: 1.9rem;
  line-height: 1;
  letter-spacing: -0.05em;
}

.admin-shell.chat-shell .crm-topbar-copy p {
  margin-top: 4px;
  font-size: 0.88rem;
}

.admin-shell.chat-shell .crm-status-pill {
  padding: 10px 16px;
  font-size: 0.86rem;
}

.admin-shell.chat-shell .crm-main-content {
  padding: 18px 22px 22px;
}

.admin-shell.chat-shell .chat-flash-banner {
  margin-bottom: 14px;
}

.admin-shell.chat-shell .chat-hero-shell {
  display: none;
}

.admin-shell.chat-shell .crm-content-wrap {
  height: calc(100vh - 104px);
}

.admin-shell.chat-shell .chat-app-grid {
  grid-template-columns: minmax(330px, 390px) minmax(0, 1fr) minmax(320px, 360px);
  gap: 18px;
  height: 100%;
}

.admin-shell.chat-shell .sidebar-card,
.admin-shell.chat-shell .conversation-card,
.admin-shell.chat-shell .tools-stack {
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: linear-gradient(180deg, #152232 0%, #101a26 100%);
  box-shadow: 0 18px 40px rgba(8, 15, 26, 0.22);
}

.admin-shell.chat-shell .sidebar-card,
.admin-shell.chat-shell .conversation-card {
  overflow: hidden;
}

.admin-shell.chat-shell .sidebar-header,
.admin-shell.chat-shell .conversation-header {
  padding: 16px 18px;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.admin-shell.chat-shell .sidebar-header-copy h2,
.admin-shell.chat-shell .conversation-header h2,
.admin-shell.chat-shell .contact-spotlight-copy h3,
.admin-shell.chat-shell .accordion-title-text {
  color: #f4f8fc;
}

.admin-shell.chat-shell .sidebar-header-copy p,
.admin-shell.chat-shell .conversation-meta,
.admin-shell.chat-shell .chat-list-meta span,
.admin-shell.chat-shell .contact-spotlight-copy p,
.admin-shell.chat-shell .subtle-notice,
.admin-shell.chat-shell .eyebrow {
  color: #8fa3bb;
}

.admin-shell.chat-shell .action-icon-chip,
.admin-shell.chat-shell .soft-badge {
  border-color: rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.06);
  color: #d6e2ef;
}

.admin-shell.chat-shell .soft-badge.success {
  background: rgba(18, 179, 166, 0.16);
  border-color: rgba(18, 179, 166, 0.28);
  color: #88f3df;
}

.admin-shell.chat-shell .chat-search {
  margin: 14px 16px 10px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.05);
}

.admin-shell.chat-shell .chat-search i,
.admin-shell.chat-shell .chat-search input,
.admin-shell.chat-shell .chat-search input::placeholder {
  color: #9db0c5;
}

.admin-shell.chat-shell .sidebar-tabs {
  margin: 0 16px 12px;
  gap: 8px;
}

.admin-shell.chat-shell .sidebar-tab {
  border-radius: 999px;
  border-color: rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  color: #adc1d6;
  font-weight: 700;
}

.admin-shell.chat-shell .sidebar-tab.active {
  background: rgba(18, 179, 166, 0.18);
  border-color: rgba(18, 179, 166, 0.32);
  color: #b3fff0;
}

.admin-shell.chat-shell .chat-list {
  padding: 0;
  background: linear-gradient(180deg, #13202d 0%, #0f1823 100%);
}

.admin-shell.chat-shell .chat-list-item {
  margin: 0;
  padding: 14px 16px;
  border: 0;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 0;
  background: rgba(255, 255, 255, 0.01);
  box-shadow: none;
  color: #dbe7f3;
}

.admin-shell.chat-shell .chat-list-item:hover,
.admin-shell.chat-shell .chat-list-item.active {
  background: linear-gradient(90deg, rgba(18, 179, 166, 0.18) 0%, rgba(255, 255, 255, 0.06) 100%);
  transform: none;
}

.admin-shell.chat-shell .chat-list-item.has-unread {
  border-left: 3px solid #12b3a6;
}

.admin-shell.chat-shell .chat-avatar {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  background: linear-gradient(135deg, #31485f, #223648);
  box-shadow: none;
  color: #fff;
}

.admin-shell.chat-shell .chat-list-top strong,
.admin-shell.chat-shell .chat-list-copy p {
  color: #f4f8fc;
}

.admin-shell.chat-shell .chat-list-copy strong {
  color: #f8fbff;
}

.admin-shell.chat-shell .chat-time,
.admin-shell.chat-shell .chat-list-meta.compact span {
  color: #8da4bc;
}

.admin-shell.chat-shell .chat-list-bottom p {
  color: #c8d7e6;
}

.admin-shell.chat-shell .chat-list-item.active .chat-list-top strong,
.admin-shell.chat-shell .chat-list-item.active .chat-list-bottom p,
.admin-shell.chat-shell .chat-list-item.active .chat-list-meta.compact span,
.admin-shell.chat-shell .chat-list-item.active .chat-time {
  color: #f8fbff;
}

.admin-shell.chat-shell .chat-unread-badge {
  min-width: 28px;
  height: 28px;
  border-radius: 999px;
  display: inline-grid;
  place-items: center;
  background: #22c55e;
  color: #052510;
  font-weight: 800;
  box-shadow: none;
}

.admin-shell.chat-shell .conversation-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
}

.admin-shell.chat-shell .conversation-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
}

.admin-shell.chat-shell .conversation-stage {
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: calc(100% - 92px);
}

.admin-shell.chat-shell .chat-thread {
  flex: 1;
  padding: 18px 18px 8px;
  background:
    radial-gradient(circle at top right, rgba(18, 179, 166, 0.08), transparent 24%),
    linear-gradient(180deg, #0f1924 0%, #0b141d 100%);
}

.admin-shell.chat-shell .bubble {
  max-width: min(72%, 640px);
}

.admin-shell.chat-shell .bubble-body {
  padding: 14px 16px 10px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  box-shadow: none;
}

.admin-shell.chat-shell .bubble.inbound .bubble-body {
  background: #22303c;
  color: #f5f8fc;
}

.admin-shell.chat-shell .bubble.outbound .bubble-body {
  background: linear-gradient(135deg, #0f766e, #0f8f7f);
  color: #f7fffd;
}

.admin-shell.chat-shell .bubble p {
  margin-bottom: 8px;
  font-size: 0.98rem;
  line-height: 1.45;
}

.admin-shell.chat-shell .bubble span {
  font-size: 0.74rem;
}

.admin-shell.chat-shell .chat-compose {
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 10px;
  padding: 12px 14px 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(8, 15, 23, 0.94);
}

.admin-shell.chat-shell .compose-box {
  min-height: 54px;
  padding: 0 16px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.06);
}

.admin-shell.chat-shell .compose-box textarea,
.admin-shell.chat-shell .compose-box textarea::placeholder,
.admin-shell.chat-shell .compose-box i,
.admin-shell.chat-shell .compose-icon-button {
  color: #cad7e4;
}

.admin-shell.chat-shell .compose-ai {
  min-width: 74px;
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.06);
  color: #dfe8f1;
}

.admin-shell.chat-shell .compose-send {
  min-width: 128px;
  background: linear-gradient(135deg, #22c55e, #14b8a6);
  box-shadow: none;
}

.admin-shell.chat-shell .chat-notice,
.admin-shell.chat-shell .image-preview {
  padding-inline: 18px;
}

.admin-shell.chat-shell .tools-stack {
  display: grid;
  gap: 14px;
  padding: 14px;
  overflow-y: auto;
  overflow-x: hidden;
  align-content: start;
}

.admin-shell.chat-shell .info-spotlight-card,
.admin-shell.chat-shell .tool-card,
.admin-shell.chat-shell .tools-accordion .accordion-item {
  overflow: hidden;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.03);
}

.admin-shell.chat-shell .contact-spotlight {
  grid-template-columns: 56px minmax(0, 1fr);
  gap: 14px;
  padding: 16px;
}

.admin-shell.chat-shell .contact-spotlight-avatar {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: linear-gradient(135deg, #ff9f67, #ff6b4a);
}

.admin-shell.chat-shell .tools-accordion {
  gap: 14px;
}

.admin-shell.chat-shell .tools-accordion .accordion-button,
.admin-shell.chat-shell .tools-accordion .accordion-button:not(.collapsed) {
  padding: 14px 16px;
  background: transparent;
  color: #f4f8fc;
}

.admin-shell.chat-shell .tools-accordion .accordion-button::after {
  filter: invert(1) brightness(1.4);
}

.admin-shell.chat-shell .stack {
  gap: 12px;
  padding: 0 16px 16px;
}

.admin-shell.chat-shell .stack .form-label {
  color: #9db1c7;
  font-size: 0.84rem;
  font-weight: 700;
}

.admin-shell.chat-shell .stack .form-control,
.admin-shell.chat-shell .stack .form-select,
.admin-shell.chat-shell .stack textarea {
  border-radius: 14px;
  min-height: 48px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.05);
  color: #f4f8fc;
}

/* Opciones nativas del select en el panel oscuro: fondo oscuro + texto claro para que sean legibles */
body.chat-shell .stack .form-select option,
body.chat-shell .stack .form-select optgroup,
.admin-shell.chat-shell .stack .form-select option,
.admin-shell.chat-shell .stack .form-select optgroup,
body.chat-shell .theme-picker .form-select option {
  background-color: #1f2b33;
  color: #f4f8fc;
}

/* Ayuda y validacion del campo de telefono (nuevo cliente) */
.field-hint {
  display: block;
  margin-top: 6px;
  font-size: 0.76rem;
  line-height: 1.35;
  color: #8696a0;
}

.field-hint.hint-error {
  color: #ff8b7d;
}

.field-hint.hint-ok {
  color: #4fd18b;
}

.admin-shell.chat-shell .stack .form-control.is-invalid,
body.chat-shell .stack .form-control.is-invalid {
  border-color: #ff6b5c;
  box-shadow: 0 0 0 0.18rem rgba(255, 107, 92, 0.18);
  background-image: none;
}

.admin-shell.chat-shell .stack .form-control.is-valid,
body.chat-shell .stack .form-control.is-valid {
  border-color: #3ecf8e;
  box-shadow: 0 0 0 0.18rem rgba(62, 207, 142, 0.16);
  background-image: none;
}

/* Verificacion de WhatsApp en el formulario de nuevo cliente */
.wa-check {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 6px;
  font-size: 0.78rem;
  font-weight: 600;
}

.wa-check i {
  font-size: 0.95rem;
  flex-shrink: 0;
}

.wa-check.wa-ok {
  color: #4fd18b;
}

.wa-check.wa-bad {
  color: #ff8b7d;
}

.wa-check.wa-info {
  color: #8696a0;
}

/* Alerta: numero ya registrado */
.phone-exists-alert {
  margin-top: 10px;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(255, 176, 32, 0.1);
  border: 1px solid rgba(255, 176, 32, 0.34);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.phone-exists-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  font-weight: 800;
  color: #ffca6b;
}

.phone-exists-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 0.82rem;
  color: #e9edef;
}

.phone-exists-body strong {
  font-size: 0.92rem;
}

.phone-exists-body span {
  color: #c4ced4;
}

.phone-exists-status {
  font-size: 0.74rem;
  color: #8696a0 !important;
}

.phone-exists-open {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  align-self: flex-start;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(37, 211, 102, 0.16);
  border: 1px solid rgba(37, 211, 102, 0.4);
  color: #4fd18b;
  font-size: 0.8rem;
  font-weight: 700;
  text-decoration: none;
  transition: background 0.18s ease, transform 0.18s ease;
}

.phone-exists-open:hover {
  background: rgba(37, 211, 102, 0.26);
  transform: translateY(-1px);
  color: #6be0a0;
}

.admin-shell.chat-shell .stack textarea {
  min-height: 96px;
}

.admin-shell.chat-shell .status-banner {
  margin-bottom: 2px;
}

@media (max-width: 1399.98px) {
  .admin-shell.chat-shell .chat-app-grid {
    grid-template-columns: minmax(300px, 340px) minmax(0, 1fr) minmax(290px, 320px);
  }
}

@media (max-width: 1199.98px) {
  .admin-shell.chat-shell .crm-main-content {
    padding: 16px;
  }

  .admin-shell.chat-shell .chat-app-grid {
    gap: 14px;
  }

  .admin-shell.chat-shell .tools-stack {
    padding: 0;
    background: transparent;
    border: 0;
    box-shadow: none;
  }
}

@media (max-width: 767.98px) {
  .admin-shell.chat-shell .crm-topbar-copy h1 {
    font-size: 1.2rem;
  }

  .admin-shell.chat-shell .chat-thread {
    padding: 14px 14px 6px;
  }

  .admin-shell.chat-shell .bubble {
    max-width: 88%;
  }

  .admin-shell.chat-shell .chat-compose {
    grid-template-columns: 1fr;
  }

  .admin-shell.chat-shell .compose-ai,
  .admin-shell.chat-shell .compose-send {
    width: 100%;
  }
}

/* ==== Chat UX: separadores de dia, meta, estado de envio y boton bajar ==== */
.chat-day-sep {
  display: flex;
  justify-content: center;
  margin: 10px 0 2px;
  position: sticky;
  top: 4px;
  z-index: 3;
  pointer-events: none;
}

.chat-day-sep span {
  display: inline-block;
  padding: 4px 14px;
  border-radius: 999px;
  background: rgba(17, 27, 33, 0.68);
  color: #ffffff;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: capitalize;
  box-shadow: 0 2px 8px rgba(17, 27, 33, 0.18);
  backdrop-filter: blur(2px);
}

.bubble-meta {
  display: flex !important;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
  margin-top: 3px;
  line-height: 1;
}

.bubble-time {
  font-size: 0.72rem;
  color: #667781;
  white-space: nowrap;
}

.bubble.pending .bubble-body {
  opacity: 0.68;
}

.pending-check {
  color: #9aa8b1 !important;
  font-size: 0.82rem;
}

.bubble-resend {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 4px;
  padding: 2px 8px;
  border: none;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.06);
  color: #3b4a54;
  font-size: 0.7rem;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s ease, background 0.15s ease;
}

.bubble.outbound:hover .bubble-resend,
.bubble-resend:focus-visible {
  opacity: 0.85;
}

.bubble-resend:hover {
  background: rgba(0, 0, 0, 0.12);
  opacity: 1;
}

.bubble-resend:disabled {
  cursor: default;
}

.bubble-resend.is-loading i {
  animation: bubble-resend-spin 0.8s linear infinite;
}

.bubble-resend.is-done {
  background: rgba(37, 211, 102, 0.18);
  color: #1a7f4b;
  opacity: 1;
}

/* Mensaje saliente que no se pudo entregar: se resalta y el boton queda siempre visible. */
.bubble.send-failed .bubble-body {
  border: 1px solid rgba(220, 53, 69, 0.55);
  box-shadow: 0 0 0 1px rgba(220, 53, 69, 0.12);
}

.bubble-fail-mark {
  color: #dc3545 !important;
  font-size: 0.82rem;
  cursor: help;
}

.bubble.send-failed .bubble-resend {
  opacity: 1;
  background: rgba(220, 53, 69, 0.12);
  color: #b02a37;
}

.bubble.send-failed .bubble-resend:hover {
  background: rgba(220, 53, 69, 0.2);
}

/* Boton de reenvio masivo (barra lateral, solo admin). */
.sidebar-bulk-resend {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 8px 14px 0;
}

.bulk-resend-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: none;
  border-radius: 8px;
  background: #25d366;
  color: #04371c;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, opacity 0.15s ease;
}

.bulk-resend-btn:hover {
  background: #20bd5a;
}

.bulk-resend-btn:disabled {
  opacity: 0.6;
  cursor: default;
}

.bulk-resend-btn.is-loading i {
  animation: bubble-resend-spin 0.8s linear infinite;
}

.bulk-resend-status {
  font-size: 0.72rem;
  color: #8696a0;
}

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

.chat-scroll-down {
  position: absolute;
  right: 22px;
  bottom: 92px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(134, 150, 160, 0.28);
  background: #ffffff;
  color: #12344d;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  box-shadow: 0 6px 18px rgba(17, 27, 33, 0.22);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px) scale(0.9);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
  z-index: 5;
}

.chat-scroll-down.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.chat-scroll-down:hover {
  background: #f4f8fc;
  transform: translateY(-2px) scale(1);
}

.chat-scroll-down-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: #25d366;
  color: #ffffff;
  font-size: 0.7rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(17, 27, 33, 0.25);
}

@media (max-width: 720px) {
  .chat-scroll-down {
    right: 14px;
    bottom: 84px;
  }
}
