/* style.css — Skoop Dashboard */

:root {
  --bg: #0c0f1a;
  --surface: #131729;
  --surface2: #1c2138;
  --surface3: #242a45;
  --border: #252d47;
  --border-light: #2d3656;

  --purple: #7c3aed;
  --purple-light: #9f67ff;
  --purple-dim: rgba(124, 58, 237, 0.15);
  --purple-glow: rgba(124, 58, 237, 0.08);

  --green: #10b981;
  --green-dim: rgba(16, 185, 129, 0.12);
  --yellow: #f59e0b;
  --yellow-dim: rgba(245, 158, 11, 0.12);
  --red: #ef4444;
  --red-dim: rgba(239, 68, 68, 0.12);
  --gray-dim: rgba(100, 116, 139, 0.12);

  --text: #e2e8f0;
  --text-muted: #8892a4;
  --text-dim: #4a5568;

  --sidebar-w: 220px;
  --toolbar-h: 60px;
  --radius: 10px;
  --radius-sm: 6px;
}

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

html, body { height: 100%; background: var(--bg); color: var(--text); font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', system-ui, sans-serif; font-size: 13px; line-height: 1.5; }

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }

/* ══ LAYOUT ══════════════════════════════════════════════ */

.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  height: 100vh;
  overflow: hidden;
}

/* ══ SIDEBAR ════════════════════════════════════════════ */

.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 16px 14px;
  border-bottom: 1px solid var(--border);
}

.logo-icon {
  width: 34px;
  height: 34px;
  background: var(--purple);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 16px;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 0 20px rgba(124, 58, 237, 0.35);
}

/* Logo del dumpling 🥟 */
.logo-img {
  width: 38px;
  height: 38px;
  object-fit: cover;
  background: transparent;
  box-shadow: 0 0 20px rgba(56, 132, 255, 0.4);
}

.logo-name { font-weight: 700; font-size: 15px; line-height: 1; }
.logo-sub { font-size: 10px; color: var(--text-dim); margin-top: 2px; }

.community-box {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.community-label {
  display: block;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-dim);
  margin-bottom: 5px;
}

.community-select {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border-light);
  color: var(--text);
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.community-select:focus { outline: 1px solid var(--purple); }

.nav {
  flex: 1;
  padding: 8px 10px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  text-decoration: none;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.15s;
  user-select: none;
}
.nav-item:hover { background: var(--surface2); color: var(--text); }
.nav-item.active {
  background: var(--purple-dim);
  color: var(--purple-light);
  font-weight: 600;
}
.nav-item svg { flex-shrink: 0; opacity: 0.7; }
.nav-item.active svg { opacity: 1; }

.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sync-status {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  color: var(--text-dim);
}

.sync-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-dim);
}
.sync-dot.active { background: var(--green); box-shadow: 0 0 6px var(--green); }

/* ══ MAIN ════════════════════════════════════════════════ */

.main {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
}

/* TOOLBAR */
.toolbar {
  height: var(--toolbar-h);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background: var(--surface);
  flex-shrink: 0;
}

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

.page-title { font-size: 17px; font-weight: 700; }

.community-tag {
  background: var(--purple-dim);
  color: var(--purple-light);
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 4px;
}

/* ══ BUTTONS ════════════════════════════════════════════ */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
}

.btn-purple { background: var(--purple); color: #fff; }
.btn-purple:hover { background: var(--purple-light); }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border-light);
}
.btn-ghost:hover { color: var(--text); border-color: var(--text-dim); }

.btn-sm { padding: 4px 10px; font-size: 11px; }

.btn-outline {
  background: transparent;
  border: 1px solid var(--border-light);
  color: var(--text-muted);
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.15s;
  width: 100%;
}
.btn-outline:hover { color: var(--text); }

.btn-link {
  background: none;
  border: none;
  color: var(--purple-light);
  font-size: 12px;
  cursor: pointer;
  padding: 0;
  font-weight: 500;
}
.btn-link:hover { text-decoration: underline; }

/* ══ PAGES ═══════════════════════════════════════════════ */

.page {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.page.hidden { display: none; }

.page-desc {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

/* ══ CARDS ══════════════════════════════════════════════ */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
}

.card.no-pad { padding: 0; }

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.card-title { font-size: 14px; font-weight: 700; }

.card-desc {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 12px;
  line-height: 1.6;
}

.tag {
  background: var(--surface2);
  color: var(--text-muted);
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 500;
}

/* ══ KPI GRID ═══════════════════════════════════════════ */

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
}

