/* Breakpoints: mobile <=640px, tablet 641-1024px, desktop >=1025px. */

* {
  box-sizing: border-box;
}
html,
body {
  height: 100%;
}
body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--text);
  background: var(--bg-main);
  overflow-x: hidden;
  overflow-y: auto;
}
body.ma-modal-open {
  overflow: hidden !important;
}
body.inbox-body,
body.ma-panel-page,
body.calendar-body,
body.prompt-insights-page {
  max-width: 100vw;
  overflow: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}
.hidden {
  display: none !important;
}
.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}
.skip-link {
  position: fixed;
  left: 16px;
  top: 16px;
  z-index: 10000;
  transform: translateY(-160%);
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  background: var(--accent, #06b6d4);
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  box-shadow: 0 14px 34px rgba(2, 8, 18, 0.32);
  transition: transform 0.16s ease;
}
.skip-link:focus,
.skip-link:focus-visible {
  transform: translateY(0);
  outline: 2px solid #fff;
  outline-offset: 2px;
}
#main-content:focus {
  outline: none;
}
#main-content:focus-visible {
  outline: 2px solid var(--accent, #06b6d4);
  outline-offset: -2px;
}
.eyebrow {
  margin: 0 0 var(--space-2);
  color: var(--accent);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.login-orbs {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}
.login-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.18;
  animation: orb-drift 16s ease-in-out infinite;
}
.login-orb-1 {
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, #3b82f6, transparent);
  top: -20%;
  left: -10%;
}
.login-orb-2 {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, #7c3aed, transparent);
  right: -10%;
  bottom: 10%;
  animation-delay: -8s;
  animation-duration: 20s;
}
.login-orb-3 {
  width: 350px;
  height: 350px;
  background: radial-gradient(circle, #06b6d4, transparent);
  bottom: -5%;
  left: 30%;
  animation-delay: -4s;
  animation-duration: 24s;
}
@keyframes orb-drift {
  0%,
  100% {
    transform: translate(0, 0);
  }
  50% {
    transform: translate(24px, -32px) scale(1.05);
  }
}

.landing-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: var(--space-6);
  background: linear-gradient(180deg, var(--bg-main) 0%, var(--bg-sidebar) 100%);
}

@media (max-width: 768px) {
  .landing-page {
    padding: 16px;
    place-items: start;
    padding-top: 20px;
  }
}

.landing-card {
  width: min(920px, 100%);
  background: rgba(32, 44, 51, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-lg);
  padding: var(--space-7);
  box-shadow: var(--shadow-lg);
}

@media (max-width: 768px) {
  .landing-card {
    padding: 20px;
    border-radius: 16px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  }
}

@media (max-width: 480px) {
  .landing-card {
    padding: 16px;
    border-radius: 12px;
  }
}
.landing-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}
.landing-header h1 {
  margin: 0 0 8px;
  font-size: clamp(28px, 4vw, 46px);
}
.landing-header p {
  margin: 0;
  color: var(--muted);
  max-width: 640px;
  line-height: 1.6;
}
.landing-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 22px 0 28px;
}
.btn {
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-full);
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition-base), border-color var(--transition-base), box-shadow var(--transition-base), color var(--transition-base), transform var(--transition-fast);
  position: relative;
}
.btn:hover {
  background: rgba(255, 255, 255, 0.08);
  transform: translateY(-1px);
}
.btn:active {
  transform: translateY(0);
}
.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none !important;
}
.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: transparent;
}
.btn-primary:hover {
  background: #0891b2;
}
.btn-primary:disabled {
  background: var(--muted);
  color: #111b21;
}
.btn-small {
  padding: 8px 12px;
  font-size: 13px;
}
.examples-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
}
.example-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 18px;
  padding: 16px;
  transition: all 0.2s ease;
  cursor: pointer;
}
.example-card:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.12);
  transform: translateY(-2px);
}
.example-card h3 {
  margin: 0 0 8px;
}
.example-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.wa-layout {
  display: grid;
  grid-template-columns: 460px 1fr;
  height: 100vh;
  overflow: hidden;
}

@media (max-width: 1024px) {
  .wa-layout {
    grid-template-columns: 380px 1fr;
  }
}

@media (max-width: 768px) {
  .wa-layout {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 100vh;
  }
}

@media (max-width: 480px) {
  .wa-layout {
    grid-template-columns: 1fr;
  }
}
.wa-sidebar {
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #111b21 0%, #07131a 100%);
  border-right: 1px solid var(--border);
  min-height: 0;
}
.wa-sidebar-header {
  position: sticky;
  top: 0;
  z-index: 5;
  background: linear-gradient(
    180deg,
    rgba(17, 27, 33, 1) 0%,
    rgba(17, 27, 33, 0.98) 100%
  );
  backdrop-filter: blur(6px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}
.wa-sidebar-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 16px 14px;
}
.wa-sidebar-top h1 {
  margin: 0;
  font-size: 20px;
}
.ghost-link {
  color: var(--muted);
  font-weight: 600;
  transition: 0.2s ease;
}
.ghost-link:hover {
  color: var(--text);
}
.wa-search {
  padding: 0 12px 14px;
}
.wa-search input,
.composer-row input {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.1);
  outline: none;
  background: var(--bg-input);
  color: var(--text);
  border-radius: 16px;
  padding: 14px 16px;
  font-size: 15px;
  transition: all 0.2s ease;
}
.wa-search input::placeholder,
.composer-row input::placeholder {
  color: var(--muted);
}
.wa-search input:focus,
.composer-row input:focus {
  background: var(--bg-input);
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(6, 182, 212, 0.1);
}
.wa-search input.error,
.composer-row input.error {
  border-color: var(--error);
  background: rgba(239, 68, 68, 0.06);
}
.wa-search input.error:focus,
.composer-row input.error:focus {
  box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.1);
}
.wa-search input:disabled,
.composer-row input:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.wa-semaphore-filters,
.wa-read-filters {
  display: flex;
  gap: 10px;
  padding: 0 12px 12px;
  flex-wrap: wrap;
}
.semaphore-filter,
.read-filter {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  border-radius: 999px;
  padding: 10px 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: 0.2s ease;
  font-weight: 600;
}
.semaphore-filter.active,
.read-filter.active {
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.05);
}
.client-badge {
  display: inline-flex;
  align-items: center;
  font-size: 10px;
  font-weight: 600;
  line-height: 1;
  padding: 3px 7px;
  border-radius: 999px;
  background: rgba(59, 130, 246, 0.18);
  color: #93c5fd;
  border: 1px solid rgba(59, 130, 246, 0.35);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  max-width: 90px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex-shrink: 0;
}
.client-badge:hover {
  background: rgba(59, 130, 246, 0.3);
  border-color: rgba(59, 130, 246, 0.55);
}
.wa-client-filters {
  border-top: 1px solid var(--border);
  padding-top: 12px;
}
.filter-section-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  padding: 0 12px 8px;
  display: block;
}
.wa-client-filter-buttons {
  display: flex;
  gap: 10px;
  padding: 0 12px 12px;
  flex-wrap: wrap;
}
.client-filter {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  border-radius: 999px;
  padding: 10px 14px;
  cursor: pointer;
  transition: 0.2s ease;
  font-size: 13px;
  font-weight: 500;
}
.client-filter:hover {
  background: rgba(255, 255, 255, 0.08);
}
.client-filter.active {
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.05);
}
.wa-client-label {
  font-size: 11px;
  color: var(--muted);
  padding: 4px 0 0;
  font-weight: 500;
}
.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}
.status-dot.large {
  width: 14px;
  height: 14px;
}
.status-dot.green {
  background: var(--green);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--success) 15%, transparent);
}
.status-dot.yellow {
  background: var(--yellow);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--warning) 15%, transparent);
}
.status-dot.red {
  background: var(--red);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--error) 15%, transparent);
}

.wa-chat-list {
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}
.custom-scroll::-webkit-scrollbar {
  width: 10px;
}
.custom-scroll::-webkit-scrollbar-track {
  background: #0f1a20;
}
.custom-scroll::-webkit-scrollbar-thumb {
  background: #32414a;
  border-radius: 999px;
  border: 2px solid #0f1a20;
}
.custom-scroll-chat::-webkit-scrollbar {
  width: 12px;
}
.custom-scroll-chat::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.02);
}
.custom-scroll-chat::-webkit-scrollbar-thumb {
  background: var(--accent-gradient);
  border-radius: 999px;
  border: 2px solid transparent;
}
/* Light theme: the dark .custom-scroll bar (near-black track/thumb) looks wrong on light
   surfaces — soften it to a light grey that matches the theme. */
html[data-ui-theme="light"] .custom-scroll::-webkit-scrollbar-track { background: #e8eef6; }
html[data-ui-theme="light"] .custom-scroll::-webkit-scrollbar-thumb {
  background: #bcc8d6;
  border-color: #e8eef6;
}
html[data-ui-theme="light"] .custom-scroll::-webkit-scrollbar-thumb:hover { background: #a3b2c4; }
.wa-chat-item {
  width: 100%;
  text-align: left;
  padding: 14px 16px;
  background: transparent;
  color: var(--text);
  border: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  cursor: pointer;
}
.wa-chat-item:hover,
.wa-chat-item.active {
  background: rgba(255, 255, 255, 0.06);
}
.wa-chat-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 4px;
}
.wa-chat-name-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.wa-chat-item-top strong {
  font-size: 15px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.wa-chat-item-top span,
.wa-chat-item-meta,
.wa-chat-item-preview,
.wa-chat-topbar p,
.summary-label,
.wa-no-results,
.wa-empty-state p,
.wa-status-label,
.composer-hint,
.composer-title {
  color: var(--muted);
}
.wa-chat-item-top span {
  font-size: 12px;
  text-transform: capitalize;
}
.wa-chat-item-meta {
  font-size: 13px;
  margin-bottom: 4px;
}
.wa-chat-item-preview-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.wa-chat-item-preview {
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}
.wa-status-label {
  font-size: 11px;
  white-space: nowrap;
}

.wa-main {
  display: flex;
  flex-direction: column;
  background: var(--bg-chat);
  min-height: 0;
}
.wa-empty-state {
  margin: auto;
  text-align: center;
  max-width: 480px;
  padding: 24px;
}
.wa-empty-state h2 {
  margin: 0 0 10px;
}
.wa-chat-panel {
  display: grid;
  grid-template-rows: auto 1fr auto;
  height: 100vh;
  min-height: 0;
}
.wa-main-sticky {
  top: 0;
  background: linear-gradient(
    180deg,
    rgba(17, 27, 33, 1) 0%,
    rgba(17, 27, 33, 0.98) 100%
  );
  backdrop-filter: blur(6px);
}
.wa-chat-topbar {
  padding: 18px 22px;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
}
.wa-chat-topbar-main {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
}
.wa-contact-heading {
  display: flex;
  align-items: center;
  gap: 14px;
}
.wa-chat-topbar p {
  margin: 6px 0 0;
}
.wa-takeover-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
}
.toggle-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  font-size: 14px;
}
.toggle-wrap input {
  appearance: none;
  width: 50px;
  height: 28px;
  border-radius: 999px;
  background: #3b4a54;
  position: relative;
  cursor: pointer;
  transition: 0.2s ease;
}
.toggle-wrap input::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: white;
  transition: 0.2s ease;
}
.toggle-wrap input:checked {
  background: var(--accent);
}
.toggle-wrap input:checked::after {
  transform: translateX(22px);
}
.toggle-slider {
  display: none;
}
.wa-summary-card {
  margin: 16px 18px 0;
  background: rgba(32, 44, 51, 0.85);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
}
.summary-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 18px;
}
.summary-label {
  display: block;
  font-size: 12px;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.summary-grid p {
  margin: 0;
  line-height: 1.5;
}
.wa-messages {
  overflow-y: auto;
  min-height: 0;
  padding: 22px 18px 26px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background-image: radial-gradient(
    rgba(255, 255, 255, 0.03) 1px,
    transparent 1px
  );
  background-size: 18px 18px;
}
.wa-message-row {
  display: flex;
}
.wa-message-row.user {
  justify-content: flex-end;
}
.wa-message-row.assistant {
  justify-content: flex-start;
}
.wa-bubble {
  max-width: min(720px, 78%);
  padding: 12px 14px;
  border-radius: 12px;
  line-height: 1.45;
  white-space: pre-wrap;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
}
.wa-bubble.user {
  background: var(--bubble-user);
}
.wa-bubble.assistant {
  background: var(--bubble-bot);
}
.wa-bubble.human {
  background: var(--bubble-human);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.wa-message-timestamp {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.6);
  margin-top: 4px;
  text-align: right;
}
.human-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  font-size: 11px;
  background: rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  padding: 4px 8px;
}
.wa-human-composer {
  border-top: 1px solid var(--border);
  background: rgba(17, 27, 33, 0.98);
  padding: 14px 18px 16px;
}
.composer-title {
  font-size: 13px;
  margin-bottom: 10px;
}
.composer-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}
#sendHumanReplyBtn {
  min-width: 120px;
}
.wa-human-composer.manual-active {
  box-shadow: inset 0 1px 0 rgba(250, 204, 21, 0.2);
}
.wa-no-results {
  padding: 18px;
}

@media (max-width: 1100px) {
  .summary-grid {
    grid-template-columns: 1fr;
  }
  .wa-chat-topbar-main {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 900px) {
  body {
    overflow: auto;
  }
  .wa-layout {
    grid-template-columns: 1fr;
    height: auto;
  }
  .wa-sidebar {
    min-height: 45vh;
  }
  .wa-chat-panel {
    height: auto;
    grid-template-rows: auto auto auto;
  }
  .wa-messages {
    max-height: 50vh;
  }
  .landing-header {
    flex-direction: column;
  }
}

.wa-human-composer.disabled {
  opacity: 0.55;
}
.wa-human-composer.disabled input,
.wa-human-composer.disabled button {
  cursor: not-allowed;
}
#sendHumanReplyBtn:disabled,
#humanReplyInput:disabled {
  opacity: 0.65;
}

.wa-read-filters {
  display: flex;
  gap: 8px;
  padding: 0 12px 12px;
  flex-wrap: wrap;
}
.read-filter {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: 8px 12px;
  cursor: pointer;
}
.read-filter.active {
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.05);
}
.wa-chat-item-side {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.wa-chat-delete-btn {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  border: 1px solid rgba(239, 68, 68, 0.14);
  background: rgba(239, 68, 68, 0.06);
  color: #f87171;
  cursor: pointer;
  transition: 0.18s ease;
  flex-shrink: 0;
}
.wa-chat-delete-btn svg {
  width: 16px;
  height: 16px;
}
.wa-chat-delete-btn:hover {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.24);
  color: #fb7185;
}
.wa-chat-delete-btn:focus-visible {
  outline: 2px solid rgba(239, 68, 68, 0.35);
  outline-offset: 2px;
}
.ai-badge,
.unread-badge,
.read-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 11px;
  line-height: 1;
  white-space: nowrap;
}
.ai-badge {
  border: 1px solid rgba(255, 255, 255, 0.12);
}
.ai-on {
  color: #67e8f9;
  background: rgba(6, 182, 212, 0.14);
}
.ai-off {
  color: #d7dde1;
  background: rgba(255, 255, 255, 0.08);
}
.unread-badge {
  color: #fff;
  background: var(--accent);
  font-weight: 700;
}
.read-badge {
  color: var(--muted);
  background: rgba(255, 255, 255, 0.05);
}
.wa-chat-item.unread {
  background: rgba(6, 182, 212, 0.04);
}
.wa-chat-item.unread .wa-chat-item-preview {
  color: var(--text);
}

/* --- Dashboard v5 visual refinements --- */
.wa-sidebar-top h1,
.wa-chat-topbar h2 {
  font-size: 22px;
}
.ghost-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
}
.wa-chat-topbar.compact-topbar {
  padding: 14px 20px;
}
.wa-chat-topbar-main.compact-main {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 18px;
}
.wa-chat-topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: nowrap;
}
.chat-meta-pill {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  min-width: 120px;
  min-height: 42px;
  padding: 8px 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.03);
}
.chat-meta-pill .summary-label {
  margin-bottom: 3px;
}
.summary-toggle-btn {
  min-height: 42px;
}
#summaryInline {
  display: none;
}
#summaryInline.visible {
  display: block;
}
#summaryInline p {
  margin: 0;
  color: var(--text);
  line-height: 1.5;
  max-width: 360px;
}
.wa-chat-panel {
  grid-template-rows: auto 1fr auto;
}
.wa-summary-card {
  display: none !important;
}
.wa-chat-item-preview.preview-unread {
  color: #fff;
  font-weight: 600;
}
.wa-chat-item.unread .wa-chat-item-preview {
  color: #fff;
}
.ai-icon {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
}
.ai-icon.on {
  color: #fff;
}
.ai-icon.off {
  color: var(--muted);
}
.ai-icon.off::after {
  content: "";
  position: absolute;
  width: 20px;
  height: 1.6px;
  background: currentColor;
  transform: rotate(-28deg);
  border-radius: 999px;
}
.read-filter,
.semaphore-filter {
  min-height: 42px;
  justify-content: center;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}
.read-filter:hover,
.semaphore-filter:hover {
  background: rgba(255, 255, 255, 0.06);
}
.read-filter.active,
.semaphore-filter.active {
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.12) 0%,
    rgba(255, 255, 255, 0.06) 100%
  );
  border-color: rgba(255, 255, 255, 0.2);
}

@media (max-width: 1280px) {
  .wa-chat-topbar-main.compact-main {
    grid-template-columns: 1fr auto;
    align-items: center;
  }
  .wa-chat-topbar-actions {
    justify-content: flex-end;
  }
}

/* === v6 visual polish === */
.wa-semaphore-filters,
.wa-read-filters {
  display: flex;
  gap: 10px;
  padding: 0 12px 12px;
  flex-wrap: wrap;
}

.semaphore-filter,
.read-filter {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  border-radius: 999px;
  min-height: 42px;
  padding: 0 16px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 600;
  font-size: 14px;
  line-height: 1;
  transition:
    background 0.18s ease,
    border-color 0.18s ease,
    color 0.18s ease,
    transform 0.18s ease,
    box-shadow 0.18s ease;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.02);
}

.semaphore-filter:hover,
.read-filter:hover {
  background: rgba(255, 255, 255, 0.07);
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.18);
  transform: translateY(-1px);
}

.read-filter.active,
.semaphore-filter.active {
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.2);
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.11) 0%,
    rgba(255, 255, 255, 0.06) 100%
  );
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.04),
    0 8px 20px rgba(0, 0, 0, 0.18);
}

.wa-chat-item.unread {
  background: rgba(6, 182, 212, 0.06);
}

.wa-chat-item.unread strong,
.wa-chat-item.unread .wa-chat-item-meta,
.wa-chat-item-preview.preview-unread {
  color: #ffffff;
}

.wa-chat-item.unread .wa-status-label {
  color: rgba(255, 255, 255, 0.88);
}

.preview-unread {
  font-weight: 700;
}

.unread-badge {
  color: #fff;
  background: var(--accent);
  font-weight: 800;
  gap: 7px;
  padding: 5px 10px;
}

.unread-badge-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: rgba(255,255,255,0.6);
  display: inline-block;
  box-shadow: 0 0 0 2px rgba(6, 182, 212, 0.2);
}

.read-badge {
  color: var(--muted);
  background: rgba(255, 255, 255, 0.05);
  font-weight: 600;
}

.ai-state {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 11px;
  line-height: 1;
  letter-spacing: 0.04em;
  font-weight: 800;
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition:
    color 0.18s ease,
    background 0.18s ease,
    border-color 0.18s ease;
}

.ai-state.ai-on {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.18);
}

.ai-state.ai-off {
  color: #8b98a1;
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.08);
}

.ai-state.ai-off::after {
  content: "";
  position: absolute;
  width: 22px;
  height: 2px;
  background: currentColor;
  transform: rotate(-34deg);
  border-radius: 999px;
  opacity: 1;
}

.wa-contact-title-block {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.wa-contact-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.wa-chat-edit-btn {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 9px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  cursor: pointer;
  transition: 0.18s ease;
  flex-shrink: 0;
}
.wa-chat-edit-btn svg {
  width: 14px;
  height: 14px;
}
.wa-chat-edit-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(6, 182, 212, 0.18);
  color: var(--text);
}
.wa-chat-edit-btn:focus-visible {
  outline: 2px solid rgba(6, 182, 212, 0.28);
  outline-offset: 2px;
}

.compact-topbar {
  padding: 14px 20px;
}

.wa-chat-topbar-main.compact-main {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 18px;
  align-items: center;
}

.wa-chat-topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: nowrap;
}

.chat-meta-pill {
  min-width: 132px;
  min-height: 42px;
  padding: 8px 14px;
  justify-content: center;
  gap: 2px;
}

.chat-meta-pill strong {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
}

.summary-toggle-btn {
  height: 42px;
  padding: 0 16px;
  white-space: nowrap;
}

@media (max-width: 1320px) {
  .wa-chat-topbar-main.compact-main {
    grid-template-columns: 1fr auto;
    align-items: center;
  }
  .wa-chat-topbar-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
  }
}

/* Compact 2×2 grid for actions when below 1360px (iPad + narrow desktop) */
@media (min-width: 821px) and (max-width: 1359px) {
  .wa-chat-topbar-actions {
    display: grid;
    grid-template-columns: auto auto;
    grid-template-areas:
      "resumen pills"
      "toggle  pills";
    gap: 6px;
    align-items: stretch;
    justify-content: end;
  }
  #summaryBtn {
    grid-area: resumen;
  }
  .mobile-meta-group {
    grid-area: pills;
    display: flex;
    flex-direction: column;
    gap: 6px;
  }
  .mobile-meta-group .chat-meta-pill {
    flex: 1;
    min-height: 0;
  }
  .desktop-only-toggle {
    grid-area: toggle;
    width: 100%;
    justify-content: space-between;
  }
}

@media (max-width: 760px) {
  .chat-meta-pill {
    min-width: 110px;
  }
  .summary-toggle-btn,
  .semaphore-filter,
  .read-filter {
    min-height: 40px;
    font-size: 13px;
  }
}

/* === v7 left filter layout FIXED === */
.wa-semaphore-section {
  padding: 0 12px 12px;
}

.wa-filter-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin: 0 0 10px 4px;
}

.filter-icon {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0.9;
}

.filter-icon svg {
  width: 16px;
  height: 16px;
}

.wa-semaphore-filters {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  padding: 0;
  align-items: center;
}

.semaphore-filter {
  width: 100%;
  min-width: 0;
  min-height: 42px;
  padding: 0;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.semaphore-filter[data-filter="all"] {
  font-size: 13px;
  font-weight: 700;
}

.semaphore-filter[data-filter="green"],
.semaphore-filter[data-filter="yellow"],
.semaphore-filter[data-filter="red"] {
  font-size: 0;
}

.semaphore-filter[data-filter="green"] .status-dot,
.semaphore-filter[data-filter="yellow"] .status-dot,
.semaphore-filter[data-filter="red"] .status-dot {
  width: 14px;
  height: 14px;
}

.wa-read-filters {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding: 0 12px 12px;
}

.read-filter {
  width: 100%;
  min-width: 0;
  min-height: 42px;
  padding: 0 12px;
  justify-content: center;
}

@media (max-width: 420px) {
  .wa-semaphore-filters,
  .wa-read-filters {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ===== Mi asistente 24 auth + settings UI ===== */
.ghost-button {
  appearance: none;
  font: inherit;
  color: inherit;
  cursor: pointer;
}
.ma-mini-account {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 10px;
}
.ma-mini-account strong {
  font-size: 14px;
}
.ma-mini-account span {
  color: var(--muted);
  font-size: 13px;
}
.ma-top-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: flex-end;
}
.ma-dashboard-banner {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  padding: 18px 22px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(17, 27, 33, 0.72);
}
.ma-dashboard-banner h2 {
  margin: 0 0 6px;
  font-size: 28px;
}
.ma-dashboard-banner p:last-child {
  margin: 0;
  color: var(--muted);
  max-width: 700px;
  line-height: 1.6;
}
.ma-dashboard-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}
.ma-pill {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.ma-login-shell {
  min-height: 100vh;
  margin: 0;
  font-family: var(--font-sans);
  background: radial-gradient(
    circle at top left,
    #202938 0%,
    #0d1117 45%,
    #090c10 100%
  );
  color: #1f2328;
}
.ma-login-wrap {
  min-height: 100vh;
  width: min(1120px, 100%);
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(340px, 420px);
  gap: 28px;
  align-items: center;
  padding: 28px;
}
.ma-login-hero,
.ma-login-card {
  border-radius: 24px;
  box-shadow: 0 22px 70px rgba(15, 23, 42, 0.16);
}
.ma-login-hero {
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.08) 0%,
    rgba(255, 255, 255, 0.04) 100%
  );
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #fff;
  padding: 34px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 28px;
}
.ma-login-brand {
  display: flex;
  gap: 18px;
  align-items: flex-start;
}
.ma-login-logo {
  width: 54px;
  height: 54px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 22px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.14);
}
.ma-login-overline {
  margin: 0 0 8px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.72);
}
.ma-login-hero h1 {
  margin: 0 0 14px;
  font-size: clamp(34px, 4vw, 52px);
  line-height: 1.02;
}
.ma-login-hero p {
  margin: 0;
  max-width: 640px;
  color: rgba(255, 255, 255, 0.8);
  line-height: 1.7;
}
.ma-login-feature-grid {
  display: grid;
  gap: 14px;
}
.ma-login-feature-grid article {
  padding: 16px 18px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  display: grid;
  gap: 6px;
}
.ma-login-feature-grid span {
  color: rgba(255, 255, 255, 0.75);
  line-height: 1.6;
  font-size: 14px;
}
.ma-login-card {
  background: #fff;
  padding: 30px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.ma-login-card-head h2 {
  margin: 0 0 8px;
  font-size: 28px;
  color: #111827;
}
.ma-login-card-head p {
  margin: 0 0 22px;
  color: #59636e;
  line-height: 1.6;
}
.ma-form,
.ma-form label {
  display: grid;
  gap: 8px;
}
.ma-form {
  gap: 16px;
}
.ma-form span {
  font-size: 14px;
  font-weight: 600;
  color: #111827;
}
.ma-form input,
.ma-form textarea {
  width: 100%;
  border: 1px solid #d0d7de;
  border-radius: 12px;
  background: #fff;
  padding: 13px 14px;
  color: #1f2328;
  font: inherit;
}
.ma-form input:focus,
.ma-form textarea:focus {
  outline: 3px solid rgba(9, 105, 218, 0.18);
  border-color: #0969da;
}
.ma-form textarea {
  resize: vertical;
  min-height: 120px;
}
.ma-login-note {
  margin-top: 18px;
  border: 1px solid #d0d7de;
  border-radius: 16px;
  background: #f6f8fa;
  padding: 16px;
  display: grid;
  gap: 6px;
  color: #59636e;
}
.ma-login-note strong {
  color: #111827;
}
.ma-alert {
  margin: 18px 0;
  border-radius: 14px;
  padding: 14px 16px;
  font-size: 14px;
  font-weight: 600;
}
.ma-alert-error {
  background: #fff1f0;
  color: #d1242f;
  border: 1px solid #ffcecb;
}
.ma-alert-success {
  background: #edfdf3;
  color: #1f883d;
  border: 1px solid #b7e3c0;
}
.ma-alert-warning {
  background: #fff8e6;
  color: #8a5a00;
  border: 1px solid #ffe2a8;
}
.ma-panel-page {
  background: #f6f8fa;
  color: #1f2328;
  margin: 0;
  font-family: var(--font-sans);
}
.ma-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr);
}

