/* ==============================================================================
   WACLIS MAIL — DESIGN SYSTEM & TOKENS OFICIALES
   Basado en la arquitectura visual de work.waclis.com y research.waclis.com
   ============================================================================== */

:root {
  /* Paleta oficial de marca Waclis */
  --magenta: #ec1895;
  --magenta-dark: #d80e84;
  --magenta-soft: #fdf0f8;
  --magenta-glow: rgba(236, 24, 149, 0.18);
  
  --ink: #25232a;
  --muted: #74717d;
  --subtle: #9b98a2;
  --line: #e7e8ec;
  --line-strong: #dfe1e6;
  --surface: #ffffff;
  --canvas: #f6f7f9;
  --column: #f1f2f4;
  
  --green: #0fa978;
  --green-soft: #eff7f4;
  --amber: #f2a013;
  --amber-soft: #fef8ee;
  --red: #df3e56;
  --red-soft: #fff1f3;
  --purple: #7458e8;
  --purple-soft: #f3f1ff;
  --cyan: #00b4d8;
  --cyan-soft: #e6f9fd;

  --sidebar-width: 250px;
  --sidebar-collapsed: 68px;
  --topbar-height: 60px;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-pill: 9999px;
  --shadow: 0 12px 38px rgba(25, 25, 45, 0.08);
  --shadow-sm: 0 2px 8px rgba(25, 25, 45, 0.05);
  --shadow-lg: 0 24px 70px rgba(23, 20, 35, 0.16);

  --font-family: 'Inter', ui-sans-serif, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

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

html, body {
  height: 100%;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--font-family);
  font-size: 14px;
  line-height: 1.5;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

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

button {
  cursor: pointer;
  border: 0;
  background: transparent;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

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

svg {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
}

:focus-visible {
  outline: 2px solid var(--magenta);
  outline-offset: 2px;
}

/* ==============================================================================
   LAYOUT PRINCIPAL
   ============================================================================== */

.app-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

/* TOPBAR HEADER */
.topbar {
  height: var(--topbar-height);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 50;
  flex-shrink: 0;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: var(--sidebar-width);
}

.menu-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  transition: all 0.15s;
}

.menu-toggle:hover {
  background: var(--canvas);
  color: var(--ink);
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.brand-logo-full {
  height: 32px;
  width: auto;
  display: block;
}

.brand-badge-qa {
  background: var(--purple-soft);
  color: var(--purple);
  font-size: 10px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 6px;
  border: 1px solid rgba(116, 88, 232, 0.2);
  text-transform: uppercase;
}

/* BUSCADOR GLOBAL GMAIL-STYLE */
.topbar-center {
  flex: 1;
  max-width: 720px;
  margin: 0 24px;
  position: relative;
}

.search-box {
  display: flex;
  align-items: center;
  background: var(--canvas);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  height: 42px;
  padding: 0 12px;
  transition: all 0.15s;
}

.search-box:focus-within {
  background: var(--surface);
  border-color: var(--magenta);
  box-shadow: 0 0 0 3px var(--magenta-glow);
}

.search-box svg {
  color: var(--subtle);
  margin-right: 10px;
}

.search-box input {
  flex: 1;
  border: 0;
  background: transparent;
  outline: none;
  font-size: 13px;
  color: var(--ink);
}

.search-box input::placeholder {
  color: var(--subtle);
}

.search-filter-btn {
  color: var(--muted);
  padding: 4px 8px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
}

.search-filter-btn:hover {
  background: rgba(0,0,0,0.05);
  color: var(--ink);
}

/* TOPBAR RIGHT */
.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.org-selector-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--canvas);
  border: 1px solid var(--line);
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
}

.org-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--magenta);
}

.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  position: relative;
  transition: all 0.15s;
}

.icon-btn:hover {
  background: var(--canvas);
  color: var(--ink);
}

.icon-btn .badge-count {
  position: absolute;
  top: 4px;
  right: 4px;
  background: var(--magenta);
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  border-radius: var(--radius-pill);
  padding: 1px 5px;
  border: 2px solid var(--surface);
}

.wcc-launcher-btn {
  color: var(--ink);
}

.user-avatar-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--magenta) 0%, var(--purple) 100%);
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--surface);
  box-shadow: var(--shadow-sm);
}

/* ==============================================================================
   CUERPO PRINCIPAL: SIDEBAR + LISTA DE CORREO + PANEL DE HILO
   ============================================================================== */