@media (max-width: 1200px) { .kpi-grid { grid-template-columns: repeat(3, 1fr); } }

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: border-color 0.2s;
}
.kpi-card:hover { border-color: var(--border-light); }

.kpi-card.kpi-green { border-color: rgba(16, 185, 129, 0.3); background: linear-gradient(135deg, var(--surface), rgba(16,185,129,0.04)); }
.kpi-card.kpi-yellow { border-color: rgba(245, 158, 11, 0.3); background: linear-gradient(135deg, var(--surface), rgba(245,158,11,0.04)); }
.kpi-card.kpi-red { border-color: rgba(239, 68, 68, 0.3); background: linear-gradient(135deg, var(--surface), rgba(239,68,68,0.04)); }
.kpi-card.kpi-gray { border-color: var(--border-light); }

.kpi-icon { font-size: 20px; flex-shrink: 0; }
.kpi-number { font-size: 24px; font-weight: 800; line-height: 1; color: var(--text); }
.kpi-label { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* ══ CHARTS ═════════════════════════════════════════════ */

.charts-row {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 16px;
}

.chart-card { }
.chart-wide { }

/* FREEMIUM — banner y candados */
#free-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin: 0 0 16px;
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 13px;
  color: #ede9fe;
  background: linear-gradient(90deg, rgba(139,92,246,0.22), rgba(139,92,246,0.08));
  border: 1px solid rgba(139,92,246,0.45);
}

.lock-card {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 10px 0 2px;
  padding: 14px 16px;
  border-radius: 10px;
  cursor: pointer;
  background: linear-gradient(180deg, rgba(139,92,246,0.12), rgba(139,92,246,0.04));
  border: 1px dashed rgba(139,92,246,0.5);
  transition: border-color .15s, background .15s;
}
.lock-card:hover { border-color: rgba(139,92,246,0.9); }
.lock-emoji { font-size: 22px; }
.lock-title { font-weight: 700; font-size: 14px; }
.lock-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.lock-card .btn { margin-left: auto; flex-shrink: 0; }

.donut-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

.donut-svg { width: 184px; height: 184px; flex-shrink: 0; }

.donut-legend {
  display: flex;
  flex-direction: column;
  gap: 11px;
  font-size: 13px;
  width: 100%;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 9px;
}

.legend-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  flex-shrink: 0;
}

.legend-label { color: var(--text-muted); white-space: nowrap; }
.legend-count {
  font-weight: 700;
  margin-left: auto;
  padding-left: 12px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.legend-pct { color: var(--text-dim); font-weight: 600; font-size: 11px; margin-left: 2px; }

/* MINI MEMBER LIST (overview) */
.mini-member-list { display: flex; flex-direction: column; gap: 1px; }

.mini-member {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 4px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.1s;
}
.mini-member:hover { background: var(--surface2); }

.mini-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--surface2);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  flex-shrink: 0;
  overflow: hidden;
}
.mini-avatar img { width: 100%; height: 100%; object-fit: cover; }