@media (max-width: 1024px) {
  .ma-shell {
    grid-template-columns: 240px minmax(0, 1fr);
  }
}

@media (max-width: 768px) {
  .ma-shell {
    grid-template-columns: 1fr;
    min-height: auto;
  }
}
.ma-sidebar {
  background: linear-gradient(180deg, #0d1117 0%, #111827 100%);
  color: #fff;
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 28px;
}

@media (max-width: 768px) {
  .ma-sidebar {
    padding: 16px 12px;
    gap: 16px;
    border-right: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  }
}
.ma-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 28px;
}

/* === Loading & State Indicators === */
.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.btn.loading,
:is(.u-btn,.u-btn-primary,.u-btn-secondary,.u-btn-ghost,.u-btn-danger).loading {
  pointer-events: none;
  position: relative;
}

.btn.loading::before,
:is(.u-btn,.u-btn-primary,.u-btn-secondary,.u-btn-ghost,.u-btn-danger).loading::before {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  left: 50%;
  top: 50%;
  margin-left: -7px;
  margin-top: -7px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.btn.loading,
:is(.u-btn,.u-btn-primary,.u-btn-secondary,.u-btn-ghost,.u-btn-danger).loading {
  opacity: 0.8;
}

/* === Form validation states === */
.ma-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.ma-field input,
.ma-field textarea,
.ma-field select {
  border: 1px solid #d0d7de;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  transition: all 0.2s ease;
}

.ma-field input:focus,
.ma-field textarea:focus,
.ma-field select:focus {
  outline: none;
  border-color: #0969da;
  box-shadow: 0 0 0 3px rgba(9, 105, 218, 0.1);
}

.ma-field.error input,
.ma-field.error textarea {
  border-color: #d1242f;
  background-color: #fff1f0;
}

.ma-field.error input:focus,
.ma-field.error textarea:focus {
  box-shadow: 0 0 0 3px rgba(209, 36, 47, 0.1);
}

.ma-field.success input,
.ma-field.success textarea {
  border-color: #1f883d;
  background-color: #edfdf3;
}

.field-error {
  color: #d1242f;
  font-size: 12px;
  margin-top: 4px;
}

.field-success {
  color: #1f883d;
  font-size: 12px;
  margin-top: 4px;
}

/* === Mobile improvements === */
@media (max-width: 768px) {
  .landing-page {
    padding: 16px;
  }
  
  .landing-card {
    padding: 20px;
    border-radius: 16px;
  }
  
  .landing-header {
    flex-direction: column;
    gap: 12px;
  }
  
  .landing-header h1 {
    font-size: clamp(24px, 6vw, 36px);
  }
  
  .wa-sidebar {
    min-height: auto;
    max-height: 40vh;
    overflow-y: auto;
  }
  
  .wa-chat-list {
    max-height: 35vh;
  }
  
  .wa-chat-panel {
    height: auto;
    min-height: 60vh;
  }
  
  .wa-messages {
    min-height: 300px;
    max-height: 40vh;
  }
  
  .wa-chat-topbar-main.compact-main {
    grid-template-columns: 1fr;
    align-items: flex-start;
  }
  
  .wa-chat-topbar-actions {
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 8px;
  }
  
  .chat-meta-pill,
  .summary-toggle-btn {
    min-height: 38px;
    font-size: 13px;
    padding: 6px 12px;
  }
  
  .composer-row {
    gap: 8px;
  }
  
  .composer-row input {
    font-size: 16px;
  }
  
  .ma-field input,
  .ma-field textarea {
    font-size: 16px;
  }
}

@media (max-width: 480px) {
  .wa-sidebar-top h1 {
    font-size: 18px;
  }
  
  .wa-chat-item {
    padding: 10px 12px;
  }
  
  .wa-chat-topbar {
    padding: 12px 16px;
  }
  
  .toggle-wrap {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  
  .toggle-wrap input {
    width: 44px;
    height: 24px;
  }
  
  .toggle-wrap input::after {
    width: 18px;
    height: 18px;
  }
  
  .toggle-wrap input:checked::after {
    transform: translateX(20px);
  }
  
  .wa-bubble {
    max-width: 85%;
    padding: 10px 12px;
    font-size: 14px;
  }
  
  .ma-form-grid {
    grid-template-columns: 1fr;
  }
  
  .ma-field-wide {
    grid-column: auto;
  }
}
.ma-brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.08);
  font-weight: 800;
}
.ma-brand p {
  margin: 0 0 4px;
  font-weight: 700;
}
.ma-brand span {
  color: rgba(255, 255, 255, 0.65);
  font-size: 14px;
}
.ma-nav {
  display: grid;
  gap: 8px;
}
.ma-nav a {
  padding: 12px 14px;
  border-radius: 12px;
  color: rgba(255, 255, 255, 0.75);
  font-weight: 600;
}
.ma-nav a.active,
.ma-nav a:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}
.ma-content {
  padding: 24px;
}
.ma-card {
  background: #fff;
  border: 1px solid #e6ebf1;
  border-radius: 24px;
  box-shadow: 0 12px 34px rgba(15, 23, 42, 0.1);
}
.ma-topbar {
  padding: 24px;
}
.ma-topbar h1 {
  margin: 0 0 8px;
  font-size: clamp(28px, 3vw, 38px);
  color: #111827;
}
.ma-topbar p:last-child {
  margin: 0;
  color: #59636e;
  line-height: 1.65;
}
.ma-grid-2 {
  margin-top: 22px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px;
}
.ma-card-pad {
  padding: 20px;
}
.ma-section-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 16px;
}
.ma-section-head h2 {
  margin: 0 0 6px;
  font-size: 20px;
  color: #111827;
}
.ma-section-head p {
  margin: 0;
  color: #59636e;
}
.ma-account-list {
  display: grid;
  gap: 12px;
}
.ma-account-row {
  border: 1px solid #e6ebf1;
  border-radius: 16px;
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}
.ma-account-row p {
  margin: 6px 0 0;
  color: #59636e;
  font-size: 14px;
}
.ma-role-pill {
  padding: 8px 12px;
  border-radius: 999px;
  background: #f6f8fa;
  border: 1px solid #d0d7de;
  color: #59636e;
  font-size: 12px;
  font-weight: 700;
}

@media (max-width: 1180px) {
  .ma-login-wrap {
    grid-template-columns: 1fr;
  }
  .ma-grid-2 {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 1000px) {
  .ma-dashboard-banner {
    flex-direction: column;
  }
  .ma-dashboard-pills {
    justify-content: flex-start;
  }
}
@media (max-width: 900px) {
  .ma-shell {
    grid-template-columns: 1fr;
  }
  .ma-sidebar {
    padding: 18px;
  }
  .ma-nav {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .ma-content,
  .ma-login-wrap {
    padding: 16px;
  }
  .ma-login-hero,
  .ma-login-card,
  .ma-card {
    border-radius: 20px;
  }
  .ma-top-actions {
    justify-content: flex-start;
  }
}
@media (max-width: 700px) {
  .ma-login-brand {
    flex-direction: column;
  }
  .ma-nav {
    grid-template-columns: 1fr;
  }
  .ma-dashboard-banner {
    padding: 16px;
  }
  .wa-sidebar-top {
    flex-direction: column;
  }
  .ma-top-actions {
    width: 100%;
  }
  .ma-top-actions .ghost-link,
  .ma-top-actions form {
    width: 100%;
  }
  .ma-top-actions .ghost-link,
  .ma-top-actions .ghost-button {
    justify-content: center;
    width: 100%;
  }
}

/* ===== Mi asistente 24 UI v4 ===== */
body.ma-panel-page {
  overflow: auto;
  background: linear-gradient(180deg, #0b141a 0%, #101a20 100%);
  color: var(--text);
}
.ma-panel-page .eyebrow {
  color: var(--accent);
}
.ma-shell-dark {
  min-height: 100vh;
}
.ma-content-dark {
  overflow: auto;
  padding: 28px;
  background:
    radial-gradient(
      circle at top right,
      rgba(59, 130, 246, 0.08),
      transparent 28%
    ),
    linear-gradient(180deg, #0b141a 0%, #111b21 100%);
}
.ma-page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}
.ma-page-header h1 {
  margin: 0 0 10px;
  font-size: clamp(28px, 3.5vw, 42px);
  line-height: 1.05;
  color: var(--text);
}
.ma-page-header p:last-child {
  margin: 0;
  color: var(--muted);
  max-width: 760px;
  line-height: 1.65;
}
.ma-page-header-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}
.ma-tag,
.ma-soft-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
}
.ma-surface {
  background: linear-gradient(
    180deg,
    rgba(32, 44, 51, 0.96) 0%,
    rgba(17, 27, 33, 0.98) 100%
  );
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 28px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.22);
  padding: 22px;
}
.ma-surface-accent {
  background: linear-gradient(
    135deg,
    rgba(6, 182, 212, 0.14) 0%,
    rgba(17, 27, 33, 0.98) 55%
  );
}
.ma-surface-hero {
  min-height: 100%;
  background:
    radial-gradient(
      circle at top left,
      rgba(59, 130, 246, 0.12),
      transparent 38%
    ),
    linear-gradient(
      180deg,
      rgba(32, 44, 51, 0.96) 0%,
      rgba(17, 27, 33, 0.98) 100%
    );
}
.ma-surface-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 18px;
}
.ma-surface-head h2,
.ma-surface-hero h2 {
  margin: 0 0 8px;
  font-size: 28px;
  line-height: 1.15;
  color: var(--text);
}
.ma-surface-head p,
.ma-surface-hero p {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}
.ma-hero-badge {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(6, 182, 212, 0.12);
  color: #67e8f9;
  border: 1px solid rgba(6, 182, 212, 0.2);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 18px;
}
.ma-hero-points {
  display: grid;
  gap: 12px;
  margin-top: 22px;
}
.ma-hero-points article {
  padding: 16px 18px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  display: grid;
  gap: 6px;
}
.ma-hero-points span {
  color: var(--muted);
  line-height: 1.6;
}
.ma-settings-grid {
  display: grid;
  grid-template-columns: minmax(320px, 0.88fr) minmax(0, 1.12fr);
  gap: 22px;
}
.ma-settings-stack {
  display: grid;
  gap: 22px;
}
.ma-admin-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 0.9fr);
  gap: 22px;
}
.ma-modern-form {
  display: grid;
  gap: 18px;
}
.ma-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.ma-field {
  display: grid;
  gap: 8px;
}
.ma-field-wide {
  grid-column: 1 / -1;
}
.ma-field span {
  color: rgba(233, 237, 239, 0.92);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.01em;
}
.ma-field-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.ma-field input,
.ma-field textarea {
  width: 100%;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  padding: 14px 15px;
  font: inherit;
}
.ma-field textarea {
  min-height: 124px;
  resize: vertical;
}
.ma-field input::placeholder,
.ma-field textarea::placeholder {
  color: var(--muted);
}
.ma-field input:focus,
.ma-field textarea:focus {
  outline: none;
  border-color: rgba(6, 182, 212, 0.6);
  box-shadow: 0 0 0 4px rgba(6, 182, 212, 0.12);
}
.ma-form-actions {
  display: flex;
  justify-content: flex-end;
}
.ma-account-table {
  display: grid;
  gap: 12px;
}
.ma-account-card {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  padding: 16px 18px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.03);
}
.ma-account-main strong {
  display: block;
  font-size: 16px;
}
.ma-account-main p {
  margin: 6px 0 0;
  color: var(--muted);
}
.ma-account-meta {
  display: grid;
  justify-items: end;
  gap: 8px;
}
.ma-account-meta small {
  color: var(--muted);
}
.ma-role-pill {
  border-color: rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
}

.ma-login-shell {
  overflow: auto;
  background:
    radial-gradient(circle at top, rgba(59, 130, 246, 0.08), transparent 24%),
    #0d1117;
  color: #c9d1d9;
}
.ma-login-github {
  min-height: 100vh;
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 36px 24px;
}
.ma-login-topbar {
  display: flex;
  justify-content: center;
  margin-bottom: 28px;
}
.ma-login-topbrand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: #f0f6fc;
  font-weight: 700;
}
.ma-login-topbrand .ma-login-logo {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: #161b22;
  border: 1px solid #30363d;
}
.ma-login-github-grid {
  display: grid;
  grid-template-columns: minmax(340px, 1fr) minmax(360px, 420px);
  gap: 26px;
  align-items: center;
}
.ma-login-sidecard {
  padding: 34px;
  border-radius: 28px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: linear-gradient(
    180deg,
    rgba(22, 27, 34, 0.94) 0%,
    rgba(13, 17, 23, 0.98) 100%
  );
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.24);
}
.ma-login-sidecard h1 {
  margin: 0 0 14px;
  font-size: clamp(36px, 4.8vw, 60px);
  line-height: 1.02;
  color: #f0f6fc;
}
.ma-login-sidecard p {
  margin: 0;
  color: #8b949e;
  line-height: 1.75;
}
.ma-login-side-list {
  display: grid;
  gap: 12px;
  margin-top: 24px;
}
.ma-login-side-list article {
  display: grid;
  gap: 4px;
  padding: 16px 18px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
}
.ma-login-side-list strong {
  color: #f0f6fc;
}
.ma-login-side-list span {
  color: #8b949e;
}
.ma-login-signin-wrap {
  display: grid;
  gap: 18px;
}
.ma-login-signin-header {
  text-align: center;
}
.ma-login-mark {
  width: 54px;
  height: 54px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  margin: 0 auto 18px;
  background: #161b22;
  border: 1px solid #30363d;
  color: #f0f6fc;
  font-weight: 800;
  font-size: 22px;
}
.ma-login-signin-header h2 {
  margin: 0 0 8px;
  font-size: 30px;
  color: #f0f6fc;
}
.ma-login-signin-header p {
  margin: 0;
  color: #8b949e;
}
.ma-login-form-card {
  display: grid;
  gap: 16px;
  padding: 24px;
  border-radius: 22px;
  background: #161b22;
  border: 1px solid #30363d;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.24);
}
.ma-login-form-card .ma-field span {
  color: #f0f6fc;
}
.ma-login-form-card .ma-field input {
  background: #0d1117;
  border-color: #30363d;
  color: #f0f6fc;
}
.ma-login-form-card .ma-field input:focus {
  border-color: #2f81f7;
  box-shadow: 0 0 0 4px rgba(47, 129, 247, 0.16);
}
.ma-login-helper {
  padding: 16px 18px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  color: #8b949e;
}
.ma-login-helper strong {
  display: block;
  margin-bottom: 8px;
  color: #f0f6fc;
}
.ma-login-helper p {
  margin: 6px 0 0;
}
.ma-login-helper span {
  color: #8b949e;
}

.ma-top-actions {
  gap: 8px;
}
.ma-top-actions .ghost-link,
.ma-top-actions .ghost-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
}
.ma-top-actions .ghost-link:hover,
.ma-top-actions .ghost-button:hover {
  background: rgba(255, 255, 255, 0.08);
}
.ma-mini-account {
  margin-top: 8px;
  padding: 12px 14px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.03);
}
.ma-mini-account strong {
  font-size: 15px;
}
.ma-mini-account span {
  margin-top: 2px;
}
.wa-sidebar-header {
  padding-bottom: 6px;
}
.wa-sidebar-top {
  align-items: flex-start;
  padding: 18px 16px 12px;
}
.wa-filters {
  padding-top: 4px;
}
.wa-chat-list {
  padding: 8px 0 0;
}
.ma-dashboard-banner-tight {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 22px;
  background: linear-gradient(
    180deg,
    rgba(17, 27, 33, 0.95) 0%,
    rgba(17, 27, 33, 0.85) 100%
  );
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.ma-dashboard-banner-tight h2 {
  margin: 0 0 6px;
  font-size: 32px;
}
.ma-dashboard-banner-tight p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}
.ma-dashboard-pills-top {
  margin-top: 6px;
}

@media (max-width: 1100px) {
  .ma-login-github-grid,
  .ma-settings-grid,
  .ma-admin-grid {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 900px) {
  .ma-shell {
    grid-template-columns: 1fr;
  }
  .ma-content-dark {
    padding: 18px;
  }
  .ma-page-header {
    flex-direction: column;
  }
  .ma-page-header-meta {
    justify-content: flex-start;
  }
  .ma-form-grid {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 700px) {
  .ma-login-github {
    padding: 20px 14px;
  }
  .ma-login-sidecard {
    padding: 24px;
  }
  .ma-login-form-card {
    padding: 18px;
  }
  .ma-dashboard-banner-tight {
    padding: 16px;
  }
  .ma-top-actions {
    width: 100%;
  }
  .ma-top-actions .ghost-link,
  .ma-top-actions form,
  .ma-top-actions .ghost-button {
    width: 100%;
  }
}

/* Mi asistente 24 refresh: token values live in tokens.css. */
body {
  background:
    radial-gradient(circle at top, rgba(59, 130, 246, 0.1), transparent 18%),
    radial-gradient(
      circle at 75% 12%,
      rgba(124, 58, 237, 0.08),
      transparent 14%
    ),
    #030915;
}
.ma-login-shell,
.ma-panel-page {
  overflow: auto;
}
.centered-login {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
}
.brand-login-grid {
  width: min(1240px, 100%);
  grid-template-columns: 1.08fr 0.78fr;
  align-items: center;
}
.logo-sidecard,
.login-card-centered,
.ma-surface,
.ma-account-card,
.ma-login-helper,
.ma-login-form-card,
.wa-chat-topbar,
.summary-panel,
.wa-composer,
.ma-mini-account,
.ma-tag,
.ma-soft-pill,
.icon-circle-link {
  background: linear-gradient(
    180deg,
    rgba(23, 33, 45, 0.94),
    rgba(12, 19, 29, 0.96)
  );
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.28);
}
.ma-login-hero-logo {
  width: min(420px, 80%);
  display: block;
  margin: 0 auto 20px;
  filter: drop-shadow(0 18px 30px rgba(0, 0, 0, 0.28));
}
.ma-login-brand-mini {
  width: 96px;
  height: 96px;
  object-fit: contain;
  margin-bottom: 8px;
}
.ma-brand-logo-small {
  width: 54px;
  height: 54px;
  object-fit: contain;
  border-radius: 14px;
}
.ma-brand-logoized {
  align-items: center;
  gap: 12px;
}
.ma-brand-mark-image {
  width: 48px;
  height: 48px;
  object-fit: contain;
  border-radius: 10px;
}
.ma-sidebar-brand-block {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}
.icon-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}
.icon-circle-link {
  width: 46px;
  height: 46px;
  min-width: 46px;
  max-width: 46px;
  border-radius: 14px;
  color: var(--text);
  display: grid;
  place-items: center;
  transition: 0.2s ease;
  padding: 0;
  box-sizing: border-box;
  flex: 0 0 46px;
  line-height: 1;
}
.icon-circle-link svg {
  width: 20px;
  height: 20px;
}
.icon-circle-link[href="/support"] svg,
.icon-circle-link[href="/admin/support"] svg {
  width: 23px;
  height: 23px;
  stroke-width: 1.95;
}
.icon-circle-link:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 255, 255, 0.18);
}
.refined-top {
  align-items: center;
  padding-bottom: 16px;
}
.wa-layout {
  grid-template-columns: 380px 1fr;
  background: transparent;
}
.wa-sidebar {
  background: linear-gradient(180deg, #07111d 0%, #040a13 100%);
}
.wa-sidebar-header {
  background: linear-gradient(
    180deg,
    rgba(7, 17, 29, 0.98),
    rgba(7, 17, 29, 0.94)
  );
}
.wa-search-wrap.compact {
  padding: 0 14px 12px;
}
input.wa-search {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: #111b2a;
  color: var(--text);
  border-radius: 0;
  padding: 14px 14px;
  font-size: 15px;
}
.wa-filter-label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px 10px;
  color: var(--muted);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
}
.wa-semaphore-filters {
  padding: 0 10px 10px;
  display: grid;
  grid-template-columns: 1.1fr 1fr 1fr 1fr;
}
.semaphore-filter {
  justify-content: center;
  min-height: 44px;
  border-radius: 999px;
  font-weight: 700;
  color: #dce7f3;
  background: rgba(255, 255, 255, 0.03);
}
.read-filter {
  padding: 10px 14px;
  border-radius: 999px;
}
.semaphore-filter .status-dot {
  width: 12px;
  height: 12px;
}
.wa-main {
  background: linear-gradient(
    180deg,
    rgba(3, 9, 21, 0.82),
    rgba(5, 12, 23, 0.98)
  );
}
.wa-main-sticky.no-banner {
  top: 0;
  padding: 14px 14px 0;
}
.fixed-summary-bar {
  border-radius: 20px;
  padding: 18px 18px 14px;
  margin: 0;
}
/* Calm secondary header buttons — no heavy gradient/shadow (only the composer Send
   keeps the accent). Colored states (.followup-toggle-btn.active amber, .attention-reset-btn
   green) define their own background/text and still win. */
.summary-toggle-btn {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border, rgba(255, 255, 255, 0.12));
  border-radius: 12px;
  padding: 12px 16px;
  font-weight: 700;
  box-shadow: none;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.summary-toggle-btn:hover {
  background: color-mix(in srgb, var(--muted) 14%, transparent);
  border-color: color-mix(in srgb, var(--muted) 40%, transparent);
}
.wa-chat-topbar-actions {
  gap: 14px;
  flex-wrap: wrap;
  align-items: center;
}

/* Etapa/Intención are non-actionable AI readouts (also in the context drawer). Quiet them
   from big bordered pills to compact stacked text so they stop competing in the header. */
body.inbox-body .chat-meta-readout {
  min-width: 0 !important;
  min-height: 0 !important;
  padding: 0 !important;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}
body.inbox-body .chat-meta-readout .pill-icon { display: none; }
body.inbox-body .chat-meta-readout .pill-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0;
  line-height: 1.2;
}
body.inbox-body .chat-meta-readout .summary-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}
body.inbox-body .chat-meta-readout strong {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
body.inbox-body .mobile-meta-group { gap: 18px; }

/* "⋯ Más" overflow menu */
.wa-more { position: relative; }
.wa-more-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 60;
  min-width: 210px;
  padding: 6px;
  background: var(--bg-panel, var(--bg-card, #0f1a26));
  border: 1px solid var(--border, rgba(255, 255, 255, 0.14));
  border-radius: 14px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.3);
}
.wa-more-menu.hidden { display: none; }
.wa-more-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  text-align: left;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.14s ease;
}
.wa-more-item:hover { background: color-mix(in srgb, var(--muted) 16%, transparent); }
.wa-more-item svg { width: 18px; height: 18px; flex-shrink: 0; color: var(--muted); }
.chat-meta-pill {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 10px 14px;
  min-width: 140px;
}
.toggle-wrap {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  padding: 8px 12px;
}
.wa-empty-state {
  display: grid;
  place-items: center;
  text-align: center;
  height: 100%;
  padding: 40px;
}
.ma-empty-logo {
  width: 180px;
  height: auto;          /* keep aspect ratio — the <img> has height="1024" which else stretches it */
  max-width: 60%;
  opacity: 0.88;
  margin-bottom: 10px;
}
.ma-search-users input,
.ma-field input,
.ma-field textarea {
  background: #0f1826;
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text);
  border-radius: 14px;
  padding: 14px 16px;
  width: 100%;
}
.ma-field textarea {
  min-height: 112px;
  resize: vertical;
}
.ma-account-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}
.ma-inline-edit {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}
.compact-form .ma-form-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.single-column-settings {
  display: block;
}
.form-inspiration-card {
  position: relative;
  overflow: hidden;
}
.form-inspiration-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    135deg,
    rgba(6, 182, 212, 0.1),
    transparent 28%,
    rgba(46, 168, 255, 0.08) 62%,
    rgba(123, 60, 255, 0.08)
  );
  pointer-events: none;
}
.ma-nav a {
  border-radius: 14px;
}
.ma-nav a.active {
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.08),
    rgba(255, 255, 255, 0.04)
  );
}
.ma-login-form-card {
  padding: 20px;
}
.wa-chat-list .wa-chat-item.active,
.wa-chat-list .wa-chat-item:hover {
  background: rgba(255, 255, 255, 0.05);
}
.wa-chat-item {
  padding: 16px 18px;
}
.wa-chat-messages {
  padding: 24px 22px 16px;
  height: calc(100vh - 230px);
  overflow: auto;
}
.wa-composer {
  margin: 0 14px 14px;
  border-radius: 18px;
  padding: 16px;
}
.ma-search-users {
  margin-bottom: 14px;
}
.ma-login-side-list article {
  border-radius: 16px;
}
@media (max-width: 1100px) {
  .brand-login-grid {
    grid-template-columns: 1fr;
  }
  .logo-sidecard {
    text-align: center;
  }
  .wa-layout {
    grid-template-columns: 320px 1fr;
  }
  .compact-form .ma-form-grid {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 820px) {
  .wa-layout {
    display: block;
    position: relative;
    height: 100vh;
    overflow: hidden;
  }
  .wa-sidebar {
    position: absolute;
    inset: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    transform: translateX(0);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 2;
  }
  .wa-sidebar-header {
    flex-shrink: 0;
  }
  .wa-chat-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    max-height: none;
  }
  .wa-main {
    position: absolute;
    inset: 0;
    height: 100vh;
    display: flex !important;
    flex-direction: column;
    background: var(--bg-chat);
    transform: translateX(100%);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1;
  }
  .wa-layout.chat-open .wa-sidebar {
    transform: translateX(-100%);
  }
  .wa-layout.chat-open .wa-main {
    transform: translateX(0);
    z-index: 3;
  }
  .wa-chat-panel {
    flex: 1;
    min-height: 0;
    height: 100%;
    grid-template-rows: auto 1fr auto;
    overflow: hidden;
  }
  .wa-chat-messages {
    height: auto !important;
    min-height: 0;
    overflow-y: auto;
  }
  .wa-mobile-back {
    display: inline-flex !important;
  }
  .ma-admin-grid {
    grid-template-columns: 1fr;
  }
  .ma-page-header {
    flex-direction: column;
  }
  .wa-semaphore-filters {
    grid-template-columns: repeat(4, 1fr);
  }
  .ma-top-actions.icon-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
  }
}