.main-body {
  display: flex;
  flex: 1;
  overflow: hidden;
  position: relative;
}

/* SIDEBAR DE NAVEGACIÓN */
.sidebar {
  width: var(--sidebar-width);
  background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  padding: 14px 10px;
  flex-shrink: 0;
  overflow-y: auto;
  transition: width 0.2s;
}

.sidebar.collapsed {
  width: var(--sidebar-collapsed);
  padding: 14px 6px;
}

.compose-btn-wrapper {
  margin-bottom: 16px;
}

.compose-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: var(--magenta);
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  height: 44px;
  border-radius: var(--radius);
  box-shadow: 0 4px 14px rgba(236, 24, 149, 0.28);
  transition: all 0.16s;
}

.compose-btn:hover {
  background: var(--magenta-dark);
  transform: translateY(-1px);
}

.compose-btn svg {
  width: 18px;
  height: 18px;
}

.sidebar.collapsed .compose-btn span {
  display: none;
}

/* NAVEGACIÓN DE CARPETAS */
.nav-section {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 20px;
}

.nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 38px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  color: #5b5862;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.14s;
}

.nav-item:hover {
  background: var(--canvas);
  color: var(--ink);
}

.nav-item.active {
  background: var(--magenta-soft);
  color: var(--magenta);
  font-weight: 700;
}

.nav-item-content {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.nav-item-content svg {
  color: inherit;
}

.nav-item-title {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-item-badge {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  background: #f0f0f3;
  padding: 1px 7px;
  border-radius: var(--radius-pill);
}

.nav-item.active .nav-item-badge {
  background: rgba(236, 24, 149, 0.12);
  color: var(--magenta);
}

.sidebar.collapsed .nav-item-title,
.sidebar.collapsed .nav-item-badge {
  display: none;
}

/* SECCIÓN DE CUENTAS / CASILLAS CONECTADAS */
.accounts-section {
  border-top: 1px solid var(--line);
  padding-top: 14px;
  margin-top: auto;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 800;
  color: var(--subtle);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.add-account-btn {
  color: var(--magenta);
  font-size: 12px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
}

.add-account-btn:hover {
  background: var(--magenta-soft);
}

.account-plan-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 6px;
  background: var(--green-soft);
  color: var(--green);
}

/* ==============================================================================
   BANDEJA CENTRAL DE CORREOS (GMAIL STYLE)
   ============================================================================== */

.mail-list-panel {
  flex: 1;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  min-width: 320px;
  overflow: hidden;
  border-right: 1px solid var(--line);
}

/* TOOLBAR DE ACCIONES DE BANDEJA */
.mail-toolbar {
  height: 48px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  background: #fafafa;
  flex-shrink: 0;
}

.mail-toolbar-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.checkbox-custom {
  width: 18px;
  height: 18px;
  accent-color: var(--magenta);
  cursor: pointer;
}

.toolbar-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  color: var(--muted);
  transition: all 0.12s;
}

.toolbar-action-btn:hover {
  background: var(--canvas);
  color: var(--ink);
}

.mail-toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
}

/* LISTA DE CORREOS VIRTUALIZADA */
.mail-list-container {
  flex: 1;
  overflow-y: auto;
}

.mail-row {
  display: flex;
  align-items: center;
  height: 52px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  transition: background 0.12s;
  font-size: 13px;
  user-select: none;
}

.mail-row:hover {
  background: #fbfbfc;
  box-shadow: inset 1px 0 0 var(--line), inset -1px 0 0 var(--line);
}

.mail-row.selected {
  background: var(--magenta-soft);
}

.mail-row.unread {
  font-weight: 700;
  color: var(--ink);
  background: #ffffff;
}

.mail-row.unread .mail-subject {
  font-weight: 700;
  color: var(--ink);
}

.mail-row-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-right: 14px;
}

.star-btn {
  color: #ccc;
  transition: color 0.15s;
}

.star-btn.starred {
  color: var(--amber);
}

.mail-account-badge {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.mail-sender {
  width: 180px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 0;
  margin-right: 16px;
}

.mail-body-preview {
  flex: 1;
  display: flex;
  align-items: center;
  min-width: 0;
  overflow: hidden;
  margin-right: 16px;
}

.mail-subject {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 500;
  color: var(--ink);
}

.mail-snippet {
  color: var(--muted);
  font-weight: 400;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-left: 8px;
}

.mail-badges {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: 8px;
}

.tag-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  white-space: nowrap;
}

.attachment-indicator {
  color: var(--muted);
  margin-left: 8px;
}