.mini-info { flex: 1; min-width: 0; }
.mini-name { font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-meta { font-size: 10px; color: var(--text-dim); }

.mini-badge {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 600;
  flex-shrink: 0;
}
.badge-active { background: var(--green-dim); color: var(--green); }
.badge-silent { background: var(--yellow-dim); color: var(--yellow); }
.badge-atRisk { background: var(--red-dim); color: var(--red); }
.badge-churned { background: var(--gray-dim); color: var(--text-dim); }

/* FASE 2: por irse / cancelación */
.badge-cancel {
  background: #ef444422;
  color: #ef4444;
  border: 1px solid #ef444455;
  display: inline-block;
  margin-top: 4px;
  font-weight: 700;
}
.filter-btn-cancel { border-color: #ef444455; }
.filter-btn-cancel.active { background: var(--red); color: #fff; }
.filter-btn-rescue { border-color: #f59e0b55; }
.filter-btn-rescue.active { background: #f59e0b; color: #1a1a1a; }
.rescue-banner {
  background: #f59e0b1a;
  border: 1px solid #f59e0b55;
  border-left: 3px solid #f59e0b;
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 14px;
  font-size: 13px;
  color: var(--text);
}
.filter-count-badge {
  display: inline-block;
  min-width: 16px;
  padding: 0 5px;
  margin-left: 4px;
  border-radius: 9px;
  background: var(--red);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
}
.cancel-banner {
  background: #ef44441a;
  border: 1px solid #ef444455;
  border-left: 3px solid #ef4444;
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 14px;
  font-size: 13px;
  color: var(--text);
}
.cancel-banner-gone { background: var(--gray-dim); border-color: var(--text-dim); border-left-color: var(--text-dim); }

/* Chips de tier (Standard / Premium / VIP) */
.tier-chip {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  vertical-align: middle;
  letter-spacing: .3px;
}
.tier-standard { background: rgba(148,163,184,.18); color: #94a3b8; }
.tier-premium { background: rgba(124,58,237,.18); color: var(--purple-light); }
.tier-vip { background: rgba(245,158,11,.2); color: #f59e0b; }

/* FEED PREVIEW */
.feed-preview { display: flex; flex-direction: column; gap: 1px; }

.feed-preview-item {
  padding: 10px 4px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.1s;
}
.feed-preview-item:last-child { border-bottom: none; }
.feed-preview-item:hover { background: var(--surface2); border-radius: var(--radius-sm); }

.feed-preview-author { font-weight: 600; font-size: 12px; }
.feed-preview-time { font-size: 10px; color: var(--text-dim); margin-left: 8px; }
.feed-preview-text { font-size: 12px; color: var(--text-muted); margin-top: 3px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }

/* ENDPOINT CHIPS */
.endpoint-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.endpoint-chip {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 3px 8px;
  font-size: 11px;
  font-family: 'SF Mono', 'Fira Code', monospace;
  color: var(--text-muted);
}
.endpoint-chip .method { color: var(--purple-light); margin-right: 4px; font-weight: 600; }

/* ══ PIPELINE KANBAN ════════════════════════════════════ */

.pipeline {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 8px;
  flex: 1;
  min-height: 0;
}

.pipeline-col {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 200px;
}

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

.pipeline-title {
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
}

.pipeline-count {
  background: var(--surface2);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 10px;
}

.pipeline-cards {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.pipeline-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px;
  cursor: pointer;
  transition: all 0.15s;
}
.pipeline-card:hover { border-color: var(--purple); background: var(--surface3); }

.pipeline-card-name { font-size: 12px; font-weight: 600; }
.pipeline-card-meta { font-size: 10px; color: var(--text-dim); margin-top: 3px; }

/* ══ MEMBERS TABLE ══════════════════════════════════════ */

.table-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.search-input {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  width: 220px;
  flex-shrink: 0;
}
.search-input:focus { outline: 1px solid var(--purple); }
.search-input::placeholder { color: var(--text-dim); }

.filter-group { display: flex; gap: 4px; }

.filter-btn {
  padding: 5px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--border);
  background: none;
  color: var(--text-muted);
  white-space: nowrap;
  transition: all 0.15s;
}
.filter-btn:hover { color: var(--text); border-color: var(--text-dim); }
.filter-btn.active { background: var(--purple-dim); border-color: var(--purple); color: var(--purple-light); }

.sort-group { display: flex; align-items: center; gap: 6px; }
.sort-label { font-size: 11px; color: var(--text-dim); }
.sort-select {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 5px 8px;
  border-radius: var(--radius-sm);
  font-size: 11px;
}

.member-count { font-size: 11px; color: var(--text-dim); margin-left: auto; }

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

.members-table th {
  text-align: left;
  padding: 10px 16px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  top: 0;
}

.members-table td {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  vertical-align: middle;
}

.members-table tr:hover td { background: var(--surface2); }
.members-table tr:last-child td { border-bottom: none; }

.td-member { display: flex; align-items: center; gap: 10px; }
.td-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--surface2);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
  overflow: hidden;
}
.td-avatar img { width: 100%; height: 100%; object-fit: cover; }

.td-name { font-weight: 600; }
.td-username { font-size: 10px; color: var(--text-dim); }

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 4px;
  font-weight: 600;
}

/* Chips de razón de churn (Nivel 1, Primer mes, Canceló, etc.) */
.reason-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}
.reason-chip {
  display: inline-flex;
  align-items: center;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--text);
  white-space: nowrap;
}

/* Plan de hoy — items marcables */
.plan-item:hover { background: var(--surface2); }
.plan-item.done .plan-item-text {
  text-decoration: line-through;
  color: var(--text-dim);
}

/* Calendario semanal */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}

.table-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 12px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-muted);
}

/* ══ FEED GRID ══════════════════════════════════════════ */