/* ── Focused UX pass: Settings batch 2 ───────────────────────────── */
.settings-billing-main {
  justify-content: space-between;
}

.settings-billing-main > div {
  min-width: 0;
}

.settings-billing-stats .ma-surface {
  min-height: 74px;
}

.settings-page #calAvailability > div:first-child {
  gap: 12px;
  flex-wrap: wrap;
}

.settings-page #calDaysGrid > div {
  transition: border-color 0.16s ease, background-color 0.16s ease;
}

.settings-page #calDaysGrid > div:has(.cal-day-chk:checked) {
  border-color: color-mix(in srgb, var(--accent) 34%, rgba(255, 255, 255, 0.08)) !important;
  background: color-mix(in srgb, var(--accent) 8%, transparent) !important;
}

.settings-page .cal-day-state {
  border-radius: 999px;
  padding: 3px 9px;
  background: rgba(255, 255, 255, 0.04);
}

.settings-page #history-modal[style*="display: block"] > div,
.settings-page #history-modal[style*="display:block"] > div {
  animation: settingsModalIn 0.16s ease;
}

@keyframes settingsModalIn {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (max-width: 820px) {
  .ma-shell-topbar {
    max-width: 100vw;
    overflow-x: hidden;
  }

  .ma-icon-topbar {
    max-width: 100vw;
    justify-content: flex-start;
    gap: 12px;
    overflow-x: auto;
    padding: 12px 16px;
    scrollbar-width: none;
  }

  .ma-icon-topbar::-webkit-scrollbar {
    display: none;
  }

  .ma-content-dark.ma-topbar-content {
    width: 100%;
    max-width: 100vw;
    box-sizing: border-box;
  }

  .settings-billing-main {
    align-items: stretch !important;
  }

  .settings-billing-main > div {
    width: 100%;
  }

  .settings-billing-main :is(.u-btn,.u-btn-primary,.u-btn-secondary,.u-btn-ghost,.u-btn-danger) {
    width: 100%;
    justify-content: center;
  }

  .settings-billing-stats {
    grid-template-columns: 1fr !important;
  }

  .settings-page #calAvailability > div:first-child :is(.u-btn,.u-btn-primary,.u-btn-secondary,.u-btn-ghost,.u-btn-danger) {
    width: fit-content;
    align-self: flex-start;
    justify-content: center;
  }

  .settings-page #calDaysGrid > div {
    align-items: stretch !important;
  }

  .settings-page .cal-times {
    width: 100%;
  }

  .settings-page .cal-times input[type="time"] {
    flex: 1;
    min-width: 120px;
  }
}

/* Mobile back button */
.wa-mobile-back {
  display: none;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text);
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
  transition: 0.18s ease;
}
.wa-mobile-back:hover {
  background: rgba(255, 255, 255, 0.12);
}
.wa-mobile-back svg {
  width: 20px;
  height: 20px;
}

/* === Icon Topbar — Settings / Users pages === */
.ma-shell-topbar {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.ma-icon-topbar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 22px 24px;
  background: linear-gradient(180deg, #07111d 0%, #040a13 100%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  position: sticky;
  top: 0;
  z-index: 10;
  flex-shrink: 0;
}

.ma-icon-topbar > form {
  display: contents;
}

.ma-icon-topbar .icon-circle-link {
  width: 58px;
  height: 58px;
  min-width: 58px;
  max-width: 58px;
  flex: 0 0 58px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(23, 33, 45, 0.94), rgba(12, 19, 29, 0.96));
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
  color: var(--text);
  display: grid;
  place-items: center;
  transition: 0.2s ease;
  cursor: pointer;
  text-decoration: none;
  appearance: none;
  font: inherit;
  padding: 0;
  box-sizing: border-box;
  line-height: 1;
}

.ma-icon-topbar .icon-circle-link svg {
  width: 26px;
  height: 26px;
  flex-shrink: 0;
}
.ma-icon-topbar .icon-circle-link[href="/support"] svg,
.ma-icon-topbar .icon-circle-link[href="/admin/support"] svg,
.wa-page-topbar .icon-circle-link[href="/support"] svg,
.wa-page-topbar .icon-circle-link[href="/admin/support"] svg {
  width: 29px;
  height: 29px;
  stroke-width: 1.95;
}
.ma-theme-toggle-rail {
  border: 1px solid rgba(6, 182, 212, 0.2);
}
.ma-theme-toggle-rail-icon {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  font-size: 18px;
  line-height: 1;
}

.ma-icon-topbar .icon-circle-link.active {
  background: linear-gradient(180deg, rgba(6, 182, 212, 0.2), rgba(6, 182, 212, 0.09));
  border-color: rgba(6, 182, 212, 0.32);
  color: var(--accent);
  box-shadow: 0 8px 28px rgba(6, 182, 212, 0.18);
}

.ma-icon-topbar .icon-circle-link:hover:not(.active) {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05));
  border-color: rgba(255, 255, 255, 0.18);
  transform: translateY(-1px);
}

.ma-content-dark.ma-topbar-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
}

/* === wa-page: new inbox layout (topbar + layout) === */
body.inbox-body {
  overflow: hidden;
  height: 100vh;
  background: linear-gradient(135deg, #060d15 0%, #0b141a 40%, #0d1520 70%, #090c18 100%);
}
body.inbox-body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(ellipse 60% 50% at 10% 20%, rgba(6,182,212,.06) 0%, transparent 60%),
    radial-gradient(ellipse 50% 40% at 90% 80%, rgba(124,58,237,.06) 0%, transparent 60%);
}
.wa-page {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  position: relative;
  z-index: 1;
}
.wa-page-topbar {
  flex-shrink: 0;
  position: static; /* override sticky from ma-icon-topbar */
}
.wa-page > .wa-layout {
  flex: 1 !important;
  min-height: 0 !important;
  height: auto !important;
  display: grid;
  grid-template-columns: 380px 1fr;
  overflow: hidden;
}
@media (max-width: 1100px) {
  .wa-page > .wa-layout {
    grid-template-columns: 320px 1fr;
  }
}
.wa-page .wa-sidebar {
  height: 100%;
  max-height: none !important;
  min-height: 0 !important;
  overflow: hidden;
}
.wa-page .wa-sidebar-header {
  background: linear-gradient(180deg, rgba(7, 17, 29, 0.98), rgba(7, 17, 29, 0.94));
}
.wa-page .wa-main {
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.wa-page .wa-chat-panel {
  flex: 1 !important;
  min-height: 0 !important;
  height: 100% !important;
  display: grid;
  grid-template-rows: auto 1fr auto;
  overflow: hidden;
}
.wa-page .wa-chat-messages {
  height: auto !important;
  min-height: 0 !important;
  overflow-y: auto;
}

/* Filter toggle */
.wa-filter-toggle {
  appearance: none;
  background: none;
  border: none;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px 10px;
  color: var(--muted);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
  cursor: pointer;
  width: 100%;
  font-family: inherit;
}
.wa-filter-toggle .filter-arrow {
  margin-left: auto;
  transition: transform 0.22s ease;
  width: 16px;
  height: 16px;
  opacity: 0.7;
}
.wa-filter-toggle[aria-expanded="true"] .filter-arrow {
  transform: rotate(180deg);
}
.wa-filter-panel {
  overflow: hidden;
}
/* Section label can host a trailing info/help icon (e.g. the 24h window note) */
.filter-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
@media (max-width: 820px) {
  .wa-filter-panel {
    max-height: 0;
    transition: max-height 0.28s ease;
  }
  .wa-filter-panel.open {
    max-height: 380px;
    overflow-y: auto;
  }
  .wa-page > .wa-layout {
    display: block !important;
    position: relative;
    overflow: hidden;
  }
  .wa-page .wa-sidebar {
    position: absolute;
    inset: 0;
    height: 100% !important;
    max-height: none !important;
    display: flex;
    flex-direction: column;
    transform: translateX(0);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 2;
    overflow: hidden;
  }
  .wa-page .wa-chat-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    max-height: none !important;
  }
  .wa-page .wa-main {
    position: absolute;
    inset: 0;
    height: 100% !important;
    display: flex !important;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1;
  }
  .wa-page .wa-layout.chat-open .wa-sidebar {
    transform: translateX(-100%);
  }
  .wa-page .wa-layout.chat-open .wa-main {
    transform: translateX(0);
    z-index: 3;
  }
}
@media (min-width: 821px) {
  .wa-filter-panel {
    max-height: none !important;
  }
  .wa-filter-toggle .filter-arrow { display: none; }
  .wa-filter-toggle { cursor: default; pointer-events: none; }
}

/* Summary panel border radius */
.summary-panel {
  border-radius: 14px;
  overflow: hidden;
  margin-top: 10px;
  padding: 14px 16px;
}

/* Admin users overflow fix */
body.ma-panel-page {
  overflow-x: hidden;
}
.ma-account-card {
  flex-wrap: wrap;
  overflow: hidden;
}
.ma-account-main {
  min-width: 0;
  flex: 1;
}
.ma-account-main strong,
.ma-account-main p {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
@media (max-width: 540px) {
  .ma-account-actions {
    width: 100%;
    justify-content: flex-end;
    padding-top: 4px;
  }
  .ma-account-meta {
    justify-items: start;
  }
}

/* Login landing redesign */
.ma-login-landing {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
}
.ma-login-landing-inner {
  width: min(680px, 100%);
}
.ma-login-landing-inner .ma-login-hero-logo {
  width: min(360px, 70%);
  margin-bottom: 24px;
}
.ma-login-landing-inner h1 {
  margin: 0 0 12px;
  font-size: clamp(32px, 5vw, 52px);
  line-height: 1.06;
  color: #f0f6fc;
}
.ma-login-landing-inner > p {
  margin: 0 0 24px;
  color: #8b949e;
  line-height: 1.75;
  max-width: 560px;
}
.ma-login-cta {
  margin-top: 28px;
  padding: 15px 32px;
  font-size: 16px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.ma-login-cta svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}
.ma-login-fullpage {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
}
.ma-signin-card {
  width: min(440px, 100%);
  display: flex;
  flex-direction: column;
  gap: 0;
  background: linear-gradient(180deg, rgba(23, 33, 45, 0.98), rgba(12, 19, 29, 0.99));
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 24px;
  padding: 36px 32px 28px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.4);
}
.ma-signin-header {
  text-align: center;
  margin-bottom: 24px;
}
.ma-signin-header img {
  width: 80px;
  margin-bottom: 14px;
}
.ma-signin-header h2 {
  margin: 0 0 6px;
  font-size: 26px;
  color: #f0f6fc;
}
.ma-signin-header p {
  margin: 0;
  color: #8b949e;
  font-size: 14px;
}
.ma-signin-card .ma-field {
  margin-bottom: 14px;
}
.ma-signin-card .ma-field:last-of-type {
  margin-bottom: 18px;
}
.ma-back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  background: none;
  border: none;
  cursor: pointer;
  font: inherit;
  padding: 10px 0 0;
  transition: color 0.18s;
}
.ma-back-link:hover { color: var(--text); }

/* --- Hotfixes v5 --- */
.summary-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.summary-close-btn {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  display: grid;
  place-items: center;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  transition: 0.18s ease;
  padding: 0;
}
.summary-close-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
}
.wa-composer {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: visible;
}
.composer-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
}
.composer-row input,
.composer-row textarea {
  min-height: 48px;
  padding: 12px 16px;
  border-radius: 14px;
  display: block;
}
#sendHumanReplyBtn {
  height: 48px;
  padding: 0 24px;
  align-self: end;
  white-space: nowrap;
}
.wa-chat-panel {
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 0;
  height: 100vh;
  overflow: hidden;
}
.wa-chat-messages {
  min-height: 0;
}
.icon-circle-link.ghost-button {
  background: transparent;
}
.ma-brand-logo-small,
.ma-brand-mark-image,
.ma-login-brand-mini {
  background: transparent;
  border-radius: 0;
}
.ma-empty-logo {
  width: 220px;
  height: auto;
  opacity: 1;
}
.ma-login-hero-logo {
  width: min(500px, 88%);
}
.login-card-centered {
  justify-self: center;
}
.centered-login .brand-login-grid {
  justify-content: center;
}

/* === Login: match card heights === */
.brand-login-grid,
.ma-login-github-grid {
  align-items: stretch;
}
.ma-login-signin-wrap {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 18px;
  padding: 34px;
}
/* === Logout confirmation modal === */
.ma-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  display: grid;
  place-items: center;
  z-index: 9999;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.ma-modal-overlay.hidden {
  display: none !important;
}
.ma-modal {
  background: linear-gradient(180deg, rgba(23, 33, 45, 0.98), rgba(12, 19, 29, 0.99));
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 24px;
  padding: 28px 24px 22px;
  width: min(360px, 90vw);
  text-align: center;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
  animation: modalIn 0.18s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.ma-modal h3 {
  margin: 0 0 8px;
  font-size: 20px;
  color: var(--text);
}
.ma-modal p {
  margin: 0 0 22px;
  color: var(--muted);
  line-height: 1.6;
  font-size: 15px;
}
.ma-modal-input {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  margin: 0 0 18px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text);
  font: inherit;
  font-size: 15px;
  box-sizing: border-box;
}
.ma-modal-input:focus {
  outline: none;
  border-color: rgba(6, 182, 212, 0.35);
  box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.12);
}
.ma-modal-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.94) translateY(8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

/* === Mobile icon topbar for Inbox === */
.wa-mobile-icons {
  display: none;
}

@media (max-width: 820px) {
  .wa-mobile-icons {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    padding: 16px 24px;
    background: linear-gradient(180deg, #07111d 0%, #040a13 100%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
  }
  .wa-mobile-icons > form {
    display: contents;
  }
.wa-mobile-icons .icon-circle-link {
  width: 52px;
  height: 52px;
  min-width: 52px;
  max-width: 52px;
  flex: 0 0 52px;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(23, 33, 45, 0.94), rgba(12, 19, 29, 0.96));
  border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
    color: var(--text);
    display: grid;
    place-items: center;
    transition: 0.2s ease;
  cursor: pointer;
  text-decoration: none;
  appearance: none;
  font: inherit;
  padding: 0;
  box-sizing: border-box;
  line-height: 1;
}
.wa-mobile-icons .icon-circle-link svg {
  width: 22px;
  height: 22px;
}
.wa-mobile-icons .icon-circle-link[href="/support"] svg,
.wa-mobile-icons .icon-circle-link[href="/admin/support"] svg {
  width: 24px;
  height: 24px;
  stroke-width: 2;
}
  .wa-mobile-icons .icon-circle-link.active {
    background: linear-gradient(180deg, rgba(6, 182, 212, 0.2), rgba(6, 182, 212, 0.09));
    border-color: rgba(6, 182, 212, 0.32);
    color: var(--accent);
    box-shadow: 0 8px 28px rgba(6, 182, 212, 0.18);
  }
  .wa-sidebar-top.refined-top {
    display: none;
  }
  /* Mobile padding & grid fixes */
  .ma-content-dark {
    padding: 16px;
  }
  .ma-form-grid {
    grid-template-columns: 1fr !important;
  }
  .ma-icon-topbar {
    padding: 16px 20px;
    gap: 16px;
  }
  .ma-icon-topbar .icon-circle-link {
    width: 52px;
    height: 52px;
    border-radius: 16px;
  }
  .ma-icon-topbar .icon-circle-link svg {
    width: 22px;
    height: 22px;
  }
}

/* === v7 polish === */

/* Message bubble spacing */
.wa-message-row { margin-bottom: 8px; }
.wa-message-row:last-child { margin-bottom: 0; }

/* Settings sections gap */
.single-column-settings {
  display: flex;
  flex-direction: column;
  gap: 32px;
}

/* Filter area container with border-radius */
.wa-filter-box {
  margin: 14px 10px 10px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 16px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.02);
}
.wa-filter-box .wa-filter-toggle {
  padding: 10px 14px;
  width: 100%;
}
.wa-filter-box .wa-semaphore-section,
.wa-filter-box .wa-read-filters {
  padding-left: 12px;
  padding-right: 12px;
}

/* Desktop: prevent account card wrapping */
@media (min-width: 541px) {
  .ma-account-card { flex-wrap: nowrap; }
}

/* Desktop vs mobile label toggle */
.label-mobile { display: none; }
.label-desktop { display: inline; }

/* Summary modal sizing */
.ma-summary-modal {
  width: min(560px, 90vw);
  max-height: 70vh;
  overflow-y: auto;
}
.ma-summary-modal p {
  margin: 0;
  line-height: 1.75;
  color: var(--muted);
  white-space: pre-wrap;
}
.ma-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.ma-modal-head h3 { margin: 0; }
.ma-modal-close {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
  transition: color 0.18s;
}
.ma-modal-close:hover { color: var(--text); }

/* Mobile conversation view refinements */
@media (max-width: 820px) {
  #chatHeaderAiBadge { display: none; }
  .wa-contact-title-block { gap: 1px; }
  .label-mobile { display: inline; }
  .label-desktop { display: none; }
  .mobile-meta-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
  }
  .mobile-meta-group .chat-meta-pill {
    min-width: 0;
    flex: 1;
    padding: 7px 10px;
  }
}

/* === v8 polish === */

/* Fix search input border-radius */
input.wa-search {
  border-radius: 12px !important;
}

/* Desktop: force account card no-wrap */
@media (min-width: 541px) {
  .ma-account-card {
    flex-wrap: nowrap !important;
  }
}

/* Mobile topbar: hide when chat is open */
@media (max-width: 820px) {
  .wa-page.chat-active .wa-page-topbar {
    display: none;
  }
}

/* Mobile chat header: compact mode */
@media (max-width: 820px) {
  .compact-topbar {
    padding: 10px 14px 8px !important;
  }
  .wa-contact-heading {
    gap: 8px;
  }
  .wa-contact-title-block {
    gap: 0 !important;
  }
  .wa-contact-title-block h2,
  #chatHeaderName {
    font-size: 15px;
    line-height: 1.2;
  }
  .wa-contact-title-block p,
  #chatHeaderPhone {
    font-size: 11px !important;
    margin: 0 !important;
    color: var(--muted);
  }
  .wa-chat-topbar-actions {
    padding-top: 4px;
    gap: 5px;
  }
  .summary-toggle-btn {
    min-height: 0 !important;
    padding: 5px 11px !important;
    font-size: 12px !important;
  }
  .chat-meta-pill {
    min-height: 0 !important;
    min-width: 0 !important;
    padding: 4px 9px !important;
    font-size: 12px !important;
  }
  .chat-meta-pill .summary-label {
    font-size: 9px;
    margin-bottom: 1px;
  }
  .chat-meta-pill strong {
    font-size: 12px;
  }
  .toggle-wrap {
    flex-direction: row !important;
    align-items: center !important;
    gap: 7px !important;
    padding: 5px 10px !important;
    font-size: 12px !important;
  }
  .toggle-wrap input {
    width: 36px !important;
    height: 20px !important;
  }
  .toggle-wrap input::after {
    width: 14px !important;
    height: 14px !important;
    top: 3px !important;
    left: 3px !important;
  }
  .toggle-wrap input:checked::after {
    transform: translateX(16px) !important;
  }
}

/* === Login page v2 === */
.ma-login-landing {
  position: relative;
  overflow: hidden;
  background: #0b1120;
  padding: 40px 20px;
}
.ma-login-landing::before {
  content: '';
  position: absolute;
  left: -25%;
  top: 10%;
  width: 65%;
  height: 80%;
  background: radial-gradient(ellipse, rgba(110, 40, 210, 0.22), transparent 60%);
  pointer-events: none;
}
.ma-login-landing::after {
  content: '';
  position: absolute;
  right: -20%;
  bottom: 5%;
  width: 60%;
  height: 75%;
  background: radial-gradient(ellipse, rgba(0, 90, 200, 0.18), transparent 60%);
  pointer-events: none;
}
.ma-login-watermark {
  position: absolute;
  opacity: 0.06;
  pointer-events: none;
  user-select: none;
}
.ma-login-watermark-left {
  left: -80px;
  bottom: -60px;
  width: 440px;
  filter: hue-rotate(240deg) saturate(1.8) brightness(0.55);
}
.ma-login-watermark-right {
  right: -90px;
  bottom: 20px;
  width: 400px;
  filter: hue-rotate(170deg) saturate(1.6) brightness(0.6);
}
.ma-landing-card {
  position: relative;
  z-index: 1;
  width: min(480px, 92vw);
  background: rgba(13, 18, 38, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 28px;
  padding: 40px 36px 36px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  backdrop-filter: blur(14px);
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.5);
}
.ma-landing-logo {
  width: 140px;
  margin-bottom: 10px;
}
.ma-landing-eyebrow {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  padding: 5px 14px;
  margin: 4px 0 14px;
}
.ma-landing-title {
  font-size: clamp(28px, 5vw, 40px);
  font-weight: 800;
  line-height: 1.1;
  margin: 0 0 12px;
  color: #f0f6fc;
}
.ma-landing-gradient {
  background: linear-gradient(90deg, #06b6d4, #7c3aed);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.ma-landing-desc {
  font-size: 14px;
  color: #8b949e;
  line-height: 1.65;
  margin: 0 0 20px;
  max-width: 380px;
}
.ma-landing-features {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 24px;
  text-align: left;
}
.ma-landing-feature {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 16px;
  padding: 14px 16px;
}
.ma-feature-icon {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ma-feature-icon svg {
  width: 20px;
  height: 20px;
}
.ma-feature-purple { background: rgba(120, 80, 220, 0.2); color: #a78bfa; }
.ma-feature-teal   { background: rgba(0,  180, 150, 0.18); color: #34d399; }
.ma-landing-feature-text strong {
  display: block;
  font-size: 14px;
  font-weight: 700;
  color: #e6edf3;
  margin-bottom: 2px;
}
.ma-landing-feature-text span {
  font-size: 13px;
  color: #8b949e;
  line-height: 1.5;
}
.ma-landing-cta-btn {
  width: 100%;
  padding: 16px 24px;
  font-size: 16px;
  font-weight: 700;
  border: none;
  border-radius: 18px;
  background: linear-gradient(90deg, #06b6d4 0%, #7c3aed 100%);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: opacity 0.2s, transform 0.18s;
}
.ma-landing-cta-btn:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}
.ma-landing-cta-btn svg {
  width: 18px;
  height: 18px;
}

/* === v9: desktop sidebar nav + mobile header/composer redesign === */

/* Desktop: left-side vertical nav — centered on the viewport */
@media (min-width: 821px) {
  .ma-shell-topbar,
  .wa-page {
    padding-left: 112px;
    box-sizing: border-box;
  }

  .wa-sidebar-inset-nav { display: none; }

  .ma-icon-topbar,
  .wa-page-topbar {
    position: fixed !important;
    top: 50% !important;
    left: 24px !important;
    transform: translateY(-50%) !important;
    width: auto !important;
    padding: 0 !important;
    gap: 18px;
    background: none !important;
    border: none !important;
    z-index: 400;
    display: flex !important;
    flex-direction: column;
    justify-content: center !important;
    align-items: center;
    flex-shrink: 0;
    /* Safety on short screens: if 10 uniform buttons + gaps exceed the viewport, let the rail
       scroll instead of clipping. Scrollbar hidden so it stays clean. */
    max-height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: none;
  }
  .ma-icon-topbar::-webkit-scrollbar,
  .wa-page-topbar::-webkit-scrollbar { width: 0; height: 0; }
}

/* Sidebar inset nav (desktop only) */
.wa-sidebar-inset-nav {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.wa-sidebar-inset-nav .icon-circle-link.small {
  width: 36px;
  height: 36px;
  border-radius: 10px;
}
.wa-sidebar-inset-nav .icon-circle-link.small svg {
  width: 17px;
  height: 17px;
}
.wa-sidebar-inset-nav form { display: contents; }

/* Mobile header row (row 1: contact + toggle) */
.wa-mobile-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  min-width: 0;
}
.wa-mobile-header-row .wa-contact-heading {
  flex: 1;
  min-width: 0;
}

/* Show/hide toggles per viewport */
.mobile-only-toggle { display: none; }
.desktop-only-toggle { display: inline-flex; }

@media (max-width: 820px) {
  .mobile-only-toggle {
    display: inline-flex;
    flex-shrink: 0;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    padding: 5px 9px;
    border-radius: 14px;
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(255,255,255,0.03);
  }
  .mobile-only-toggle input {
    width: 32px !important;
    height: 18px !important;
  }
  .mobile-only-toggle input::after {
    width: 12px !important;
    height: 12px !important;
    top: 3px !important;
    left: 3px !important;
  }
  .mobile-only-toggle input:checked::after {
    transform: translateX(14px) !important;
  }
  .desktop-only-toggle { display: none; }
  /* Also hide the original toggle-wrap label-mobile span when using the new mobile-only-toggle */
}

/* "Respuesta IA" visual toggle in header (mobile only, far right of name row) */
.header-ia-toggle {
  display: none;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
  flex-shrink: 0;
  user-select: none;
}
@media (max-width: 820px) {
  .header-ia-toggle {
    display: flex;
  }
}

/* Resumen button icon */
.summary-btn-icon {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}
@media (max-width: 820px) {
  .summary-toggle-btn {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 13px !important;
    padding: 8px 14px !important;
    min-height: 36px !important;
  }
}

@media (max-width: 430px) {
  .compact-topbar {
    padding: 12px 14px 10px !important;
  }
  .wa-mobile-header-row {
    gap: 12px;
    align-items: flex-start;
  }
  .wa-contact-heading {
    gap: 10px !important;
  }
  .wa-mobile-back {
    width: 48px !important;
    height: 48px !important;
    border-radius: 16px !important;
  }
  .wa-mobile-back svg {
    width: 20px !important;
    height: 20px !important;
  }
  .wa-contact-title-block h2,
  #chatHeaderName {
    font-size: 17px !important;
    line-height: 1.15 !important;
  }
  .wa-contact-title-block p,
  #chatHeaderPhone {
    font-size: 12px !important;
    line-height: 1.35 !important;
  }
  .header-ia-toggle {
    gap: 8px !important;
    font-size: 13px !important;
  }
  .wa-mci-toggle-visual {
    width: 36px !important;
    height: 20px !important;
  }
  .wa-mci-toggle-visual::after {
    width: 14px !important;
    height: 14px !important;
  }
  .wa-mci-toggle-visual.on::after {
    transform: translateX(16px) !important;
  }
  .wa-chat-topbar-actions {
    padding-top: 8px !important;
    gap: 8px !important;
    align-items: stretch !important;
  }
  .summary-toggle-btn {
    min-height: 44px !important;
    padding: 10px 14px !important;
    border-radius: 15px !important;
    font-size: 14px !important;
    font-weight: 800 !important;
  }
  .summary-btn-icon {
    width: 16px !important;
    height: 16px !important;
  }
  .mobile-meta-group {
    gap: 8px !important;
  }
  .mobile-meta-group .chat-meta-pill,
  .chat-meta-pill {
    min-height: 44px !important;
    padding: 8px 10px !important;
    border-radius: 15px !important;
    gap: 8px !important;
  }
  .chat-meta-pill .summary-label {
    font-size: 10px !important;
    margin-bottom: 2px !important;
  }
  .chat-meta-pill strong {
    font-size: 13px !important;
    line-height: 1.15 !important;
  }
  .pill-icon {
    width: 15px !important;
    height: 15px !important;
  }
}

/* Meta pill icon + text layout */
.pill-icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  opacity: 0.65;
}
.pill-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.chat-meta-pill {
  display: inline-flex !important;
  align-items: center !important;
  flex-direction: row !important;
  gap: 8px !important;
}

/* Mobile composer info card */
.wa-mobile-composer-info {
  display: none;
}
@media (max-width: 820px) {
  #humanComposer.disabled .wa-mobile-composer-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 20px 20px 16px;
    text-align: center;
  }
  #humanComposer.disabled .wa-composer-input-wrap {
    display: none;
  }
}
.wa-mci-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(6, 182, 212, 0.12);
  border: 1px solid rgba(6, 182, 212, 0.22);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
}
.wa-mci-icon svg { width: 30px; height: 30px; }
.wa-mci-body strong {
  display: block;
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
}
.wa-mci-body p {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.6;
  margin: 0;
}
.wa-mci-footer {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--muted);
  cursor: pointer;
  padding: 4px 0;
}
.wa-mci-toggle-visual {
  display: inline-block;
  width: 40px;
  height: 22px;
  border-radius: 999px;
  background: #3b4a54;
  position: relative;
  transition: background 0.2s;
  flex-shrink: 0;
}
.wa-mci-toggle-visual::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: white;
  transition: transform 0.2s;
}
.wa-mci-toggle-visual.on {
  background: var(--accent);
}
.wa-mci-toggle-visual.on::after {
  transform: translateX(18px);
}