.mail-date {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  flex-shrink: 0;
  text-align: right;
  min-width: 75px;
}

/* ESTADO VACÍO DE BANDEJA */
.empty-mail-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 40px;
  text-align: center;
  color: var(--muted);
}

.empty-mail-state svg {
  width: 64px;
  height: 64px;
  color: var(--subtle);
  margin-bottom: 16px;
}

.empty-mail-state h3 {
  color: var(--ink);
  font-size: 18px;
  margin-bottom: 6px;
}

/* ==============================================================================
   PANEL LATERAL DERECHO DE HILO (THREAD VIEWER)
   ============================================================================== */

.thread-viewer-panel {
  width: 55%;
  min-width: 480px;
  max-width: 850px;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--line);
  overflow: hidden;
  box-shadow: -4px 0 20px rgba(0, 0, 0, 0.03);
}

.thread-header {
  min-height: 64px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
}

.thread-title-area {
  flex: 1;
  min-width: 0;
  margin-right: 14px;
}

.thread-subject {
  font-size: 18px;
  font-weight: 750;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}

.thread-labels-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.thread-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* PESTAÑAS CONTEXTUALES DEL ECOSISTEMA */
.thread-tabs-bar {
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--line);
  background: #fafafa;
  padding: 0 16px;
  gap: 8px;
  flex-shrink: 0;
  overflow-x: auto;
}

.context-tab-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 40px;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  transition: all 0.15s;
  white-space: nowrap;
}

.context-tab-btn:hover {
  color: var(--ink);
}

.context-tab-btn.active {
  color: var(--magenta);
  border-bottom-color: var(--magenta);
  background: #fff;
}

.thread-content-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

/* MENSAJE INDIVIDUAL DENTRO DEL HILO */
.thread-message-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  margin-bottom: 16px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.02);
}

.message-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: #fbfbfc;
  cursor: pointer;
  border-bottom: 1px solid var(--line);
}

.message-author-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.author-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #e4e5ea;
  color: var(--ink);
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
}

.author-names {
  display: flex;
  flex-direction: column;
}

.author-display-name {
  font-weight: 700;
  color: var(--ink);
  font-size: 13px;
}

.author-email {
  font-size: 11px;
  color: var(--muted);
}

.message-date-and-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: var(--muted);
}

.message-body-container {
  padding: 20px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--ink);
  overflow-x: auto;
}

/* ADJUNTOS */
.attachments-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
  padding: 14px 20px;
  background: #fafafa;
  border-top: 1px solid var(--line);
}

.attachment-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s;
}

.attachment-chip:hover {
  border-color: var(--magenta);
  box-shadow: var(--shadow-sm);
}

.attachment-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.attachment-name {
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.attachment-size {
  font-size: 10px;
  color: var(--muted);
}

/* RESPUESTA RÁPIDA DENTRO DEL HILO */
.quick-reply-box {
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 16px;
}

/* ==============================================================================
   MODAL / DOCK DE REDACCIÓN DE CORREO (COMPOSER)
   ============================================================================== */

.composer-dock {
  position: fixed;
  bottom: 0;
  right: 24px;
  width: 620px;
  height: 580px;
  background: var(--surface);
  border-radius: var(--radius) var(--radius) 0 0;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--line-strong);
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow: hidden;
  transition: all 0.2s ease-in-out;
}

.composer-dock.minimized {
  height: 44px;
}

.composer-dock.fullscreen {
  inset: 20px;
  width: auto;
  height: auto;
  border-radius: var(--radius);
}

.composer-header {
  height: 44px;
  background: #25232a;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  cursor: pointer;
}

.composer-title {
  font-size: 13px;
  font-weight: 700;
}

.composer-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.composer-header-actions button {
  color: #c5c3cb;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 4px;
}

.composer-header-actions button:hover {
  color: #fff;
  background: rgba(255,255,255,0.1);
}

.composer-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.composer-fields {
  display: flex;
  flex-direction: column;
  border-bottom: 1px solid var(--line);
}

.composer-field-row {
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding: 6px 14px;
  min-height: 40px;
}

.composer-field-label {
  width: 50px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}

.composer-field-input {
  flex: 1;
  border: 0;
  outline: none;
  font-size: 13px;
  color: var(--ink);
}

.composer-subject-input {
  font-weight: 600;
}

/* TOOLBAR DEL EDITOR */
.composer-rich-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  padding: 6px 14px;
  background: #fafafa;
  border-bottom: 1px solid var(--line);
}

