:root {
  --primary:       #25D366;
  --primary-dark:  #128C7E;
  --secondary:     #075E54;
  --accent:        #34B7F1;
  --background:    #f0f2f5;
  --card-bg:       #ffffff;
  --text-primary:  #111b21;
  --text-secondary:#667781;
  --border:        #e9edef;
  --success:       #06cf9c;
  --warning:       #fcba03;
  --danger:        #ff4757;
  --shadow:        0 2px 8px rgba(0,0,0,0.10);
  --shadow-lg:     0 12px 32px rgba(0,0,0,0.18);
  --radius:        12px;
  --radius-sm:     8px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', 'Roboto', sans-serif;
  background: var(--background);
  color: var(--text-primary);
  line-height: 1.6;
}

.container {
  max-width: 1440px;
  margin: 0 auto;
  padding: 16px 20px;
}

/* ── Header ── */
.header {
  background: linear-gradient(135deg, var(--secondary) 0%, var(--primary-dark) 100%);
  padding: 14px 24px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  margin-bottom: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
}

.header h1 {
  font-size: 20px;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.3px;
}

.header-center {
  display: flex;
  align-items: center;
}

.header-center-tabs {
  flex: 1;
  display: flex;
  justify-content: center;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

/* Store selector */
.store-selector {
  padding: 8px 14px;
  border-radius: 20px;
  border: 1px solid rgba(255,255,255,0.3);
  background: rgba(255,255,255,0.15);
  color: #ffffff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  outline: none;
  min-width: 140px;
}

.store-selector option {
  background: var(--secondary);
  color: #fff;
}

/* Status badge */
.status-badge {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 14px;
  background: rgba(255,255,255,0.12);
  border-radius: 20px;
  border: 1px solid rgba(255,255,255,0.2);
}

.status-badge .status-text {
  font-size: 13px;
  color: rgba(255,255,255,0.9);
  font-weight: 500;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--danger);
  animation: pulse 2s infinite;
  will-change: opacity;
}

.status-badge.connected .status-dot { background: var(--success); }
.status-badge.connecting .status-dot { background: var(--warning); }

/* Mini dots — estado de cada tienda en el header */
.stores-status-dots {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: rgba(255,255,255,0.08);
  border-radius: 20px;
  border: 1px solid rgba(255,255,255,0.15);
}

.store-dot {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: rgba(255,255,255,0.75);
  font-weight: 500;
  cursor: default;
}

.store-dot-circle {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--danger);
  flex-shrink: 0;
}

.store-dot[data-status="connected"]    .store-dot-circle { background: var(--success); animation: pulse 2s infinite; }
.store-dot[data-status="reconnecting"] .store-dot-circle { background: var(--success); animation: pulse 0.8s infinite; }
.store-dot[data-status="qr"]           .store-dot-circle { background: var(--warning); animation: pulse 1s infinite; }
.store-dot[data-status="qr_wait"]      .store-dot-circle { background: var(--warning); }
.store-dot[data-status="connecting"]   .store-dot-circle { background: var(--warning); }
.store-dot[data-status="disconnected"] .store-dot-circle { background: var(--danger); }
.store-dot[data-status="failed"]       .store-dot-circle { background: var(--danger); }

@keyframes pulse {
  0%,100% { opacity: 1; }
  50% { opacity: 0.45; }
}

/* User info */
.user-info {
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-name {
  font-size: 13px;
  font-weight: 600;
  color: rgba(255,255,255,0.95);
}

.user-role-badge {
  font-size: 11px;
  padding: 2px 8px;
  background: rgba(255,255,255,0.2);
  border-radius: 10px;
  color: rgba(255,255,255,0.8);
  font-weight: 500;
}

.btn-logout {
  padding: 6px 12px;
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 8px;
  color: rgba(255,255,255,0.9);
  cursor: pointer;
  font-size: 14px;
  transition: background 0.2s;
}

.btn-logout:hover { background: rgba(255,255,255,0.25); }

/* Date filters */
.date-filters {
  display: flex;
  align-items: center;
  gap: 8px;
}

.date-filters span {
  color: rgba(255,255,255,0.7);
  font-size: 13px;
}

.date-filters input[type="date"] {
  padding: 7px 10px;
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: var(--radius-sm);
  font-size: 13px;
  background: rgba(255,255,255,0.12);
  color: #fff;
  outline: none;
}

.date-filters input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(1);
}

.date-filters button {
  padding: 7px 14px;
  background: rgba(255,255,255,0.2);
  color: white;
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: background 0.2s;
}

.date-filters button:hover { background: rgba(255,255,255,0.3); }

/* ── Tabs ── */
.tabs {
  display: flex;
  gap: 4px;
  background: rgba(0,0,0,0.2);
  padding: 4px;
  border-radius: 24px;
}

.tab {
  padding: 7px 18px;
  border: none;
  border-radius: 20px;
  background: transparent;
  color: rgba(255,255,255,0.7);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  white-space: nowrap;
}