.feed-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.feed-grid { display: flex; flex-direction: column; gap: 10px; }

.feed-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  transition: border-color 0.2s;
}
.feed-card:hover { border-color: var(--border-light); }

.feed-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.feed-author-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--surface2);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
  overflow: hidden;
}
.feed-author-avatar img { width: 100%; height: 100%; object-fit: cover; }

.feed-author-info { flex: 1; }
.feed-author-name { font-size: 13px; font-weight: 700; }
.feed-post-time { font-size: 11px; color: var(--text-dim); }

.feed-card-body {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.7;
  margin-bottom: 10px;
}

.feed-card-stats {
  display: flex;
  gap: 16px;
  font-size: 11px;
  color: var(--text-dim);
}

/* ══ EMAILS IA ══════════════════════════════════════════ */

.emails-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 16px;
  height: 100%;
  min-height: 0;
}

.emails-sidebar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.emails-section-title {
  font-size: 13px;
  font-weight: 700;
  padding: 14px 16px 8px;
}

.emails-desc {
  font-size: 11px;
  color: var(--text-muted);
  padding: 0 16px 12px;
  line-height: 1.6;
  border-bottom: 1px solid var(--border);
}

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

.email-member-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}
.email-member-item:hover { background: var(--surface2); }
.email-member-item.selected { background: var(--purple-dim); }

.email-member-name { font-size: 12px; font-weight: 600; }
.email-member-days { font-size: 10px; color: var(--text-dim); margin-top: 2px; }

.emails-editor {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.email-placeholder {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--text-muted);
  padding: 40px;
  text-align: center;
  font-size: 13px;
}
.email-placeholder-icon { font-size: 40px; }

.email-member-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--surface2);
}

.avatar-placeholder-lg {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--purple-dim);
  border: 2px solid var(--purple);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
  color: var(--purple-light);
  flex-shrink: 0;
}

.email-member-name { font-size: 15px; font-weight: 700; }
.email-member-meta { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

.email-options {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.opt-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--text-dim);
}

.opt-group {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.opt-btn {
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--border);
  background: none;
  color: var(--text-muted);
  transition: all 0.15s;
}
.opt-btn:hover { color: var(--text); border-color: var(--text-dim); }
.opt-btn.active { background: var(--purple-dim); border-color: var(--purple); color: var(--purple-light); }

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
}
.checkbox-label input { accent-color: var(--purple); }

.email-output-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px 6px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--text-dim);
}

.email-textarea {
  flex: 1;
  margin: 0 20px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 13px;
  line-height: 1.7;
  padding: 12px;
  resize: none;
  font-family: inherit;
  min-height: 180px;
}
.email-textarea:focus { outline: 1px solid var(--purple); }

.email-subject-input {
  margin: 0 20px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 13px;
  padding: 10px 12px;
  font-family: inherit;
  box-sizing: border-box;
}
.email-subject-input:focus { outline: 1px solid var(--purple); }