.rich-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 4px;
  color: #5f5b66;
}

.rich-btn:hover {
  background: var(--line);
  color: var(--ink);
}

.toolbar-divider {
  width: 1px;
  height: 18px;
  background: var(--line);
  margin: 0 4px;
}

.composer-editor-content {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  outline: none;
  font-size: 13px;
  line-height: 1.6;
}

.composer-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-top: 1px solid var(--line);
  background: #fafafa;
}

.composer-footer-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.send-button-group {
  display: inline-flex;
  border-radius: var(--radius-sm);
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(236, 24, 149, 0.25);
}

.send-primary-btn {
  background: var(--magenta);
  color: #fff;
  font-weight: 700;
  padding: 0 16px;
  height: 38px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.send-primary-btn:hover {
  background: var(--magenta-dark);
}

.send-schedule-dropdown-btn {
  background: var(--magenta-dark);
  color: #fff;
  padding: 0 8px;
  height: 38px;
  border-left: 1px solid rgba(255,255,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
}

.composer-footer-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ==============================================================================
   LANZADOR WCC (UNIVERSAL APP SWITCHER)
   ============================================================================== */

.wcc-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(25, 23, 30, 0.35);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  padding: 68px 24px;
}

.wcc-popover-card {
  width: 340px;
  background: var(--surface);
  border-radius: 16px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  padding: 18px;
  display: flex;
  flex-direction: column;
  animation: popoverFadeIn 0.15s ease-out;
}

@keyframes popoverFadeIn {
  from { opacity: 0; transform: translateY(-8px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.wcc-popover-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.wcc-popover-title {
  font-size: 13px;
  font-weight: 800;
  color: var(--ink);
}

.wcc-apps-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.wcc-app-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 12px 6px;
  border-radius: 12px;
  transition: all 0.14s;
  text-align: center;
  color: var(--ink);
}

.wcc-app-item:hover {
  background: var(--canvas);
  transform: translateY(-1px);
}

.wcc-app-item.current {
  background: var(--magenta-soft);
  color: var(--magenta);
}

.wcc-app-icon-wrapper {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}

.wcc-app-name {
  font-size: 11px;
  font-weight: 600;
}

/* ==============================================================================
   TOASTS & DESHACER ENVÍO (UNDO SEND)
   ============================================================================== */

.undo-send-banner {
  position: fixed;
  bottom: 24px;
  left: 24px;
  background: #25232a;
  color: #fff;
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 14px;
  z-index: 2000;
  font-size: 13px;
  animation: slideUpToast 0.2s ease-out;
}

@keyframes slideUpToast {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.undo-send-btn {
  color: var(--magenta);
  font-weight: 800;
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 0.05em;
}

.undo-send-btn:hover {
  text-decoration: underline;
}

/* ==============================================================================
   RESPONSIVE (MÓVIL Y TABLET)
   ============================================================================== */

@media (max-width: 900px) {
  .thread-viewer-panel {
    position: fixed;
    inset: 0;
    width: 100vw;
    max-width: none;
    z-index: 100;
  }
  
  .composer-dock {
    inset: 0;
    width: 100vw;
    height: 100vh;
    border-radius: 0;
  }
}

/* ==============================================================================
   MODALES DE CONFIGURACIÓN & ASISTENTE DE ONBOARDING
   ============================================================================== */

.settings-modal-backdrop,
.onboarding-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(18, 17, 23, 0.55);
  backdrop-filter: blur(4px);
  z-index: 1500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.settings-modal-container {
  background: #ffffff;
  width: 950px;
  max-width: 96vw;
  height: 640px;
  max-height: 90vh;
  border-radius: var(--radius-lg, 12px);
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.18);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line, #e7e8ec);
}

.settings-modal-header {
  height: 56px;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line, #e7e8ec);
  background: #ffffff;
}

.settings-header-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.settings-header-title h2 {
  font-size: 16px;
  font-weight: 700;
  color: var(--ink, #121117);
  margin: 0;
}

.settings-close-btn {
  background: none;
  border: none;
  font-size: 18px;
  color: var(--muted, #74717d);
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.settings-close-btn:hover {
  background: var(--canvas, #f3f3f6);
  color: var(--ink, #121117);
}

.settings-modal-body {
  flex: 1;
  display: flex;
  overflow: hidden;
}

.settings-tabs-sidebar {
  width: 230px;
  border-right: 1px solid var(--line, #e7e8ec);
  background: #fbfbfc;
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-shrink: 0;
}

.settings-tab-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  border: none;
  background: none;
  color: var(--ink-secondary, #3a3842);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  width: 100%;
  text-align: left;
  transition: all 0.14s;
}

.settings-tab-btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: var(--muted, #74717d);
}

.settings-tab-btn:hover {
  background: var(--canvas, #f3f3f6);
  color: var(--ink, #121117);
}

.settings-tab-btn.active {
  background: #ffffff;
  color: var(--magenta, #ec1895);
  font-weight: 700;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.settings-tab-btn.active svg {
  color: var(--magenta, #ec1895);
}

.settings-content-area {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
  background: #ffffff;
}

.settings-section-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--ink, #121117);
  margin-bottom: 6px;
}

.settings-section-desc {
  font-size: 12.5px;
  color: var(--muted, #74717d);
  margin-bottom: 18px;
}

/* CARDS & TABLAS DENTRO DE CONFIGURACIÓN */
.account-card-item {
  border: 1px solid var(--line, #e7e8ec);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #ffffff;
  transition: border-color 0.15s;
}

.account-card-item:hover {
  border-color: #cbd0d8;
}

.account-card-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.account-avatar-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

.account-details h4 {
  margin: 0 0 3px 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink, #121117);
}

.account-details p {
  margin: 0;
  font-size: 12px;
  color: var(--muted, #74717d);
}

.badge-pill-status {
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge-pill-status.connected {
  background: rgba(34, 197, 94, 0.12);
  color: #16a34a;
}

.badge-pill-status.default {
  background: rgba(236, 24, 149, 0.12);
  color: var(--magenta, #ec1895);
}

/* ASISTENTE DE ONBOARDING */
.onboarding-modal-card {
  background: #ffffff;
  width: 520px;
  max-width: 94vw;
  border-radius: 14px;
  box-shadow: 0 24px 50px rgba(0, 0, 0, 0.2);
  padding: 24px;
  border: 1px solid var(--line, #e7e8ec);
}

.onboarding-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 18px;
}

.onboarding-title-lockup {
  display: flex;
  gap: 12px;
  align-items: center;
}

.onboarding-title-lockup h3 {
  margin: 0 0 4px 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--ink, #121117);
}

.onboarding-title-lockup p {
  margin: 0;
  font-size: 12.5px;
  color: var(--muted, #74717d);
}

.oauth-quick-providers {
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin-bottom: 18px;
}

.oauth-provider-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 42px;
  border-radius: 8px;
  border: 1px solid var(--line, #e7e8ec);
  background: #ffffff;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink, #121117);
  cursor: pointer;
  transition: all 0.14s;
}

.oauth-provider-btn:hover {
  background: #f8f8fa;
  border-color: #cbd0d8;
}

.onboarding-divider {
  display: flex;
  align-items: center;
  text-align: center;
  margin: 14px 0;
  color: var(--muted, #74717d);
  font-size: 11px;
}

.onboarding-divider::before,
.onboarding-divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid var(--line, #e7e8ec);
}

.onboarding-divider span {
  padding: 0 10px;
}

.form-group-field {
  margin-bottom: 14px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.form-group-field label {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink, #121117);
}

.form-group-field input,
.form-group-field select,
.form-group-field textarea {
  height: 38px;
  padding: 0 12px;
  border-radius: 7px;
  border: 1px solid var(--line, #e7e8ec);
  font-size: 13px;
  outline: none;
  font-family: inherit;
  transition: border-color 0.15s;
}

.form-group-field textarea {
  height: auto;
  padding: 10px 12px;
}

.form-group-field input:focus,
.form-group-field select:focus,
.form-group-field textarea:focus {
  border-color: var(--magenta, #ec1895);
}

.field-hint {
  font-size: 11px;
  color: var(--muted, #74717d);
}

.grid-2-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.onboarding-actions-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 18px;
}

.btn-text-link {
  background: none;
  border: none;
  color: var(--muted, #74717d);
  font-size: 12px;
  cursor: pointer;
  padding: 0;
}

.btn-text-link:hover {
  color: var(--ink, #121117);
  text-decoration: underline;
}

.btn-primary-action {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--magenta, #ec1895);
  color: #ffffff;
  border: none;
  height: 40px;
  padding: 0 18px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.15s;
}

.btn-primary-action:hover {
  opacity: 0.92;
}

.detection-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(236, 24, 149, 0.2);
  border-top-color: var(--magenta, #ec1895);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto;
}

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