/* === v10 nav consolidation === */

/* Always hide the old sidebar inset nav (replaced by inline nav) */
.wa-sidebar-inset-nav { display: none !important; }

/* Hide mobile top toggle — it's redundant (bottom card already has toggle) */
.mobile-only-toggle { display: none !important; }

/* Inline nav: always hidden — topbar handles navigation on desktop */
.wa-inline-nav { display: none !important; }
@media (min-width: 821px) {
  .wa-inline-nav {
    display: none !important;
  }
  .wa-inline-nav .icon-circle-link {
    width: 46px;
    height: 46px;
    border-radius: 14px;
  }
  .wa-inline-nav .icon-circle-link svg {
    width: 20px;
    height: 20px;
  }
  /* Chat header nav: centered column, same styling as settings ma-icon-topbar */
  .wa-chat-header-nav {
    margin-left: 0;
    padding-left: 0;
    border-left: none;
    gap: 12px;
    justify-content: center;
  }
  .wa-chat-header-nav .icon-circle-link {
    width: 50px;
    height: 50px;
    border-radius: 16px;
    background: linear-gradient(180deg, rgba(23, 33, 45, 0.94), rgba(12, 19, 29, 0.96));
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.28);
    color: var(--text);
    display: grid;
    place-items: center;
    transition: 0.2s ease;
    cursor: pointer;
    text-decoration: none;
    appearance: none;
    font: inherit;
  }
  .wa-chat-header-nav .icon-circle-link svg {
    width: 22px;
    height: 22px;
  }
  .wa-chat-header-nav .icon-circle-link.active {
    background: linear-gradient(180deg, rgba(6, 182, 212, 0.2), rgba(6, 182, 212, 0.09));
    border-color: rgba(6, 182, 212, 0.32);
    color: var(--accent);
    box-shadow: 0 4px 16px rgba(6, 182, 212, 0.18);
  }
  .wa-chat-header-nav .icon-circle-link:hover:not(.active) {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05));
    border-color: rgba(255, 255, 255, 0.18);
    transform: translateY(-1px);
  }
  /* Empty state nav: slightly larger, no divider */
  .wa-empty-nav {
    margin-left: 0;
    padding-left: 0;
    border-left: none;
    gap: 12px;
    margin-bottom: 24px;
  }
  .wa-empty-nav .icon-circle-link {
    width: 56px;
    height: 56px;
    border-radius: 18px;
  }
  .wa-empty-nav .icon-circle-link svg {
    width: 24px;
    height: 24px;
  }
}

/* Compact mobile Atención humana card */
.wa-mobile-composer-info {
  display: none;
}
@media (max-width: 820px) {
  #humanComposer.disabled .wa-mobile-composer-info {
    padding: 14px 16px 12px !important;
    gap: 8px !important;
    flex-direction: row !important;
    align-items: center !important;
    text-align: left !important;
  }
  .wa-mci-icon {
    width: 44px !important;
    height: 44px !important;
    flex-shrink: 0;
  }
  .wa-mci-icon svg { width: 22px !important; height: 22px !important; }
  .wa-mci-body {
    flex: 1;
    min-width: 0;
  }
  .wa-mci-body strong {
    font-size: 14px !important;
    margin-bottom: 2px !important;
  }
  .wa-mci-body p {
    font-size: 12px !important;
    line-height: 1.4 !important;
  }
  .wa-mci-footer {
    flex-direction: column !important;
    align-items: center !important;
    gap: 4px !important;
    flex-shrink: 0;
    font-size: 11px !important;
  }
  .wa-mci-toggle-visual {
    width: 32px !important;
    height: 18px !important;
  }
  .wa-mci-toggle-visual::after {
    width: 12px !important;
    height: 12px !important;
  }
  .wa-mci-toggle-visual.on::after {
    transform: translateX(14px) !important;
  }
}

/* === Universal background (matches login landing) === */
body,
body.ma-login-shell,
body.ma-panel-page,
body.inbox-body {
  background-color: #0b1120 !important;
  background-image:
    radial-gradient(ellipse 70% 80% at -18% 42%, rgba(100, 30, 210, 0.22) 0%, transparent 58%),
    radial-gradient(ellipse 65% 70% at 112% 82%, rgba(0, 80, 200, 0.18) 0%, transparent 58%) !important;
  background-attachment: fixed !important;
  background-repeat: no-repeat !important;
}

/* Make main containers semi-transparent so body blobs show through */
.ma-icon-topbar {
  background: rgba(7, 10, 20, 0.82) !important;
  backdrop-filter: blur(14px) !important;
}
@media (min-width: 821px) {
  .ma-icon-topbar,
  .wa-page-topbar {
    background: transparent !important;
    backdrop-filter: none !important;
    box-shadow: none !important;
    border: none !important;
  }
}
.ma-content-dark {
  background:
    radial-gradient(circle at top right, rgba(59, 130, 246, 0.06), transparent 28%),
    rgba(10, 15, 30, 0.72) !important;
}
/* Inbox: sidebar + chat area */
.wa-sidebar {
  background: rgba(13, 20, 33, 0.78) !important;
  backdrop-filter: blur(8px);
}
.wa-sidebar-header {
  background: rgba(13, 20, 33, 0.92) !important;
  backdrop-filter: blur(10px);
}
.wa-chat-messages {
  background: rgba(8, 12, 24, 0.60) !important;
}
.wa-chat-topbar,
.wa-chat-topbar.compact-topbar {
  background: rgba(10, 16, 32, 0.88) !important;
  backdrop-filter: blur(12px) !important;
}
.wa-composer {
  background: rgba(10, 16, 30, 0.90) !important;
  backdrop-filter: blur(10px);
}

/* === v11: filter top spacing + mobile viewport fix === */

/* Use dynamic viewport height so layout fits the visible area on mobile (excludes browser chrome) */
body.inbox-body {
  height: 100dvh !important;
}
.wa-page {
  height: 100dvh !important;
}

/* Give the search input top breathing room on mobile so it's not flush with the top edge */
@media (max-width: 820px) {
  .wa-search-wrap.compact {
    padding-top: 10px !important;
  }
}

/* Match calendar mobile nav sizing/spacing across inbox, settings, dashboard and users */
@media (max-width: 768px) {
  .ma-icon-topbar,
  .wa-page-topbar {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(44px, 1fr)) !important;
    align-items: stretch !important;
    justify-items: stretch !important;
    padding: 10px 12px !important;
    gap: 6px !important;
    min-height: auto !important;
    justify-content: stretch !important;
    flex-wrap: wrap !important;
    overflow-x: hidden !important;
    overflow-y: visible !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06) !important;
    scrollbar-width: none;
  }
  .ma-icon-topbar::-webkit-scrollbar,
  .wa-page-topbar::-webkit-scrollbar {
    display: none;
  }
  .ma-icon-topbar .icon-circle-link,
  .wa-page-topbar .icon-circle-link {
    width: 100% !important;
    height: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    aspect-ratio: 1 / 1 !important;
    border-radius: 16px !important;
    flex: none !important;
  }
  .ma-icon-topbar .icon-circle-link svg,
  .wa-page-topbar .icon-circle-link svg {
    width: 21px !important;
    height: 21px !important;
  }
  .ma-icon-topbar .icon-circle-link[href="/support"] svg,
  .ma-icon-topbar .icon-circle-link[href="/admin/support"] svg,
  .wa-page-topbar .icon-circle-link[href="/support"] svg,
  .wa-page-topbar .icon-circle-link[href="/admin/support"] svg {
    width: 24px !important;
    height: 24px !important;
    stroke-width: 2.05 !important;
  }
}

@media (max-width: 430px) {
  .ma-icon-topbar,
  .wa-page-topbar {
    grid-template-columns: repeat(auto-fit, minmax(40px, 1fr)) !important;
    padding: 10px !important;
    gap: 6px !important;
  }
  .ma-icon-topbar .icon-circle-link,
  .wa-page-topbar .icon-circle-link {
    border-radius: 15px !important;
  }
  .ma-icon-topbar .icon-circle-link svg,
  .wa-page-topbar .icon-circle-link svg {
    width: 20px !important;
    height: 20px !important;
  }
  .ma-icon-topbar .icon-circle-link[href="/support"] svg,
  .ma-icon-topbar .icon-circle-link[href="/admin/support"] svg,
  .wa-page-topbar .icon-circle-link[href="/support"] svg,
  .wa-page-topbar .icon-circle-link[href="/admin/support"] svg {
    width: 23px !important;
    height: 23px !important;
    stroke-width: 2.05 !important;
  }
  .biz-active-strip {
    top: 54px;
  }
}

@media (max-width: 360px) {
  .ma-icon-topbar,
  .wa-page-topbar {
    grid-template-columns: repeat(auto-fit, minmax(38px, 1fr)) !important;
    row-gap: 6px !important;
    column-gap: 5px !important;
    justify-content: stretch !important;
    padding: 10px !important;
  }
  .biz-active-strip {
    top: 92px;
  }
}

/* === User theme toggle + light theme for authenticated pages === */
.ma-theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 54px;
  min-width: 238px;
  padding: 9px 10px 9px 14px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(180deg, rgba(23, 33, 45, 0.94), rgba(12, 19, 29, 0.96));
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  transition: 0.18s ease;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.22);
}
.ma-theme-toggle:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 255, 255, 0.16);
}
.ma-theme-toggle-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  flex: 1;
  min-width: 0;
  gap: 2px;
}
.ma-theme-toggle-label {
  font-size: 15px;
  line-height: 1.1;
}
.ma-theme-toggle-state {
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
}
.ma-theme-switch {
  position: relative;
  width: 56px;
  height: 32px;
  border-radius: 999px;
  background: rgba(100, 116, 139, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
  transition: background 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}
.ma-theme-switch-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.96);
  color: #475569;
  font-size: 12px;
  line-height: 1;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.24);
  transition: transform 0.18s ease, color 0.18s ease, background 0.18s ease;
}
.ma-theme-toggle[aria-pressed="true"] .ma-theme-switch {
  background: linear-gradient(90deg, rgba(6, 182, 212, 0.84), rgba(59, 130, 246, 0.92));
  border-color: rgba(6, 182, 212, 0.3);
  box-shadow: 0 10px 22px rgba(6, 182, 212, 0.2);
}
.ma-theme-toggle[aria-pressed="true"] .ma-theme-switch-thumb {
  transform: translateX(24px);
  color: #0891b2;
}

html[data-ui-theme="light"] body {
  color: var(--text);
  background:
    radial-gradient(circle at top, rgba(59, 130, 246, 0.08), transparent 22%),
    radial-gradient(circle at 78% 14%, rgba(6, 182, 212, 0.08), transparent 16%),
    #edf4fb;
}
html[data-ui-theme="light"] body.inbox-body,
html[data-ui-theme="light"] body.ma-panel-page {
  background:
    radial-gradient(circle at top left, rgba(56, 189, 248, 0.12), transparent 24%),
    radial-gradient(circle at bottom left, rgba(168, 85, 247, 0.1), transparent 24%),
    linear-gradient(180deg, #f8fbff 0%, #eef4fb 100%) !important;
}
html[data-ui-theme="light"] body.inbox-body::before {
  background:
    radial-gradient(ellipse 58% 48% at 10% 18%, rgba(6, 182, 212, 0.08) 0%, transparent 60%),
    radial-gradient(ellipse 50% 40% at 92% 82%, rgba(99, 102, 241, 0.08) 0%, transparent 60%);
}
html[data-ui-theme="light"] .logo-sidecard,
html[data-ui-theme="light"] .login-card-centered,
html[data-ui-theme="light"] .ma-surface,
html[data-ui-theme="light"] .ma-account-card,
html[data-ui-theme="light"] .ma-login-helper,
html[data-ui-theme="light"] .ma-login-form-card,
html[data-ui-theme="light"] .wa-chat-topbar,
html[data-ui-theme="light"] .summary-panel,
html[data-ui-theme="light"] .wa-composer,
html[data-ui-theme="light"] .ma-mini-account,
html[data-ui-theme="light"] .ma-tag,
html[data-ui-theme="light"] .ma-soft-pill,
html[data-ui-theme="light"] .icon-circle-link,
html[data-ui-theme="light"] .chat-meta-pill,
html[data-ui-theme="light"] .toggle-wrap,
html[data-ui-theme="light"] .semaphore-filter,
html[data-ui-theme="light"] .read-filter,
html[data-ui-theme="light"] .ma-theme-toggle {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.97), rgba(241, 245, 249, 0.98)) !important;
  border-color: rgba(148, 163, 184, 0.24) !important;
  box-shadow: 0 14px 36px rgba(15, 23, 42, 0.08) !important;
  color: var(--text);
}
html[data-ui-theme="light"] .ma-page-header h1,
html[data-ui-theme="light"] .ma-surface-head h2,
html[data-ui-theme="light"] .ma-surface-hero h2,
html[data-ui-theme="light"] .ma-account-main strong {
  color: #0f172a !important;
}
html[data-ui-theme="light"] .ma-page-header p:last-child,
html[data-ui-theme="light"] .ma-surface-head p,
html[data-ui-theme="light"] .ma-surface-hero p,
html[data-ui-theme="light"] .ma-account-main p,
html[data-ui-theme="light"] .ma-account-meta small,
html[data-ui-theme="light"] .ma-field span,
html[data-ui-theme="light"] .ma-hero-points span {
  color: #475569 !important;
}
html[data-ui-theme="light"] .ma-theme-switch {
  background: rgba(148, 163, 184, 0.26);
  border-color: rgba(148, 163, 184, 0.34);
}
html[data-ui-theme="light"] .ma-theme-switch-thumb {
  background: #ffffff;
  color: #0891b2;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.14);
}
html[data-ui-theme="light"] .ma-theme-toggle[aria-pressed="true"] .ma-theme-switch {
  background: linear-gradient(90deg, #0ea5e9, #2563eb);
  border-color: rgba(37, 99, 235, 0.24);
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.18);
}
html[data-ui-theme="light"] .icon-circle-link.active {
  background: linear-gradient(180deg, rgba(6, 182, 212, 0.16), rgba(6, 182, 212, 0.08)) !important;
  border-color: rgba(8, 145, 178, 0.28) !important;
  color: var(--accent) !important;
  box-shadow: 0 12px 28px rgba(6, 182, 212, 0.14) !important;
}
html[data-ui-theme="light"] .ma-icon-topbar,
html[data-ui-theme="light"] .wa-page-topbar {
  background: rgba(255, 255, 255, 0.78) !important;
  border-color: rgba(148, 163, 184, 0.16) !important;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.08) !important;
  backdrop-filter: blur(16px) !important;
}
@media (min-width: 821px) {
  html[data-ui-theme="light"] .ma-icon-topbar,
  html[data-ui-theme="light"] .wa-page-topbar {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
  }
}
html[data-ui-theme="light"] .ma-icon-topbar .icon-circle-link,
html[data-ui-theme="light"] .wa-page-topbar .icon-circle-link {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(241, 245, 249, 0.98)) !important;
  border-color: rgba(148, 163, 184, 0.24) !important;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.08) !important;
  color: #172033 !important;
}
html[data-ui-theme="light"] .ma-icon-topbar .icon-circle-link:hover:not(.active),
html[data-ui-theme="light"] .wa-page-topbar .icon-circle-link:hover:not(.active) {
  background: linear-gradient(180deg, rgba(255, 255, 255, 1), rgba(236, 242, 249, 0.98)) !important;
  border-color: rgba(14, 165, 233, 0.22) !important;
  box-shadow: 0 14px 30px rgba(14, 165, 233, 0.1) !important;
}
html[data-ui-theme="light"] .wa-sidebar {
  background: linear-gradient(180deg, #f9fbff 0%, #eef4fb 100%) !important;
  border-right-color: var(--border) !important;
}
html[data-ui-theme="light"] .wa-sidebar-header {
  background:
    radial-gradient(circle at top left, rgba(56, 189, 248, 0.07), transparent 26%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(243, 248, 255, 0.97)) !important;
  border-bottom: 1px solid rgba(148, 163, 184, 0.14);
}
html[data-ui-theme="light"] .wa-main {
  background: linear-gradient(180deg, rgba(248, 251, 255, 0.85), rgba(239, 244, 251, 0.96)) !important;
}
html[data-ui-theme="light"] .wa-page,
html[data-ui-theme="light"] .wa-page > .wa-layout,
html[data-ui-theme="light"] .wa-chat-panel {
  background: transparent !important;
}
html[data-ui-theme="light"] .wa-main-sticky,
html[data-ui-theme="light"] .wa-main-sticky.no-banner {
  background:
    radial-gradient(circle at top right, rgba(56, 189, 248, 0.05), transparent 28%),
    linear-gradient(180deg, rgba(248, 251, 255, 0.98), rgba(240, 245, 252, 0.96)) !important;
}
html[data-ui-theme="light"] .wa-chat-messages {
  background: rgba(255, 255, 255, 0.55) !important;
}
html[data-ui-theme="light"] .wa-bubble {
  color: #0f172a !important;
  border: 1px solid rgba(148, 163, 184, 0.2);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}
html[data-ui-theme="light"] .wa-bubble.assistant {
  border-color: rgba(148, 163, 184, 0.2);
}
html[data-ui-theme="light"] .wa-bubble.user {
  color: #065f46 !important;
  border-color: rgba(16, 185, 129, 0.24);
}
html[data-ui-theme="light"] .wa-bubble.human {
  color: #1e3a8a !important;
  border-color: rgba(59, 130, 246, 0.22);
}
html[data-ui-theme="light"] .wa-message-timestamp {
  color: #64748b !important;
}
html[data-ui-theme="light"] .human-badge {
  background: rgba(37, 99, 235, 0.08);
  color: #1d4ed8;
  border: 1px solid rgba(37, 99, 235, 0.16);
}
html[data-ui-theme="light"] .ma-content-dark,
html[data-ui-theme="light"] .wa-page .wa-chat-messages,
html[data-ui-theme="light"] .wa-chat-topbar.compact-topbar {
  background:
    radial-gradient(circle at top right, rgba(56, 189, 248, 0.06), transparent 26%),
    rgba(255, 255, 255, 0.62) !important;
}
html[data-ui-theme="light"] .wa-chat-topbar,
html[data-ui-theme="light"] .wa-chat-topbar.compact-topbar {
  background:
    radial-gradient(circle at top right, rgba(56, 189, 248, 0.08), transparent 28%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.97), rgba(244, 248, 255, 0.96)) !important;
  border: 1px solid rgba(148, 163, 184, 0.22) !important;
  border-bottom-color: rgba(148, 163, 184, 0.18) !important;
  box-shadow:
    0 18px 42px rgba(15, 23, 42, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.88) !important;
}
html[data-ui-theme="light"] .wa-chat-topbar h2,
html[data-ui-theme="light"] #chatHeaderName {
  color: #0f172a !important;
}
html[data-ui-theme="light"] .wa-chat-topbar p,
html[data-ui-theme="light"] #chatHeaderPhone,
html[data-ui-theme="light"] .header-ia-toggle,
html[data-ui-theme="light"] .chat-meta-pill .summary-label {
  color: #64748b !important;
}
html[data-ui-theme="light"] .wa-chat-topbar .chat-meta-pill {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(247, 250, 255, 0.98)) !important;
  border-color: rgba(148, 163, 184, 0.22) !important;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06) !important;
}
html[data-ui-theme="light"] .wa-chat-topbar .chat-meta-pill strong {
  color: #0f172a !important;
}
html[data-ui-theme="light"] .wa-chat-topbar .toggle-wrap {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(245, 248, 255, 0.96)) !important;
  border-color: rgba(148, 163, 184, 0.22) !important;
  color: #0f172a !important;
}
html[data-ui-theme="light"] .wa-chat-topbar .toggle-wrap input {
  background: rgba(8, 145, 178, 0.22);
}
html[data-ui-theme="light"] .wa-chat-topbar .toggle-wrap input:not(:checked) {
  background: rgba(148, 163, 184, 0.34);
}
html[data-ui-theme="light"] input.wa-search,
html[data-ui-theme="light"] .ma-search-users input,
html[data-ui-theme="light"] .ma-field input,
html[data-ui-theme="light"] .ma-field textarea,
html[data-ui-theme="light"] .composer-row input,
html[data-ui-theme="light"] .ma-modal,
html[data-ui-theme="light"] .summary-close-btn {
  color: var(--text);
}
html[data-ui-theme="light"] input.wa-search,
html[data-ui-theme="light"] .ma-search-users input,
html[data-ui-theme="light"] .ma-field input,
html[data-ui-theme="light"] .ma-field textarea,
html[data-ui-theme="light"] .composer-row input,
html[data-ui-theme="light"] .ma-field select {
  background: #f8fbff !important;
  border-color: rgba(148, 163, 184, 0.28) !important;
  color: var(--text) !important;
}
html[data-ui-theme="light"] .wa-chat-list .wa-chat-item.active,
html[data-ui-theme="light"] .wa-chat-list .wa-chat-item:hover {
  background: rgba(8, 145, 178, 0.08) !important;
}
html[data-ui-theme="light"] .wa-chat-delete-btn {
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.18);
  color: #dc2626;
}
html[data-ui-theme="light"] .wa-chat-edit-btn {
  background: rgba(255, 255, 255, 0.88);
  border-color: rgba(148, 163, 184, 0.22);
  color: #64748b;
}
html[data-ui-theme="light"] .wa-chat-edit-btn:hover {
  background: rgba(255, 255, 255, 0.98);
  border-color: rgba(8, 145, 178, 0.24);
  color: #0f172a;
}
html[data-ui-theme="light"] .wa-chat-delete-btn:hover {
  background: rgba(239, 68, 68, 0.14);
  border-color: rgba(239, 68, 68, 0.24);
  color: #b91c1c;
}
html[data-ui-theme="light"] .wa-chat-item.unread strong,
html[data-ui-theme="light"] .wa-chat-item.unread .wa-chat-item-meta,
html[data-ui-theme="light"] .wa-chat-item.unread .wa-status-label,
html[data-ui-theme="light"] .wa-chat-item.unread .wa-chat-item-preview,
html[data-ui-theme="light"] .wa-chat-item-preview.preview-unread {
  color: #0f172a !important;
}
html[data-ui-theme="light"] .read-badge {
  background: rgba(148, 163, 184, 0.12);
  color: #475569;
}
html[data-ui-theme="light"] .ai-state.ai-on {
  color: #0891b2;
  background: rgba(8, 145, 178, 0.1);
  border-color: rgba(8, 145, 178, 0.2);
}
html[data-ui-theme="light"] .ai-state.ai-off {
  color: #64748b;
  background: rgba(148, 163, 184, 0.12);
  border-color: rgba(148, 163, 184, 0.2);
}
html[data-ui-theme="light"] .u-btn-primary,
html[data-ui-theme="light"] .u-btn-secondary,
html[data-ui-theme="light"] .u-btn-ghost {
  border-color: rgba(148, 163, 184, 0.28);
  color: var(--text);
}
html[data-ui-theme="light"] .u-btn-danger {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.34);
  color: #b91c1c !important;
}
html[data-ui-theme="light"] .u-btn-danger:hover {
  background: rgba(239, 68, 68, 0.16);
  border-color: rgba(239, 68, 68, 0.4);
  color: #991b1b !important;
}
html[data-ui-theme="light"] .ma-alert-success {
  background: rgba(34, 197, 94, 0.12);
  color: #166534;
}
html[data-ui-theme="light"] .ma-alert-error {
  background: rgba(239, 68, 68, 0.12);
  color: #991b1b;
}
html[data-ui-theme="light"] .ma-alert-warning {
  background: rgba(245, 158, 11, 0.14);
  color: #92400e;
}
html[data-ui-theme="light"] .ma-modal {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(241, 245, 249, 0.98));
  border-color: rgba(148, 163, 184, 0.24);
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.16);
}
html[data-ui-theme="light"] .ma-modal-input {
  background: #f8fbff;
  border-color: rgba(148, 163, 184, 0.28);
  color: #0f172a;
}
html[data-ui-theme="light"] .summary-close-btn,
html[data-ui-theme="light"] .wa-mobile-back {
  background: rgba(255, 255, 255, 0.8);
  border-color: rgba(148, 163, 184, 0.24);
  color: var(--text);
}