.email-actions {
  display: flex;
  gap: 8px;
  padding: 12px 20px;
}
.email-send-actions { padding-top: 0; }
.btn-send { background: #16a34a; color: #fff; }
.btn-send:hover { background: #15803d; }
.btn-wa { background: #25D366; color: #fff; }
.btn-wa:hover { background: #1da851; }
.btn-send:disabled, .btn-wa:disabled { opacity: 0.45; cursor: not-allowed; }

.claude-tip {
  margin: 0 20px 16px;
  background: var(--purple-glow);
  border: 1px solid rgba(124, 58, 237, 0.2);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.6;
}
.claude-tip strong { color: var(--purple-light); }

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

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(3px);
}
.modal-overlay.hidden { display: none; }

/* ── Onboarding (bienvenida + tutorial) ── */
.onboarding-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.65);
  display: flex; align-items: center; justify-content: center;
  z-index: 1200; backdrop-filter: blur(4px);
}
.onboarding-overlay.hidden { display: none; }
.onboarding-card {
  position: relative; background: var(--surface); border: 1px solid var(--border-light);
  border-radius: 16px; width: 540px; max-width: calc(100vw - 40px);
  max-height: calc(100vh - 60px); overflow-y: auto;
  padding: 30px 30px 22px; box-shadow: 0 24px 70px rgba(0,0,0,.5);
}
.onboarding-skip {
  position: absolute; top: 14px; right: 14px; background: none; border: none;
  color: var(--text-dim); font-size: 12px; font-weight: 600; cursor: pointer; padding: 4px 6px;
}
.onboarding-skip:hover { color: var(--text-muted); }
.onboarding-body { min-height: 240px; }
.onb-hero { font-size: 46px; text-align: center; margin-bottom: 6px; }
.onb-title { font-size: 22px; font-weight: 800; text-align: center; margin-bottom: 6px; color: var(--text); }
.onb-sub { font-size: 14px; color: var(--purple-light); text-align: center; font-weight: 600; margin-bottom: 14px; }
.onb-p { font-size: 14px; line-height: 1.6; color: var(--text-muted); text-align: center; margin: 0 6px; }
.onb-feats { list-style: none; padding: 0; margin: 6px 0 0; display: flex; flex-direction: column; gap: 12px; }
.onb-feats li { display: flex; gap: 12px; align-items: flex-start; font-size: 13.5px; line-height: 1.5; color: var(--text-muted); }
.onb-feats li span { font-size: 20px; flex: 0 0 auto; line-height: 1.3; }
.onb-feats li strong { color: var(--text); }
.onb-steps { list-style: none; padding: 0; margin: 6px 0 14px; display: flex; flex-direction: column; gap: 14px; }
.onb-steps li { display: flex; gap: 12px; align-items: center; font-size: 14px; line-height: 1.5; color: var(--text-muted); }
.onb-steps li strong { color: var(--text); }
.onb-num {
  flex: 0 0 auto; width: 28px; height: 28px; border-radius: 50%;
  background: var(--purple); color: #fff; font-weight: 800; font-size: 14px;
  display: flex; align-items: center; justify-content: center;
}
.onboarding-dots { display: flex; justify-content: center; gap: 7px; margin: 18px 0 16px; }
.onb-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--surface3); transition: all .15s; }
.onb-dot.on { background: var(--purple-light); width: 22px; border-radius: 4px; }
.onboarding-actions { display: flex; align-items: center; gap: 10px; }
.onboarding-actions #onb-prev { flex: 0 0 auto; }
.onboarding-actions .btn-video { flex: 1 1 auto; text-align: center; text-decoration: none; }
.onboarding-actions #onb-next { flex: 0 0 auto; }
.onboarding-actions .hidden { display: none; }
.btn-video { background: var(--surface2); color: var(--text); border: 1px solid var(--border-light); }
.btn-video:hover { border-color: var(--purple); color: var(--purple-light); }

.modal {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  width: 520px;
  max-height: 80vh;
  overflow-y: auto;
  position: relative;
  padding: 24px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.4);
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 14px;
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 16px;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 4px;
}
.modal-close:hover { color: var(--text); background: var(--surface2); }

.modal-member-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
}

.modal-avatar {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: var(--surface2);
  border: 2px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 700;
  overflow: hidden;
}
.modal-avatar img { width: 100%; height: 100%; object-fit: cover; }

.modal-member-name { font-size: 18px; font-weight: 800; }
.modal-member-meta { font-size: 12px; color: var(--text-muted); margin-top: 3px; }

.modal-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}

.modal-stat {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px;
  text-align: center;
}

.modal-stat-number { font-size: 20px; font-weight: 800; }
.modal-stat-label { font-size: 10px; color: var(--text-dim); margin-top: 2px; }

.modal-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-dim);
  margin-bottom: 8px;
}

.modal-timeline { display: flex; flex-direction: column; gap: 6px; }
.modal-timeline-item {
  display: flex;
  gap: 10px;
  font-size: 12px;
  color: var(--text-muted);
}
.timeline-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--purple); margin-top: 6px; flex-shrink: 0; }

/* ══ TOAST ══════════════════════════════════════════════ */