.tab:hover { background: rgba(255,255,255,0.15); color: #fff; }

.tab.active {
  background: #ffffff;
  color: var(--secondary);
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

/* ── QR Section ── */
.qr-section {
  background: var(--card-bg);
  padding: 40px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 20px;
  text-align: center;
}

.qr-container h2 { margin-bottom: 20px; color: var(--secondary); }
.qr-container img { max-width: 280px; margin: 16px auto; border-radius: var(--radius); box-shadow: var(--shadow-lg); display: block; }
.qr-container p { color: var(--text-secondary); font-size: 14px; }

/* ── Dashboard ── */
.dashboard-header {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 16px;
  gap: 10px;
}

.btn-export {
  padding: 8px 16px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--primary-dark);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, box-shadow 0.2s;
}

.btn-export:hover { background: var(--background); box-shadow: var(--shadow); }

/* ── Stats Grid ── */
.stats-grid {
  display: flex;
  flex-wrap: nowrap;
  gap: 14px;
  margin-bottom: 20px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.stats-grid .stat-card {
  flex: 1 0 180px;
  min-width: 170px;
}

.stat-card {
  background: var(--card-bg);
  padding: 20px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 16px;
  transition: transform 0.2s, box-shadow 0.2s;
  border-left: 4px solid transparent;
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0.04;
  background: currentColor;
}

.stat-card { cursor: pointer; }
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.stat-card:hover::after {
  content: '↗';
  position: absolute;
  top: 10px;
  right: 12px;
  font-size: 13px;
  opacity: 0.45;
  color: currentColor;
}

.stat-card--blue  { border-left-color: #4361ee; color: #4361ee; }
.stat-card--green { border-left-color: var(--primary); color: var(--primary); }
.stat-card--orange{ border-left-color: var(--warning); color: var(--warning); }
.stat-card--purple{ border-left-color: #6366f1; color: #6366f1; }
.stat-card--red   { border-left-color: var(--danger); color: var(--danger); }
.stat-card--teal  { border-left-color: #0d9488; color: #0d9488; }

.stat-icon-wrap {
  font-size: 28px;
  width: 54px;
  height: 54px;
  border-radius: var(--radius);
  background: var(--background);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-value {
  font-size: 32px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
}

.stat-label {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 5px;
  font-weight: 500;
}

.stat-sublabel {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 3px;
  opacity: 0.75;
}

/* ── Charts Grid ── */
.charts-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

.charts-grid--3 { grid-template-columns: repeat(3, 1fr); }
.charts-grid--2 { grid-template-columns: repeat(2, 1fr); }

@media (max-width: 1100px) {
  .charts-grid--3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 700px) {
  .charts-grid--3, .charts-grid--2 { grid-template-columns: 1fr; }
}

.chart-card {
  background: var(--card-bg);
  padding: 20px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
}

.chart-card h3 {
  margin-bottom: 14px;
  color: var(--secondary);
  font-size: 15px;
  font-weight: 700;
}

.chart-wrap {
  position: relative;
  flex: 1;
  min-height: 200px;
  max-height: 320px;
  overflow: hidden;
}

.chart-wrap--donut {
  min-height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Filtro de período */
.period-filter {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.period-btn {
  padding: 6px 16px;
  border-radius: 20px;
  border: 1.5px solid var(--border);
  background: var(--card-bg);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.period-btn:hover { border-color: var(--primary); color: var(--primary); }
.period-btn.active { background: var(--primary); border-color: var(--primary); color: white; }

/* Filtro de dispositivo/agente */
.agent-filter {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.agent-filter-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
}

.agent-filter-btns {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.agent-filter-btn {
  padding: 6px 16px;
  border-radius: 20px;
  border: 1.5px solid var(--border);
  background: var(--card-bg);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.agent-filter-btn:hover { border-color: var(--accent); color: var(--accent); }
.agent-filter-btn.active { background: var(--accent); border-color: var(--accent); color: white; }

/* Lista clientes molestos */
.angry-list { display: flex; flex-direction: column; gap: 8px; max-height: 280px; overflow-y: auto; }

.angry-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: #fff5f5;
  border: 1px solid #fecaca;
  cursor: pointer;
  transition: background 0.15s;
}

.angry-item:hover { background: #fee2e2; }

.angry-item-avatar { font-size: 22px; flex-shrink: 0; }

.angry-item-info { flex: 1; min-width: 0; }
.angry-item-name { font-weight: 700; font-size: 14px; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.angry-item-time { font-size: 11px; color: var(--text-secondary); }

.angry-item-score {
  font-size: 13px;
  font-weight: 700;
  color: var(--danger);
  flex-shrink: 0;
}

.angry-empty { color: var(--text-secondary); font-size: 14px; padding: 20px 0; text-align: center; }

.agent-list { max-height: 300px; overflow-y: auto; }
.agent-list--table { max-height: none; }

.agent-item {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.agent-item:last-child { border-bottom: none; }

.agent-name { font-weight: 600; font-size: 14px; color: var(--text-primary); }

.agent-stats { display: flex; gap: 12px; font-size: 13px; color: var(--text-secondary); }

.agent-stat { display: flex; align-items: center; gap: 4px; }

.agent-stat-value { font-weight: 700; color: var(--primary-dark); }

/* ── Tables ── */
.table-card {
  background: var(--card-bg);
  padding: 20px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}

.table-card h3 { margin-bottom: 16px; color: var(--secondary); font-size: 16px; font-weight: 700; }

/* ── Response Log ── */
.response-log-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}
.response-log-header h3 { margin-bottom: 0; }
.response-log-controls { display: flex; align-items: center; gap: 8px; }

.log-summary {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.log-summary-chip {
  background: var(--background);
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}
.log-summary-chip strong { color: var(--text-primary); }
.log-summary-chip.chip-ok     { background: #d1fae5; color: #065f46; }
.log-summary-chip.chip-warn   { background: #fef3c7; color: #92400e; }
.log-summary-chip.chip-danger { background: #fee2e2; color: #991b1b; }

.log-entry {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0 16px;
  align-items: start;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.12s;
  border-radius: var(--radius-sm);
  padding: 10px 8px;
}
.log-entry:last-child { border-bottom: none; }
.log-entry:hover { background: var(--background); }

.log-entry-index {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
  width: 24px;
  text-align: center;
  padding-top: 2px;
}

.log-entry-main { min-width: 0; }

.log-entry-contact {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.log-entry-times {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 3px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.log-entry-arrow { color: var(--primary); font-weight: 700; }

.log-entry-preview {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 480px;
  font-style: italic;
}

.log-entry-badge {
  font-size: 13px;
  font-weight: 800;
  padding: 4px 12px;
  border-radius: 20px;
  white-space: nowrap;
  align-self: center;
}
.log-badge--ok     { background: #d1fae5; color: #065f46; }
.log-badge--warn   { background: #fef3c7; color: #92400e; }
.log-badge--danger { background: #fee2e2; color: #991b1b; }

.log-empty { text-align: center; color: var(--text-secondary); padding: 32px 0; font-size: 14px; }
.log-agent { font-size: 11px; color: var(--text-secondary); margin-top: 2px; }

/* Stat period label */
.stat-period-label { font-size: 12px; font-weight: 400; color: var(--text-secondary); margin-left: 6px; }

/* Abandoned responses table */
.abandoned-scroll { max-height: 280px; overflow-y: auto; }
.abandoned-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.abandoned-table thead th {
  position: sticky; top: 0; background: var(--card-bg);
  text-align: left; padding: 7px 10px;
  border-bottom: 2px solid var(--border);
  font-size: 11px; font-weight: 600; color: var(--text-secondary);
  white-space: nowrap;
}
.abandoned-row td { padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.abandoned-row:last-child td { border-bottom: none; }
.abandoned-contact { display: flex; align-items: center; gap: 8px; min-width: 0; }
.abandoned-contact span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 130px; }
.abandoned-avatar {
  width: 28px; height: 28px; border-radius: 50%; object-fit: cover; flex-shrink: 0;
}
.abandoned-avatar--placeholder {
  background: var(--primary); color: white;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
}
.abandoned-mins { font-weight: 600; white-space: nowrap; }
.abandoned-empty {
  text-align: center; padding: 40px 16px;
  color: var(--text-secondary); font-size: 13px;
}

.abandoned--warn     td:nth-child(3) { color: #d97706; font-weight: 600; }
.abandoned--high     td:nth-child(3) { color: #ea580c; font-weight: 600; }
.abandoned--critical td:nth-child(3) { color: #dc2626; font-weight: 700; }
.abandoned--warn     { background: #fffbeb; }
.abandoned--high     { background: #fff7ed; }
.abandoned--critical { background: #fef2f2; }

.table-container { overflow-x: auto; }

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

thead { background: var(--background); }

th {
  padding: 11px 12px;
  text-align: left;
  font-weight: 700;
  color: var(--text-secondary);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

td { padding: 11px 12px; border-top: 1px solid var(--border); color: var(--text-primary); font-size: 14px; }

tbody tr:hover { background: var(--background); }

.pending-urgent { color: var(--danger); font-weight: 700; }
.pending-warning { color: var(--warning); font-weight: 700; }
.pending-ok { color: var(--success); }

/* ── Pending board ── */
.pending-count-badge {
  background: var(--danger);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  margin-left: 8px;
  vertical-align: middle;
}

.pending-board {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 8px;
}

.pending-empty {
  color: var(--text-secondary);
  text-align: center;
  padding: 24px 0;
  font-size: 14px;
}

.pending-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-radius: 12px;
  background: var(--surface);
  border-left: 4px solid transparent;
  transition: background 0.15s;
}
.pending-card:hover { background: var(--background); }
.pending-card--ok      { border-left-color: var(--success); }
.pending-card--warning { border-left-color: var(--warning); }
.pending-card--urgent  { border-left-color: var(--danger); }

.pending-card-avatar {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
}
.pending-avatar-img {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
}
.pending-avatar-initials {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pending-card-body {
  flex: 1;
  min-width: 0;
}
.pending-card-top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}
.pending-card-name {
  font-weight: 600;
  font-size: 15px;
  color: var(--text-primary);
}
.pending-card-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.pending-card-badge--ok      { background: rgba(6,207,156,0.15); color: #049b73; }
.pending-card-badge--warning { background: rgba(252,186,3,0.15);  color: #b88700; }
.pending-card-badge--urgent  { background: rgba(255,71,87,0.15);  color: #cc2030; }

.pending-card-preview {
  font-size: 13px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 5px;
}
.pending-card-meta {
  display: flex;
  gap: 16px;
  font-size: 12px;
  color: var(--text-secondary);
}

.pending-card-btn {
  flex-shrink: 0;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
  white-space: nowrap;
}
.pending-card-btn:hover { opacity: 0.85; }

/* ── Badges ── */
.badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.badge-success { background: rgba(6,207,156,0.15); color: #049b73; }
.badge-warning { background: rgba(252,186,3,0.15);  color: #b88700; }
.badge-danger  { background: rgba(255,71,87,0.15);  color: #cc2030; }
.badge-ok      { background: rgba(6,207,156,0.15); color: #049b73; }

/* Role badges */
.role-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
}

.role-op    { background: rgba(52,183,241,0.15); color: #0d6efd; }
.role-admin { background: rgba(123,45,139,0.15); color: #7b2d8b; }
.role-user  { background: rgba(37,211,102,0.15); color: #128C7E; }

/* ── Activity Feed ── */
.activity-feed {
  position: fixed;
  right: 20px;
  bottom: 20px;
  width: 300px;
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  max-height: 380px;
  z-index: 100;
  overflow: hidden;
}

.activity-feed h4 {
  padding: 12px 16px;
  background: linear-gradient(135deg, var(--secondary), var(--primary-dark));
  color: white;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.feed-toggle-arrow {
  font-size: 10px;
  transition: transform 0.2s ease;
}

.activity-feed--collapsed .feed-toggle-arrow {
  transform: rotate(-90deg);
}

.activity-feed--collapsed .feed-messages {
  display: none;
}

.activity-feed--collapsed {
  max-height: none;
}

.feed-messages { max-height: 320px; overflow-y: auto; padding: 8px; }

.feed-message {
  padding: 7px 10px;
  margin-bottom: 6px;
  background: var(--background);
  border-radius: var(--radius-sm);
  font-size: 12px;
  animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

.feed-message.inbound  { border-left: 3px solid var(--primary); }
.feed-message.outbound { border-left: 3px solid var(--secondary); }
.feed-message.response { border-left: 3px solid var(--success); }
.feed-message--clickable { cursor: pointer; }
.feed-message--clickable:hover { background: var(--hover); }
.feed-msg-main { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 12px; }
.feed-store-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  white-space: nowrap;
  flex-shrink: 0;
}
.feed-time { font-size: 11px; color: var(--text-secondary); margin-top: 3px; }

/* ── Chat Module ── */
.chat-module {
  display: flex;
  height: calc(100vh - 150px);
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.chat-list-panel {
  width: 290px;
  min-width: 290px;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  background: #f8f9fa;
}

.chat-search-bar { padding: 10px; border-bottom: 1px solid var(--border); }

.chat-search-bar input {
  width: 100%;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 14px;
  outline: none;
  background: var(--card-bg);
}

.chat-list { flex: 1; overflow-y: auto; }

.chat-empty { padding: 24px 20px; text-align: center; color: var(--text-secondary); font-size: 14px; }

.chat-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
  position: relative;
}

.chat-item:hover { background: var(--border); }

.chat-item.active { background: #e8f5e9; border-left: 3px solid var(--primary); }

/* ── Member status row tinting ── */
.chat-item.member-activo {
  background: rgba(37, 211, 102, 0.06);
  border-left: 3px solid #25D366;
}
.chat-item.member-activo:hover { background: rgba(37, 211, 102, 0.12); }
.chat-item.member-vencido {
  background: rgba(239, 68, 68, 0.06);
  border-left: 3px solid #ef4444;
}
.chat-item.member-vencido:hover { background: rgba(239, 68, 68, 0.12); }
.chat-item.member-revision {
  background: rgba(245, 158, 11, 0.06);
  border-left: 3px solid #f59e0b;
}
.chat-item.member-revision:hover { background: rgba(245, 158, 11, 0.12); }

.chat-avatar-wrap {
  position: relative;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
}

.chat-avatar-img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

.chat-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--primary-dark);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
  flex-shrink: 0;
}

.conv-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary-dark);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 700;
  flex-shrink: 0;
  overflow: hidden;
}

.conv-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

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

.chat-item-body { flex: 1; min-width: 0; }

.chat-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2px;
}

.chat-item-name { font-weight: 700; font-size: 14px; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-item-time { font-size: 11px; color: var(--text-secondary); flex-shrink: 0; }
.chat-item-preview { font-size: 12px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.unread-dot { width: 9px; height: 9px; background: var(--primary); border-radius: 50%; flex-shrink: 0; }

.sentiment-badge { font-size: 14px; flex-shrink: 0; }

.prospect-tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 4px;
  background: #f59e0b22;
  color: #d97706;
  border: 1px solid #f59e0b44;
  margin-top: 2px;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

/* Conversation Panel */
.conversation-panel { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.conversation-placeholder {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  gap: 12px;
}

.placeholder-icon { font-size: 48px; opacity: 0.35; }

.conversation-header {
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--card-bg);
  flex-shrink: 0;
}

.conv-name { font-weight: 700; font-size: 16px; color: var(--text-primary); }
.conv-status { font-size: 12px; color: var(--text-secondary); }
.conv-badges { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }

.conv-badge { padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 700; }
.conv-badge.angry      { background: #ffeaea; color: var(--danger); }
.conv-badge.neutral    { background: #f0f2f5; color: var(--text-secondary); }
.conv-badge.satisfied  { background: #e6fff5; color: #00a86b; }
.conv-badge.unresolved { background: #fff8e1; color: #e67e00; }
.conv-badge.flag       { background: #f0e6ff; color: #7c3aed; }

.conv-summary {
  font-size: 12px;
  color: var(--text-secondary);
  padding: 4px 12px 6px;
  font-style: italic;
  border-top: 1px solid var(--border);
  width: 100%;
}

/* Messages */
.conv-messages-wrap {
  position: relative;
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.messages-container {
  flex: 1;
  overflow-y: auto;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: #efeae2;
}

.chat-date-float {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  background: rgba(30, 41, 59, 0.82);
  color: #f8fafc;
  padding: 4px 14px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
  pointer-events: none;
  backdrop-filter: blur(6px);
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.25s;
  text-transform: capitalize;
}
.chat-date-float.visible { opacity: 1; }

/* ── Date separator ── */
.date-separator {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 14px 8px;
  color: var(--text-secondary);
  font-size: 12px;
}
.date-separator::before,
.date-separator::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}
.date-separator span {
  white-space: nowrap;
  background: var(--bg);
  padding: 3px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  font-weight: 500;
  text-transform: capitalize;
}

.bubble {
  max-width: 65%;
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 14px;
  line-height: 1.5;
  position: relative;
  word-break: break-word;
  box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.bubble.in  { align-self: flex-start; background: var(--card-bg); border-top-left-radius: 2px; }
.bubble.out { align-self: flex-end; background: #d9fdd3; border-top-right-radius: 2px; }

.bubble-time { font-size: 10px; color: var(--text-secondary); text-align: right; margin-top: 3px; }

.bubble-reactions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}
.bubble-reaction {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: rgba(0,0,0,0.06);
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 12px;
  padding: 2px 7px;
  font-size: 14px;
  line-height: 1.3;
  cursor: default;
  transition: transform 0.1s;
}
.bubble.out .bubble-reaction { background: rgba(255,255,255,0.18); border-color: rgba(255,255,255,0.2); }
.bubble-reaction:hover { transform: scale(1.15); }
.bubble-reaction-count { font-size: 11px; font-weight: 600; color: var(--text-secondary); }
.bubble.out .bubble-reaction-count { color: rgba(255,255,255,0.75); }
.bubble-agent { font-size: 11px; color: var(--primary-dark); font-weight: 700; margin-bottom: 2px; }

.chat-img { max-width: 220px; max-height: 220px; border-radius: 8px; cursor: zoom-in; display: block; margin-top: 4px; }
.chat-sticker { width: 120px; height: 120px; object-fit: contain; display: block; margin-top: 2px; background: transparent; }
.chat-audio { display: block; margin-top: 4px; width: 220px; height: 36px; border-radius: 20px; accent-color: var(--primary); }
.chat-video { max-width: 260px; max-height: 260px; border-radius: 8px; display: block; margin-top: 4px; background: #000; }
.chat-gif { max-width: 220px; max-height: 220px; border-radius: 8px; cursor: zoom-in; display: block; margin-top: 4px; }
.chat-doc { margin-top: 6px; }
.chat-doc .doc-link {
  display: flex; align-items: center; gap: 8px; padding: 10px 14px;
  background: var(--bg-secondary, #f0f0f0); border-radius: 10px;
  text-decoration: none; color: var(--text-primary, #333);
  transition: background 0.2s;
}
.chat-doc .doc-link:hover { background: var(--bg-hover, #e4e4e4); }
.chat-doc .doc-icon { font-size: 24px; }
.chat-doc .doc-name { flex: 1; font-size: 13px; font-weight: 500; word-break: break-all; }
.chat-doc .doc-action { font-size: 11px; color: var(--primary, #25D366); font-weight: 600; white-space: nowrap; }
[data-theme="dark"] .chat-doc .doc-link { background: rgba(255,255,255,0.08); color: #e0e0e0; }
[data-theme="dark"] .chat-doc .doc-link:hover { background: rgba(255,255,255,0.14); }
.msg-type-icon { color: var(--text-secondary); font-size: 13px; font-style: italic; }

/* Input bar */
.message-input-bar {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: var(--card-bg);
  flex-shrink: 0;
}

/* ── Fila normal (textarea + botones) ── */
.input-row {
  display: flex;
  width: 100%;
  align-items: flex-end;
  gap: 8px;
  background: var(--background);
  border: 1.5px solid var(--border);
  border-radius: 26px;
  padding: 6px 6px 6px 16px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.input-row:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,211,102,0.12);
}

.message-input-bar textarea {
  flex: 1;
  min-width: 0;
  padding: 6px 0;
  border: none;
  background: transparent;
  border-radius: 0;
  font-size: 14px;
  resize: none;
  outline: none;
  max-height: 120px;
  min-height: 28px;
  font-family: inherit;
  line-height: 1.5;
  color: var(--text-primary);
}

.message-input-bar textarea::placeholder { color: var(--text-secondary); }

.send-btn, .mic-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  border: none;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
  box-shadow: 0 2px 6px rgba(37,211,102,0.35);
}

.send-btn:hover, .mic-btn:hover {
  background: var(--primary-dark);
  box-shadow: 0 3px 10px rgba(37,211,102,0.45);
}
.send-btn:active, .mic-btn:active  { transform: scale(0.91); }
.send-btn:disabled, .mic-btn:disabled {
  background: var(--border);
  color: var(--text-secondary);
  box-shadow: none;
  cursor: not-allowed;
}

/* ── Fila de grabación ── */
.recording-row {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 10px;
  background: #fff5f5;
  border: 1.5px solid #ffd0d0;
  border-radius: 26px;
  padding: 8px 8px 8px 14px;
  animation: fadeIn 0.18s ease;
}

@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.rec-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--danger);
  flex-shrink: 0;
  animation: blink 1s infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.15; }
}

.rec-timer {
  font-size: 15px;
  font-weight: 700;
  color: var(--danger);
  min-width: 38px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

.rec-label {
  flex: 1;
  font-size: 13px;
  color: #c0392b;
  font-style: italic;
}

.rec-cancel-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--border);
  color: var(--text-secondary);
  border: none;
  cursor: pointer;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
}
.rec-cancel-btn:hover { background: #e0e0e0; color: var(--danger); }

.rec-send-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  border: none;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s, transform 0.1s;
  box-shadow: 0 2px 6px rgba(37,211,102,0.35);
}
.rec-send-btn:hover  { background: var(--primary-dark); }
.rec-send-btn:active { transform: scale(0.91); }
.rec-send-btn:disabled { background: var(--border); box-shadow: none; cursor: not-allowed; }

/* ── Admin Panel ── */
.admin-panel { display: block; }

.admin-section {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 20px;
  padding: 20px;
}

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

.admin-section-header h3 { font-size: 16px; font-weight: 700; color: var(--secondary); }

.btn-primary {
  padding: 8px 18px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

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

.btn-secondary {
  padding: 8px 18px;
  background: var(--background);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-secondary:hover { background: var(--border); }

.btn-icon {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
  padding: 4px 6px;
  border-radius: 6px;
  transition: background 0.15s;
}

.btn-icon:hover { background: var(--background); }
.btn-icon.btn-danger:hover { background: rgba(255,71,87,0.1); }

/* Store admin items */
.stores-list { display: flex; flex-direction: column; gap: 10px; }

.store-admin-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: var(--background);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.store-admin-info { display: flex; flex-direction: column; }
.store-id-label { font-size: 12px; color: var(--text-secondary); font-family: monospace; }

/* WA Connection items */
.wa-connections-list { display: flex; flex-direction: column; gap: 12px; }

.wa-conn-item {
  padding: 12px 16px;
  background: var(--background);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.wa-conn-info {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

/* ── Botones de tarjetas de tienda ─────────────────────────────── */
.wa-conn-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

/* Base compartida */
.btn-qr, .btn-refresh-qr, .btn-sync, .btn-recalc, .btn-disconnect {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 13px;
  border: none;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  color: white;
  transition: transform 0.12s ease, box-shadow 0.15s ease, filter 0.15s ease;
  box-shadow: 0 2px 6px rgba(0,0,0,0.18), inset 0 1px 0 rgba(255,255,255,0.15);
  position: relative;
  white-space: nowrap;
  user-select: none;
}

.btn-qr, .btn-refresh-qr, .btn-sync, .btn-recalc, .btn-disconnect {
  will-change: transform;
}

.btn-qr:hover:not(:disabled),
.btn-refresh-qr:hover:not(:disabled),
.btn-sync:hover:not(:disabled),
.btn-recalc:hover:not(:disabled),
.btn-disconnect:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.22), inset 0 1px 0 rgba(255,255,255,0.18);
  filter: brightness(1.08);
}

.btn-qr:active:not(:disabled),
.btn-refresh-qr:active:not(:disabled),
.btn-sync:active:not(:disabled),
.btn-recalc:active:not(:disabled),
.btn-disconnect:active:not(:disabled) {
  transform: translateY(0px) scale(0.97);
  box-shadow: 0 1px 4px rgba(0,0,0,0.18), inset 0 1px 0 rgba(255,255,255,0.1);
  filter: brightness(0.96);
}

.btn-qr:disabled,
.btn-refresh-qr:disabled,
.btn-sync:disabled,
.btn-recalc:disabled,
.btn-disconnect:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  box-shadow: none;
}

/* Colores individuales */
.btn-qr         { background: linear-gradient(145deg, #25D366, #1aad54); }
.btn-refresh-qr { background: linear-gradient(145deg, #34B7F1, #1a9fd4); }
.btn-sync       { background: linear-gradient(145deg, #22c55e, #16a34a); }
.btn-recalc     { background: linear-gradient(145deg, #6366f1, #4f46e5); }
.btn-disconnect { background: linear-gradient(145deg, #ef4444, #dc2626); }

.inline-qr { margin-top: 8px; }

/* WA store status badges */
.wa-store-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.wa-store-badge.status-connected    { background: rgba(6,207,156,0.15);  color: #049b73; }
.wa-store-badge.status-disconnected { background: rgba(255,71,87,0.12);  color: #cc2030; }
.wa-store-badge.status-qr           { background: rgba(252,186,3,0.15);  color: #b88700; }
.wa-store-badge.status-qr_wait      { background: rgba(252,186,3,0.10);  color: #a07000; }
.wa-store-badge.status-pairing      { background: rgba(52,183,241,0.15); color: #0d6efd; }
.wa-store-badge.status-failed       { background: rgba(255,71,87,0.15);  color: #cc2030; }
.wa-store-badge.status-connecting   { background: rgba(52,183,241,0.15); color: #0d6efd; }

/* ── Global Panel ── */
.global-panel { display: block; }

/* ── Modals ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
  padding: 20px;
}

.modal-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 { font-size: 17px; font-weight: 700; color: var(--text-primary); }

.modal-close {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 4px 8px;
  border-radius: 6px;
}

.modal-close:hover { background: var(--background); }

.modal-form { padding: 20px; display: flex; flex-direction: column; gap: 14px; }

.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group label { font-size: 13px; font-weight: 600; color: var(--text-primary); }

.form-group input, .form-group select {
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
  font-family: inherit;
}

.form-group input:focus, .form-group select:focus { border-color: var(--primary); }

.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 4px; }

/* ── Lightbox ── */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  cursor: zoom-out;
}

.lightbox img { max-width: 90vw; max-height: 90vh; border-radius: var(--radius-sm); }

/* ── Contact Profile Drawer ── */
.profile-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  z-index: 900;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}
.profile-overlay.open { opacity: 1; pointer-events: all; }

.profile-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: 320px;
  height: 100%;
  background: var(--card-bg);
  z-index: 901;
  box-shadow: -4px 0 24px rgba(0,0,0,0.15);
  transform: translateX(100%);
  transition: transform 0.25s cubic-bezier(.4,0,.2,1);
  overflow-y: auto;
}
.profile-drawer.open { transform: translateX(0); }

.profile-drawer-inner { padding: 0 0 32px; }

.profile-close {
  position: absolute;
  top: 14px;
  right: 16px;
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 4px 8px;
  border-radius: 6px;
  z-index: 1;
}
.profile-close:hover { background: var(--border); }

.profile-avatar-wrap {
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  padding: 36px 0 28px;
  display: flex;
  justify-content: center;
}

.profile-avatar {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: rgba(255,255,255,0.25);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  font-weight: 700;
  overflow: hidden;
  border: 3px solid rgba(255,255,255,0.4);
}

.profile-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.profile-name {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  text-align: center;
  padding: 20px 24px 4px;
}

.profile-phone {
  font-size: 14px;
  color: var(--text-secondary);
  text-align: center;
  padding: 0 24px 16px;
}

.profile-section-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 16px 24px 8px;
  border-top: 1px solid var(--border);
}

.profile-row {
  display: flex;
  flex-direction: column;
  padding: 10px 24px;
  gap: 2px;
  border-bottom: 1px solid var(--border);
}

.profile-label {
  font-size: 11px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.profile-value {
  font-size: 14px;
  color: var(--text-primary);
  font-weight: 500;
  word-break: break-all;
}

.profile-jid { font-family: monospace; font-size: 12px; color: var(--text-secondary); }

/* ── Loading ── */
.spinner {
  border: 3px solid var(--border);
  border-top: 3px solid var(--primary);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  animation: spin 1s linear infinite;
  margin: 20px auto;
}

@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* ── Messages loading skeleton ── */
.msgs-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  height: 100%;
}
.msgs-loading-spinner {
  border: 3px solid var(--border);
  border-top: 3px solid var(--primary);
  border-radius: 50%;
  width: 28px;
  height: 28px;
  animation: spin 0.8s linear infinite;
}

/* ── Sync chats button ── */
.btn-sync-chats {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 16px;
  padding: 4px 6px;
  border-radius: 6px;
  transition: color 0.15s, background 0.15s;
}
.btn-sync-chats:hover { color: var(--primary); background: var(--hover); }
.btn-sync-chats.syncing { animation: spin 0.8s linear infinite; pointer-events: none; color: var(--primary); }

/* ── Stat Detail Drawer ── */
.stat-drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  z-index: 900;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}
.stat-drawer-overlay.open { opacity: 1; pointer-events: all; }

.stat-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: 420px;
  max-width: 100vw;
  height: 100%;
  background: var(--card-bg);
  z-index: 901;
  box-shadow: -4px 0 24px rgba(0,0,0,0.15);
  transform: translateX(100%);
  transition: transform 0.28s cubic-bezier(.4,0,.2,1);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
.stat-drawer.open { transform: translateX(0); }

.stat-drawer-inner { flex: 1; display: flex; flex-direction: column; }

.stat-drawer-close {
  position: absolute;
  top: 14px;
  right: 16px;
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: rgba(255,255,255,0.75);
  padding: 4px 8px;
  border-radius: 6px;
  z-index: 1;
}
.stat-drawer-close:hover { background: rgba(255,255,255,0.15); }

.stat-drawer-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 32px 24px 28px;
  color: white;
}
.stat-drawer-header.color-blue   { background: linear-gradient(135deg,#4361ee,#3a0ca3); }
.stat-drawer-header.color-orange { background: linear-gradient(135deg,#f77f00,#d62828); }
.stat-drawer-header.color-green  { background: linear-gradient(135deg,#128C7E,#25D366); }
.stat-drawer-header.color-purple { background: linear-gradient(135deg,#6366f1,#8b5cf6); }
.stat-drawer-header.color-red    { background: linear-gradient(135deg,#ef4444,#dc2626); }
.stat-drawer-header.color-teal   { background: linear-gradient(135deg,#0d9488,#14b8a6); }

.stat-drawer-icon { font-size: 40px; line-height: 1; }

.stat-drawer-title {
  font-size: 22px;
  font-weight: 800;
  line-height: 1.1;
}
.stat-drawer-subtitle {
  font-size: 13px;
  opacity: 0.8;
  margin-top: 4px;
}

.stat-drawer-body {
  flex: 1;
  padding: 20px;
}

/* Loading state */
.stat-drawer-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 48px 0;
  gap: 12px;
  color: var(--text-secondary);
}

/* Section inside drawer */
.drawer-section {
  margin-bottom: 20px;
}
.drawer-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-secondary);
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

/* Metric row */
.drawer-metric-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--background);
  margin-bottom: 6px;
}
.drawer-metric-label { font-size: 13px; color: var(--text-secondary); }
.drawer-metric-value { font-size: 15px; font-weight: 700; color: var(--text-primary); }

/* List items */
.drawer-list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s;
  border-radius: var(--radius-sm);
  padding: 10px 10px;
}
.drawer-list-item:last-child { border-bottom: none; }
.drawer-list-item:hover { background: var(--background); }

.drawer-list-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
  color: var(--text-secondary);
  flex-shrink: 0;
  overflow: hidden;
}
.drawer-list-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }

.drawer-list-info { flex: 1; min-width: 0; }
.drawer-list-name { font-size: 14px; font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.drawer-list-meta { font-size: 12px; color: var(--text-secondary); margin-top: 1px; }

.drawer-list-right { margin-left: auto; text-align: right; flex-shrink: 0; }
.drawer-list-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 20px;
  white-space: nowrap;
}
.drawer-list-badge--urgent  { background: #fee2e2; color: #dc2626; }
.drawer-list-badge--warning { background: #fef3c7; color: #d97706; }
.drawer-list-badge--ok      { background: #d1fae5; color: #059669; }
.drawer-list-badge--neutral { background: var(--background); color: var(--text-secondary); }

/* Chart inside drawer */
.drawer-chart-wrap {
  position: relative;
  height: 180px;
  margin-bottom: 16px;
}

/* Agent bar */
.drawer-agent-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.drawer-agent-bar-name { font-size: 13px; font-weight: 600; width: 110px; flex-shrink: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.drawer-agent-bar-track { flex: 1; background: var(--border); border-radius: 4px; height: 8px; }
.drawer-agent-bar-fill  { height: 8px; border-radius: 4px; background: var(--primary); transition: width 0.4s; }
.drawer-agent-bar-val   { font-size: 12px; font-weight: 700; color: var(--text-secondary); width: 36px; text-align: right; }

.drawer-empty {
  text-align: center;
  color: var(--text-secondary);
  font-size: 14px;
  padding: 32px 0;
}

/* ── Responsive ── */
@media (max-width: 900px) {
  .header { flex-wrap: wrap; }
  .charts-grid { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  .activity-feed { width: 100%; right: 0; left: 0; border-radius: var(--radius) var(--radius) 0 0; }
  .tabs { flex-wrap: wrap; }
}

/* ── Dark Mode ── */
[data-theme="dark"] {
  --background:    #0b141a;
  --card-bg:       #1f2c34;
  --text-primary:  #e9edef;
  --text-secondary:#8696a0;
  --border:        #2a3942;
  --shadow:        0 2px 8px rgba(0,0,0,0.40);
  --shadow-lg:     0 12px 32px rgba(0,0,0,0.50);
}

[data-theme="dark"] .header {
  background: linear-gradient(135deg, #0d1418 0%, #1f2c34 100%);
}

[data-theme="dark"] .tab-content,
[data-theme="dark"] .card,
[data-theme="dark"] .stat-card,
[data-theme="dark"] .chart-card,
[data-theme="dark"] .chat-panel,
[data-theme="dark"] .conversation-panel,
[data-theme="dark"] .pending-card,
[data-theme="dark"] .agent-item,
[data-theme="dark"] .log-entry,
[data-theme="dark"] .chat-sidebar,
[data-theme="dark"] .admin-section,
[data-theme="dark"] .modal-content,
[data-theme="dark"] .stat-drawer-panel {
  background: var(--card-bg);
  color: var(--text-primary);
}

[data-theme="dark"] .chat-list {
  background: #111b21;
}

[data-theme="dark"] .chat-item {
  border-bottom-color: var(--border);
}

[data-theme="dark"] .chat-item:hover,
[data-theme="dark"] .chat-item.active {
  background: #2a3942;
}
[data-theme="dark"] .chat-item.member-activo {
  background: rgba(37, 211, 102, 0.08);
  border-left: 3px solid #25D366;
}
[data-theme="dark"] .chat-item.member-activo:hover { background: rgba(37, 211, 102, 0.15); }
[data-theme="dark"] .chat-item.member-vencido {
  background: rgba(239, 68, 68, 0.08);
  border-left: 3px solid #ef4444;
}
[data-theme="dark"] .chat-item.member-vencido:hover { background: rgba(239, 68, 68, 0.15); }
[data-theme="dark"] .chat-item.member-revision {
  background: rgba(245, 158, 11, 0.08);
  border-left: 3px solid #f59e0b;
}
[data-theme="dark"] .chat-item.member-revision:hover { background: rgba(245, 158, 11, 0.15); }

[data-theme="dark"] .chat-search-wrap {
  background: #1f2c34;
  border-bottom-color: var(--border);
}

[data-theme="dark"] .chat-search {
  background: #2a3942;
  color: var(--text-primary);
  border-color: var(--border);
}

[data-theme="dark"] .messages-container {
  background: #0b141a;
}

[data-theme="dark"] .bubble.in {
  background: #1f2c34;
  color: var(--text-primary);
}

[data-theme="dark"] .bubble.out {
  background: #005c4b;
  color: #e9edef;
}

[data-theme="dark"] .message-input-bar {
  background: #1f2c34;
  border-top-color: var(--border);
}

[data-theme="dark"] #messageInput {
  background: #2a3942;
  color: var(--text-primary);
  border-color: var(--border);
}

[data-theme="dark"] #messageInput::placeholder {
  color: var(--text-secondary);
}

[data-theme="dark"] .conv-header {
  background: #1f2c34;
  border-bottom-color: var(--border);
}

[data-theme="dark"] .stat-card .stat-value {
  color: var(--text-primary);
}

[data-theme="dark"] .stat-card .stat-label {
  color: var(--text-secondary);
}

[data-theme="dark"] table th {
  background: #2a3942;
  color: var(--text-secondary);
}

[data-theme="dark"] table td {
  border-bottom-color: var(--border);
  color: var(--text-primary);
}

[data-theme="dark"] .tab {
  color: rgba(255,255,255,0.7);
}

[data-theme="dark"] .tab.active {
  color: #fff;
}

[data-theme="dark"] .modal-content {
  border-color: var(--border);
}

[data-theme="dark"] input,
[data-theme="dark"] select,
[data-theme="dark"] textarea {
  background: #2a3942;
  color: var(--text-primary);
  border-color: var(--border);
}

[data-theme="dark"] label {
  color: var(--text-secondary);
}

[data-theme="dark"] .profile-drawer {
  background: #1f2c34;
  border-left-color: var(--border);
}

[data-theme="dark"] .activity-feed {
  background: #1f2c34;
  border-top-color: var(--border);
}

[data-theme="dark"] .feed-message {
  border-bottom-color: var(--border);
}

/* ── Dark mode toggle button ── */
.btn-header-icon {
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.25);
  color: #fff;
  border-radius: 8px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  transition: background 0.2s;
}

.btn-header-icon:hover {
  background: rgba(255,255,255,0.25);
}

/* ── Typing indicator ── */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 2px 0;
}

.typing-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--primary);
  animation: typingBounce 1.2s infinite;
}

.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30%           { transform: translateY(-5px); opacity: 1; }
}

/* ── Message status (checkmarks) ── */
.msg-status {
  display: inline-flex;
  align-items: center;
  margin-left: 4px;
  font-size: 12px;
  color: var(--text-secondary);
}

.msg-status.delivered { color: var(--text-secondary); }
.msg-status.read      { color: #53bdeb; }

.bubble-time-wrap {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 2px;
  margin-top: 2px;
}

.bubble.out .bubble-time-wrap {
  justify-content: flex-end;
}

/* ── Emoji picker ── */
.btn-emoji {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 20px;
  padding: 4px 8px;
  border-radius: 8px;
  color: var(--text-secondary);
  transition: background 0.2s;
  flex-shrink: 0;
}

.btn-emoji:hover {
  background: var(--border);
}

.emoji-picker {
  position: absolute;
  bottom: 100%;
  left: 0;
  right: 0;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  box-shadow: var(--shadow-lg);
  z-index: 100;
  max-height: 220px;
  overflow-y: auto;
}

.emoji-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.emoji-btn {
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
  transition: background 0.15s;
  line-height: 1;
}

.emoji-btn:hover {
  background: var(--border);
}

/* ── Improved bubble design ── */
.bubble {
  max-width: 65%;
  margin-bottom: 4px;
  padding: 8px 12px 4px;
  border-radius: 12px;
  line-height: 1.5;
  font-size: 14px;
  position: relative;
  word-wrap: break-word;
  animation: bubbleIn 0.15s ease-out;
}

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

.bubble.out {
  background: #dcf8c6;
  color: #111b21;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

.bubble.in {
  background: #ffffff;
  color: #111b21;
  align-self: flex-start;
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}

[data-theme="dark"] .bubble.out {
  background: #005c4b;
  color: #e9edef;
}

[data-theme="dark"] .bubble.in {
  background: #1f2c34;
  color: #e9edef;
}

.bubble-time {
  font-size: 11px;
  color: var(--text-secondary);
  text-align: right;
  margin-top: 2px;
}

.bubble.out .bubble-time { color: #667781; }

/* ── Messages container background (WhatsApp-like) ── */
.messages-container {
  background: #efeae2 url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23d1c4b0' fill-opacity='0.3'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/G%3E%3C/svg%3E") !important;
}

[data-theme="dark"] .messages-container {
  background: #0b141a !important;
}

/* ── Alert Badge ── */
.btn-alerts-icon {
  position: relative;
}

.alert-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  background: #ef4444;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  line-height: 1;
  animation: alertPulse 2s infinite;
}

@keyframes alertPulse {
  0%, 100% { transform: scale(1); }
  50%       { transform: scale(1.15); }
}

/* ── Alerts Panel ── */
.alerts-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 300;
}

.alerts-overlay.open { display: block; }

.alerts-panel {
  position: fixed;
  top: 0;
  right: -420px;
  width: 420px;
  height: 100vh;
  background: var(--card-bg);
  box-shadow: -4px 0 24px rgba(0,0,0,0.2);
  z-index: 301;
  display: flex;
  flex-direction: column;
  transition: right 0.3s ease;
}

.alerts-panel.open { right: 0; }

.alerts-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: #fff;
}

.alerts-panel-header h3 {
  font-size: 16px;
  font-weight: 700;
}

.alerts-panel-header .btn-icon {
  color: #fff;
  background: rgba(255,255,255,0.2);
  border: none;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
}

.alerts-panel-filters {
  display: flex;
  gap: 6px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.alert-filter-btn {
  padding: 4px 10px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: none;
  font-size: 12px;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all 0.2s;
}

.alert-filter-btn.active,
.alert-filter-btn:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.alerts-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.alert-card {
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  padding: 9px 12px;
  cursor: pointer;
  transition: all 0.2s;
  background: var(--card-bg);
  border-left: 4px solid #ef4444;
}

.alert-card:hover { transform: translateX(2px); box-shadow: var(--shadow); }

.alert-card--critical { border-left-color: #dc2626; background: rgba(239,68,68,0.05); }
.alert-card--high     { border-left-color: #f97316; background: rgba(249,115,22,0.05); }
.alert-card--medium   { border-left-color: #f59e0b; background: rgba(245,158,11,0.05); }

.alert-card-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.alert-urgency-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}

.alert-card-name {
  font-weight: 600;
  font-size: 13px;
  color: var(--text-primary);
  flex-shrink: 0;
}

.alert-card-store {
  font-size: 11px;
  color: var(--text-secondary);
  background: var(--border);
  padding: 2px 8px;
  border-radius: 10px;
}

.alert-card-urgency {
  font-size: 20px;
  font-weight: 800;
  color: #ef4444;
}

.alert-card-summary {
  font-size: 12px;
  color: var(--text-secondary);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.alert-flags {
  display: flex;
  flex-wrap: nowrap;
  gap: 4px;
  flex-shrink: 0;
}

.alert-flag {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 600;
}

.flag--lenguaje_agresivo { background: rgba(239,68,68,0.15); color: #dc2626; }
.flag--amenaza_legal     { background: rgba(168,85,247,0.15); color: #7c3aed; }
.flag--spam_detectado    { background: rgba(245,158,11,0.15); color: #d97706; }
.flag--cliente_frustrado { background: rgba(249,115,22,0.15); color: #ea580c; }
.flag--escalacion_requerida { background: rgba(239,68,68,0.2); color: #b91c1c; }
.flag--sin_respuesta     { background: rgba(107,114,128,0.15); color: #4b5563; }
.flag--precio_rechazado  { background: rgba(6,182,212,0.15); color: #0e7490; }
.flag--queja_repetida    { background: rgba(236,72,153,0.15); color: #be185d; }
.flag--solicitud_urgente { background: rgba(239,68,68,0.15); color: #dc2626; }

.alert-card-time {
  font-size: 11px;
  flex-shrink: 0;
  margin-left: auto;
  color: var(--text-secondary);
  margin-top: 6px;
}

.alerts-empty {
  text-align: center;
  color: var(--text-secondary);
  padding: 40px 20px;
  font-size: 14px;
}

/* ── Global alerts section ── */
.alerts-global-section {
  margin-bottom: 24px;
}

.section-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.section-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.global-alerts-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.btn-sm {
  padding: 6px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: none;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-secondary);
  transition: all 0.2s;
}

.btn-sm:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* Dark mode for alerts */
[data-theme="dark"] .alert-card {
  background: #1f2c34;
  border-color: #2a3942;
}

[data-theme="dark"] .alert-card--critical { background: rgba(239,68,68,0.08); }
[data-theme="dark"] .alert-card--high     { background: rgba(249,115,22,0.08); }
[data-theme="dark"] .alert-card--medium   { background: rgba(245,158,11,0.08); }

[data-theme="dark"] .alerts-panel {
  background: #1f2c34;
  border-left: 1px solid #2a3942;
}

/* ── Label tags (Receta Vencida / Receta Enviada) ── */
.label-tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 4px;
  margin-top: 2px;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}
.label-tag--receta-vencida {
  background: #ef444422;
  color: #ef4444;
  border: 1px solid #ef444444;
}
.label-tag--receta-enviada {
  background: #22c55e22;
  color: #16a34a;
  border: 1px solid #22c55e44;
}

/* ── Toast notifications ── */
.toast-container {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
  pointer-events: all;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.25s, transform 0.25s;
  max-width: 480px;
}
.toast--visible { opacity: 1; transform: translateY(0); }
.toast--info    { background: #1e293b; color: #f8fafc; }
.toast--warning { background: #92400e; color: #fef3c7; }
.toast--success { background: #14532d; color: #dcfce7; }
.toast--error   { background: #7f1d1d; color: #fee2e2; }
.toast-close {
  background: none; border: none; cursor: pointer; font-size: 14px;
  opacity: 0.7; color: inherit; padding: 0; line-height: 1;
}
.toast-close:hover { opacity: 1; }

/* ── Sync progress toast ── */
.sync-progress-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(16px);
  background: #1e293b;
  color: #f8fafc;
  padding: 12px 20px;
  border-radius: 10px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.25);
  min-width: 240px;
  max-width: 360px;
  z-index: 10000;
  opacity: 0;
  transition: opacity 0.25s, transform 0.25s;
  pointer-events: none;
}
.sync-progress-toast--visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.sync-progress-label {
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 8px;
  text-align: center;
}
.sync-progress-track {
  height: 3px;
  background: rgba(255,255,255,0.15);
  border-radius: 2px;
  overflow: hidden;
}
.sync-progress-fill {
  height: 100%;
  background: var(--primary, #7c3aed);
  border-radius: 2px;
  transition: width 0.3s ease;
  width: 0%;
}

/* ── Store Overview Cards (Global Dashboard) ── */
.store-overview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px;
  margin-bottom: 20px;
}
.store-overview-card {
  background: var(--card-bg);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  border: 1px solid var(--border);
}
.store-overview-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}
.soc-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
}
.soc-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.soc-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.soc-status {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  flex-shrink: 0;
}
.soc-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.soc-stat {
  text-align: center;
  padding: 5px 4px;
  border-radius: 6px;
  background: var(--background);
}
.soc-stat--warn .soc-stat-value { color: var(--danger); }
.soc-stat--ok .soc-stat-value   { color: var(--primary); }
.soc-stat-value {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}
.soc-stat-label {
  font-size: 10px;
  color: var(--text-secondary);
  margin-top: 1px;
  white-space: nowrap;
}

[data-theme="dark"] .store-overview-card { background: #1e2d35; border-color: #2a3942; }
[data-theme="dark"] .soc-stat { background: #162028; }

/* ── Stat card amber (prospectos) ── */
.stat-card--amber { border-left-color: #f59e0b; color: #f59e0b; }

/* ── Chat filter bar ── */
.chat-filter-bar {
  display: flex;
  gap: 4px;
  padding: 8px 12px 4px;
  border-bottom: 1px solid var(--border);
  background: var(--card-bg);
  overflow-x: auto;
  flex-shrink: 0;
}
.chat-filter-btn {
  padding: 4px 10px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}
.chat-filter-btn:hover { background: var(--background); color: var(--text-primary); }
.chat-filter-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
[data-theme="dark"] .chat-filter-btn { border-color: #2a3942; }
[data-theme="dark"] .chat-filter-btn:hover { background: #162028; }

/* ── Prospect section ── */
.prospect-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.1s;
  border-radius: 6px;
  padding-left: 4px;
}
.prospect-row:hover { background: var(--background); }
.prospect-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: #f59e0b33;
  color: #f59e0b;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px;
  flex-shrink: 0;
  overflow: hidden;
}
.prospect-info { flex: 1; min-width: 0; }
.prospect-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  display: flex; align-items: center; gap: 6px;
  flex-wrap: wrap;
}
.prospect-meta {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 2px;
}
.prospect-last {
  font-size: 11px;
  color: var(--text-secondary);
  white-space: nowrap;
  flex-shrink: 0;
}

/* Period select small */
.period-select-sm {
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--text-primary);
  font-size: 13px;
  cursor: pointer;
}

/* Soc stat prospect color */
.soc-stat--prospect .soc-stat-value { color: #f59e0b; }

/* Store overview grid - más columnas en pantallas grandes */
@media (min-width: 900px) {
  .store-overview-grid { grid-template-columns: repeat(4, 1fr); }
}

/* ── Sound button off state ── */
.btn-sound--off { opacity: 0.5; }

/* ── Pending tab badge ── */
.tab-pending-badge {
  display: inline-block;
  background: #ef4444;
  color: #fff;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  line-height: 18px;
  text-align: center;
  padding: 0 4px;
  margin-left: 4px;
  vertical-align: middle;
}

/* ── Manual label menu ── */
.conv-label-menu {
  position: relative;
  flex-shrink: 0;
}

.btn-label-toggle {
  background: rgba(0,0,0,0.08);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px 10px;
  font-size: 12px;
  cursor: pointer;
  color: var(--text-primary);
  white-space: nowrap;
  transition: background 0.15s;
}

.btn-label-toggle:hover { background: rgba(0,0,0,0.14); }
.btn-label-toggle.btn-label-active { border-color: #f59e0b; color: #b45309; background: #fef3c7; }

.label-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  min-width: 180px;
  z-index: 200;
  overflow: hidden;
}

.label-opt {
  display: block;
  width: 100%;
  padding: 10px 14px;
  border: none;
  background: none;
  text-align: left;
  font-size: 13px;
  cursor: pointer;
  color: var(--text-primary);
  transition: background 0.15s;
}

.label-opt:hover { background: var(--background); }

.digest-card { display:flex; align-items:flex-start; gap:10px; padding:10px 14px;
  border-radius:8px; background:var(--card-bg); margin-bottom:6px;
  cursor:pointer; transition:background 0.15s; }
.digest-card:hover { background:var(--background); }
.digest-dot { width:10px; height:10px; border-radius:50%; margin-top:4px; flex-shrink:0; }
.digest-body { flex:1; min-width:0; }
.digest-header { display:flex; align-items:center; gap:6px; flex-wrap:wrap; }
.digest-name { font-weight:600; font-size:.875rem; }
.digest-summary { font-size:.8rem; color:var(--text-secondary); margin-top:2px;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.digest-vol-badge { background:#3b82f6; color:#fff; font-size:.7rem;
  padding:1px 7px; border-radius:999px; font-weight:600; }
.digest-empty { color:var(--text-secondary); text-align:center; padding:1.5rem; font-size:.9rem; }

/* ═══════════════════════════════════════════════════
   MODULE NAVIGATION SIDEBAR
   ═══════════════════════════════════════════════════ */

#module-bar {
  position: fixed; top: 0; left: 0;
  width: 56px; height: 100vh; z-index: 2000;
  background: linear-gradient(180deg, #0a1628 0%, #0d1b2a 100%);
  border-right: 1px solid rgba(255,255,255,0.06);
  display: flex; flex-direction: column; align-items: center;
  padding-top: 14px; gap: 6px;
}
.module-btn {
  width: 40px; height: 40px; border-radius: 12px;
  border: none; cursor: pointer;
  background: transparent;
  color: rgba(255,255,255,0.35);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  transition: all 0.2s; gap: 0;
}
.module-btn:hover { background: rgba(255,255,255,0.06); color: rgba(255,255,255,0.7); }
.module-btn.active { background: rgba(37,211,102,0.15); color: #25D366; }
.module-bar-spacer { flex: 1; }

/* Module views */
.module-view { display: none; position: fixed; top: 0; left: 56px; right: 0; bottom: 0; overflow: hidden; }
.module-view.active { display: flex; flex-direction: column; }
#module-whatsapp .container { margin-left: 0; }
#module-whatsapp { overflow: auto; }

/* ═══════════════════════════════════════════════════
   OFFICE MODULE (Organic Integration)
   ═══════════════════════════════════════════════════ */

.office-wrapper {
  display: flex; flex-direction: column;
  height: 100%; background: #0d1117;
}
.office-header {
  height: 44px; min-height: 44px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px;
  background: linear-gradient(135deg, #1a1f35 0%, #0f1729 100%);
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.office-header-left {
  display: flex; align-items: center; gap: 10px;
}
.office-header-left h3 {
  font-size: 0.9rem; font-weight: 700; color: #e6edf3; margin: 0;
}
.office-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #6b7280;
  transition: background 0.3s;
}
.office-dot.connected {
  background: #22c55e;
  box-shadow: 0 0 6px rgba(34,197,94,0.5);
  animation: officePulse 2s ease-in-out infinite;
}
@keyframes officePulse {
  0%, 100% { box-shadow: 0 0 4px rgba(34,197,94,0.3); }
  50% { box-shadow: 0 0 10px rgba(34,197,94,0.6); }
}
.office-agent-count {
  font-size: 0.7rem; color: rgba(255,255,255,0.4);
  background: rgba(255,255,255,0.06); padding: 2px 10px; border-radius: 99px;
}
.office-header-right {
  display: flex; gap: 4px;
}
.office-btn {
  background: transparent; border: 1px solid rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.45); border-radius: 6px;
  width: 30px; height: 30px; cursor: pointer;
  font-size: 14px; display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
}
.office-btn:hover {
  background: rgba(255,255,255,0.08); color: #e6edf3;
  border-color: rgba(255,255,255,0.15);
}
.office-body {
  flex: 1; position: relative; overflow: hidden;
  margin: 6px; border-radius: 10px;
  background: #0a0e17;
}
.office-loading {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; background: #0a0e17; z-index: 2;
}
.office-loading span {
  font-size: 0.85rem; color: rgba(255,255,255,0.4);
}
.office-spinner {
  width: 32px; height: 32px; border-radius: 50%;
  border: 3px solid rgba(255,255,255,0.08);
  border-top-color: #22c55e;
  animation: officeSpin 0.8s linear infinite;
}
@keyframes officeSpin { to { transform: rotate(360deg); } }
.office-error {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; background: #0a0e17; z-index: 2;
}
.office-error-icon { font-size: 2rem; }
.office-error span { font-size: 0.85rem; color: rgba(255,255,255,0.5); }
.office-retry-btn {
  background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.12);
  color: #e6edf3; padding: 8px 20px; border-radius: 8px;
  cursor: pointer; font-size: 0.8rem; transition: all 0.15s;
}
.office-retry-btn:hover { background: rgba(255,255,255,0.12); }
#office-iframe {
  width: 100%; height: 100%; border: none;
  display: none; /* shown after load */
}
#office-iframe.loaded { display: block; }

/* ═══ PiP (Picture-in-Picture) — reuses same iframe ═══ */
#office-pip {
  position: fixed;
  bottom: 20px; right: 20px;
  width: 380px; height: 260px;
  border-radius: 14px; overflow: hidden;
  box-shadow: 0 12px 48px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.08);
  background: #0a0e17;
  z-index: 3000;
  resize: both;
  min-width: 260px; min-height: 170px;
  transition: box-shadow 0.2s;
}
#office-pip:hover { box-shadow: 0 16px 56px rgba(0,0,0,0.7), 0 0 0 1px rgba(255,255,255,0.12); }
#pip-titlebar {
  height: 30px;
  background: linear-gradient(135deg, #1a1f35, #0f1729);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 10px; cursor: grab;
  font-size: 0.72rem; color: rgba(255,255,255,0.5);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  user-select: none;
}
#pip-titlebar:active { cursor: grabbing; }
#pip-titlebar .pip-label {
  display: flex; align-items: center; gap: 6px;
}
#pip-titlebar .pip-dot {
  width: 6px; height: 6px; border-radius: 50%; background: #22c55e;
}
#pip-titlebar button {
  background: none; border: none; color: rgba(255,255,255,0.4);
  cursor: pointer; font-size: 12px; padding: 3px 6px; border-radius: 4px;
  transition: all 0.12s;
}
#pip-titlebar button:hover { background: rgba(255,255,255,0.1); color: #fff; }
#pip-content {
  width: 100%; height: calc(100% - 30px); overflow: hidden;
}
#pip-content iframe { width: 100%; height: 100%; border: none; }

/* ═══════════════════════════════════════════════════
   MR.BILLIE DASHBOARD MODULE
   ═══════════════════════════════════════════════════ */

.billie-container {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 0;
  height: 100vh;
  background: #0d1117;
  color: #e6edf3;
}

/* Left column: dashboard */
.billie-dashboard {
  padding: 20px 24px;
  overflow-y: auto;
}

/* Scoreboard */
.billie-scoreboard {
  background: linear-gradient(135deg, #1a1f35 0%, #0f1729 100%);
  border: 1px solid rgba(212,168,67,0.2);
  border-radius: 14px;
  padding: 20px 24px;
  margin-bottom: 20px;
}
.scoreboard-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 14px;
}
.scoreboard-header h2 {
  font-size: 1rem; font-weight: 700;
  color: #d4a843; letter-spacing: 1px;
}
.scoreboard-week {
  font-size: 0.8rem; color: rgba(255,255,255,0.5);
  background: rgba(255,255,255,0.06); padding: 3px 10px; border-radius: 99px;
}
.scoreboard-bar {
  height: 28px; background: rgba(255,255,255,0.06);
  border-radius: 14px; position: relative; overflow: hidden;
  margin-bottom: 16px;
}
.scoreboard-fill {
  height: 100%; border-radius: 14px;
  background: linear-gradient(90deg, #d4a843, #f0d078);
  transition: width 0.6s ease;
}
.scoreboard-label {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  font-size: 0.75rem; font-weight: 700; color: #0d1117;
}
.scoreboard-stats {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px;
}
.scoreboard-stat { text-align: center; }
.scoreboard-stat-value {
  display: block; font-size: 1.1rem; font-weight: 700; color: #fff;
}
.scoreboard-stat-label {
  display: block; font-size: 0.7rem; color: rgba(255,255,255,0.4);
  text-transform: uppercase; letter-spacing: 0.5px; margin-top: 2px;
}
.billie-status-badge {
  padding: 2px 8px; border-radius: 99px; font-size: 0.75rem !important;
  background: rgba(251,191,36,0.15); color: #fbbf24;
}

/* Store cards */
.billie-stores-grid {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 12px; margin-bottom: 20px;
}
.billie-store-card {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 12px; padding: 16px; text-align: center;
  transition: all 0.2s;
}
.billie-store-card:hover { background: rgba(255,255,255,0.07); transform: translateY(-2px); }
.billie-store-name { font-size: 0.7rem; font-weight: 700; letter-spacing: 1px; color: rgba(255,255,255,0.5); margin-bottom: 6px; }
.billie-store-revenue { font-size: 1.4rem; font-weight: 800; color: #fff; }
.billie-store-meta { font-size: 0.7rem; color: rgba(255,255,255,0.3); margin-top: 4px; }
.billie-store--mawida { border-left: 3px solid #00b894; }
.billie-store--ldlq { border-left: 3px solid #e17055; }
.billie-store--biobio { border-left: 3px solid #6c5ce7; }
.billie-store--entrerios { border-left: 3px solid #fdcb6e; }

/* Pipeline Kanban */
.billie-pipeline { margin-bottom: 20px; }
.billie-pipeline h3 { font-size: 0.9rem; color: rgba(255,255,255,0.6); margin-bottom: 12px; font-weight: 600; }
.pipeline-board {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px;
}
.pipeline-column {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 10px; padding: 10px;
  min-height: 180px;
}
.pipeline-col-header {
  font-size: 0.75rem; font-weight: 700;
  color: rgba(255,255,255,0.5); text-transform: uppercase;
  letter-spacing: 0.5px; margin-bottom: 10px;
  display: flex; align-items: center; gap: 6px;
}
.pipeline-count {
  background: rgba(255,255,255,0.1); color: rgba(255,255,255,0.6);
  font-size: 0.65rem; padding: 1px 6px; border-radius: 99px;
}
.pipeline-cards { display: flex; flex-direction: column; gap: 6px; min-height: 60px; }
.pipeline-card {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px; padding: 8px 10px;
  font-size: 0.8rem; color: #e6edf3;
  cursor: grab; transition: all 0.15s;
}
.pipeline-card:hover { background: rgba(255,255,255,0.1); }
.pipeline-card .task-module {
  font-size: 0.65rem; color: rgba(255,255,255,0.35);
  margin-top: 4px;
}
.pipeline-add-btn {
  width: 100%; margin-top: 8px; padding: 6px;
  background: transparent; border: 1px dashed rgba(255,255,255,0.1);
  border-radius: 8px; color: rgba(255,255,255,0.3);
  cursor: pointer; font-size: 0.75rem; transition: all 0.15s;
}
.pipeline-add-btn:hover { border-color: rgba(255,255,255,0.2); color: rgba(255,255,255,0.5); background: rgba(255,255,255,0.03); }

/* Daily Checklist */
.billie-checklist h3 { font-size: 0.9rem; color: rgba(255,255,255,0.6); margin-bottom: 12px; font-weight: 600; }
.checklist-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; border-radius: 8px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.05);
  margin-bottom: 6px; cursor: pointer; transition: all 0.15s;
}
.checklist-item:hover { background: rgba(255,255,255,0.06); }
.checklist-item.completed { opacity: 0.5; }
.checklist-item.completed .checklist-text { text-decoration: line-through; }
.checklist-check {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.2);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; font-size: 10px;
}
.checklist-item.completed .checklist-check {
  background: #25D366; border-color: #25D366; color: #fff;
}
.checklist-text { font-size: 0.82rem; color: #e6edf3; }
.checklist-module { font-size: 0.65rem; color: rgba(255,255,255,0.3); margin-left: auto; }

/* Right column: Chat */
.billie-chat {
  border-left: 1px solid rgba(255,255,255,0.06);
  display: flex; flex-direction: column;
  background: #0b0f19;
}
.billie-chat-header {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px;
  background: linear-gradient(135deg, #1a1f35, #0f1729);
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.billie-avatar-wrap {
  width: 40px; height: 40px; border-radius: 50%;
  background: rgba(212,168,67,0.15);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
}
.billie-chat-header h3 { font-size: 0.95rem; font-weight: 700; color: #fff; margin: 0; }
.billie-subtitle { font-size: 0.7rem; color: rgba(255,255,255,0.4); }
.billie-messages {
  flex: 1; overflow-y: auto; padding: 16px;
  display: flex; flex-direction: column; gap: 12px;
}
.billie-msg { display: flex; gap: 10px; max-width: 90%; }
.billie-msg--bot { align-self: flex-start; }
.billie-msg--user { align-self: flex-end; flex-direction: row-reverse; }
.billie-msg-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: rgba(212,168,67,0.12);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; flex-shrink: 0;
}
.billie-msg--user .billie-msg-avatar { background: rgba(37,211,102,0.12); }
.billie-msg-content {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 12px; padding: 10px 14px;
  font-size: 0.83rem; line-height: 1.5; color: #e6edf3;
}
.billie-msg--user .billie-msg-content {
  background: rgba(37,211,102,0.12);
  border-color: rgba(37,211,102,0.15);
}
.billie-msg--typing .billie-msg-content {
  color: rgba(255,255,255,0.4);
}
.billie-input-area {
  display: flex; gap: 8px; padding: 12px 16px;
  border-top: 1px solid rgba(255,255,255,0.06);
  background: rgba(0,0,0,0.2);
}
.billie-input-area input {
  flex: 1; background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px; padding: 10px 14px;
  color: #e6edf3; font-size: 0.85rem; outline: none;
}
.billie-input-area input:focus { border-color: rgba(212,168,67,0.3); }
.billie-input-area input::placeholder { color: rgba(255,255,255,0.25); }
.billie-send-btn {
  background: linear-gradient(135deg, #d4a843, #c49a38);
  border: none; border-radius: 10px; padding: 10px 18px;
  color: #0d1117; font-weight: 700; font-size: 0.8rem;
  cursor: pointer; transition: all 0.15s;
}
.billie-send-btn:hover { filter: brightness(1.1); transform: translateY(-1px); }

/* Pipeline header row */
.pipeline-header-row {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px;
}
.pipeline-header-row h3 { font-size: 0.9rem; color: rgba(255,255,255,0.6); font-weight: 600; margin: 0; }
.pipeline-open-full {
  background: none; border: 1px solid rgba(255,255,255,0.1); border-radius: 6px;
  color: rgba(255,255,255,0.5); font-size: 0.72rem; padding: 4px 10px; cursor: pointer;
  transition: all 0.15s;
}
.pipeline-open-full:hover { background: rgba(255,255,255,0.06); color: #e6edf3; }

/* Responsive billie */
@media (max-width: 900px) {
  .billie-container { grid-template-columns: 1fr; }
  .billie-chat { border-left: none; border-top: 1px solid rgba(255,255,255,0.06); height: 400px; }
  .billie-stores-grid { grid-template-columns: repeat(2, 1fr); }
  .pipeline-board { grid-template-columns: repeat(2, 1fr); }
}

/* ═══════════════════════════════════════════════════
   BILLIE SUB-NAVIGATION
   ═══════════════════════════════════════════════════ */

.billie-subnav {
  display: flex; gap: 0; background: #0d1117;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  padding: 0 20px; min-height: 42px; flex-shrink: 0;
}
.billie-tab {
  background: none; border: none; border-bottom: 2px solid transparent;
  color: rgba(255,255,255,0.4); font-size: 0.82rem; font-weight: 600;
  padding: 10px 18px; cursor: pointer; transition: all 0.2s;
}
.billie-tab:hover { color: rgba(255,255,255,0.7); }
.billie-tab.active { color: #d4a843; border-bottom-color: #d4a843; }
.billie-view { display: none; flex: 1; overflow: auto; }
.billie-view.active { display: flex; flex-direction: column; }
#billie-dashboard-view.active { display: block; overflow: auto; }

/* ═══════════════════════════════════════════════════
   PIPELINE FULLSCREEN VIEW
   ═══════════════════════════════════════════════════ */

.pipeline-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; gap: 12px;
  background: #0d1117;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0; flex-wrap: wrap;
}
.pipeline-filters {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
}
.pipeline-filters select, .pipeline-search {
  background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.1);
  color: #e6edf3; border-radius: 7px; padding: 6px 10px;
  font-size: 0.78rem; outline: none;
}
.pipeline-filters select:focus, .pipeline-search:focus { border-color: rgba(212,168,67,0.4); }
.pipeline-search { width: 180px; }
.pipeline-search::placeholder { color: rgba(255,255,255,0.25); }
.filter-overdue-btn {
  background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.2);
  color: #ef4444; border-radius: 7px; padding: 6px 12px;
  font-size: 0.78rem; cursor: pointer; transition: all 0.15s;
}
.filter-overdue-btn:hover { background: rgba(239,68,68,0.2); }
.filter-overdue-btn.active { background: rgba(239,68,68,0.25); border-color: #ef4444; }
.filter-overdue-btn span { font-weight: 700; }
.pipeline-actions {
  display: flex; gap: 8px;
}
.pipeline-action-btn {
  background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.6); border-radius: 8px; padding: 7px 14px;
  font-size: 0.8rem; cursor: pointer; font-weight: 600; transition: all 0.15s;
}
.pipeline-action-btn:hover { background: rgba(255,255,255,0.1); color: #e6edf3; }
.pipeline-action-btn.primary {
  background: linear-gradient(135deg, #d4a843, #c49a38);
  border-color: transparent; color: #0d1117;
}
.pipeline-action-btn.primary:hover { filter: brightness(1.1); }

/* Kanban Full Board */
.pipeline-fullboard {
  display: flex; gap: 12px; padding: 14px;
  flex: 1; overflow-x: auto; overflow-y: hidden;
  background: #0a0e17;
}
.pipeline-full-column {
  min-width: 280px; max-width: 320px; flex-shrink: 0;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 12px; display: flex; flex-direction: column;
  max-height: 100%;
}
.pipeline-full-column.drag-over {
  border-color: rgba(212,168,67,0.4);
  background: rgba(212,168,67,0.04);
}
.pfull-col-header {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 14px; flex-shrink: 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.pfull-col-dot {
  width: 10px; height: 10px; border-radius: 50%;
}
.pfull-col-name {
  font-size: 0.8rem; font-weight: 700; color: rgba(255,255,255,0.7);
  text-transform: uppercase; letter-spacing: 0.5px;
}
.pfull-col-count {
  background: rgba(255,255,255,0.08); color: rgba(255,255,255,0.5);
  font-size: 0.65rem; padding: 2px 7px; border-radius: 99px; margin-left: auto;
}
.pfull-col-cards {
  flex: 1; overflow-y: auto; padding: 8px;
  display: flex; flex-direction: column; gap: 8px;
  min-height: 60px;
}
.pfull-col-cards::-webkit-scrollbar { width: 4px; }
.pfull-col-cards::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 4px; }

/* Full Pipeline Cards */
.pfull-card {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px; padding: 10px 12px;
  cursor: grab; transition: all 0.15s;
  position: relative; border-left: 3px solid transparent;
}
.pfull-card:hover {
  background: rgba(255,255,255,0.08);
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
  transform: translateY(-1px);
}
.pfull-card.dragging { opacity: 0.5; transform: rotate(2deg); }
.pfull-card[data-priority="3"] { border-left-color: #ef4444; }
.pfull-card[data-priority="2"] { border-left-color: #f59e0b; }
.pfull-card[data-priority="1"] { border-left-color: #6366f1; }
.pfull-card[data-priority="0"] { border-left-color: #6b7280; }
.pfull-card-title {
  font-size: 0.82rem; font-weight: 600; color: #e6edf3;
  margin-bottom: 6px; line-height: 1.3;
}
.pfull-card-meta {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}
.pfull-card-module {
  font-size: 0.65rem; color: rgba(255,255,255,0.35);
  background: rgba(255,255,255,0.06); padding: 1px 6px; border-radius: 4px;
}
.pfull-card-deadline {
  font-size: 0.65rem; padding: 1px 6px; border-radius: 4px; font-weight: 600;
}
.pfull-card-deadline.ok { background: rgba(34,197,94,0.12); color: #22c55e; }
.pfull-card-deadline.soon { background: rgba(245,158,11,0.12); color: #f59e0b; }
.pfull-card-deadline.overdue { background: rgba(239,68,68,0.15); color: #ef4444; }
.pfull-card-reminder { font-size: 0.65rem; color: rgba(212,168,67,0.6); }
.pfull-card-tags {
  display: flex; gap: 3px; flex-wrap: wrap; margin-top: 4px;
}
.pfull-card-tag {
  font-size: 0.6rem; color: rgba(255,255,255,0.4);
  background: rgba(255,255,255,0.05); padding: 1px 5px; border-radius: 3px;
}
.pfull-card .card-detail-btn {
  position: absolute; top: 8px; right: 8px;
  background: rgba(255,255,255,0.08); border: none; border-radius: 4px;
  color: rgba(255,255,255,0.4); font-size: 12px; width: 22px; height: 22px;
  display: none; align-items: center; justify-content: center; cursor: pointer;
}
.pfull-card:hover .card-detail-btn { display: flex; }
.pfull-card .card-detail-btn:hover { background: rgba(255,255,255,0.15); color: #fff; }

/* Quick Add in column */
.pfull-quick-add {
  margin: 4px 8px 10px; padding: 0;
}
.pfull-quick-add-btn {
  width: 100%; padding: 7px; background: transparent;
  border: 1px dashed rgba(255,255,255,0.1); border-radius: 8px;
  color: rgba(255,255,255,0.3); font-size: 0.78rem; cursor: pointer;
  transition: all 0.15s;
}
.pfull-quick-add-btn:hover {
  border-color: rgba(255,255,255,0.2); color: rgba(255,255,255,0.5);
  background: rgba(255,255,255,0.03);
}
.pfull-quick-add-input {
  width: 100%; background: rgba(255,255,255,0.06);
  border: 1px solid rgba(212,168,67,0.3); border-radius: 8px;
  padding: 8px 10px; color: #e6edf3; font-size: 0.8rem; outline: none;
}
.pfull-quick-add-input::placeholder { color: rgba(255,255,255,0.25); }

/* ═══════════════════════════════════════════════════
   TASK MODAL
   ═══════════════════════════════════════════════════ */

.task-modal-overlay {
  position: fixed; inset: 0; z-index: 5000;
  background: rgba(0,0,0,0.6);
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(4px);
  animation: fadeIn 0.15s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.task-modal {
  background: #161b22; border: 1px solid rgba(255,255,255,0.1);
  border-radius: 16px; width: 540px; max-width: 95vw;
  max-height: 90vh; overflow-y: auto;
  box-shadow: 0 24px 80px rgba(0,0,0,0.5);
  animation: modalIn 0.2s ease;
}
@keyframes modalIn { from { transform: scale(0.95) translateY(10px); opacity: 0; } to { transform: scale(1) translateY(0); opacity: 1; } }
.task-modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid rgba(255,255,255,0.06);
}
.task-modal-header h3 { margin: 0; font-size: 1rem; color: #e6edf3; }
.modal-close {
  background: none; border: none; color: rgba(255,255,255,0.4);
  font-size: 18px; cursor: pointer; padding: 4px 8px; border-radius: 6px;
}
.modal-close:hover { background: rgba(255,255,255,0.08); color: #fff; }
.task-modal-body { padding: 16px 20px; }
.task-input-lg {
  width: 100%; background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1); border-radius: 10px;
  padding: 12px 14px; color: #e6edf3; font-size: 1rem;
  font-weight: 600; outline: none; margin-bottom: 12px;
  box-sizing: border-box;
}
.task-input-lg:focus { border-color: rgba(212,168,67,0.4); }
.task-input-lg::placeholder { color: rgba(255,255,255,0.25); font-weight: 400; }
.task-textarea {
  width: 100%; background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08); border-radius: 10px;
  padding: 10px 14px; color: #e6edf3; font-size: 0.85rem;
  outline: none; resize: vertical; margin-bottom: 16px;
  font-family: inherit; box-sizing: border-box;
}
.task-textarea:focus { border-color: rgba(212,168,67,0.3); }
.task-textarea::placeholder { color: rgba(255,255,255,0.2); }
.task-fields-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 14px;
}
.task-field label {
  display: block; font-size: 0.72rem; color: rgba(255,255,255,0.45);
  text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 6px; font-weight: 600;
}
.task-select, .task-input {
  width: 100%; background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1); border-radius: 8px;
  padding: 8px 10px; color: #e6edf3; font-size: 0.82rem; outline: none;
  box-sizing: border-box;
}
.task-select:focus, .task-input:focus { border-color: rgba(212,168,67,0.4); }
.task-select-sm { width: 70px; flex-shrink: 0; }
.reminder-row { display: flex; gap: 8px; }
.reminder-row .task-input { flex: 1; }

/* Priority selector */
.priority-selector { display: flex; gap: 4px; flex-wrap: wrap; }
.pri {
  background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1);
  border-radius: 6px; padding: 5px 8px; font-size: 0.72rem;
  cursor: pointer; color: rgba(255,255,255,0.5); transition: all 0.12s;
}
.pri:hover { background: rgba(255,255,255,0.1); }
.pri.active { border-color: rgba(212,168,67,0.5); background: rgba(212,168,67,0.1); color: #d4a843; }
.pri-urgent.active { border-color: #ef4444; background: rgba(239,68,68,0.12); color: #ef4444; }
.pri-high.active { border-color: #f59e0b; background: rgba(245,158,11,0.12); color: #f59e0b; }
.pri-normal.active { border-color: #6366f1; background: rgba(99,102,241,0.12); color: #6366f1; }
.pri-low.active { border-color: #6b7280; background: rgba(107,114,128,0.12); color: #9ca3af; }

.task-modal-footer {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 14px 20px; border-top: 1px solid rgba(255,255,255,0.06);
}
.modal-btn {
  padding: 9px 20px; border-radius: 8px; font-size: 0.82rem;
  font-weight: 600; cursor: pointer; transition: all 0.15s; border: none;
}
.modal-btn.cancel {
  background: rgba(255,255,255,0.06); color: rgba(255,255,255,0.5);
}
.modal-btn.cancel:hover { background: rgba(255,255,255,0.1); color: #e6edf3; }
.modal-btn.save {
  background: linear-gradient(135deg, #d4a843, #c49a38); color: #0d1117;
}
.modal-btn.save:hover { filter: brightness(1.1); }

/* ═══════════════════════════════════════════════════
   STAGES MODAL
   ═══════════════════════════════════════════════════ */

.stages-modal {
  background: #161b22; border: 1px solid rgba(255,255,255,0.1);
  border-radius: 16px; width: 440px; max-width: 95vw;
  box-shadow: 0 24px 80px rgba(0,0,0,0.5);
  animation: modalIn 0.2s ease;
}
.stages-list { padding: 12px 20px; display: flex; flex-direction: column; gap: 8px; }
.stage-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.06); border-radius: 8px;
}
.stage-drag-handle {
  cursor: grab; color: rgba(255,255,255,0.25); font-size: 14px;
}
.stage-color-btn {
  width: 22px; height: 22px; border-radius: 6px; border: 2px solid rgba(255,255,255,0.1);
  cursor: pointer; transition: border-color 0.12s;
}
.stage-color-btn:hover { border-color: rgba(255,255,255,0.3); }
.stage-name-input {
  flex: 1; background: transparent; border: none; color: #e6edf3;
  font-size: 0.85rem; font-weight: 600; outline: none;
  padding: 4px 6px; border-radius: 4px;
}
.stage-name-input:focus { background: rgba(255,255,255,0.06); }
.stage-delete-btn {
  background: none; border: none; color: rgba(239,68,68,0.5);
  cursor: pointer; font-size: 14px; padding: 4px; border-radius: 4px;
}
.stage-delete-btn:hover { color: #ef4444; background: rgba(239,68,68,0.1); }
.add-stage-btn {
  margin: 8px 20px 4px; padding: 8px; background: transparent;
  border: 1px dashed rgba(255,255,255,0.12); border-radius: 8px;
  color: rgba(255,255,255,0.35); font-size: 0.8rem; cursor: pointer;
  transition: all 0.15s;
}
.add-stage-btn:hover { border-color: rgba(255,255,255,0.25); color: rgba(255,255,255,0.6); }

/* Color picker popup */
.stage-color-picker {
  position: absolute; display: flex; gap: 4px; padding: 6px;
  background: #1e2330; border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,0.4); z-index: 6000;
}
.stage-color-opt {
  width: 24px; height: 24px; border-radius: 6px; border: 2px solid transparent;
  cursor: pointer; transition: all 0.1s;
}
.stage-color-opt:hover { transform: scale(1.15); }
.stage-color-opt.active { border-color: #fff; }

/* ═══════════════════════════════════════════════════
   TASK DETAIL PANEL (slide-in from right)
   ═══════════════════════════════════════════════════ */

.task-detail-panel {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: 420px; max-width: 100vw;
  background: #161b22; border-left: 1px solid rgba(255,255,255,0.08);
  box-shadow: -8px 0 40px rgba(0,0,0,0.4);
  z-index: 4000; display: flex; flex-direction: column;
  animation: slideIn 0.2s ease;
}
@keyframes slideIn { from { transform: translateX(100%); } to { transform: translateX(0); } }
.task-detail-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid rgba(255,255,255,0.06);
}
.task-detail-header h3 { margin: 0; font-size: 0.95rem; color: #e6edf3; }
.detail-close {
  background: none; border: none; color: rgba(255,255,255,0.4);
  font-size: 18px; cursor: pointer; padding: 4px 8px; border-radius: 6px;
}
.detail-close:hover { background: rgba(255,255,255,0.08); color: #fff; }
.task-detail-body {
  flex: 1; overflow-y: auto; padding: 16px 20px;
}
.detail-field { margin-bottom: 16px; }
.detail-field-label {
  font-size: 0.7rem; color: rgba(255,255,255,0.4);
  text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 4px; font-weight: 600;
}
.detail-field-value {
  font-size: 0.85rem; color: #e6edf3; line-height: 1.5;
}
.detail-field-value.editable {
  background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.06);
  border-radius: 6px; padding: 6px 10px; cursor: text;
}
.detail-field-value.editable:focus { border-color: rgba(212,168,67,0.3); outline: none; }
.detail-reminders { margin-top: 8px; }
.detail-reminder-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 10px; background: rgba(255,255,255,0.04);
  border-radius: 6px; margin-bottom: 4px; font-size: 0.78rem;
}
.detail-reminder-item .rem-channel { color: rgba(255,255,255,0.4); }
.detail-reminder-item .rem-time { color: rgba(212,168,67,0.7); }
.detail-reminder-item .rem-delete {
  background: none; border: none; color: rgba(239,68,68,0.4);
  cursor: pointer; font-size: 12px;
}
.detail-reminder-item .rem-delete:hover { color: #ef4444; }
.task-detail-footer {
  padding: 14px 20px; border-top: 1px solid rgba(255,255,255,0.06);
}
.detail-delete-btn {
  background: rgba(239,68,68,0.08); border: 1px solid rgba(239,68,68,0.15);
  color: #ef4444; border-radius: 8px; padding: 8px 16px;
  font-size: 0.82rem; cursor: pointer; transition: all 0.15s;
}
.detail-delete-btn:hover { background: rgba(239,68,68,0.15); }

/* ═══ Responsive Pipeline ═══ */
@media (max-width: 768px) {
  .pipeline-toolbar { flex-direction: column; align-items: stretch; }
  .pipeline-filters { flex-wrap: wrap; }
  .pipeline-fullboard { flex-direction: column; overflow-x: hidden; overflow-y: auto; }
  .pipeline-full-column { min-width: auto; max-width: none; }
  .task-modal { width: 95vw; }
  .task-fields-grid { grid-template-columns: 1fr; }
  .task-detail-panel { width: 100vw; }
}

/* ═══ STORE FLYOUT (sidebar hover menu) ═══ */
.store-module-wrap { position: relative; }
.store-flyout {
  display: none; position: absolute;
  left: 52px; top: 0;
  background: #1a1f2e; border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px; padding: 8px 0;
  min-width: 170px; z-index: 2001;
  box-shadow: 0 12px 40px rgba(0,0,0,0.6);
  opacity: 0; transform: translateX(-6px);
  transition: opacity 0.2s, transform 0.2s;
}
.store-module-wrap:hover .store-flyout {
  display: block; opacity: 1; transform: translateX(0);
}
.store-flyout-title {
  padding: 6px 14px 8px; font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 1.5px;
  color: rgba(255,255,255,0.3); border-bottom: 1px solid rgba(255,255,255,0.06);
  margin-bottom: 4px;
}
.store-flyout-btn {
  display: flex; align-items: center; gap: 8px;
  width: 100%; padding: 8px 14px; border: none;
  background: transparent; color: rgba(255,255,255,0.65);
  font-size: 13px; cursor: pointer; transition: all 0.15s;
  text-align: left;
}
.store-flyout-btn:hover {
  background: rgba(255,255,255,0.06); color: #fff;
}
.sf-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}
.sf-dot--green { background: #4ade80; }
.sf-dot--purple { background: #a78bfa; }
.sf-dot--orange { background: #fb923c; }
.sf-dot--blue { background: #60a5fa; }

/* ═══ TIENDAS MODULE ═══ */
.tiendas-wrapper {
  padding: 24px 32px; overflow-y: auto; height: 100vh;
  background: #0d1117;
}
.tiendas-header { margin-bottom: 24px; }
.tiendas-header h2 {
  font-size: 22px; font-weight: 700; color: #e6edf3; margin: 0 0 4px;
}
.tiendas-subtitle { color: #8b949e; font-size: 14px; margin: 0; }
.tiendas-tabs {
  display: flex; gap: 8px; margin-bottom: 24px; flex-wrap: wrap;
}
.tienda-tab {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 18px; border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.03); color: #8b949e;
  font-size: 13px; font-weight: 600; cursor: pointer;
  transition: all 0.2s;
}
.tienda-tab:hover, .tienda-tab.active {
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.2); color: #e6edf3;
}

/* Dashboard per store */
.tienda-dash { display: none; animation: tdashIn 0.35s ease; }
.tienda-dash.active { display: block; }
@keyframes tdashIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.tdash-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px; flex-wrap: wrap; gap: 10px;
}
.tdash-head h3 { font-size: 18px; font-weight: 700; color: #e6edf3; margin: 0; }
.tdash-status {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; color: #8b949e;
}
.tdot {
  width: 8px; height: 8px; border-radius: 50%;
}
.tdot.online { background: #4ade80; }
.tdot.connecting { background: #fb923c; animation: tdotPulse 1.4s infinite; }
.tdot.offline { background: #f87171; }
@keyframes tdotPulse { 0%,100% { opacity:1; } 50% { opacity:0.3; } }

/* KPI cards */
.tdash-kpis {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px; margin-bottom: 20px;
}
.tdash-kpi {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px; padding: 18px;
  transition: all 0.2s;
}
.tdash-kpi:hover {
  border-color: rgba(255,255,255,0.18);
  transform: translateY(-2px);
}
.tkpi-label {
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 1px; color: #8b949e; margin-bottom: 6px;
}
.tkpi-value {
  font-size: 28px; font-weight: 800; color: #e6edf3;
}
.tkpi-sub { font-size: 11px; margin-top: 4px; }
.tkpi-sub.neutral { color: #8b949e; }
.tkpi-sub.up { color: #4ade80; }
.tkpi-sub.down { color: #f87171; }

/* Charts */
.tdash-charts {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 14px; margin-bottom: 20px;
}
.tdash-chart {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px; padding: 18px;
}
.tdash-chart h4 {
  font-size: 14px; font-weight: 600; color: #8b949e; margin: 0 0 14px;
}
.tdash-placeholder {
  height: 160px; display: flex; align-items: center; justify-content: center;
  border: 1px dashed rgba(255,255,255,0.1); border-radius: 8px;
  color: #484f58; font-size: 13px;
}

/* Orders table */
.tdash-orders {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px; padding: 18px; overflow-x: auto;
}
.tdash-orders h4 {
  font-size: 14px; font-weight: 600; color: #8b949e; margin: 0 0 12px;
}
.tdash-table { width: 100%; border-collapse: collapse; }
.tdash-table th, .tdash-table td {
  padding: 10px 12px; text-align: left; font-size: 13px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.tdash-table th {
  color: #8b949e; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.5px; font-size: 11px;
}
.tdash-table td { color: #c9d1d9; }
.tdash-empty {
  text-align: center; color: #484f58; padding: 28px !important;
}

/* Responsive */
@media (max-width: 768px) {
  .tiendas-wrapper { padding: 16px; }
  .tdash-kpis { grid-template-columns: 1fr 1fr; }
  .tdash-charts { grid-template-columns: 1fr; }
}

/* ═══ TIENDA ENTRE RIOS — ODOO CONNECTED ═══ */
.tdash-refresh {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.7);
  border-radius: 8px;
  padding: 6px 12px;
  cursor: pointer;
  font-size: 16px;
  transition: all 0.2s;
  margin-left: auto;
}
.tdash-refresh:hover { background: rgba(255,255,255,0.15); color: #fff; }
.tdash-refresh.spinning { animation: spin 0.8s linear infinite; }
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

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

.tdash-summary { padding: 0 16px; margin-bottom: 16px; }
.tdash-summary-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tdash-summary-card {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  padding: 16px;
}
.tdash-summary-card h4 { margin: 0 0 12px 0; font-size: 14px; color: rgba(255,255,255,0.8); }
.ts-row { display: flex; justify-content: space-between; padding: 4px 0; font-size: 13px; color: rgba(255,255,255,0.5); }
.ts-row strong { color: #fff; font-weight: 600; }

.tdash-meta { border-top: 1px solid rgba(255,255,255,0.06); margin-top: 8px; }

.tdot.online { background: #25D366; box-shadow: 0 0 6px rgba(37,211,102,0.4); }
.tdot.connecting { background: #f0ad4e; animation: pulse 1.5s infinite; }
.tdot.offline { background: #666; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }

/* ═══ ENTRE RIOS ANALYTICS DASHBOARD ═══ */
.er-header { display:flex; justify-content:space-between; align-items:center; padding:16px 20px 8px; }
.er-title h3 { margin:0; font-size:18px; }
.er-controls { display:flex; gap:8px; align-items:center; }
.er-controls select { background:#1a1f2e; color:#fff; border:1px solid rgba(255,255,255,0.12); border-radius:8px; padding:6px 10px; font-size:13px; }

.er-kpis { display:grid; grid-template-columns:repeat(6,1fr); gap:10px; padding:10px 20px; }
.er-kpi { background:rgba(255,255,255,0.04); border:1px solid rgba(255,255,255,0.08); border-radius:12px; padding:14px; text-align:center; }
.er-kpi-main { background:rgba(37,211,102,0.08); border-color:rgba(37,211,102,0.2); }
.er-kpi-label { font-size:11px; color:rgba(255,255,255,0.5); text-transform:uppercase; letter-spacing:0.5px; margin-bottom:6px; }
.er-kpi-val { font-size:22px; font-weight:700; color:#fff; }
.er-kpi-sub { font-size:12px; color:rgba(255,255,255,0.4); margin-top:4px; }
.er-kpi-sub.positive { color:#25D366; }
.er-kpi-sub.warning { color:#f0ad4e; }
.er-kpi-sub.negative { color:#e74c3c; }

.er-projections { display:grid; grid-template-columns:repeat(5,1fr); gap:10px; padding:0 20px 10px; }
.er-proj-card { background:rgba(52,152,219,0.08); border:1px solid rgba(52,152,219,0.15); border-radius:10px; padding:10px 14px; display:flex; flex-direction:column; gap:4px; }
.er-proj-card span { font-size:11px; color:rgba(255,255,255,0.45); }
.er-proj-card strong { font-size:16px; color:#3498db; }

.er-grid { display:grid; grid-template-columns:1fr 1fr; gap:12px; padding:8px 20px 20px; }
.er-panel { background:rgba(255,255,255,0.03); border:1px solid rgba(255,255,255,0.07); border-radius:12px; padding:16px; }
.er-panel h4 { margin:0 0 12px; font-size:14px; color:rgba(255,255,255,0.75); }
.er-panel-wide { grid-column:1/-1; }

.er-chart { min-height:180px; max-height:350px; position:relative; overflow:hidden; }
#er-categ-chart.er-chart { min-height:auto; }
.er-bar-chart { display:flex; align-items:flex-end; gap:3px; height:160px; padding:0 4px; }
.er-bar { background:linear-gradient(180deg,#25D366,#1a9e4a); border-radius:3px 3px 0 0; min-width:8px; flex:1; position:relative; cursor:default; transition:opacity 0.2s; }
.er-bar:hover { opacity:0.8; }
.er-bar-tip { display:none; position:absolute; bottom:100%; left:50%; transform:translateX(-50%); background:#1a1f2e; border:1px solid rgba(255,255,255,0.15); border-radius:6px; padding:4px 8px; font-size:11px; white-space:nowrap; z-index:10; }
.er-bar:hover .er-bar-tip { display:block; }
.er-bar-labels { display:flex; gap:3px; padding:4px; }
.er-bar-label { flex:1; text-align:center; font-size:9px; color:rgba(255,255,255,0.3); overflow:hidden; }

.er-categ-bar { display:flex; height:24px; border-radius:6px; overflow:hidden; margin-bottom:8px; }
.er-categ-seg { height:100%; position:relative; cursor:default; transition:opacity 0.2s; }
.er-categ-seg:hover { opacity:0.8; }

.er-table-wrap { font-size:13px; }
.er-table-scroll { max-height:320px; overflow-y:auto; }
.er-table-wrap table { width:100%; border-collapse:collapse; }
.er-table-wrap th { text-align:left; padding:6px 8px; border-bottom:1px solid rgba(255,255,255,0.1); color:rgba(255,255,255,0.5); font-size:11px; text-transform:uppercase; position:sticky; top:0; background:#0d1117; }
.er-table-wrap td { padding:5px 8px; border-bottom:1px solid rgba(255,255,255,0.04); color:rgba(255,255,255,0.75); }
.er-table-wrap tr:hover td { background:rgba(255,255,255,0.03); }
.er-table-wrap .er-num { text-align:right; font-variant-numeric:tabular-nums; }
.er-table-wrap .er-money { color:#25D366; font-weight:600; }
.er-table-wrap .er-rank { color:rgba(255,255,255,0.3); font-size:11px; width:28px; }

/* ── Period selector bar ── */
.er-period-bar { display:flex; align-items:center; gap:6px; padding:4px 20px 8px; flex-wrap:wrap; }
.er-period-group { display:flex; gap:2px; }
.er-period-sep { width:1px; height:20px; background:rgba(255,255,255,0.1); margin:0 4px; }
.er-period-btn {
  background:rgba(255,255,255,0.04); border:1px solid rgba(255,255,255,0.08);
  color:rgba(255,255,255,0.55); border-radius:6px; padding:5px 12px; font-size:12px;
  cursor:pointer; transition:all 0.15s; font-weight:500; white-space:nowrap;
}
.er-period-btn:hover { background:rgba(255,255,255,0.08); color:rgba(255,255,255,0.85); }
.er-period-btn.active { background:rgba(37,211,102,0.15); border-color:rgba(37,211,102,0.4); color:#25D366; font-weight:600; }
.er-period-btn.er-period-sm { padding:4px 8px; font-size:11px; }
.er-period-label { margin-left:auto; font-size:12px; color:rgba(255,255,255,0.35); font-style:italic; }
@media (max-width:900px) {
  .er-period-bar { gap:4px; }
  .er-period-btn { padding:4px 8px; font-size:11px; }
  .er-period-label { display:none; }
}

.er-meta { padding:8px 20px; font-size:11px; color:rgba(255,255,255,0.3); border-top:1px solid rgba(255,255,255,0.05); }

@media (max-width:1200px) {
  .er-kpis { grid-template-columns:repeat(3,1fr); }
  .er-projections { grid-template-columns:repeat(3,1fr); }
  .er-grid { grid-template-columns:1fr; }
  .er-panel-wide { grid-column:1; }
}

/* ═══ TIENDA SUB-TABS ═══ */
.tienda-subtabs {
  display: flex; gap: 4px; margin-bottom: 20px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  padding-bottom: 0;
}
.tienda-subtab {
  padding: 8px 20px; border: none; background: transparent;
  color: #8b949e; font-size: 13px; font-weight: 600;
  cursor: pointer; transition: all 0.2s;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tienda-subtab:hover { color: #c9d1d9; }
.tienda-subtab.active {
  color: #fb923c; border-bottom-color: #fb923c;
}
.tienda-subcontent { display: none; animation: tdashIn 0.35s ease; }
.tienda-subcontent.active { display: block; }

/* Inventario category rows */
.inv-categ-row:hover { background: rgba(255,255,255,0.04) !important; }
.inv-categ-row td:first-child { transition: transform 0.2s; }
.inv-prod-row td { border-bottom-color: rgba(255,255,255,0.03) !important; }

/* ═══ INVENTORY INSIGHT CARDS ═══ */
.inv-insights {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 10px;
}
.inv-insight-card {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 14px; border-radius: 10px;
  transition: transform 0.15s;
}
.inv-insight-card:hover { transform: translateY(-1px); }
.inv-insight-icon { font-size: 18px; flex-shrink: 0; margin-top: 1px; }
.inv-insight-title { font-size: 13px; font-weight: 600; color: #e6edf3; line-height: 1.3; }
.inv-insight-desc { font-size: 11px; color: #8b949e; margin-top: 3px; line-height: 1.4; }


/* ═══════════════════════════════════════════════════════════════
   ANALYTICS FEATURES: Churn, Affinity, Peak Hours, Export
   ═══════════════════════════════════════════════════════════════ */

/* ═══ CHURN DETECTION ═══ */
.er-churn-summary {
  display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap;
}
.er-churn-stat {
  background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px; padding: 10px 16px; text-align: center; min-width: 100px;
}
.er-churn-stat-val { font-size: 22px; font-weight: 700; }
.er-churn-stat-label { font-size: 11px; color: rgba(255,255,255,0.45); margin-top: 2px; }
.er-churn-high { color: #f87171; }
.er-churn-medium { color: #fb923c; }
.er-churn-low { color: #fbbf24; }
.er-risk-dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px;
}
.er-risk-dot.high { background: #f87171; }
.er-risk-dot.medium { background: #fb923c; }
.er-risk-dot.low { background: #fbbf24; }

/* ═══ PRODUCT AFFINITY ═══ */
.er-affinity-bar {
  height: 8px; background: rgba(255,255,255,0.06); border-radius: 4px; overflow: hidden;
  min-width: 80px;
}
.er-affinity-bar-fill {
  height: 100%; background: linear-gradient(90deg, #60a5fa, #a78bfa);
  border-radius: 4px; transition: width 0.3s;
}
.er-pair-connector {
  color: rgba(255,255,255,0.3); font-size: 12px; padding: 0 6px;
}

/* ═══ PEAK HOURS HEATMAP ═══ */
.er-heatmap-container { overflow-x: auto; padding: 4px 0; }
.er-heatmap {
  display: grid;
  grid-template-columns: 40px repeat(24, 1fr);
  grid-template-rows: 24px repeat(7, 32px);
  gap: 2px;
  min-width: 600px;
}
.er-hm-header {
  font-size: 10px; color: rgba(255,255,255,0.35);
  display: flex; align-items: center; justify-content: center;
  font-weight: 600;
}
.er-hm-day {
  font-size: 11px; color: rgba(255,255,255,0.55); font-weight: 600;
  display: flex; align-items: center; justify-content: flex-end;
  padding-right: 6px;
}
.er-hm-cell {
  border-radius: 4px; position: relative; cursor: default;
  transition: transform 0.1s, box-shadow 0.15s;
  display: flex; align-items: center; justify-content: center;
  font-size: 9px; color: transparent;
}
.er-hm-cell:hover {
  transform: scale(1.4); z-index: 5;
  box-shadow: 0 0 12px rgba(37,211,102,0.5);
  color: #fff; font-weight: 700;
}
.er-hm-cell:hover::after {
  content: attr(data-tip);
  position: absolute; bottom: calc(100% + 6px); left: 50%;
  transform: translateX(-50%);
  background: #1a1f2e; border: 1px solid rgba(255,255,255,0.15);
  border-radius: 6px; padding: 4px 8px;
  font-size: 11px; color: #fff; white-space: nowrap; z-index: 20;
  pointer-events: none;
}
.er-hm-0 { background: rgba(255,255,255,0.02); }
.er-hm-1 { background: rgba(37,211,102,0.12); }
.er-hm-2 { background: rgba(37,211,102,0.25); }
.er-hm-3 { background: rgba(37,211,102,0.40); }
.er-hm-4 { background: rgba(37,211,102,0.55); }
.er-hm-5 { background: rgba(37,211,102,0.70); }
.er-hm-6 { background: rgba(37,211,102,0.85); }
.er-hm-7 { background: #25D366; }
.er-hm-legend {
  display: flex; align-items: center; gap: 4px; margin-top: 8px;
  font-size: 10px; color: rgba(255,255,255,0.35);
}
.er-hm-legend-cell {
  width: 14px; height: 14px; border-radius: 3px;
}

/* ═══ CUSTOMER EXPORT ═══ */
.er-export-btn {
  display: flex; align-items: center; gap: 8px;
  background: rgba(37,211,102,0.12); border: 1px solid rgba(37,211,102,0.3);
  color: #25D366; border-radius: 10px; padding: 10px 20px;
  font-size: 14px; font-weight: 600; cursor: pointer;
  transition: all 0.2s; margin-top: 12px; width: 100%;
  justify-content: center;
}
.er-export-btn:hover {
  background: rgba(37,211,102,0.2); border-color: #25D366;
  transform: translateY(-1px); box-shadow: 0 4px 12px rgba(37,211,102,0.2);
}
.er-export-btn:active { transform: translateY(0); }
.er-export-btn.loading { opacity: 0.6; pointer-events: none; }


/* ═══ Odoo Member Status Badges ═══ */
.member-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 8px;
  margin-left: 4px;
  line-height: 16px;
  white-space: nowrap;
  vertical-align: middle;
}
.member-badge--activo {
  background: #dcfce7;
  color: #166534;
}
.member-badge--vencido {
  background: #fee2e2;
  color: #991b1b;
}
.member-badge--revision {
  background: #fef9c3;
  color: #854d0e;
}
.member-badge--no-socio {
  background: #f3f4f6;
  color: #6b7280;
}

/* Dark theme overrides */
[data-theme="dark"] .member-badge--activo {
  background: #14532d;
  color: #86efac;
}
[data-theme="dark"] .member-badge--vencido {
  background: #7f1d1d;
  color: #fca5a5;
}
[data-theme="dark"] .member-badge--revision {
  background: #713f12;
  color: #fde047;
}
[data-theme="dark"] .member-badge--no-socio {
  background: #374151;
  color: #9ca3af;
}


/* ═══ BREADCRUMB NAVIGATION ═══ */
#breadcrumb-bar {
  position: fixed;
  bottom: 8px;
  left: 56px;
  z-index: 9000;
  background: rgba(22, 27, 34, 0.85);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  padding: 4px 14px;
  font-size: 12px;
  color: rgba(255,255,255,0.5);
  font-family: 'SF Mono', 'Fira Code', monospace;
  letter-spacing: 0.3px;
  pointer-events: none;
  user-select: all;
  transition: opacity 0.2s;
}
#breadcrumb-bar:hover {
  opacity: 1;
  color: rgba(255,255,255,0.7);
}
#breadcrumb-path {
  color: inherit;
}


/* ═══ NOTIFICATION WHATSAPP ═══ */
.notif-status-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 12px;
  letter-spacing: 0.3px;
}
.notif-connected {
  background: #dcfce7;
  color: #166534;
}
.notif-qr {
  background: #fef9c3;
  color: #854d0e;
  animation: pulse-badge 1.5s infinite;
}
.notif-disconnected {
  background: #f3f4f6;
  color: #6b7280;
}
@keyframes pulse-badge {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}
[data-theme="dark"] .notif-connected { background: #14532d; color: #86efac; }
[data-theme="dark"] .notif-qr { background: #713f12; color: #fde047; }
[data-theme="dark"] .notif-disconnected { background: #374151; color: #9ca3af; }
.btn-danger {
  background: #ef4444;
  color: white;
  border: none;
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-danger:hover { background: #dc2626; }


/* ═══ PROFILE ORDER HISTORY ═══ */
.btn-sm-green {
  background: #25D366; color: #fff; border: none; border-radius: 6px;
  padding: 4px 10px; font-size: 11px; font-weight: 600; cursor: pointer;
  transition: all 0.15s;
}
.btn-sm-green:hover { background: #1da851; }
.profile-order-card {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px; padding: 10px; margin-bottom: 8px;
}
.profile-order-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 6px;
}
.profile-order-name { font-size: 12px; font-weight: 700; color: #e6edf3; }
.profile-order-date { font-size: 10px; color: #8b949e; }
.profile-order-total { font-size: 13px; font-weight: 700; color: #25D366; }
.profile-order-lines { padding-left: 8px; border-left: 2px solid rgba(255,255,255,0.08); }
.profile-order-line {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 11px; color: #8b949e; padding: 2px 0;
}
.profile-order-line .pol-name { flex: 1; color: #c9d1d9; }
.profile-order-line .pol-qty { min-width: 30px; text-align: right; }
.profile-order-line .pol-price { min-width: 65px; text-align: right; color: #e6edf3; }
.profile-orders-empty {
  text-align: center; padding: 16px; color: #8b949e; font-size: 12px;
}

/* ═══ EXPIRED RX SALES KPI ═══ */
.expired-rx-panel {
  background: rgba(239,68,68,0.04);
  border: 1px solid rgba(239,68,68,0.15);
  border-radius: 12px; padding: 16px; margin-top: 16px;
}
.expired-rx-panel h4 {
  font-size: 14px; font-weight: 700; color: #ef4444; margin: 0 0 12px;
}
.expired-rx-kpis {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px;
}
.expired-rx-kpi {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 8px; padding: 10px; text-align: center;
}
.erx-val { font-size: 22px; font-weight: 800; color: #e6edf3; }
.erx-val.danger { color: #ef4444; }
.erx-label { font-size: 10px; color: #8b949e; text-transform: uppercase; letter-spacing: 0.5px; margin-top: 2px; }
.expired-rx-table {
  width: 100%; font-size: 11px; border-collapse: collapse;
}
.expired-rx-table th {
  text-align: left; font-size: 10px; color: #8b949e; text-transform: uppercase;
  padding: 6px 8px; border-bottom: 1px solid rgba(255,255,255,0.08);
}
.expired-rx-table td {
  padding: 6px 8px; color: #c9d1d9;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.expired-rx-table .rx-expired-date { color: #ef4444; font-weight: 600; }
.expired-rx-toggle {
  background: none; border: 1px solid rgba(239,68,68,0.3); border-radius: 6px;
  color: #ef4444; font-size: 11px; padding: 4px 10px; cursor: pointer; margin-top: 8px;
  transition: all 0.15s;
}
.expired-rx-toggle:hover { background: rgba(239,68,68,0.1); }

/* ═══ General Tab — Aggregated Store View ═══ */
.sf-dot--gold { background: #f5c842; box-shadow: 0 0 6px rgba(245,200,66,0.5); }
.store-breakdown { margin-top: 4px; }
.store-breakdown table { width: 100%; border-collapse: collapse; }
.store-breakdown th { text-align: left; font-size: 11px; color: var(--text-secondary); padding: 6px 8px; border-bottom: 1px solid rgba(255,255,255,0.08); }
.store-breakdown td { padding: 8px; font-size: 13px; border-bottom: 1px solid rgba(255,255,255,0.04); }
.store-breakdown .sb-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 6px; }
.store-breakdown .sb-bar-wrap { height: 8px; border-radius: 4px; background: rgba(255,255,255,0.06); width: 100%; }
.store-breakdown .sb-bar-fill { height: 100%; border-radius: 4px; transition: width 0.5s ease; }
.store-breakdown tr.sb-total td { font-weight: 700; border-top: 2px solid rgba(255,255,255,0.15); color: #25D366; }