@media (max-width: 820px) {
  .ma-theme-toggle {
    min-width: 100%;
  }
}

/* ──────────────────────────────────────────────────────────
   Business Switcher Button  (biz-sw-trigger)
   ────────────────────────────────────────────────────────── */
.biz-sw-trigger {
  width: 44px !important;
  min-width: 44px;
  height: 44px;
  max-width: 44px;
  padding: 0 !important;
  border-radius: 14px !important;
  gap: 0;
  flex-direction: column !important;
  justify-content: center;
  align-items: center;
  border: 1px solid rgba(24, 200, 242, 0.28) !important;
  background: rgba(24, 200, 242, 0.07) !important;
  color: inherit;
}
.biz-sw-trigger svg {
  width: 19px;
  height: 19px;
  flex-shrink: 0;
}
.biz-sw-trigger:hover {
  border-color: rgba(24, 200, 242, 0.5) !important;
  background: rgba(24, 200, 242, 0.12) !important;
}
html[data-ui-theme="light"] .biz-sw-trigger {
  border-color: rgba(14, 165, 233, 0.3) !important;
  background: rgba(14, 165, 233, 0.08) !important;
}
html[data-ui-theme="light"] .biz-sw-trigger:hover {
  border-color: rgba(14, 165, 233, 0.55) !important;
  background: rgba(14, 165, 233, 0.14) !important;
}
.biz-sw-name {
  display: none !important;
}
.biz-active-strip {
  position: fixed;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 960;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  max-width: min(680px, calc(100vw - 140px));
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid rgba(24, 200, 242, 0.16);
  background: rgba(12, 18, 31, 0.76);
  backdrop-filter: blur(14px);
  box-shadow: 0 14px 40px rgba(2, 8, 23, 0.28);
  color: #d9e8f8;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.03em;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}
html[data-ui-theme="light"] .biz-active-strip {
  border-color: rgba(14, 165, 233, 0.2);
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 14px 34px rgba(37, 99, 235, 0.12);
  color: #17304f;
}
@media (min-width: 821px) {
  .biz-active-strip {
    /* Pinned to the far-LEFT screen edge (its own thin column, hosted on <body>), so the
       business name never overlaps the chat list on the right and never clips off-screen. */
    position: fixed;
    top: 50%;
    left: 3px;
    right: auto;
    transform: translateY(-50%);
    width: 22px;
    min-width: 22px;
    max-width: 22px;
    min-height: 150px;
    max-height: 250px;
    padding: 16px 0;
    border-radius: 999px;
    white-space: normal;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    text-align: center;
    line-height: 1.12;
    letter-spacing: 0.08em;
    font-size: 11px;
  }
}
@media (max-width: 820px) {
  .biz-active-strip {
    display: none !important;
  }
}

/* ──────────────────────────────────────────────────────────
   Business / Company Switcher Panel  (biz-switcher.js)
   ────────────────────────────────────────────────────────── */
.biz-sw-panel {
  position: fixed;
  z-index: 9999;
  width: 264px;
  border-radius: 18px;
  padding: 14px;
  font-family: var(--font-sans);
  background: #0d1220;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #e7edf7;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.52);
}
html[data-ui-theme="light"] .biz-sw-panel {
  background: #fff;
  border-color: rgba(37, 99, 235, 0.14);
  color: #10203c;
  box-shadow: 0 24px 64px rgba(37, 99, 235, 0.18);
}
.biz-sw-title {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #6b7890;
  padding-bottom: 10px;
  margin-bottom: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}
html[data-ui-theme="light"] .biz-sw-title {
  color: #7b8ca5;
  border-bottom-color: rgba(37, 99, 235, 0.1);
}
.biz-sw-co-group { margin-bottom: 10px; }
.biz-sw-co-label {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #6b7890;
  padding: 0 4px 5px;
}
html[data-ui-theme="light"] .biz-sw-co-label { color: #7b8ca5; }
.biz-sw-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 9px 10px;
  border-radius: 10px;
  border: none;
  background: transparent;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: #e7edf7;
  text-align: left;
  transition: background 0.14s;
}
html[data-ui-theme="light"] .biz-sw-item { color: #10203c; }
.biz-sw-item:hover { background: rgba(255, 255, 255, 0.06); }
html[data-ui-theme="light"] .biz-sw-item:hover { background: rgba(37, 99, 235, 0.06); }
.biz-sw-item-active { color: #18c8f2; background: rgba(24, 200, 242, 0.09); }
html[data-ui-theme="light"] .biz-sw-item-active { color: #0ea5e9; background: rgba(14, 165, 233, 0.09); }
.biz-sw-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.14);
}
html[data-ui-theme="light"] .biz-sw-dot { background: rgba(37, 99, 235, 0.18); }
.biz-sw-dot-active { background: #18c8f2; }
html[data-ui-theme="light"] .biz-sw-dot-active { background: #0ea5e9; }
.biz-sw-item-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.biz-sw-check { margin-left: auto; font-size: 11px; color: #18c8f2; flex-shrink: 0; }
html[data-ui-theme="light"] .biz-sw-check { color: #0ea5e9; }
.biz-sw-all-link {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #18c8f2;
  text-decoration: none;
  padding: 10px 4px 2px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  margin-top: 6px;
  transition: opacity 0.14s;
}
html[data-ui-theme="light"] .biz-sw-all-link { color: #0ea5e9; border-top-color: rgba(37, 99, 235, 0.1); }
.biz-sw-all-link:hover { opacity: 0.74; }
.biz-sw-loading, .biz-sw-empty, .biz-sw-no-biz {
  font-size: 12px;
  color: #6b7890;
  padding: 12px 4px;
  text-align: center;
  line-height: 1.6;
}
.biz-sw-create-link { color: #18c8f2; }
html[data-ui-theme="light"] .biz-sw-loading,
html[data-ui-theme="light"] .biz-sw-empty,
html[data-ui-theme="light"] .biz-sw-no-biz { color: #7b8ca5; }
html[data-ui-theme="light"] .biz-sw-create-link { color: #0ea5e9; }

/* ── Dashboard empty-state logo: theme-aware ──────────────────────────────── */
/* Dark mode (default): show dark logo, hide light logo */
.ma-logo-dark  { display: block; }
.ma-logo-light { display: none;  }

/* Light mode: swap logos */
html[data-ui-theme="light"] .ma-logo-dark  { display: none;  }
html[data-ui-theme="light"] .ma-logo-light { display: block; }

/* ============================================================
   WhatsApp-style composer: auto-expanding textarea + attachments
   ============================================================ */
.composer-row textarea#humanReplyInput {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.1);
  outline: none;
  background: var(--bg-input);
  color: var(--text);
  border-radius: 14px;
  font-size: 15px;
  font-family: inherit;
  line-height: 1.4;
  resize: none;
  overflow-y: auto;
  max-height: 160px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.composer-row textarea#humanReplyInput::placeholder { color: var(--muted); }
.composer-row textarea#humanReplyInput:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(6, 182, 212, 0.1);
}
.composer-row textarea#humanReplyInput:disabled { opacity: 0.6; cursor: not-allowed; }
@media (max-width: 820px) {
  .composer-row textarea#humanReplyInput { font-size: 16px; }
}

/* The hidden file input must never render: the `.composer-row input` rules
   (which set display:block) otherwise override its [hidden] attribute and add it
   as a stray grid cell, pushing the send button to a second row. */
.composer-row input[type="file"] { display: none !important; }

.composer-attach-btn {
  align-self: end;
  width: 48px;
  height: 48px;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: var(--bg-input);
  color: var(--muted);
  border-radius: 14px;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.composer-attach-btn svg { width: 22px; height: 22px; }
.composer-attach-btn:hover:not(:disabled) { color: var(--accent); border-color: var(--accent); }
.composer-attach-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ============================================================
   "Dar seguimiento" follow-up marker
   ============================================================ */
.followup-toggle-btn.active {
  background: rgba(245, 158, 11, 0.16);
  border-color: var(--warning, #f59e0b);
  color: var(--warning, #f59e0b);
}
.followup-toggle-btn.active .summary-btn-icon { stroke: var(--warning, #f59e0b); }

/* "Marcar atendido" — return an escalated chat to green/normal */
.attention-reset-btn {
  background: color-mix(in srgb, var(--success, #22c55e) 14%, transparent);
  border-color: color-mix(in srgb, var(--success, #22c55e) 55%, transparent);
  color: var(--success, #22c55e);
}
.attention-reset-btn .summary-btn-icon { stroke: var(--success, #22c55e); }
.attention-reset-btn:hover { background: color-mix(in srgb, var(--success, #22c55e) 22%, transparent); }

.followup-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10.5px;
  font-weight: 700;
  line-height: 1;
  padding: 3px 7px;
  border-radius: 999px;
  background: rgba(245, 158, 11, 0.16);
  color: var(--warning, #f59e0b);
  white-space: nowrap;
}
.followup-badge svg { width: 11px; height: 11px; }

.wa-chat-item.followup {
  border-left: 3px solid var(--warning, #f59e0b);
}

/* ============================================================
   Inline media in chat bubbles (image / audio / video / document)
   ============================================================ */
.wa-media { margin-bottom: 2px; }
.wa-bubble-text { white-space: pre-wrap; word-break: break-word; }
.wa-bubble-text + .wa-message-timestamp,
.wa-media + .wa-message-timestamp { margin-top: 4px; }
.wa-bubble-link { color: #53bdeb; text-decoration: underline; word-break: break-all; }

.wa-media-image {
  max-width: 260px;
  max-height: 320px;
  width: auto;
  border-radius: 10px;
  cursor: pointer;
  display: block;
}
.wa-media-video {
  max-width: 280px;
  max-height: 340px;
  border-radius: 10px;
  display: block;
}
.wa-media-audio {
  width: 240px;
  max-width: 100%;
  height: 40px;
}
.wa-media-doc {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
}
.wa-media-doc svg { width: 20px; height: 20px; flex: 0 0 auto; }
.wa-media-doc:hover { background: rgba(255, 255, 255, 0.16); }

html[data-ui-theme="light"] .composer-row textarea#humanReplyInput,
html[data-ui-theme="light"] .composer-attach-btn {
  border-color: rgba(0, 0, 0, 0.12);
}
html[data-ui-theme="light"] .wa-media-doc { background: rgba(0, 0, 0, 0.06); color: #1f2933; }
html[data-ui-theme="light"] .wa-bubble-link { color: #1d6fb8; }

/* ============================================================================
   UI polish & accessibility — additive global layer
   Low specificity (:where) so existing component styles always win; uses CSS
   variables so everything adapts to both the dark and light themes.
   ============================================================================ */

/* Honest color-scheme so native controls (scrollbars, pickers) match the theme */
html[data-ui-theme="light"] { color-scheme: light; }

/* Crisper text rendering */
body { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility; }

/* On-brand text selection */
::selection { background: color-mix(in srgb, var(--accent, #06b6d4) 35%, transparent); }

/* Consistent muted placeholders */
:where(input, textarea)::placeholder { color: var(--muted, #8696a0); opacity: 0.85; }

/* Visible keyboard focus everywhere — mouse clicks stay clean via :focus-visible */
:where(a, button, input, select, textarea, [tabindex], [role="button"]):focus-visible {
  outline: 2px solid var(--accent, #06b6d4);
  outline-offset: 2px;
}
/* Subtle elevation when a text field gains keyboard focus */
:where(input, textarea, select):focus-visible {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent, #06b6d4) 25%, transparent);
}

/* Clear affordance for disabled / busy controls */
:where(button, input, select, textarea, a)[disabled],
:where(button, input, select, textarea):disabled,
[aria-disabled="true"] { cursor: not-allowed; opacity: 0.6; }
[aria-busy="true"] { cursor: progress; }

/* Polished, short transitions on interactive controls (specific props only) */
:where(a, button, .btn, input, select, textarea, [role="button"]) {
  transition: background-color .15s ease, border-color .15s ease, color .15s ease,
              box-shadow .15s ease, transform .12s ease, opacity .15s ease;
}

/* Touch-friendly tap targets on touch devices */
@media (pointer: coarse) {
  :where(button, .btn, [role="button"]) { min-height: 44px; }
}

/* Smooth in-page scrolling + offset so anchored sections aren't hidden */
html { scroll-behavior: smooth; }
:where([id]) { scroll-margin-top: 16px; }

/* Tidier headings — balanced wrapping, never overflow */
:where(h1, h2, h3, h4) { text-wrap: balance; overflow-wrap: break-word; }

/* Reusable loading spinner (opt-in via .is-loading; e.g. on submit buttons) */
.is-loading { position: relative; color: transparent !important; pointer-events: none; }
.is-loading::after {
  content: ""; position: absolute; inset: 0; margin: auto;
  width: 1.1em; height: 1.1em; border-radius: 50%;
  border: 2px solid color-mix(in srgb, currentColor 30%, transparent);
  border-top-color: var(--accent, #06b6d4);
  animation: ma-spin .6s linear infinite;
}
@keyframes ma-spin { to { transform: rotate(360deg); } }

/* Inbox: conversation-loading placeholder (shown while messages are fetched) */
.wa-loading-msgs {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  height: 100%; min-height: 140px;
  color: var(--muted, #8696a0); font-size: 14px;
}
.wa-loading-msgs::before {
  content: ""; width: 16px; height: 16px; border-radius: 50%; flex: 0 0 auto;
  border: 2px solid color-mix(in srgb, currentColor 30%, transparent);
  border-top-color: var(--accent, #06b6d4);
  animation: ma-spin .6s linear infinite;
}

.wa-loading-msgs.error::before {
  display: none;
}

/* App/page skeletons for navigation and conversation changes */

@keyframes ma-skeleton-shimmer {
  0% { background-position: 160% 0; }
  100% { background-position: -60% 0; }
}

.ma-skeleton-block,
.ma-page-skeleton-line,
.ma-page-skeleton-card,
.ma-page-skeleton-row,
.wa-message-skeleton-bubble,
.wa-message-skeleton-avatar,
.wa-message-skeleton-line,
.wa-message-skeleton-chip {
  background: linear-gradient(90deg, var(--skeleton-base) 0%, var(--skeleton-sheen) 42%, var(--skeleton-base) 76%);
  background-size: 220% 100%;
  animation: ma-skeleton-shimmer 1.15s ease-in-out infinite;
}

.ma-page-is-loading {
  cursor: progress;
}

.ma-page-skeleton {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: grid;
  place-items: stretch;
  padding: 18px;
  background: color-mix(in srgb, var(--bg, #0b1120) 66%, transparent);
  backdrop-filter: blur(12px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.16s ease;
}

.ma-page-skeleton.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.ma-page-skeleton-shell {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  gap: 22px;
  width: min(1180px, 100%);
  margin: 0 auto;
  border: 1px solid color-mix(in srgb, var(--border, rgba(255,255,255,.16)) 72%, transparent);
  border-radius: 24px;
  background: color-mix(in srgb, var(--surface, #111827) 82%, transparent);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.24);
  overflow: hidden;
}

.ma-page-skeleton-rail {
  display: grid;
  align-content: start;
  justify-items: center;
  gap: 16px;
  padding: 22px 12px;
  border-right: 1px solid color-mix(in srgb, var(--border, rgba(255,255,255,.16)) 60%, transparent);
}

.ma-page-skeleton-rail span {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  background: var(--skeleton-base);
}

.ma-page-skeleton-main {
  display: grid;
  align-content: start;
  gap: 18px;
  padding: 28px;
}

.ma-page-skeleton-line {
  height: 14px;
  width: min(420px, 64%);
  border-radius: 999px;
}

.ma-page-skeleton-line.short { width: 140px; }
.ma-page-skeleton-line.medium { width: min(560px, 78%); }
.ma-page-skeleton-line.title {
  height: 34px;
  width: min(520px, 82%);
}

.ma-page-skeleton-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.ma-page-skeleton-card {
  height: 78px;
  border-radius: 18px;
}

.ma-page-skeleton-panel {
  display: grid;
  gap: 14px;
  min-height: 360px;
  padding: 22px;
  border-radius: 22px;
  border: 1px solid color-mix(in srgb, var(--border, rgba(255,255,255,.16)) 58%, transparent);
  background: color-mix(in srgb, var(--surface-2, #17212b) 72%, transparent);
}

.ma-page-skeleton-row {
  height: 72px;
  width: 72%;
  border-radius: 18px;
}

.ma-page-skeleton-row.wide {
  width: 92%;
}

body.inbox-body .wa-chat-messages.is-message-loading {
  overflow: hidden;
}

.wa-message-skeleton {
  display: grid;
  gap: 18px;
  min-height: 100%;
  padding: 24px clamp(18px, 4vw, 42px);
}

.wa-message-skeleton-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

.wa-message-skeleton-row.user {
  justify-content: flex-end;
}

.wa-message-skeleton-avatar {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  border-radius: 999px;
}

.wa-message-skeleton-bubble {
  width: min(520px, 72%);
  min-height: 88px;
  border-radius: 18px;
  padding: 14px;
}

.wa-message-skeleton-row.user .wa-message-skeleton-bubble {
  width: min(420px, 68%);
}

.wa-message-skeleton-line {
  height: 12px;
  border-radius: 999px;
  margin-bottom: 10px;
}

.wa-message-skeleton-line.short { width: 42%; }
.wa-message-skeleton-line.medium { width: 66%; }
.wa-message-skeleton-line.long { width: 88%; }

.wa-message-skeleton-chip {
  width: 72px;
  height: 10px;
  border-radius: 999px;
  margin-top: 14px;
  opacity: 0.72;
}

@media (max-width: 820px) {
  .ma-page-skeleton {
    padding: 10px;
  }

  .ma-page-skeleton-shell {
    grid-template-columns: 1fr;
    gap: 0;
    border-radius: 20px;
  }

  .ma-page-skeleton-rail {
    grid-auto-flow: column;
    grid-auto-columns: 48px;
    align-content: center;
    justify-content: start;
    overflow: hidden;
    padding: 14px;
    border-right: 0;
    border-bottom: 1px solid color-mix(in srgb, var(--border, rgba(255,255,255,.16)) 60%, transparent);
  }

  .ma-page-skeleton-main {
    padding: 20px 18px;
  }

  .ma-page-skeleton-grid {
    grid-template-columns: 1fr;
  }

  .ma-page-skeleton-card {
    height: 56px;
  }

  .ma-page-skeleton-panel {
    min-height: 420px;
    padding: 18px;
  }

  .wa-message-skeleton {
    padding: 18px 16px;
  }

  .wa-message-skeleton-bubble {
    width: 82%;
  }
}

/* Respect users who prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

/* ── WhatsApp 24h window: inbox filter, badges, composer notice & divider ── */
.wa-window-filters { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.window-filter {
  border: 1px solid var(--border); background: transparent; color: var(--muted);
  border-radius: 999px; padding: 5px 12px; font-size: 12px; font-weight: 600;
  cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
}
.window-filter.active { background: var(--accent, #06b6d4); border-color: var(--accent, #06b6d4); color: #fff; }
.window-filter .win-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green, #22c55e); }
.window-filter.active .win-dot { background: #fff; }
.window-info { color: var(--muted); font-size: 15px; cursor: help; user-select: none; line-height: 1; }
.window-badge {
  display: inline-flex; align-items: center; gap: 3px; font-size: 10px; font-weight: 700;
  color: var(--warning, #f59e0b);
  background: color-mix(in srgb, var(--warning, #f59e0b) 15%, transparent);
  border-radius: 6px; padding: 1px 6px;
}
.window-badge svg { width: 11px; height: 11px; }
.wa-window-notice {
  margin: 0 14px 8px; padding: 9px 12px; border-radius: 10px; font-size: 12.5px;
  color: var(--warning, #f59e0b);
  background: color-mix(in srgb, var(--warning, #f59e0b) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--warning, #f59e0b) 30%, transparent);
}
.wa-window-divider {
  display: flex; align-items: center; text-align: center; gap: 12px;
  margin: 18px 10px 8px; color: var(--warning, #f59e0b);
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
}
.wa-window-divider::before, .wa-window-divider::after {
  content: ""; flex: 1; height: 1px;
  background: color-mix(in srgb, var(--warning, #f59e0b) 45%, transparent);
}
.wa-composer.window-closed { opacity: .9; }

/* Prompt-insights banner (floats above the inbox when a proposal is ready) */
.pi-banner {
  position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%);
  z-index: 60; max-width: calc(100vw - 24px);
  background: var(--accent-gradient, linear-gradient(135deg, #06b6d4, #3b82f6));
  color: #fff; text-decoration: none; font-size: 13.5px; font-weight: 700;
  padding: 11px 18px; border-radius: 999px; box-shadow: 0 8px 24px rgba(0, 0, 0, .3);
}
.pi-banner:hover { filter: brightness(1.06); }
@media (max-width: 600px) {
  .pi-banner { font-size: 12.5px; bottom: 12px; padding: 10px 14px; }
}

/* ── Responsive & mobile baseline (app-wide, additive, low specificity) ── */
/* Stop iOS from auto-inflating text; kill the grey tap-flash on touch. */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
* { -webkit-tap-highlight-color: transparent; }
/* Media never overflows its container (low specificity: explicit sizes still win). */
:where(img, video, canvas) { max-width: 100%; }
/* Phones: 16px form fields prevent iOS Safari from zooming in on focus. */
@media (max-width: 480px) {
  :where(input, textarea, select) { font-size: 16px; }
}
/* Tablets & Samsung Fold (open ≈ 768–900px CSS px, near-square): keep generous
   tap targets and let long content wrap instead of forcing horizontal scroll. */
@media (min-width: 600px) and (max-width: 1024px) {
  :where(button, .btn, [role="button"]) { min-height: 44px; }
  :where(pre, code, table) { max-width: 100%; overflow-x: auto; }
}
/* Phones in landscape (short viewport): trim large fixed vertical gaps. */
@media (orientation: landscape) and (max-height: 480px) {
  :where(.ma-modal-overlay) { align-items: flex-start; }
}

/* ============================================================================
   Unified button system — make action-button families share one look.
   Canonical spec now lives in components.css as .u-btn-*.
   This compatibility layer harmonizes the older .btn-*, .plan-*, .lp-*,
   .pi-*, auth and reset buttons without editing each page. Specialized shape controls
   (segments, filters, icon/nav/slot buttons) are intentionally excluded.
   ============================================================================ */
.u-btn, .u-btn-primary, .u-btn-secondary, .u-btn-ghost, .u-btn-danger,
.btn-primary, .btn-secondary, .btn-ghost, .btn-danger, .btn-small, .btn-sm,
.plan-btn, .plan-cta, .plan-btn-primary, .plan-btn-outline, .plan-btn-ghost,
.plans-btn, .plans-btn-primary,
.lp-btn, .lp-btn-lg, .lp-btn-primary, .lp-btn-ghost, .lp-plan-btn,
.pi-btn, .rp-btn, .rp-wa-btn, .lf-submit, .rg-submit,
.secondary-button, .mobile-outline-btn, .mobile-link-btn {
  border-radius: 12px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  transition: background-color .18s ease, border-color .18s ease, color .18s ease,
              box-shadow .18s ease, transform .12s ease, filter .18s ease, opacity .18s ease;
}
/* Consistent hover lift (never on disabled) */
.u-btn:not(:disabled):hover, .u-btn-primary:not(:disabled):hover,
.u-btn-secondary:not(:disabled):hover, .u-btn-ghost:not(:disabled):hover,
.u-btn-danger:not(:disabled):hover,
.btn-primary:not(:disabled):hover, .btn-secondary:not(:disabled):hover, .btn-ghost:not(:disabled):hover,
.plan-btn:not(:disabled):hover, .plan-cta:not(:disabled):hover, .plan-btn-primary:not(:disabled):hover,
.plans-btn:not(:disabled):hover, .plans-btn-primary:not(:disabled):hover,
.lp-btn:not(:disabled):hover, .lp-btn-primary:not(:disabled):hover,
.pi-btn:not(:disabled):hover, .rp-btn:not(:disabled):hover,
.lf-submit:not(:disabled):hover, .rg-submit:not(:disabled):hover {
  transform: translateY(-1px);
}

/* PRIMARY — one brand gradient everywhere */
.u-btn-primary, .btn-primary,
.plan-btn-primary, .plans-btn-primary, .plan-cta, .lp-plan-btn, .lp-btn-primary,
.pi-btn.primary, .rp-btn, .lf-submit, .rg-submit {
  background: linear-gradient(90deg, var(--accent, #06b6d4), var(--accent-2, #3b82f6));
  color: #fff;
  border: 1px solid transparent;
}
.u-btn-primary:not(:disabled):hover, .btn-primary:not(:disabled):hover,
.plan-btn-primary:not(:disabled):hover, .plans-btn-primary:not(:disabled):hover,
.plan-cta:not(:disabled):hover, .lp-plan-btn:not(:disabled):hover, .lp-btn-primary:not(:disabled):hover,
.pi-btn.primary:not(:disabled):hover, .rp-btn:not(:disabled):hover,
.lf-submit:not(:disabled):hover, .rg-submit:not(:disabled):hover {
  filter: brightness(1.06);
  background: linear-gradient(90deg, var(--accent, #06b6d4), var(--accent-2, #3b82f6));
}

/* SECONDARY / OUTLINE / GHOST — one quiet style */
.u-btn-secondary, .u-btn-ghost, .btn-secondary, .btn-ghost,
.plan-btn-outline, .plan-btn-ghost, .lp-btn-ghost,
.secondary-button, .mobile-outline-btn, .pi-btn.ghost {
  background: transparent;
  border: 1px solid var(--border, rgba(255, 255, 255, 0.16));
  color: var(--text, #e9edef);
}
.u-btn-secondary:not(:disabled):hover, .u-btn-ghost:not(:disabled):hover,
.btn-secondary:not(:disabled):hover, .btn-ghost:not(:disabled):hover,
.plan-btn-outline:not(:disabled):hover, .plan-btn-ghost:not(:disabled):hover,
.secondary-button:not(:disabled):hover, .pi-btn.ghost:not(:disabled):hover {
  background: color-mix(in srgb, var(--accent, #06b6d4) 12%, transparent);
  border-color: color-mix(in srgb, var(--accent, #06b6d4) 45%, transparent);
}

/* DANGER — one red style */
.u-btn-danger, .btn-danger, .btn-reject {
  background: color-mix(in srgb, var(--red, #ef4444) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--red, #ef4444) 32%, transparent);
  color: var(--red, #ef4444);
}
.u-btn-danger:not(:disabled):hover, .btn-danger:not(:disabled):hover, .btn-reject:not(:disabled):hover {
  background: color-mix(in srgb, var(--red, #ef4444) 22%, transparent);
}

/* SMALL — one compact size */
.u-btn-sm, .btn-small, .btn-sm { padding: 9px 14px; font-size: 13px; }

/* Disabled is uniform across families */
.u-btn:disabled, .u-btn-primary:disabled, .u-btn-secondary:disabled, .u-btn-ghost:disabled, .u-btn-danger:disabled,
.btn-primary:disabled, .btn-secondary:disabled,
.plan-btn:disabled, .plan-cta:disabled, .pi-btn:disabled, .rp-btn:disabled,
.lf-submit:disabled, .rg-submit:disabled {
  opacity: .6; cursor: not-allowed; transform: none; filter: none;
}

/* ============================================================================
   UI consistency polish — icons, badges & filters matched across light + dark.
   ============================================================================ */
/* 24h-window filter pills now mirror the sibling read/semaphore filters exactly. */
.window-filter {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  border-radius: 999px;
  padding: 10px 14px;
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 8px;
  transition: 0.2s ease;
  font-weight: 600;
}
.window-filter.active {
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.05);
}
.window-filter .win-dot { width: 9px; height: 9px; }
html[data-ui-theme="light"] .window-filter {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.97), rgba(241, 245, 249, 0.98));
  border-color: rgba(148, 163, 184, 0.24);
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.06);
  color: var(--text);
}
html[data-ui-theme="light"] .window-filter.active {
  border-color: rgba(8, 145, 178, 0.4);
  color: var(--accent);
}
html[data-ui-theme="light"] .window-info { color: var(--muted); }

/* Window badge: one compact, non-wrapping unit. */
.window-badge { white-space: nowrap; line-height: 1.5; }
.window-badge svg { flex: 0 0 auto; }

/* Dark-mode nav-rail icons get the same accent-aware hover the light theme has. */
.icon-circle-link:hover:not(.active) {
  background: color-mix(in srgb, var(--accent, #06b6d4) 14%, transparent);
  border-color: color-mix(in srgb, var(--accent, #06b6d4) 40%, transparent);
  color: var(--accent, #06b6d4);
}

/* ── Triage cues: "awaiting reply", Pendientes filter, notifications bell ── */
.awaiting-badge {
  display: inline-flex; align-items: center; white-space: nowrap;
  font-size: 10px; font-weight: 700; line-height: 1.6;
  color: var(--accent, #06b6d4);
  background: color-mix(in srgb, var(--accent, #06b6d4) 14%, transparent);
  border-radius: 6px; padding: 1px 7px;
}
/* Left accent bar on conversations waiting for a reply (inset shadow = no layout shift) */
.wa-chat-item.awaiting { box-shadow: inset 3px 0 0 var(--accent, #06b6d4); }
.window-filter .pend-dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--accent, #06b6d4);
}
.window-filter.active .pend-dot { background: currentColor; }
.window-filter.wf-icon { padding: 8px 12px; font-size: 15px; line-height: 1; }
.window-filter.wf-icon.active { background: color-mix(in srgb, var(--accent, #06b6d4) 16%, transparent); border-color: color-mix(in srgb, var(--accent, #06b6d4) 45%, transparent); }

/* ── Quick replies panel (composer) · theme-aware ── */
.wa-composer-input-wrap { position: relative; }
.qr-panel {
  position: absolute; left: 12px; right: 12px; bottom: calc(100% + 8px); z-index: 40;
  background: var(--bg-panel, #202c33); border: 1px solid var(--border, #2f3b43);
  border-radius: 14px; box-shadow: 0 -10px 30px rgba(0, 0, 0, .3);
  padding: 10px; max-height: 340px; display: flex; flex-direction: column; gap: 8px;
}
.qr-head { display: flex; gap: 8px; align-items: center; }
.qr-head input {
  flex: 1; background: var(--bg-input, #2a3942); border: 1px solid var(--border, #2f3b43);
  color: var(--text); border-radius: 8px; padding: 8px 10px; font: inherit;
}
.qr-x { background: transparent; border: none; color: var(--muted); cursor: pointer; font-size: 14px; padding: 4px 8px; }
.qr-list { overflow-y: auto; display: flex; flex-direction: column; gap: 4px; }
.qr-item { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 8px; }
.qr-item:hover { background: color-mix(in srgb, var(--accent, #06b6d4) 10%, transparent); }
.qr-tag {
  flex: 0 0 auto; font-size: 11px; font-weight: 700; cursor: pointer;
  color: var(--accent, #06b6d4); background: color-mix(in srgb, var(--accent, #06b6d4) 14%, transparent);
  padding: 2px 7px; border-radius: 6px;
}
.qr-body { flex: 1; font-size: 13px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.qr-del { flex: 0 0 auto; background: transparent; border: none; color: var(--muted); cursor: pointer; opacity: 0; transition: opacity .15s; }
.qr-item:hover .qr-del { opacity: 1; }
.qr-empty { color: var(--muted); font-size: 13px; padding: 14px; text-align: center; }
.qr-add { display: flex; gap: 6px; border-top: 1px solid var(--border, #2f3b43); padding-top: 8px; }
.qr-add input { background: var(--bg-input, #2a3942); border: 1px solid var(--border, #2f3b43); color: var(--text); border-radius: 8px; padding: 8px 10px; font: inherit; font-size: 13px; }
.qr-add #qrNewShortcut { width: 84px; flex: 0 0 auto; }
.qr-add #qrNewBody { flex: 1; }
@media (max-width: 600px) { .qr-add { flex-wrap: wrap; } .qr-add #qrNewBody { width: 100%; } }

/* ── Message delivery ticks + optimistic send states ── */
.wa-tick { margin-left: 5px; font-size: 11px; opacity: .85; }
.wa-msg-pending { opacity: .72; }
.wa-msg-failed { box-shadow: inset 0 0 0 1px var(--red, #ef4444); }
.wa-msg-failed .wa-message-timestamp::after { content: " · no enviado"; color: var(--red, #ef4444); }

/* ── Context drawer (CRM-lite) · theme-aware ── */
.ctx-backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, .45); z-index: 70; }
.ctx-drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: 360px; max-width: 92vw; z-index: 71;
  background: var(--bg-panel, #202c33); border-left: 1px solid var(--border, #2f3b43);
  box-shadow: -12px 0 40px rgba(0, 0, 0, .35);
  display: flex; flex-direction: column; animation: ctx-slide-in .22s ease;
}
@keyframes ctx-slide-in { from { transform: translateX(100%); } to { transform: translateX(0); } }
.ctx-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 18px; border-bottom: 1px solid var(--border, #2f3b43); color: var(--text); }
.ctx-x { background: transparent; border: none; color: var(--muted); font-size: 16px; cursor: pointer; }
.ctx-body { padding: 18px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.ctx-name { font-size: 18px; font-weight: 700; color: var(--text); }
.ctx-phone { font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.ctx-row { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; padding: 9px 0; border-bottom: 1px solid var(--border, #2f3b43); }
.ctx-row span { color: var(--muted); }
.ctx-row b { color: var(--text); text-align: right; }
.ctx-lead { background: color-mix(in srgb, var(--accent, #06b6d4) 8%, transparent); border: 1px solid color-mix(in srgb, var(--accent, #06b6d4) 22%, transparent); border-radius: 10px; padding: 12px; margin: 8px 0; }
.ctx-lead-head { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--accent, #06b6d4); margin-bottom: 6px; }
.ctx-lead-body { font-size: 13px; color: var(--text); line-height: 1.5; }
.ctx-notes-label { font-size: 12px; color: var(--muted); margin-top: 10px; }
.ctx-notes { width: 100%; box-sizing: border-box; min-height: 120px; resize: vertical; background: var(--bg-input, #2a3942); color: var(--text); border: 1px solid var(--border, #2f3b43); border-radius: 10px; padding: 10px; font: inherit; font-size: 13px; margin-bottom: 10px; }
.ctx-saved { color: var(--success, #10b981); font-size: 13px; font-weight: 600; }
@media (max-width: 600px) { .ctx-drawer { width: 100%; max-width: 100%; } }

/* ── ⌘K command palette · theme-aware ── */
.cmdk-overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, .5); z-index: 80; display: flex; align-items: flex-start; justify-content: center; padding-top: 12vh; }
.cmdk-box {
  width: 560px; max-width: 92vw; background: var(--bg-panel, #202c33);
  border: 1px solid var(--border, #2f3b43); border-radius: 14px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .5); overflow: hidden; animation: ctx-slide-in .14s ease;
}
.cmdk-box input {
  width: 100%; box-sizing: border-box; border: none; border-bottom: 1px solid var(--border, #2f3b43);
  background: transparent; color: var(--text); padding: 16px 18px; font: inherit; font-size: 15px; outline: none;
}
.cmdk-results { max-height: 320px; overflow-y: auto; }
.cmdk-item { padding: 11px 18px; font-size: 14px; color: var(--text); cursor: pointer; }
.cmdk-item.active, .cmdk-item:hover { background: color-mix(in srgb, var(--accent, #06b6d4) 14%, transparent); }
.cmdk-hint { padding: 8px 18px; font-size: 11px; color: var(--muted); border-top: 1px solid var(--border, #2f3b43); }

/* ── AI learning: feedback on bot replies, copilot, manual outcome ── */
.msg-fb { display: flex; gap: 4px; margin-top: 4px; opacity: .5; transition: opacity .15s; }
.wa-message-row:hover .msg-fb { opacity: 1; }
.msg-fb-btn {
  background: transparent; border: none; cursor: pointer; font-size: 12px;
  padding: 1px 5px; border-radius: 6px; filter: grayscale(1); opacity: .8; line-height: 1.4;
}
.msg-fb-btn:hover { background: rgba(127, 127, 127, .15); filter: none; }
.msg-fb-btn.active { filter: none; opacity: 1; background: color-mix(in srgb, var(--accent, #06b6d4) 18%, transparent); }
.composer-attach-btn.loading { opacity: .55; pointer-events: none; }
.ctx-outcome { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 10px 0 4px; }
.ctx-outcome-label { color: var(--muted); font-size: 13px; }
.ctx-outcome-btns { display: flex; gap: 6px; }
.ctx-oc {
  border: 1px solid var(--border, #2f3b43); background: transparent; color: var(--text);
  border-radius: 999px; padding: 5px 12px; font-size: 12px; font-weight: 600; cursor: pointer;
}
.ctx-oc[data-oc="won"].active { background: color-mix(in srgb, var(--green, #22c55e) 18%, transparent); border-color: var(--green, #22c55e); color: var(--green, #22c55e); }
.ctx-oc[data-oc="lost"].active { background: color-mix(in srgb, var(--red, #ef4444) 16%, transparent); border-color: var(--red, #ef4444); color: var(--red, #ef4444); }

/* ── Navigation labels + lightweight toast feedback ── */
.ma-icon-topbar {
  overflow: visible;
}

.icon-circle-link[data-nav-label] {
  position: relative;
}

.icon-circle-link[data-nav-label]::after {
  content: attr(data-nav-label);
  position: absolute;
  top: calc(100% + 9px);
  left: 50%;
  z-index: 1200;
  transform: translateX(-50%) translateY(-6px);
  opacity: 0;
  pointer-events: none;
  padding: 5px 8px;
  border-radius: 8px;
  background: rgba(8, 16, 29, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #e9edef;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  transition: opacity 0.14s ease, transform 0.14s ease;
}

.icon-circle-link[data-nav-label]:hover::after,
.icon-circle-link[data-nav-label]:focus-visible::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Vertical rail: on desktop (≥821px) EVERY rail becomes a fixed left column —
   both .wa-page-topbar (inbox/contacts) AND plain .ma-icon-topbar (centro/settings/
   admin). Show the label to the RIGHT of the icon so it never lands on the icon
   stacked directly below it (a below-center tooltip got hidden behind it). */
@media (min-width: 821px) {
  .ma-icon-topbar .icon-circle-link[data-nav-label]::after,
  .wa-page-topbar .icon-circle-link[data-nav-label]::after {
    top: 50%;
    left: calc(100% + 12px);
    transform: translateX(-6px) translateY(-50%);
  }
  .ma-icon-topbar .icon-circle-link[data-nav-label]:hover::after,
  .ma-icon-topbar .icon-circle-link[data-nav-label]:focus-visible::after,
  .wa-page-topbar .icon-circle-link[data-nav-label]:hover::after,
  .wa-page-topbar .icon-circle-link[data-nav-label]:focus-visible::after {
    transform: translateX(0) translateY(-50%);
  }
}

@media (max-width: 820px) {
  .icon-circle-link[data-nav-label]::after {
    display: none;
  }
}

@media (max-width: 820px) {
  body.inbox-route .wa-page-topbar {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 6px !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
  }
  body.inbox-route .wa-page-topbar::-webkit-scrollbar {
    display: none;
  }
  body.inbox-route .wa-page-topbar .icon-circle-link,
  body.inbox-route .wa-page-topbar .biz-sw-trigger {
    width: 46px !important;
    min-width: 46px !important;
    max-width: 46px !important;
    height: 46px !important;
    min-height: 46px !important;
    flex: 0 0 46px !important;
    aspect-ratio: auto !important;
  }
  body.inbox-route .wa-page-topbar .ma-theme-toggle-rail-icon {
    width: 22px;
    height: 22px;
    font-size: 17px;
  }
}

html[data-ui-theme="light"] .icon-circle-link[data-nav-label]::after {
  background: rgba(255, 255, 255, 0.98);
  border-color: rgba(148, 163, 184, 0.28);
  color: #0f172a;
}

/* ─────────────────────────────────────────────────────────────────────────────
   PERSISTENT NAV LABELS — every rail destination shows its name under the icon so a
   first-time, non-technical user knows where each button goes WITHOUT hovering (mobile
   had no labels at all). CSS-only: repurposes the existing data-nav-label from a hover
   tooltip into an always-visible in-flow label. Applies to the vertical rail (desktop)
   and the top/mobile bar alike.
   ───────────────────────────────────────────────────────────────────────────── */
.ma-icon-topbar .icon-circle-link,
.wa-page-topbar .icon-circle-link {
  /* Uniform size for EVERY nav button (fixed w/h) so short labels ("Chats") and long/2-line
     ones ("Cambiar negocio") render the same box — no more ragged widths. Height fits a
     2-line label; single-line labels centre with breathing room. */
  flex-direction: column !important;
  justify-content: center !important;
  gap: 5px !important;
  width: 86px !important;
  min-width: 86px !important;
  max-width: 86px !important;
  height: 66px !important;
  min-height: 66px !important;
  flex: 0 0 66px !important;
  padding: 7px 6px !important;
  border-radius: 16px !important;
}
.ma-icon-topbar .icon-circle-link::after,
.wa-page-topbar .icon-circle-link::after {
  content: attr(data-nav-label);
  position: static !important;
  top: auto !important;
  left: auto !important;
  transform: none !important;
  opacity: 1 !important;
  z-index: auto;
  pointer-events: auto;
  background: none !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
  border-radius: 0 !important;
  font-size: 10px !important;
  font-weight: 600 !important;
  line-height: 1.12 !important;
  letter-spacing: 0.01em;
  color: var(--muted);
  max-width: 86px;
  text-align: center;
  white-space: normal !important;
  overflow-wrap: normal;   /* break only at spaces — never mid-word ("Configuració n") */
  hyphens: none;
  transition: color 0.16s ease;
}
.ma-icon-topbar .icon-circle-link.active::after,
.wa-page-topbar .icon-circle-link.active::after {
  color: var(--text);
}
/* Ensure the label shows on mobile too (the old rule hid the tooltip ≤820px). */
@media (max-width: 820px) {
  .ma-icon-topbar .icon-circle-link::after,
  .wa-page-topbar .icon-circle-link::after,
  body.inbox-route .wa-page-topbar .icon-circle-link::after {
    display: block !important;
  }
  body.inbox-route .wa-page-topbar .icon-circle-link {
    /* Uniform size in the mobile bottom bar too (single scrollable row). */
    width: 74px !important;
    min-width: 74px !important;
    max-width: 74px !important;
    height: 56px !important;
    min-height: 56px !important;
    flex: 0 0 74px !important;
  }
  /* The inbox nav is a FIXED bottom bar — keep it a single compact scrollable row so
     the labels don't wrap it into a tall grid that overlaps the conversation list. */
  body.inbox-route .wa-page-topbar {
    flex-wrap: nowrap !important;
    justify-content: flex-start !important;
  }
}

.ma-toast {
  position: fixed;
  left: 50%;
  bottom: 18px;
  z-index: 9200;
  max-width: min(420px, calc(100vw - 28px));
  transform: translateX(-50%) translateY(10px);
  opacity: 0;
  padding: 11px 16px;
  border-radius: 12px;
  background: rgba(15, 24, 41, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #e9edef;
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.34);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
  transition: opacity 0.16s ease, transform 0.16s ease;
}

.ma-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.ma-toast-error {
  border-color: color-mix(in srgb, var(--red, #ef4444) 38%, transparent);
  color: #fecaca;
}

.ma-toast-ok {
  border-color: color-mix(in srgb, var(--success, #10b981) 36%, transparent);
}

.ma-toast-warning {
  border-color: color-mix(in srgb, var(--warning, #f59e0b) 40%, transparent);
  color: #fde68a;
}

.ma-toast-info {
  border-color: color-mix(in srgb, var(--info, #3b82f6) 38%, transparent);
  color: #bfdbfe;
}

html[data-ui-theme="light"] .ma-toast {
  background: rgba(255, 255, 255, 0.98);
  border-color: rgba(148, 163, 184, 0.28);
  color: #10203c;
  box-shadow: 0 18px 46px rgba(15, 23, 42, 0.16);
}

.ct-open-link,
.an-open-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 0 10px;
  border-radius: 10px;
  border: 1px solid color-mix(in srgb, var(--accent, #06b6d4) 28%, transparent);
  background: color-mix(in srgb, var(--accent, #06b6d4) 10%, transparent);
  color: var(--accent, #06b6d4);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.ct-open-link:hover,
.an-open-link:hover {
  background: color-mix(in srgb, var(--accent, #06b6d4) 16%, transparent);
  border-color: color-mix(in srgb, var(--accent, #06b6d4) 44%, transparent);
}

@media (max-width: 560px) {
  .ct-open-link,
  .an-open-link {
    min-height: 38px;
    width: 100%;
  }
}

/* ── Focused UX pass: Dashboard batch 1 ───────────────────────────── */
.wa-inbox-meta {
  margin: 10px 14px 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.wa-mobile-list-hint {
  display: none;
}

.wa-chat-item {
  position: relative;
  transition: background-color 0.16s ease, border-color 0.16s ease, transform 0.16s ease;
}

.wa-chat-item:hover {
  transform: translateX(2px);
}

.wa-chat-item.active {
  box-shadow: inset 3px 0 0 var(--accent);
}

.wa-chat-name-wrap {
  min-width: 0;
}

.wa-chat-name-wrap strong,
.wa-chat-item-meta,
.wa-chat-item-preview {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wa-chat-item-preview-row {
  align-items: center;
}

.wa-open-affordance {
  display: none;
  margin-left: 8px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.wa-no-results {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-start;
  color: var(--muted);
}

.wa-no-results strong {
  color: var(--text);
}

.wa-clear-filters {
  border: 1px solid color-mix(in srgb, var(--accent) 42%, var(--border));
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--accent);
  border-radius: 999px;
  min-height: 34px;
  padding: 0 14px;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.wa-empty-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 6px;
}

.wa-empty-actions a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--border));
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
}

.wa-filter-panel .filter-section-label {
  margin: 12px 14px 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.wa-filter-panel .filter-section-label:first-child {
  margin-top: 2px;
}

.window-filter[aria-pressed="true"],
.read-filter[aria-pressed="true"],
.semaphore-filter[aria-pressed="true"],
.client-filter[aria-pressed="true"] {
  outline: 1px solid color-mix(in srgb, var(--accent) 28%, transparent);
}

.window-filter.wf-icon {
  min-width: 76px;
  justify-content: center;
}

.wa-chat-topbar.compact-topbar {
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.18);
}

.wa-chat-topbar-actions {
  gap: 10px;
}

.wa-composer.window-closed #sendHumanReplyBtn {
  opacity: 0.9;
}

@media (min-width: 821px) {
  .wa-page > .wa-layout {
    grid-template-columns: minmax(340px, 380px) minmax(0, 1fr);
  }

  .wa-filter-panel {
    padding-bottom: 12px;
  }
}

@media (max-width: 820px) {
  .wa-sidebar-header {
    position: sticky;
    top: 0;
    z-index: 4;
  }

  .wa-inbox-meta {
    margin: 12px 28px 0;
    font-size: 11px;
  }

  .wa-mobile-list-hint {
    display: block;
    margin: 8px 28px 18px;
    color: var(--muted);
    font-size: 13px;
  }

  .wa-chat-item {
    padding-right: 28px;
  }

  .wa-chat-item:hover {
    transform: none;
  }

  .wa-open-affordance {
    display: inline-flex;
  }

  .wa-chat-item-side {
    flex-shrink: 0;
  }

  .wa-filter-panel {
    max-height: 42vh;
    overflow-y: auto;
  }

  .wa-empty-actions {
    flex-direction: column;
  }

  .wa-empty-actions a {
    width: 100%;
  }
}

/* ── Focused UX pass: Settings batch 1 ───────────────────────────── */
.settings-health-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 10px 0 14px;
}

.settings-health-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 70px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  color: var(--text);
  text-decoration: none;
}

.settings-health-card span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.settings-health-card strong {
  font-size: 15px;
}

.settings-health-card:hover {
  border-color: color-mix(in srgb, var(--accent) 38%, var(--border));
  background: color-mix(in srgb, var(--accent) 8%, var(--surface));
}

.ma-settings-jumpnav a.active {
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  border-color: color-mix(in srgb, var(--accent) 46%, var(--border));
  color: var(--accent);
}

.settings-page .ma-modern-form textarea {
  min-height: 92px;
}

.settings-page .ma-form-actions {
  position: sticky;
  bottom: 14px;
  z-index: 5;
  padding-top: 10px;
  background: linear-gradient(180deg, transparent, color-mix(in srgb, var(--surface) 92%, transparent) 30%);
  border-radius: 0 0 16px 16px;
}

.settings-page .knowledge-dropzone {
  gap: 18px;
}

.settings-page .knowledge-dropzone-side {
  min-width: 210px;
}

@media (max-width: 820px) {
  .settings-health-strip {
    grid-template-columns: 1fr;
    gap: 8px;
    margin-top: 12px;
  }

  .settings-health-card {
    min-height: 58px;
    padding: 12px 14px;
  }

  .settings-page .ma-settings-jumpnav {
    scroll-snap-type: x proximity;
  }

  .settings-page .ma-settings-jumpnav a {
    scroll-snap-align: center;
    white-space: nowrap;
  }

  .settings-page .ma-modern-form textarea {
    min-height: 108px;
  }

  .settings-page .ma-form-actions {
    bottom: 8px;
  }

  .settings-page .knowledge-dropzone {
    align-items: stretch;
  }

  .settings-page .knowledge-dropzone-side {
    min-width: 0;
    display: grid;
    grid-template-columns: 1fr;
  }
}

/* ── Dashboard deep UX pass: batch 1 final cascade guard ── */
body.inbox-body .wa-filter-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 0 14px 14px;
}

body.inbox-body .wa-filter-panel .wa-window-filters {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  align-items: stretch;
  margin: 0;
}

body.inbox-body .wa-filter-panel .window-filter,
body.inbox-body .wa-filter-panel .read-filter,
body.inbox-body .wa-filter-panel .semaphore-filter,
body.inbox-body .wa-filter-panel .client-filter {
  -webkit-appearance: none;
  appearance: none;
  min-height: 44px;
  margin: 0;
  border-radius: 999px;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.2;
  white-space: nowrap;
}

body.inbox-body .wa-filter-panel .window-filter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  gap: 7px;
  padding: 0 12px;
  border: 1px solid color-mix(in srgb, var(--muted) 18%, transparent);
  background: color-mix(in srgb, var(--surface, #111827) 82%, transparent);
  color: var(--text);
  box-shadow: none;
}

body.inbox-body .wa-filter-panel .window-info {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--muted) 30%, transparent);
  background: color-mix(in srgb, var(--surface, #111827) 86%, transparent);
}

body.inbox-body .wa-filter-panel .window-filter[aria-pressed="true"] {
  border-color: color-mix(in srgb, var(--accent) 42%, transparent);
  background: color-mix(in srgb, var(--accent) 15%, transparent);
  color: var(--accent);
  outline: none;
}

html[data-ui-theme="light"] body.inbox-body .wa-filter-panel .window-filter,
html[data-ui-theme="light"] body.inbox-body .wa-filter-panel .window-info {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.97), rgba(241, 245, 249, 0.96));
  border-color: rgba(148, 163, 184, 0.28);
  color: #0f172a;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.06);
}

html[data-ui-theme="light"] body.inbox-body .wa-filter-panel .window-filter[aria-pressed="true"] {
  background: rgba(8, 145, 178, 0.1);
  border-color: rgba(8, 145, 178, 0.34);
  color: #0891b2;
  box-shadow: 0 10px 22px rgba(8, 145, 178, 0.08);
}

/* ── Dashboard deep UX pass: batch 2, composer attachment hardening ── */
body.inbox-body #mediaFileInput,
body.inbox-body .sr-file-input,
body.inbox-body .composer-row input[type="file"] {
  display: none !important;
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

body.inbox-body .wa-composer-input-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

body.inbox-body .composer-media-status {
  min-height: 0;
  padding: 8px 11px;
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--accent) 28%, transparent);
  background: color-mix(in srgb, var(--accent) 9%, transparent);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
}

body.inbox-body .composer-media-status[hidden] {
  display: none !important;
}

body.inbox-body .composer-media-status[data-type="loading"] {
  color: var(--accent);
}

body.inbox-body .composer-media-status[data-type="success"] {
  border-color: color-mix(in srgb, var(--green) 35%, transparent);
  background: color-mix(in srgb, var(--green) 10%, transparent);
  color: var(--green);
}

body.inbox-body .composer-media-status[data-type="error"] {
  border-color: color-mix(in srgb, var(--red) 36%, transparent);
  background: color-mix(in srgb, var(--red) 10%, transparent);
  color: var(--red);
}

body.inbox-body .wa-composer.is-uploading .composer-attach-btn,
body.inbox-body .wa-composer.is-uploading #sendHumanReplyBtn {
  cursor: wait;
}

body.inbox-body .wa-composer.is-uploading .composer-row textarea#humanReplyInput {
  opacity: 0.78;
}

html[data-ui-theme="light"] body.inbox-body .composer-media-status {
  background: rgba(8, 145, 178, 0.08);
  border-color: rgba(8, 145, 178, 0.22);
  color: #0f7490;
}

html[data-ui-theme="light"] body.inbox-body .composer-media-status[data-type="error"] {
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.24);
  color: #b91c1c;
}

/* ── Dashboard deep UX pass: batch 3, chat readability and navigation ── */
body.inbox-body .wa-chat-panel {
  position: relative;
}

body.inbox-body .wa-chat-topbar.compact-topbar {
  padding-block: 14px;
}

body.inbox-body .wa-contact-title-row {
  min-width: 0;
}

body.inbox-body .wa-contact-title-row h2,
body.inbox-body .wa-contact-title-block p,
body.inbox-body .pill-text strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.inbox-body .wa-chat-topbar-actions {
  align-items: center;
}

body.inbox-body .wa-chat-messages {
  scroll-behavior: smooth;
}

body.inbox-body .wa-bubble {
  max-width: min(720px, 76%);
  overflow-wrap: anywhere;
}

body.inbox-body .wa-message-row.user .wa-bubble {
  max-width: min(520px, 72%);
}

body.inbox-body .wa-media {
  max-width: 100%;
  overflow: hidden;
}

body.inbox-body .wa-media-image,
body.inbox-body .wa-media-video {
  width: auto;
  max-width: min(360px, 100%);
  max-height: 360px;
  object-fit: contain;
  background: color-mix(in srgb, var(--surface, #111827) 78%, transparent);
  border: 1px solid color-mix(in srgb, var(--muted) 18%, transparent);
}

body.inbox-body .wa-media-doc {
  max-width: min(360px, 100%);
  min-height: 48px;
}

body.inbox-body .wa-scroll-latest {
  position: absolute;
  right: 24px;
  bottom: 124px;
  z-index: 12;
  min-height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  background: color-mix(in srgb, var(--surface, #111827) 92%, transparent);
  color: var(--accent);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.22);
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

body.inbox-body .wa-scroll-latest.hidden {
  display: none !important;
}

html[data-ui-theme="light"] body.inbox-body .wa-media-image,
html[data-ui-theme="light"] body.inbox-body .wa-media-video {
  background: rgba(248, 250, 252, 0.92);
  border-color: rgba(148, 163, 184, 0.22);
}

html[data-ui-theme="light"] body.inbox-body .wa-scroll-latest {
  background: rgba(255, 255, 255, 0.96);
  border-color: rgba(8, 145, 178, 0.28);
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.12);
}

@media (max-width: 820px) {
  body.inbox-body .wa-bubble,
  body.inbox-body .wa-message-row.user .wa-bubble {
    max-width: 86%;
  }

  body.inbox-body .wa-scroll-latest {
    right: 16px;
    bottom: 104px;
  }
}

/* ── Dashboard deep UX pass: batch 4, conversation-list ergonomics ── */
body.inbox-body .wa-chat-list[role="listbox"] {
  outline: none;
}

body.inbox-body .wa-chat-item {
  border: 1px solid transparent;
}

body.inbox-body .wa-chat-item:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent) 70%, transparent);
  outline-offset: -3px;
  border-color: color-mix(in srgb, var(--accent) 34%, transparent);
}

body.inbox-body .wa-chat-item[aria-selected="true"] {
  border-color: color-mix(in srgb, var(--accent) 28%, transparent);
}

body.inbox-body .wa-chat-item-top {
  gap: 10px;
}

body.inbox-body .wa-chat-name-wrap {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

body.inbox-body .wa-chat-name-wrap strong {
  min-width: 0;
}

body.inbox-body .wa-chat-item-side {
  align-items: center;
  gap: 8px;
}

body.inbox-body .window-badge,
body.inbox-body .followup-badge,
body.inbox-body .awaiting-badge,
body.inbox-body .client-badge,
body.inbox-body .read-badge,
body.inbox-body .unread-badge {
  flex: 0 0 auto;
}

body.inbox-body .wa-chat-delete-btn {
  opacity: 0.68;
}

body.inbox-body .wa-chat-item:hover .wa-chat-delete-btn,
body.inbox-body .wa-chat-delete-btn:focus-visible {
  opacity: 1;
}

body.inbox-body .wa-status-label {
  flex: 0 0 auto;
  max-width: 92px;
  overflow: hidden;
  text-overflow: ellipsis;
}

body.inbox-body .wa-chat-item-preview-row {
  gap: 8px;
}

html[data-ui-theme="light"] body.inbox-body .wa-chat-item[aria-selected="true"] {
  background: rgba(8, 145, 178, 0.08);
  border-color: rgba(8, 145, 178, 0.28);
}

/* ── Dashboard deep UX pass: batch 5, persistence and draft states ── */
body.inbox-body .composer-draft-meta {
  min-height: 16px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.35;
}

body.inbox-body .composer-draft-meta:empty {
  display: none;
}

body.inbox-body .wa-composer.manual-active .composer-draft-meta:not(:empty) {
  color: color-mix(in srgb, var(--accent) 75%, var(--muted));
}

html[data-ui-theme="light"] body.inbox-body .wa-composer.manual-active .composer-draft-meta:not(:empty) {
  color: #0f7490;
}

/* Dashboard audit hotfix: keep the contact identity visible on desktop. */
@media (min-width: 821px) {
  body.inbox-body .wa-chat-topbar-main.compact-main {
    grid-template-columns: minmax(260px, 1fr) minmax(0, auto);
  }

  body.inbox-body .wa-mobile-header-row {
    min-width: 260px;
    width: auto;
    justify-content: flex-start;
  }

  body.inbox-body .wa-contact-heading,
  body.inbox-body .wa-contact-title-block,
  body.inbox-body .wa-contact-title-row {
    min-width: 0;
  }

  body.inbox-body .wa-contact-title-block {
    max-width: min(360px, 32vw);
  }

  body.inbox-body .wa-chat-topbar-actions {
    min-width: 0;
  }
}

@media (min-width: 821px) and (max-width: 1680px) {
  body.inbox-body .wa-chat-topbar-actions {
    display: grid;
    grid-template-columns: auto auto auto;
    grid-template-areas:
      "follow summary pills"
      "toggle toggle pills";
    gap: 8px;
    justify-content: end;
    align-items: stretch;
  }

  body.inbox-body #followupBtn {
    grid-area: follow;
  }

  body.inbox-body #summaryBtn {
    grid-area: summary;
  }

  body.inbox-body .mobile-meta-group {
    grid-area: pills;
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  body.inbox-body .desktop-only-toggle {
    grid-area: toggle;
    width: 100%;
    justify-content: space-between;
  }
}

@media (max-width: 820px) {
  body.inbox-body .wa-filter-panel.open {
    max-height: 440px;
  }
}

/* Inbox v2: minimal, low-noise operator layout */
body.inbox-body {
  background: var(--bg, #0b1120);
}

body.inbox-body::before {
  display: none;
}

body.inbox-body .wa-page > .wa-layout {
  grid-template-columns: clamp(304px, 20vw, 356px) minmax(0, 1fr);
}

body.inbox-body .wa-sidebar {
  width: auto !important;
  background: color-mix(in srgb, var(--surface, #111827) 84%, transparent);
  border-right: 1px solid color-mix(in srgb, var(--border, rgba(148, 163, 184, 0.22)) 75%, transparent);
}

body.inbox-body .wa-sidebar-header {
  display: grid;
  gap: 10px;
  padding: 14px 12px 10px;
  background: color-mix(in srgb, var(--surface, #111827) 90%, transparent);
  border-bottom: 1px solid color-mix(in srgb, var(--border, rgba(148, 163, 184, 0.22)) 72%, transparent);
}

body.inbox-body .wa-filter-box {
  margin: 0;
}

body.inbox-body .wa-filter-toggle {
  min-height: 38px;
  padding: 0 11px;
  gap: 8px;
  border: 1px solid color-mix(in srgb, var(--border, rgba(148, 163, 184, 0.22)) 82%, transparent);
  border-radius: 12px;
  background: color-mix(in srgb, var(--surface-2, #17212b) 78%, transparent);
  color: var(--text, #e5edf5);
  font-size: 13px;
  font-weight: 760;
  letter-spacing: 0;
  text-transform: none;
  pointer-events: auto !important;
  cursor: pointer !important;
}

body.inbox-body .wa-filter-toggle .filter-icon svg,
body.inbox-body .wa-filter-toggle .filter-arrow {
  width: 15px;
  height: 15px;
}

body.inbox-body .wa-filter-toggle .filter-arrow {
  display: block !important;
}

body.inbox-body .filter-active-summary {
  min-width: 0;
  max-width: 148px;
  margin-left: auto;
  overflow: hidden;
  color: var(--muted, #8fa1b5);
  font-size: 11px;
  font-weight: 720;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.inbox-body .wa-filter-panel {
  max-height: 0 !important;
  margin-top: 0;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transition: max-height 0.2s ease, opacity 0.16s ease, margin-top 0.16s ease;
}

body.inbox-body .wa-filter-panel.open {
  max-height: 278px !important;
  margin-top: 8px;
  overflow-y: auto;
  opacity: 1;
  pointer-events: auto;
}

body.inbox-body .wa-filter-panel .filter-section-label {
  margin: 9px 0 5px;
  color: var(--muted, #8fa1b5);
  font-size: 10px;
  font-weight: 820;
  letter-spacing: 0.08em;
  line-height: 1.2;
}

body.inbox-body .wa-semaphore-filters,
body.inbox-body .wa-read-filters,
body.inbox-body .wa-window-filters,
body.inbox-body .wa-client-filter-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
}

body.inbox-body .semaphore-filter,
body.inbox-body .read-filter,
body.inbox-body .window-filter,
body.inbox-body .client-filter {
  flex: 0 0 auto;
  width: auto;
  min-width: 0 !important;
  min-height: 30px !important;
  height: 30px;
  padding: 0 10px !important;
  border-radius: 10px;
  box-shadow: none;
  font-size: 12px;
  font-weight: 760;
  line-height: 1;
}

body.inbox-body .semaphore-filter:not([data-filter="all"]) {
  width: 34px;
  padding: 0 !important;
}

body.inbox-body .semaphore-filter .status-dot,
body.inbox-body .window-filter .win-dot,
body.inbox-body .window-filter .pend-dot,
body.inbox-body .window-filter .notif-dot {
  width: 9px;
  height: 9px;
}

body.inbox-body .window-info {
  align-self: center;
  font-size: 13px;
}

body.inbox-body .wa-search-wrap.compact {
  margin: 0;
}

body.inbox-body .wa-search {
  min-height: 38px;
  height: 38px;
  padding: 0 12px;
  border-radius: 12px;
  font-size: 13px;
}

body.inbox-body .wa-inbox-meta {
  min-height: 16px;
  padding: 0 2px;
  color: var(--muted, #8fa1b5);
  font-size: 10.5px;
  font-weight: 820;
  letter-spacing: 0.08em;
  line-height: 1.35;
  text-transform: uppercase;
}

body.inbox-body .wa-chat-list {
  gap: 6px;
  padding: 8px 10px 14px;
}

body.inbox-body .wa-chat-item {
  display: grid;
  gap: 7px;
  min-height: 96px;
  padding: 14px 12px 13px !important;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  box-shadow: none;
}

body.inbox-body .wa-chat-item:hover,
body.inbox-body .wa-chat-item[aria-selected="true"] {
  background: color-mix(in srgb, var(--accent, #06b6d4) 8%, transparent);
}

body.inbox-body .wa-chat-item[aria-selected="true"] {
  border-color: color-mix(in srgb, var(--accent, #06b6d4) 34%, transparent);
}

body.inbox-body .wa-chat-item-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

body.inbox-body .wa-chat-name-wrap {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 7px;
}

body.inbox-body .wa-chat-name-wrap .status-dot {
  flex: 0 0 auto;
}

body.inbox-body .wa-chat-name {
  display: block;
  min-width: 0;
  overflow: hidden;
  color: var(--text, #e5edf5);
  font-size: 14px;
  font-weight: 820;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.inbox-body .wa-chat-name-wrap > .wa-chat-name {
  flex: 1 1 auto;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.inbox-body .wa-chat-item-side {
  display: flex;
  align-items: center;
  gap: 6px;
}

body.inbox-body .wa-chat-item-badges {
  display: flex;
  min-width: 0;
  min-height: 20px;
  align-items: center;
  gap: 5px;
  overflow: hidden;
}

body.inbox-body .wa-chat-item-badges:empty {
  display: none;
}

body.inbox-body .wa-chat-item-badges > * {
  flex: 0 1 auto;
  max-width: 104px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.inbox-body .wa-chat-item-badges .ai-state {
  flex: 0 0 auto;
  max-width: none;
}

body.inbox-body .followup-badge,
body.inbox-body .window-badge,
body.inbox-body .awaiting-badge,
body.inbox-body .client-badge,
body.inbox-body .read-badge,
body.inbox-body .unread-badge {
  min-height: 20px;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 780;
  line-height: 1;
}

body.inbox-body .wa-chat-delete-btn {
  width: 30px;
  height: 30px;
  min-height: 30px;
  border-radius: 10px;
}

body.inbox-body .wa-chat-item-meta,
body.inbox-body .wa-chat-item-preview {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.inbox-body .wa-chat-item .wa-chat-item-meta,
body.inbox-body .wa-chat-item .wa-chat-item-preview {
  display: block;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.inbox-body .wa-chat-item-meta {
  color: var(--muted, #8fa1b5);
  font-size: 12px;
  line-height: 1.3;
}

body.inbox-body .wa-chat-item-preview-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
}

body.inbox-body .wa-status-label,
body.inbox-body .wa-open-affordance {
  display: none;
}

body.inbox-body .wa-chat-item-preview {
  color: var(--muted, #8fa1b5);
  font-size: 12.5px;
  line-height: 1.35;
}

body.inbox-body .wa-main-sticky.no-banner {
  padding: 14px 18px 10px;
}

body.inbox-body .wa-chat-topbar.compact-topbar {
  min-height: 0;
  padding: 14px 16px;
  border-radius: 18px;
  background: color-mix(in srgb, var(--surface, #111827) 88%, transparent);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.14);
}

body.inbox-body .wa-chat-topbar-main.compact-main {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto;
  gap: 14px;
  align-items: center;
}

body.inbox-body .wa-mobile-header-row,
body.inbox-body .wa-contact-heading,
body.inbox-body .wa-contact-title-block,
body.inbox-body .wa-contact-title-row {
  min-width: 0;
}

body.inbox-body .wa-contact-heading {
  gap: 10px;
}

body.inbox-body .status-dot.large {
  width: 13px;
  height: 13px;
}

body.inbox-body .wa-contact-title-block {
  max-width: min(480px, 40vw);
}

body.inbox-body .wa-contact-title-row {
  gap: 7px;
}

body.inbox-body .wa-contact-title-row h2 {
  min-width: 0;
  overflow: hidden;
  font-size: clamp(20px, 1.5vw, 26px);
  line-height: 1.12;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.inbox-body .wa-chat-edit-btn {
  width: 30px;
  height: 30px;
  min-height: 30px;
  border-radius: 10px;
}

body.inbox-body #chatHeaderPhone {
  margin-top: 4px;
  font-size: 13px;
  line-height: 1.3;
}

body.inbox-body .wa-chat-topbar-actions {
  display: flex !important;
  max-width: min(820px, 52vw);
  min-width: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

body.inbox-body .summary-toggle-btn,
body.inbox-body .chat-meta-pill,
body.inbox-body .desktop-only-toggle {
  min-height: 40px !important;
  height: 40px;
  border-radius: 12px;
  box-shadow: none;
}

body.inbox-body .summary-toggle-btn {
  width: auto;
  min-width: 0;
  padding: 0 13px;
  font-size: 13px;
  font-weight: 800;
}

body.inbox-body .summary-btn-icon,
body.inbox-body .pill-icon {
  width: 15px;
  height: 15px;
}

body.inbox-body .mobile-meta-group {
  display: flex !important;
  flex-direction: row !important;
  gap: 8px;
}

body.inbox-body .chat-meta-pill {
  width: auto;
  padding: 7px 11px;
}

body.inbox-body .pill-text strong {
  font-size: 13px;
  line-height: 1.2;
}

body.inbox-body .summary-label.inline {
  font-size: 9.5px;
  letter-spacing: 0.08em;
}

body.inbox-body .desktop-only-toggle {
  width: auto !important;
  padding: 0 12px;
  gap: 10px;
}

body.inbox-body .desktop-only-toggle > span:first-child {
  font-size: 12px;
  font-weight: 760;
  white-space: nowrap;
}

body.inbox-body .wa-composer {
  padding: 12px 18px 14px;
  border-radius: 18px 18px 0 0;
  background: color-mix(in srgb, var(--surface, #111827) 92%, transparent);
  box-shadow: 0 -12px 32px rgba(0, 0, 0, 0.12);
}

body.inbox-body .composer-title {
  margin-bottom: 7px;
  font-size: 11.5px;
  font-weight: 760;
}

body.inbox-body .composer-row {
  display: grid !important;
  grid-template-columns: 40px 40px 40px minmax(180px, 1fr) minmax(104px, 128px);
  gap: 8px;
  align-items: end;
}

body.inbox-body .composer-attach-btn {
  width: 40px;
  height: 40px;
  min-height: 40px;
  border-radius: 12px;
}

body.inbox-body .composer-attach-btn svg {
  width: 18px;
  height: 18px;
}

body.inbox-body #humanReplyInput {
  min-height: 40px;
  max-height: 108px;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.35;
}

body.inbox-body #sendHumanReplyBtn {
  width: 100%;
  min-width: 104px;
  min-height: 40px;
  height: 40px;
  padding: 0 18px;
  border-radius: 12px;
  font-size: 14px;
}

body.inbox-body .composer-hint {
  margin-top: 7px;
  font-size: 12px;
  line-height: 1.35;
}

html[data-ui-theme="light"] body.inbox-body {
  background: #f6f8fb;
}

html[data-ui-theme="light"] body.inbox-body .wa-sidebar,
html[data-ui-theme="light"] body.inbox-body .wa-sidebar-header,
html[data-ui-theme="light"] body.inbox-body .wa-chat-topbar.compact-topbar,
html[data-ui-theme="light"] body.inbox-body .wa-composer {
  background: rgba(255, 255, 255, 0.92);
}

html[data-ui-theme="light"] body.inbox-body .wa-filter-toggle {
  background: rgba(248, 250, 252, 0.94);
  color: #172033;
}

html[data-ui-theme="light"] body.inbox-body .wa-chat-item:hover,
html[data-ui-theme="light"] body.inbox-body .wa-chat-item[aria-selected="true"] {
  background: rgba(8, 145, 178, 0.08);
}

@media (max-width: 1280px) and (min-width: 821px) {
  body.inbox-body .wa-page > .wa-layout {
    grid-template-columns: 316px minmax(0, 1fr);
  }

  body.inbox-body .wa-chat-topbar-main.compact-main {
    grid-template-columns: minmax(220px, 1fr);
  }

  body.inbox-body .wa-chat-topbar-actions {
    max-width: none;
    justify-content: flex-start;
  }
}

@media (max-width: 820px) {
  body.inbox-body .wa-sidebar-header {
    padding: 12px 12px 9px;
  }

  body.inbox-body .wa-filter-panel.open {
    max-height: 320px !important;
  }

  body.inbox-body .wa-chat-list {
    padding: 8px 10px 12px;
  }

  body.inbox-body .wa-chat-item {
    min-height: 88px;
  }

  body.inbox-body .wa-main-sticky.no-banner {
    padding: 10px;
  }

  body.inbox-body .wa-chat-topbar.compact-topbar {
    padding: 12px;
    border-radius: 16px;
  }

  body.inbox-body .wa-chat-topbar-main.compact-main {
    grid-template-columns: 1fr;
  }

  body.inbox-body .wa-chat-topbar-actions {
    max-width: none;
    justify-content: flex-start;
  }

  body.inbox-body .mobile-meta-group {
    overflow-x: auto;
    max-width: 100%;
  }

  body.inbox-body .wa-contact-title-block {
    max-width: none;
  }

  body.inbox-body .wa-composer {
    padding: 10px 10px 12px;
  }

  body.inbox-body .composer-row {
    grid-template-columns: 40px 40px 40px minmax(0, 1fr);
  }

  body.inbox-body #sendHumanReplyBtn {
    grid-column: 1 / -1;
    width: 100%;
  }
}

/* Bloque B: responsive guardrails and mobile inbox navigation */
html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

@media (max-width: 820px) {
  button,
  [role="button"],
  .u-btn,
  .u-btn-primary,
  .u-btn-secondary,
  .u-btn-ghost,
  .u-btn-danger,
  .btn,
  .btn-primary,
  .btn-secondary,
  .btn-excel,
  .icon-circle-link,
  input[type="button"],
  input[type="submit"],
  input[type="reset"],
  input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
  select,
  textarea {
    min-height: 44px;
  }

  .inbox-route .wa-page-topbar {
    position: fixed !important;
    top: auto !important;
    right: max(10px, env(safe-area-inset-right)) !important;
    bottom: calc(8px + env(safe-area-inset-bottom)) !important;
    left: max(10px, env(safe-area-inset-left)) !important;
    z-index: 520 !important;
    width: auto !important;
    min-height: 62px !important;
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(44px, 1fr)) !important;
    gap: 6px !important;
    padding: 8px !important;
    transform: none !important;
    border: 1px solid color-mix(in srgb, var(--border) 85%, transparent) !important;
    border-radius: 20px !important;
    background: color-mix(in srgb, var(--bg-panel) 90%, transparent) !important;
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.38) !important;
    backdrop-filter: blur(18px) !important;
  }

  .inbox-route .wa-page.chat-active .wa-page-topbar {
    display: none !important;
  }

  .inbox-route .wa-page-topbar .icon-circle-link {
    width: 100% !important;
    height: 46px !important;
    min-width: 44px !important;
    min-height: 44px !important;
    aspect-ratio: auto !important;
    border-radius: 15px !important;
  }

  .inbox-route .wa-sidebar-header {
    padding-top: max(12px, env(safe-area-inset-top)) !important;
  }

  .inbox-route .wa-chat-list {
    padding-bottom: calc(92px + env(safe-area-inset-bottom)) !important;
  }
}

/* Bloque E: quieter inbox states and clearer WhatsApp constraints */
body.inbox-body .status-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 6px 0 2px;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 720;
  line-height: 1.2;
}

body.inbox-body .status-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 22px;
  padding: 0 7px;
  border: 1px solid color-mix(in srgb, var(--border) 72%, transparent);
  border-radius: var(--radius-full);
  background: color-mix(in srgb, var(--surface-2) 58%, transparent);
}

body.inbox-body .status-legend .status-dot {
  width: 7px;
  height: 7px;
  box-shadow: none;
}

body.inbox-body .wa-window-notice {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  margin: 0 18px 10px;
  padding: 10px 12px;
  border-radius: 14px;
  line-height: 1.35;
}

body.inbox-body .wa-window-notice strong {
  color: var(--text);
  font-size: 12px;
  white-space: nowrap;
}

body.inbox-body .wa-window-notice span {
  min-width: 0;
  color: color-mix(in srgb, var(--warning) 82%, var(--muted));
}

body.inbox-body .wa-window-notice a {
  color: var(--warning);
  font-size: 12px;
  font-weight: 820;
  text-decoration: none;
  white-space: nowrap;
}

body.inbox-body .wa-window-notice a:hover,
body.inbox-body .wa-window-notice a:focus-visible {
  text-decoration: underline;
}

body.inbox-body .wa-chat-delete-btn {
  opacity: 0;
  transform: scale(0.94);
}

body.inbox-body .wa-chat-item:hover .wa-chat-delete-btn,
body.inbox-body .wa-chat-item:focus-within .wa-chat-delete-btn,
body.inbox-body .wa-chat-delete-btn:focus-visible {
  opacity: 1;
  transform: scale(1);
}

@media (max-width: 820px) {
  body.inbox-body .status-legend {
    gap: 5px;
  }

  body.inbox-body .wa-window-notice {
    grid-template-columns: 1fr;
    align-items: start;
    margin: 0 10px 10px;
  }

  body.inbox-body .wa-window-notice strong {
    white-space: normal;
  }

  body.inbox-body .wa-chat-delete-btn {
    opacity: 0.58;
    transform: none;
  }
}

/* Tanda 2 G3: quieter inbox list, searchable controls and non-color status cues */
body.inbox-body .wa-filter-panel.open {
  max-height: min(238px, 30vh) !important;
}

body.inbox-body .semaphore-filter {
  gap: 6px;
}

body.inbox-body .semaphore-filter:not([data-filter="all"]) {
  width: auto;
  min-width: 74px !important;
  padding: 0 10px !important;
}

body.inbox-body .status-filter-label {
  display: inline;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.inbox-body .wa-search-wrap.compact {
  position: relative;
}

body.inbox-body .wa-search-wrap.compact .wa-search {
  padding-right: 42px;
}

body.inbox-body .wa-search-clear {
  position: absolute;
  top: 50%;
  right: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  min-height: 32px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted, #8fa1b5);
  cursor: pointer;
  transform: translateY(-50%);
}

body.inbox-body .wa-search-clear[hidden] {
  display: none;
}

body.inbox-body .wa-search-clear:hover,
body.inbox-body .wa-search-clear:focus-visible {
  background: color-mix(in srgb, var(--accent, #06b6d4) 12%, transparent);
  color: var(--text, #e5edf5);
  outline: none;
}

body.inbox-body .wa-search-clear svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
}

body.inbox-body .wa-chat-item {
  min-height: 104px;
  grid-template-rows: auto 22px auto auto;
}

body.inbox-body .wa-chat-item[aria-selected="true"] {
  box-shadow: inset 3px 0 0 color-mix(in srgb, var(--accent, #06b6d4) 72%, transparent);
}

body.inbox-body .wa-chat-item-badges > * {
  max-width: 112px;
}

body.inbox-body .more-badge {
  flex: 0 0 auto;
  max-width: none;
}

body.inbox-body .wa-chat-delete-btn {
  color: var(--muted, #8fa1b5);
  opacity: 0;
}

body.inbox-body .wa-chat-delete-btn:hover,
body.inbox-body .wa-chat-delete-btn:focus-visible {
  background: color-mix(in srgb, var(--danger, #ef4444) 12%, transparent);
  color: var(--danger, #ef4444);
}

body.inbox-body .wa-chat-item-preview-row {
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

body.inbox-body .wa-status-label {
  display: inline-flex;
  align-items: center;
  max-width: 96px;
  min-height: 18px;
  overflow: hidden;
  color: var(--muted, #8fa1b5);
  font-size: 10.5px;
  font-weight: 760;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 640px) {
  body.inbox-body,
  body.inbox-body .wa-page,
  body.inbox-body .wa-page > .wa-layout,
  body.inbox-body .wa-sidebar,
  body.inbox-body .wa-chat-list {
    width: 100vw !important;
    max-width: 100vw;
    min-width: 0;
    overflow-x: hidden;
  }

  body.inbox-body .wa-page > .wa-layout {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  body.inbox-body .wa-sidebar {
    left: 0;
    right: 0;
  }

  body.inbox-body .wa-filter-panel.open {
    max-height: min(220px, 28vh) !important;
  }

  body.inbox-body .semaphore-filter:not([data-filter="all"]) {
    min-width: 64px !important;
  }

  body.inbox-body .status-filter-label {
    max-width: 44px;
  }

  body.inbox-body .wa-chat-name-wrap {
    max-width: calc(100vw - 64px);
  }

  body.inbox-body .wa-chat-name-wrap > .wa-chat-name {
    max-width: min(100%, 286px);
  }

  body.inbox-body .wa-chat-item-badges,
  body.inbox-body .wa-chat-item-preview-row {
    max-width: calc(100vw - 42px);
  }

  body.inbox-body .wa-chat-item .wa-chat-item-meta,
  body.inbox-body .wa-chat-item .wa-chat-item-preview {
    max-width: min(100%, 318px);
  }

  body.inbox-body .wa-chat-item {
    box-sizing: border-box;
    max-width: 100%;
    min-height: 108px;
    overflow: hidden;
  }
}

/* Tanda 2 G4: inbox chat header, composer, message states and reading flow */
body.inbox-body .wa-contact-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  border: 1px solid color-mix(in srgb, var(--accent) 34%, transparent);
  border-radius: 14px;
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  color: var(--accent);
  font-size: 13px;
  font-weight: 860;
  letter-spacing: 0;
  text-transform: uppercase;
}

body.inbox-body .wa-contact-heading .status-dot.large {
  flex: 0 0 auto;
}

body.inbox-body .chat-meta-readout {
  cursor: default;
  background: transparent !important;
  box-shadow: none !important;
}

body.inbox-body .chat-meta-readout .summary-label.inline {
  color: var(--muted);
}

body.inbox-body .summary-toggle-btn:disabled,
body.inbox-body .toggle-wrap input[aria-busy="true"] {
  cursor: progress;
}

body.inbox-body .wa-window-notice {
  border: 1px solid color-mix(in srgb, var(--warning) 30%, transparent);
  background: color-mix(in srgb, var(--warning) 11%, var(--surface));
  color: var(--text);
}

body.inbox-body .wa-window-notice span {
  color: color-mix(in srgb, var(--warning) 82%, var(--text));
}

body.inbox-body .wa-composer.disabled .composer-row {
  opacity: 0.72;
}

body.inbox-body .wa-composer.disabled #humanReplyInput,
body.inbox-body .wa-composer.disabled #sendHumanReplyBtn,
body.inbox-body .wa-composer.disabled .composer-attach-btn {
  cursor: not-allowed;
}

body.inbox-body .composer-row {
  grid-template-columns: 44px 44px 44px minmax(180px, 1fr) minmax(104px, 128px);
}

body.inbox-body .composer-attach-btn {
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
}

body.inbox-body #humanReplyInput,
body.inbox-body #sendHumanReplyBtn {
  min-height: 44px;
}

body.inbox-body .wa-day-separator {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 14px 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 820;
  text-transform: uppercase;
}

body.inbox-body .wa-day-separator::before,
body.inbox-body .wa-day-separator::after {
  content: "";
  flex: 1 1 auto;
  height: 1px;
  background: color-mix(in srgb, var(--border) 72%, transparent);
}

body.inbox-body .wa-day-separator span {
  flex: 0 0 auto;
  max-width: min(70vw, 220px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.inbox-body .wa-message-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 6px;
  font-size: 11px;
  font-weight: 760;
}

body.inbox-body .wa-message-status.sent {
  color: color-mix(in srgb, var(--success) 84%, var(--muted));
}

body.inbox-body .wa-message-status.pending {
  color: var(--muted);
}

body.inbox-body .wa-msg-pending {
  opacity: 1;
  border-style: dashed;
}

body.inbox-body .wa-msg-failed {
  border-color: color-mix(in srgb, var(--danger) 54%, transparent);
}

body.inbox-body .wa-msg-failed .wa-message-timestamp::after {
  content: "";
}

body.inbox-body .wa-msg-failed .wa-message-status.pending {
  color: var(--danger);
}

/* ── WhatsApp-style delivery ticks ──────────────────────────────────────── */
/* Sent (single ✓) and delivered (double ✓✓) inherit the muted timestamp colour;
   read goes WhatsApp-blue; failed goes danger-red. The tick is an inline SVG. */
.wa-tick {
  height: 11px;
  width: auto;
  display: block;
}
body.inbox-body .wa-message-status.sent,
body.inbox-body .wa-message-status.delivered {
  color: inherit;            /* matches .wa-message-timestamp (theme-correct grey) */
  opacity: 0.9;
}
body.inbox-body .wa-message-status.read {
  color: #53bdeb;            /* WhatsApp read-blue — reads well on both themes */
  opacity: 1;
}
body.inbox-body .wa-message-status.failed {
  color: var(--danger);
  font-weight: 700;
}

/* ── "Escribiendo…" typing indicator ────────────────────────────────────── */
.wa-typing-row .wa-typing-bubble {
  padding: 12px 16px;
  display: inline-flex;
  align-items: center;
  min-height: 0;
}
.wa-typing-dots {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.wa-typing-dots span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.4;
  animation: waTypingBounce 1.25s infinite ease-in-out;
}
.wa-typing-dots span:nth-child(2) { animation-delay: 0.16s; }
.wa-typing-dots span:nth-child(3) { animation-delay: 0.32s; }
@keyframes waTypingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.35; }
  30%           { transform: translateY(-4px); opacity: 0.9; }
}
@media (prefers-reduced-motion: reduce) {
  .wa-typing-dots span { animation: none; opacity: 0.6; }
}
/* Inbox-list "escribiendo…" preview */
.wa-preview-typing {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-style: italic;
  color: var(--success, #16a37a);
}
.wa-typing-dots.inline span {
  width: 4px;
  height: 4px;
}

/* ── Inbox cold-open skeleton (shimmer placeholders before the first fetch) ── */
.wa-chat-skeleton {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border, rgba(255, 255, 255, 0.05));
}
.wa-sk-line {
  height: 10px;
  border-radius: 6px;
  background: linear-gradient(
    90deg,
    color-mix(in srgb, var(--muted) 16%, transparent) 25%,
    color-mix(in srgb, var(--muted) 30%, transparent) 37%,
    color-mix(in srgb, var(--muted) 16%, transparent) 63%
  );
  background-size: 400% 100%;
  animation: waSkShimmer 1.4s ease infinite;
}
.wa-sk-title { width: 52%; height: 12px; margin-bottom: 9px; }
.wa-sk-sub { width: 34%; margin-bottom: 9px; }
.wa-sk-preview { width: 78%; }
@keyframes waSkShimmer {
  0% { background-position: 100% 50%; }
  100% { background-position: 0 50%; }
}
@media (prefers-reduced-motion: reduce) {
  .wa-sk-line { animation: none; }
}

/* ── In-conversation search bar ("buscar en el chat") ───────────────────── */
.wa-chat-search {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border, rgba(255, 255, 255, 0.08));
  background: var(--bg-elevated, rgba(8, 16, 29, 0.6));
}
.wa-chat-search.hidden { display: none; }
.wa-chat-search-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: var(--muted);
}
.wa-chat-search-input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 14px;
  padding: 6px 4px;
  outline: none;
}
.wa-chat-search-input::placeholder { color: var(--muted); }
.wa-chat-search-count {
  flex-shrink: 0;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  min-width: 34px;
  text-align: right;
}
.wa-chat-search-nav {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  transition: background 0.14s ease, opacity 0.14s ease;
}
.wa-chat-search-nav svg { width: 18px; height: 18px; }
.wa-chat-search-nav:hover:not(:disabled) {
  background: color-mix(in srgb, var(--muted) 22%, transparent);
}
.wa-chat-search-nav:disabled { opacity: 0.4; cursor: default; }

/* Highlighted matches inside message bubbles */
mark.wa-search-hit {
  background: #fde68a;            /* amber — readable on every bubble colour */
  color: #1f2937;
  border-radius: 3px;
  padding: 0 1px;
}
mark.wa-search-hit.is-active {
  background: #f59e0b;
  color: #1f2937;
  box-shadow: 0 0 0 2px color-mix(in srgb, #f59e0b 55%, transparent);
}

body.inbox-body .msg-fb {
  opacity: 0.82;
}

body.inbox-body .msg-fb-btn {
  min-width: 30px;
  min-height: 28px;
}

body.inbox-body .msg-fb-btn[aria-pressed="true"] {
  filter: none;
  opacity: 1;
  outline: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
}

body.inbox-body .wa-scroll-latest.has-new {
  border-color: color-mix(in srgb, var(--accent) 58%, transparent);
  background: color-mix(in srgb, var(--accent) 16%, var(--surface));
}

@media (max-width: 820px) {
  body.inbox-body .wa-chat-panel,
  body.inbox-body .wa-main-sticky.no-banner,
  body.inbox-body .wa-chat-topbar.compact-topbar,
  body.inbox-body .wa-chat-topbar-main.compact-main {
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: hidden;
  }

  body.inbox-body .wa-main-sticky.no-banner {
    width: 100vw !important;
    max-width: 100vw !important;
    padding-right: 10px !important;
    padding-left: 10px !important;
  }

  body.inbox-body .wa-chat-topbar.compact-topbar {
    width: calc(100vw - 20px) !important;
    max-width: calc(100vw - 20px) !important;
  }

  body.inbox-body .wa-page.chat-active .wa-layout,
  body.inbox-body .wa-page.chat-active .wa-main,
  body.inbox-body .wa-page.chat-active .wa-chat-panel {
    width: 100vw !important;
    max-width: 100vw;
    min-width: 0;
    overflow-x: hidden;
  }

  body.inbox-body .wa-mobile-header-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
  }

  body.inbox-body .mobile-only-toggle {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    min-height: 0 !important;
    overflow: hidden !important;
    clip: rect(0 0 0 0) !important;
    clip-path: inset(50%) !important;
    white-space: nowrap !important;
  }

  body.inbox-body .header-ia-toggle {
    max-width: 72px;
    gap: 6px;
  }

  body.inbox-body .header-ia-toggle > span:first-child {
    font-size: 11px;
    font-weight: 780;
  }

  body.inbox-body .wa-chat-topbar-actions {
    display: flex !important;
    flex-wrap: wrap;
    width: calc(min(100vw, 390px) - 44px) !important;
    max-width: calc(min(100vw, 390px) - 44px) !important;
    gap: 8px;
  }

  body.inbox-body #followupBtn,
  body.inbox-body #summaryBtn {
    flex: 0 0 calc((min(100vw, 390px) - 52px) / 2);
    width: calc((min(100vw, 390px) - 52px) / 2);
    max-width: calc((min(100vw, 390px) - 52px) / 2);
    min-width: 0 !important;
    padding-right: 10px !important;
    padding-left: 10px !important;
    overflow: hidden;
    justify-content: center;
  }

  body.inbox-body #followupBtnLabel,
  body.inbox-body #summaryBtn {
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  body.inbox-body #followupBtnLabel {
    min-width: 0;
    overflow: hidden;
  }

  body.inbox-body .wa-chat-topbar-actions > *,
  body.inbox-body .mobile-meta-group > * {
    min-width: 0 !important;
  }

  body.inbox-body .mobile-meta-group {
    display: grid !important;
    flex: 0 0 calc(min(100vw, 390px) - 44px);
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 8px;
    width: calc(min(100vw, 390px) - 44px) !important;
    max-width: calc(min(100vw, 390px) - 44px) !important;
    overflow: hidden;
  }

  body.inbox-body .chat-meta-pill {
    width: 100%;
    min-width: 0;
  }

  body.inbox-body .wa-contact-avatar {
    flex-basis: 34px;
    width: 34px;
    height: 34px;
    border-radius: 12px;
    font-size: 12px;
  }

  body.inbox-body .composer-row {
    grid-template-columns: 44px 44px 44px minmax(0, 1fr);
  }

  body.inbox-body .wa-day-separator {
    margin: 12px 0;
  }
}

html[data-ui-theme="light"] body.inbox-body .wa-contact-avatar {
  background: color-mix(in srgb, var(--accent) 10%, var(--surface));
  border-color: color-mix(in srgb, var(--accent) 24%, transparent);
}

html[data-ui-theme="light"] body.inbox-body .chat-meta-readout {
  background: transparent !important;  /* readouts are now borderless quiet text, no pill box */
}

html[data-ui-theme="light"] body.inbox-body .wa-window-notice {
  background: color-mix(in srgb, var(--warning) 10%, var(--surface));
}

html[data-ui-theme="light"] body.inbox-body .followup-toggle-btn.active {
  background: color-mix(in srgb, var(--warning) 14%, var(--surface)) !important;
  border-color: color-mix(in srgb, var(--warning) 34%, transparent) !important;
  color: var(--warning) !important;
}

/* ── Wave 5: minimalist WhatsApp-style chat header on phones ──
   Icon-only action buttons (labels via title/aria-label); stage/intent live in the
   context drawer (tap the contact name). Appended last to win the breakpoint cascade. */
@media (max-width: 820px) {
  .wa-chat-topbar-actions {
    flex-wrap: wrap !important;
    align-items: center !important;
    gap: 6px !important;
  }
  .wa-chat-topbar-actions .summary-toggle-btn {
    width: 40px !important;
    height: 40px !important;
    min-width: 40px !important;
    min-height: 40px !important;
    flex: 0 0 auto !important;
    padding: 0 !important;
    justify-content: center !important;
    gap: 0 !important;
  }
  .wa-chat-topbar-actions .summary-toggle-btn .btn-label { display: none !important; }
  .wa-chat-topbar-actions .summary-toggle-btn .summary-btn-icon { margin: 0 !important; }
  /* Higher specificity than `body.inbox-body .mobile-meta-group { display:grid !important }` (L8221) */
  body.inbox-body .wa-chat-topbar-actions .mobile-meta-group { display: none !important; }
}

/* "Reactivar" warm-leads banner in the inbox list */
.wa-warm-banner {
  display: flex; align-items: center; gap: 10px;
  margin: 8px 0 4px; padding: 9px 12px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 38%, transparent);
  font-size: 12.5px; color: var(--text); line-height: 1.35;
}
.wa-warm-banner span { flex: 1; }
.wa-warm-exit {
  flex: 0 0 auto; background: none; border: none; cursor: pointer;
  color: var(--accent); font-weight: 700; font-size: 12.5px; padding: 4px 6px; border-radius: 8px;
}
.wa-warm-exit:hover { background: color-mix(in srgb, var(--accent) 16%, transparent); }

/* WhatsApp-style: new message bubbles slide in softly (only newly-appended rows) */
@keyframes waMsgEnter { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.wa-message-row.wa-msg-enter { animation: waMsgEnter 0.22s cubic-bezier(0.22, 1, 0.36, 1) both; }
@media (prefers-reduced-motion: reduce) { .wa-message-row.wa-msg-enter { animation: none; } }

/* Optimistic send: smooth "Enviando" → ✓ promotion in place (no thread re-render) */
body.inbox-body .wa-bubble.human { transition: border-color 0.25s ease, opacity 0.25s ease; }
@keyframes waStatusSwap { from { opacity: 0; transform: translateY(2px); } to { opacity: 1; transform: none; } }
.wa-message-status.wa-status-swap { animation: waStatusSwap 0.22s ease both; }
@media (prefers-reduced-motion: reduce) { .wa-message-status.wa-status-swap { animation: none; } }

/* Soft fade-in of the conversation thread on switch (smooths the loading→content swap) */
@keyframes waThreadEnter { from { opacity: 0.3; } to { opacity: 1; } }
#messages.wa-thread-enter { animation: waThreadEnter 0.2s ease-out; }
@media (prefers-reduced-motion: reduce) { #messages.wa-thread-enter { animation: none; } }

/* ── Fold OPEN (701–820px, e.g. Galaxy Z Fold 3/4 inner screen ≈ 768px): show the desktop
   2-pane inbox (list + chat) + left vertical rail instead of the phone single-pane.
   Scoped to body.inbox-* so Centro/Settings are unaffected. High specificity to beat the
   ≤820px mobile rules (which stretch the rail full-width and overlay the panes). ── */
/* DISABLED (impossible range): the user wants the WhatsApp single-pane layout on
   foldables/large phones (701-820px) too, never a 2-pane split. The <=820px single-pane
   rules now govern this range. Kept inert-but-referenceable rather than deleted. */
@media (min-width: 701px) and (max-width: 700px) {
  body.inbox-body .wa-page { padding-left: 100px !important; box-sizing: border-box !important; }
  body.inbox-body .wa-page > .wa-layout,
  body.inbox-body .wa-page.chat-active .wa-layout {
    display: grid !important;
    grid-template-columns: 300px minmax(0, 1fr) !important;
    position: relative !important; overflow: visible !important;
    width: auto !important; max-width: none !important; height: 100% !important;
  }
  body.inbox-body .wa-page .wa-sidebar,
  body.inbox-body .wa-page .wa-main {
    position: relative !important; inset: auto !important;
    transform: none !important; transition: none !important;
    width: auto !important; max-width: none !important; height: 100% !important; min-height: 0 !important;
    z-index: auto !important;
  }
  body.inbox-body .wa-page .wa-chat-panel,
  body.inbox-body .wa-page .wa-main-sticky.no-banner,
  body.inbox-body .wa-page .wa-chat-topbar.compact-topbar,
  body.inbox-body .wa-page .wa-chat-topbar-main.compact-main {
    width: 100% !important; max-width: 100% !important; min-width: 0 !important;
  }
  body.inbox-route .wa-page-topbar {
    position: fixed !important;
    top: 50% !important; left: 22px !important; right: auto !important; bottom: auto !important;
    transform: translateY(-50%) !important;
    width: auto !important; min-width: 0 !important; min-height: 0 !important;
    display: flex !important; flex-direction: column !important; grid-template-columns: none !important;
    gap: 14px !important; padding: 0 !important;
    background: none !important; border: none !important; box-shadow: none !important; backdrop-filter: none !important;
    border-radius: 0 !important; z-index: 400 !important;
    justify-content: center !important; align-items: center !important;
  }
  body.inbox-route .wa-page.chat-active .wa-page-topbar { display: flex !important; }
  body.inbox-route .wa-page-topbar .icon-circle-link {
    width: 46px !important; height: 46px !important;
    min-width: 46px !important; max-width: 46px !important; aspect-ratio: auto !important;
  }
  body.inbox-body .wa-sidebar-inset-nav { display: none !important; }
  /* In 2-pane the list is always visible, so the mobile "back" arrow is redundant. */
  body.inbox-body .wa-mobile-back { display: none !important; }
  /* Mirror desktop: show the (disabled) composer input, not the mobile info card, when AI is on. */
  body.inbox-body #humanComposer.disabled .wa-mobile-composer-info { display: none !important; }
  body.inbox-body #humanComposer.disabled .wa-composer-input-wrap { display: flex !important; }
}

/* Always-visible inbox quick filters (Todas / No leídos / Pendientes) */
.wa-quick-filters {
  display: flex;
  gap: 6px;
  margin: 6px 0 2px;
  flex-wrap: wrap;
}
.wa-quick-chip {
  appearance: none;
  border: 1px solid var(--border, rgba(255, 255, 255, 0.12));
  background: transparent;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 650;
  line-height: 1;
  min-height: 32px;
  padding: 0 13px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.wa-quick-chip:hover {
  color: var(--text);
  border-color: color-mix(in srgb, var(--muted) 45%, transparent);
}
.wa-quick-chip.active {
  background: color-mix(in srgb, var(--success, #16a37a) 18%, transparent);
  border-color: color-mix(in srgb, var(--success, #16a37a) 50%, transparent);
  color: color-mix(in srgb, var(--success, #16a37a) 90%, var(--text));
}

/* Composer draft meta + character counter (surfaces near the 4000-char limit) */
.composer-draft-meta {
  margin-top: 4px;
  font-size: 11.5px;
  line-height: 1.3;
  color: var(--muted);
  transition: color 0.15s ease;
}
.composer-draft-meta.is-warning {
  color: color-mix(in srgb, var(--warning) 84%, var(--text));
}
.composer-draft-meta.is-danger {
  color: color-mix(in srgb, var(--danger) 84%, var(--text));
  font-weight: 600;
}

/* Composer attachment preview (confirm before sending) */
.composer-attach-preview {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  margin-bottom: 8px;
  border: 1px solid var(--border, rgba(255, 255, 255, 0.12));
  border-radius: 12px;
  background: color-mix(in srgb, var(--muted) 10%, transparent);
}
.composer-attach-preview.hidden { display: none; }
.cap-thumb {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--muted) 16%, transparent);
  font-size: 22px;
  line-height: 1;
}
.cap-thumb img { width: 100%; height: 100%; object-fit: cover; }
.cap-info { min-width: 0; flex: 1; }
.cap-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cap-size { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.cap-remove {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--muted);
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.14s ease, color 0.14s ease;
}
.cap-remove svg { width: 18px; height: 18px; }
.cap-remove:hover { background: color-mix(in srgb, var(--muted) 20%, transparent); color: var(--text); }

/* Composer send button: subtle tactile press feedback + "ready" lift */
#sendHumanReplyBtn { transition: transform 0.12s ease, filter 0.15s ease, opacity 0.15s ease, box-shadow 0.15s ease; }
#sendHumanReplyBtn:active:not(:disabled) { transform: scale(0.95); }
/* Inactive until there's text to send (disabled handles the dim); becoming ready
   gives a gentle lift so the activation is felt. */
#sendHumanReplyBtn.is-ready { box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18); }

/* ── WhatsApp single-pane inbox for foldables / large phones / portrait tablets (821–1024px) ──
   Phones (≤820px) already get a single conversation pane (list → tap → full chat + back).
   Devices reporting 821–1024px (Galaxy/Pixel Fold inner screens, big phones, phones in
   landscape, portrait tablets) were falling back to the desktop 2-pane split. Extend the same
   single-pane slide layout up to 1024px so the whole phone/tablet range behaves like WhatsApp;
   only true desktop (≥1025px) keeps the 2-pane list+chat. Last in source + !important so it
   beats the ≥821px desktop rules. Paired with the JS chat-open threshold (also raised to 1024). */
@media (min-width: 821px) and (max-width: 1024px) {
  body.inbox-body .wa-page > .wa-layout,
  body.inbox-body .wa-page.chat-active .wa-layout {
    display: block !important;
    position: relative !important;
    overflow: hidden !important;
    grid-template-columns: none !important;
    width: auto !important;
    max-width: none !important;
    height: 100% !important;
  }
  body.inbox-body .wa-page .wa-sidebar {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    max-width: none !important;
    height: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    transform: translateX(0) !important;
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1) !important;
    z-index: 2 !important;
  }
  body.inbox-body .wa-page .wa-main {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    max-width: none !important;
    height: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    transform: translateX(100%) !important;
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1) !important;
    z-index: 1 !important;
  }
  body.inbox-body .wa-page .wa-layout.chat-open .wa-sidebar { transform: translateX(-100%) !important; }
  body.inbox-body .wa-page .wa-layout.chat-open .wa-main { transform: translateX(0) !important; z-index: 3 !important; }
  body.inbox-body .wa-mobile-back { display: inline-flex !important; }
}