.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface3);
  border: 1px solid var(--border-light);
  color: var(--text);
  padding: 9px 18px;
  border-radius: var(--radius);
  font-size: 13px;
  z-index: 9999;
  white-space: nowrap;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  animation: toast-in 0.2s ease;
}
.toast.hidden { display: none; }
@keyframes toast-in { from { opacity: 0; transform: translateX(-50%) translateY(10px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }

/* ══ UTILS ══════════════════════════════════════════════ */
.hidden { display: none !important; }

/* ══ EQUIPO: ESTADO DE ATENCIÓN (Fase 5) ════════════════ */
.attn-dot { display:inline-block; width:8px; height:8px; border-radius:50%; margin-right:6px; vertical-align:middle; flex:0 0 auto; }
.attn-mini { display:inline-flex; align-items:center; justify-content:center; min-width:18px; height:18px; padding:0 4px; margin-left:6px; border-radius:9px; background:var(--purple-dim); color:var(--purple-light); font-size:10px; font-weight:700; vertical-align:middle; }

/* Pastilla visible de atención (Atendido / Atendiéndose) en listas */
.attn-badge { display:inline-flex; align-items:center; gap:4px; padding:3px 9px; border-radius:999px; font-size:11px; font-weight:800; letter-spacing:.2px; line-height:1.4; max-width:100%; }
.attn-badge.done { background:var(--green); color:#052e1c; box-shadow:0 0 0 1px rgba(16,185,129,.35); }
.attn-badge.attending { background:#f59e0b; color:#3a2500; box-shadow:0 0 0 1px rgba(245,158,11,.35); }
.pipeline-card-attn { margin:6px 0 2px; }
.td-attn { margin-top:4px; }

/* Banner de atención dentro del modal del miembro */
.attn-banner { display:flex; align-items:center; gap:6px; font-size:13px; font-weight:700; padding:9px 12px; border-radius:9px; margin-bottom:8px; }
.attn-banner.done { background:var(--green-dim); color:var(--green); border:1px solid rgba(16,185,129,.4); }
.attn-banner.attending { background:rgba(245,158,11,.12); color:#f59e0b; border:1px solid rgba(245,158,11,.4); }

/* Píldora de sincronización del equipo en el toolbar */
.team-sync { display:inline-flex; align-items:center; gap:5px; padding:3px 10px; border-radius:999px; font-size:11px; font-weight:700; }
.team-sync.pending { background:rgba(245,158,11,.14); color:#f59e0b; border:1px solid rgba(245,158,11,.35); }
.team-sync.syncing { background:var(--purple-dim); color:var(--purple-light); border:1px solid rgba(124,58,237,.35); }
.team-sync.synced { background:var(--green-dim); color:var(--green); border:1px solid rgba(16,185,129,.35); }
.team-sync.hidden { display:none; }

/* Filtro de atención del pipeline */
.attn-filter-bar { display:flex; align-items:center; flex-wrap:wrap; gap:6px; margin-bottom:14px; }
.attn-filter-label { color:var(--text-muted); font-size:12px; font-weight:600; margin-right:2px; }

/* Segmented control de atención dentro del modal */
.attn-seg-row { display:flex; gap:6px; flex-wrap:wrap; margin-bottom:8px; }
.attn-seg { flex:1 1 0; min-width:96px; padding:9px 10px; border:1px solid var(--surface3); background:var(--surface); color:var(--text); border-radius:9px; font-size:12px; font-weight:600; cursor:pointer; transition:all .12s; }
.attn-seg:hover { border-color:var(--purple); }
.attn-seg.active { background:var(--purple); border-color:var(--purple); color:#fff; }
.attn-who { font-size:12px; color:var(--text-muted); margin-bottom:4px; }
.attn-me { font-size:12px; color:var(--text-dim); }
.attn-me a { color:var(--purple-light); text-decoration:none; }
.attn-me a:hover { text-decoration:underline; }

/* Etiquetas */
.label-row { display:flex; flex-wrap:wrap; gap:6px; align-items:center; }
.label-chip { padding:5px 10px; border:1px solid var(--surface3); background:var(--surface); color:var(--text); border-radius:14px; font-size:12px; font-weight:600; cursor:pointer; transition:all .12s; }
.label-chip:hover { border-color:var(--purple); }
.label-chip.add { border-style:dashed; color:var(--text-muted); }

/* Notas del equipo */
.team-notes { display:flex; flex-direction:column; gap:8px; margin-bottom:10px; max-height:220px; overflow-y:auto; }
.team-note { background:var(--surface2); border:1px solid var(--surface3); border-radius:9px; padding:9px 11px; }
.team-note-head { font-size:11px; color:var(--text-muted); margin-bottom:3px; }
.team-note-body { font-size:13px; color:var(--text); white-space:pre-wrap; word-break:break-word; }
.team-note-add { display:flex; gap:8px; align-items:flex-end; }
.team-note-add textarea { flex:1; box-sizing:border-box; background:var(--surface); color:var(--text); border:1px solid var(--surface3); border-radius:9px; padding:9px; font-size:13px; font-family:inherit; resize:vertical; }
.team-note-add textarea:focus { outline:none; border-color:var(--purple); }
