/* =====================================================
   CLIENTES MAPPEATE — Design System
   Modern Executive Dashboard | Dark / Light Mode
   ===================================================== */

/* ---- CSS Custom Properties ---- */
:root {
  /* Brand Colors */
  --brand-primary: #4F7CFF;
  --brand-primary-hover: #3D6AEE;
  --brand-secondary: #00C6A2;
  --brand-accent: #FF6B6B;
  --brand-warning: #FFB547;
  --brand-danger: #FF4757;
  --brand-success: #2ED573;
  --brand-maps: #4285F4;
  --brand-whatsapp: #25D366;

  /* Tamaños */
  --radius: 12px;
  --radius-sm: 8px;
  --radius-xs: 4px;
  --radius-full: 9999px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.15);
  --shadow-lg: 0 10px 30px rgba(0,0,0,0.2);
  --transition: 0.2s ease;

  /* Typography */
  --font: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
}

/* ---- LIGHT MODE ---- */
[data-theme="light"] {
  --bg-base: #F0F4FF;
  --bg-surface: #FFFFFF;
  --bg-surface-2: #F7F9FE;
  --bg-surface-3: #EEF2FF;
  --bg-hover: #F0F4FF;
  --border: #E2E8F7;
  --border-strong: #C8D5F0;
  --text-primary: #1A1D2E;
  --text-secondary: #4A5568;
  --text-muted: #8492A6;
  --text-inverse: #FFFFFF;
  --sidebar-bg: #1A1D2E;
  --sidebar-text: #CBD5E0;
  --sidebar-active: #4F7CFF;
  --sidebar-active-bg: rgba(79,124,255,0.12);
  --input-bg: #FFFFFF;
  --input-border: #D1DCED;
  --scrollbar: #CBD5E0;
  --overlay: rgba(0,0,0,0.4);
  --card-glow: rgba(79,124,255,0.08);
  --stat-gradient-1: linear-gradient(135deg, #4F7CFF 0%, #7B9FFF 100%);
  --stat-gradient-2: linear-gradient(135deg, #00C6A2 0%, #00E5BC 100%);
  --stat-gradient-3: linear-gradient(135deg, #FFB547 0%, #FFCC74 100%);
  --stat-gradient-4: linear-gradient(135deg, #FF6B6B 0%, #FF9191 100%);
}

/* ---- DARK MODE ---- */
[data-theme="dark"] {
  --bg-base: #0D0F1A;
  --bg-surface: #151824;
  --bg-surface-2: #1A1D2E;
  --bg-surface-3: #1F2336;
  --bg-hover: #1F2336;
  --border: #252840;
  --border-strong: #303456;
  --text-primary: #F0F4FF;
  --text-secondary: #94A3C4;
  --text-muted: #5A6481;
  --text-inverse: #FFFFFF;
  --sidebar-bg: #0D0F1A;
  --sidebar-text: #94A3C4;
  --sidebar-active: #4F7CFF;
  --sidebar-active-bg: rgba(79,124,255,0.15);
  --input-bg: #1A1D2E;
  --input-border: #303456;
  --scrollbar: #252840;
  --overlay: rgba(0,0,0,0.7);
  --card-glow: rgba(79,124,255,0.05);
  --stat-gradient-1: linear-gradient(135deg, #3D6AEE 0%, #4F7CFF 100%);
  --stat-gradient-2: linear-gradient(135deg, #00A88A 0%, #00C6A2 100%);
  --stat-gradient-3: linear-gradient(135deg, #E09A2B 0%, #FFB547 100%);
  --stat-gradient-4: linear-gradient(135deg, #E04545 0%, #FF6B6B 100%);
}

/* ---- RESET & BASE ---- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  background: var(--bg-base);
  color: var(--text-primary);
  transition: background var(--transition), color var(--transition);
  overflow-x: hidden;
  min-height: 100vh;
}

/* ---- SCROLLBAR ---- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--scrollbar); border-radius: var(--radius-full); }

/* ---- APP LAYOUT ---- */
.app-wrapper {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ---- SIDEBAR ---- */
.sidebar {
  width: 260px;
  min-width: 260px;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow-y: auto;
  transition: transform var(--transition), width var(--transition);
  z-index: 100;
  position: relative;
}

.sidebar-logo {
  padding: 24px 20px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.sidebar-logo .logo-icon {
  width: 40px;
  height: 40px;
  background: var(--brand-primary);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  margin-bottom: 10px;
}

.sidebar-logo .logo-name {
  font-size: 16px;
  font-weight: 700;
  color: #FFFFFF;
  letter-spacing: -0.3px;
}

.sidebar-logo .logo-sub {
  font-size: 11px;
  color: var(--sidebar-text);
  margin-top: 2px;
  opacity: 0.7;
}

.sidebar-section-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--sidebar-text);
  opacity: 0.5;
  padding: 18px 20px 6px;
}

.sidebar-nav {
  flex: 1;
  padding: 8px 12px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--sidebar-text);
  font-size: 13.5px;
  font-weight: 500;
  transition: all var(--transition);
  margin-bottom: 2px;
  user-select: none;
  text-decoration: none;
}

.nav-item:hover {
  background: rgba(255,255,255,0.06);
  color: #FFFFFF;
}

.nav-item.active {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-active);
  font-weight: 600;
}

.nav-item .nav-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.nav-badge {
  margin-left: auto;
  background: var(--brand-danger);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  min-width: 20px;
  text-align: center;
}

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

.bcv-widget {
  background: rgba(79,124,255,0.1);
  border: 1px solid rgba(79,124,255,0.2);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
}

.bcv-widget .bcv-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--brand-primary);
  opacity: 0.8;
}

.bcv-widget .bcv-rate {
  font-size: 18px;
  font-weight: 700;
  color: #FFFFFF;
  margin-top: 2px;
  font-family: var(--font-mono);
}

.bcv-widget .bcv-sub {
  font-size: 10px;
  color: var(--sidebar-text);
  opacity: 0.6;
  margin-top: 1px;
}

.bcv-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--brand-success);
  margin-right: 4px;
  animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ---- MAIN CONTENT ---- */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-base);
}

/* ---- TOP BAR ---- */
.topbar {
  height: 64px;
  min-height: 64px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  gap: 16px;
  z-index: 50;
}

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

.hamburger-btn {
  display: none;
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-xs);
  font-size: 20px;
}

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

.page-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 1px;
}

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

.topbar-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--bg-surface-2);
  color: var(--text-secondary);
  transition: all var(--transition);
}

.topbar-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border-strong);
}

.topbar-btn.primary {
  background: var(--brand-primary);
  color: white;
  border-color: var(--brand-primary);
}

.topbar-btn.primary:hover {
  background: var(--brand-primary-hover);
  border-color: var(--brand-primary-hover);
}

.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 16px;
  transition: all var(--transition);
}

.theme-toggle:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

/* ---- PAGE CONTAINER ---- */
.page-container {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

.page-section {
  display: none;
}

.page-section.active {
  display: block;
}

/* ---- STAT CARDS ---- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: box-shadow var(--transition), transform var(--transition);
  position: relative;
  overflow: hidden;
}

.stat-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  border-radius: var(--radius) var(--radius) 0 0;
}

.stat-card.blue::before { background: var(--stat-gradient-1); }
.stat-card.green::before { background: var(--stat-gradient-2); }
.stat-card.yellow::before { background: var(--stat-gradient-3); }
.stat-card.red::before { background: var(--stat-gradient-4); }
.stat-card.purple::before { background: linear-gradient(90deg, #8b5cf6, #6d28d9); }

.stat-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  margin-bottom: 8px;
}

.stat-card.blue .stat-icon { background: rgba(79,124,255,0.12); }
.stat-card.green .stat-icon { background: rgba(0,198,162,0.12); }
.stat-card.yellow .stat-icon { background: rgba(255,181,71,0.12); }
.stat-card.red .stat-icon { background: rgba(255,71,87,0.12); }
.stat-card.purple .stat-icon { background: rgba(139,92,246,0.12); }

.stat-label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-value {
  font-size: 26px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.5px;
  font-family: var(--font-mono);
}

.stat-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.stat-trend {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: var(--radius-full);
  margin-top: 4px;
}

.stat-trend.up { background: rgba(46,213,115,0.12); color: var(--brand-success); }
.stat-trend.down { background: rgba(255,71,87,0.12); color: var(--brand-danger); }

/* ---- CARDS / PANELS ---- */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 20px;
}

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

.card-title {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-body {
  padding: 20px;
}

/* ---- ALERT CARDS ---- */
.alert-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.alert-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  border-left: 4px solid;
  transition: box-shadow var(--transition);
}

.alert-item:hover { box-shadow: var(--shadow-sm); }

.alert-item.danger {
  background: rgba(255,71,87,0.06);
  border-color: var(--brand-danger);
}

.alert-item.warning {
  background: rgba(255,181,71,0.06);
  border-color: var(--brand-warning);
}

.alert-item.ok {
  background: rgba(46,213,115,0.06);
  border-color: var(--brand-success);
}

.alert-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  white-space: nowrap;
}

.alert-badge.danger { background: var(--brand-danger); color: white; }
.alert-badge.warning { background: var(--brand-warning); color: #1A1D2E; }
.alert-badge.ok { background: var(--brand-success); color: #1A1D2E; }

.alert-info { flex: 1; min-width: 0; }
.alert-name { font-size: 13.5px; font-weight: 600; color: var(--text-primary); }
.alert-detail { font-size: 12px; color: var(--text-muted); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.alert-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

/* ---- BUTTONS ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
}

.btn:active { transform: scale(0.97); }

.btn-primary { background: var(--brand-primary); color: white; }
.btn-primary:hover { background: var(--brand-primary-hover); }

.btn-success { background: var(--brand-success); color: #1A1D2E; }
.btn-success:hover { filter: brightness(1.1); }

.btn-warning { background: var(--brand-warning); color: #1A1D2E; }
.btn-warning:hover { filter: brightness(1.1); }

.btn-danger { background: var(--brand-danger); color: white; }
.btn-danger:hover { filter: brightness(1.1); }

.btn-ghost { background: transparent; color: var(--text-secondary); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--bg-hover); color: var(--text-primary); }

.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-xs { padding: 3px 8px; font-size: 11px; border-radius: var(--radius-xs); }
.btn-icon { padding: 6px; width: 32px; height: 32px; border-radius: var(--radius-xs); }

.btn-whatsapp {
  background: var(--brand-whatsapp);
  color: white;
}
.btn-whatsapp:hover { filter: brightness(1.1); }

.btn-maps {
  background: var(--brand-maps);
  color: white;
}
.btn-maps:hover { filter: brightness(1.1); }

/* ---- FILTER BAR ---- */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.filter-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius-full);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  border: 1.5px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-secondary);
  transition: all var(--transition);
  user-select: none;
}

.filter-btn:hover {
  border-color: var(--brand-primary);
  color: var(--brand-primary);
}

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

.filter-btn.danger.active { background: var(--brand-danger); border-color: var(--brand-danger); }
.filter-btn.warning.active { background: var(--brand-warning); border-color: var(--brand-warning); color: #1A1D2E; }
.filter-btn.success.active { background: var(--brand-success); border-color: var(--brand-success); color: #1A1D2E; }

.filter-count {
  background: rgba(255,255,255,0.2);
  border-radius: var(--radius-full);
  padding: 1px 6px;
  font-size: 10px;
  min-width: 18px;
  text-align: center;
}

/* ---- SEARCH BOX ---- */
.search-input-wrapper {
  position: relative;
  flex: 1;
  min-width: 200px;
  max-width: 320px;
}

.search-input-wrapper .search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 14px;
  pointer-events: none;
}

.search-input-wrapper input {
  width: 100%;
  padding: 8px 12px 8px 34px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--input-bg);
  color: var(--text-primary);
  font-size: 13px;
  font-family: var(--font);
  transition: border-color var(--transition);
  outline: none;
}

.search-input-wrapper input:focus {
  border-color: var(--brand-primary);
}

.search-input-wrapper input::placeholder {
  color: var(--text-muted);
}

/* ---- TABLE ---- */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-sm);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table th {
  padding: 10px 14px;
  background: var(--bg-surface-2);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  text-align: left;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 1;
}

.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
  vertical-align: middle;
}

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

.data-table tbody tr {
  transition: background var(--transition);
}

.data-table tbody tr:hover {
  background: var(--bg-hover);
}

.data-table tr.row-danger { background: rgba(255,71,87,0.04); }
.data-table tr.row-warning { background: rgba(255,181,71,0.04); }

/* ---- STATUS BADGES ---- */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.status-badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.status-badge.al-dia { background: rgba(46,213,115,0.12); color: var(--brand-success); }
.status-badge.pendiente { background: rgba(255,181,71,0.12); color: var(--brand-warning); }
.status-badge.vencido { background: rgba(255,71,87,0.12); color: var(--brand-danger); }
.status-badge.cancelado { background: rgba(90,100,129,0.12); color: var(--text-muted); }
.status-badge.exonerado {
  background: rgba(139, 92, 246, 0.15);
  color: #8b5cf6;
  border: 1px solid rgba(139, 92, 246, 0.35);
  font-weight: 700;
}
.status-badge.exonerado::before {
  background: #8b5cf6;
}
[data-theme="dark"] .status-badge.exonerado {
  background: rgba(139, 92, 246, 0.25);
  color: #c4b5fd;
  border-color: rgba(139, 92, 246, 0.5);
}

.filter-btn.exonerado {
  border-color: rgba(139, 92, 246, 0.35);
  color: #8b5cf6;
}
.filter-btn.exonerado:hover {
  background: rgba(139, 92, 246, 0.1);
}
.filter-btn.exonerado.active {
  background: #8b5cf6 !important;
  border-color: #8b5cf6 !important;
  color: #ffffff !important;
}
.filter-btn.exonerado.active .filter-count {
  background: rgba(255, 255, 255, 0.25) !important;
  color: #ffffff !important;
}
[data-theme="dark"] .filter-btn.exonerado {
  color: #c4b5fd;
}

.data-table tbody tr.row-exonerado:hover {
  background: rgba(139, 92, 246, 0.05);
}

/* ---- PROGRESS BAR ---- */
.progress-section {
  margin-bottom: 20px;
}

.progress-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.progress-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.progress-pct {
  font-size: 13px;
  font-weight: 700;
  color: var(--brand-primary);
  font-family: var(--font-mono);
}

.progress-track {
  height: 10px;
  background: var(--bg-surface-3);
  border-radius: var(--radius-full);
  overflow: hidden;
  position: relative;
}

.progress-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.progress-fill::after {
  content: '';
  position: absolute;
  top: 0; left: -100%;
  width: 100%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  to { left: 100%; }
}

.progress-fill.primary { background: var(--stat-gradient-1); }
.progress-fill.success { background: var(--stat-gradient-2); }
.progress-fill.warning { background: var(--stat-gradient-3); }

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

/* ---- CHARTS ROW ---- */
.charts-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}

/* ---- MONTHLY CHART ---- */
.month-chart {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 100px;
  padding-bottom: 4px;
}

.month-bar-group {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  cursor: pointer;
}

.month-bars {
  width: 100%;
  display: flex;
  gap: 2px;
  align-items: flex-end;
  height: 80px;
}

.month-bar-projected {
  flex: 1;
  border-radius: 3px 3px 0 0;
  background: rgba(79,124,255,0.15);
  border: 1px solid rgba(79,124,255,0.3);
  min-height: 4px;
  transition: height 0.6s;
}

.month-bar-real {
  flex: 1;
  border-radius: 3px 3px 0 0;
  background: var(--brand-primary);
  min-height: 0;
  transition: height 0.6s;
}

.month-label {
  font-size: 9px;
  color: var(--text-muted);
  font-weight: 500;
}

/* ---- MODAL ---- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 100%;
  max-width: 640px;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(0.96) translateY(10px);
  transition: transform 0.25s;
  box-shadow: var(--shadow-lg);
}

.modal-overlay.open .modal {
  transform: scale(1) translateY(0);
}

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

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

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-xs);
  transition: color var(--transition);
  line-height: 1;
}

.modal-close:hover { color: var(--text-primary); }

.modal-body {
  padding: 24px;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ---- FORM ELEMENTS ---- */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.form-group.full { grid-column: 1 / -1; }

.form-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.form-control {
  padding: 9px 12px;
  border: 1px solid var(--input-border);
  border-radius: var(--radius-sm);
  background: var(--input-bg);
  color: var(--text-primary);
  font-size: 13.5px;
  font-family: var(--font);
  transition: border-color var(--transition);
  outline: none;
}

.form-control:focus {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px rgba(79,124,255,0.1);
}

.form-control::placeholder { color: var(--text-muted); }

select.form-control {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%238492A6' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
}

textarea.form-control {
  resize: vertical;
  min-height: 80px;
}

/* ---- BCV CONVERTER WIDGET ---- */
.converter-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
}

.converter-inputs {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
}

.converter-field {
  flex: 1;
  position: relative;
}

.converter-field .currency-prefix {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-weight: 700;
  font-size: 13px;
  color: var(--text-muted);
  pointer-events: none;
}

.converter-field input {
  width: 100%;
  padding: 12px 12px 12px 36px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--input-bg);
  color: var(--text-primary);
  font-size: 18px;
  font-weight: 700;
  font-family: var(--font-mono);
  transition: border-color var(--transition);
  outline: none;
}

.converter-field input:focus {
  border-color: var(--brand-primary);
}

.converter-arrow {
  font-size: 20px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.converter-field.result input {
  background: var(--bg-surface-2);
  color: var(--brand-success);
  cursor: default;
}

/* ---- TOAST NOTIFICATIONS ---- */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow-lg);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  min-width: 260px;
  max-width: 360px;
  pointer-events: all;
  animation: slide-in-right 0.3s ease;
  border-left: 3px solid var(--brand-primary);
}

.toast.success { border-left-color: var(--brand-success); }
.toast.error { border-left-color: var(--brand-danger); }
.toast.warning { border-left-color: var(--brand-warning); }

@keyframes slide-in-right {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes slide-out-right {
  from { transform: translateX(0); opacity: 1; }
  to { transform: translateX(120%); opacity: 0; }
}

.toast.hiding { animation: slide-out-right 0.3s ease forwards; }

/* ---- EMPTY STATE ---- */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}

.empty-state .empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-state h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.empty-state p {
  font-size: 13px;
  max-width: 300px;
  margin: 0 auto 20px;
}

/* ---- SPINNER ---- */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--brand-primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}

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

.loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(var(--bg-surface), 0.7);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  border-radius: var(--radius);
}

/* ---- CONFIG PANEL ---- */
.config-section {
  margin-bottom: 28px;
}

.config-section h3 {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.price-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}

.price-item {
  background: var(--bg-surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
}

.price-item-label {
  font-size: 11.5px;
  color: var(--text-muted);
  font-weight: 500;
  margin-bottom: 4px;
}

.price-item-value {
  font-size: 20px;
  font-weight: 800;
  color: var(--brand-primary);
  font-family: var(--font-mono);
}

.price-item-note {
  font-size: 10.5px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ---- RUBROS GRID & CARDS ---- */
.rubros-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 16px;
}

.rubro-card {
  background: var(--bg-surface-2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.rubro-card:hover {
  border-color: var(--brand-primary);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.08);
}

.rubro-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.rubro-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
}

.rubro-category-badge {
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: rgba(79, 124, 255, 0.1);
  color: var(--brand-primary);
  white-space: nowrap;
  flex-shrink: 0;
}

.rubro-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.rubro-tag {
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.rubro-tag.alto { background: rgba(46,213,115,0.12); color: var(--brand-success); }
.rubro-tag.medio { background: rgba(255,181,71,0.12); color: var(--brand-warning); }
.rubro-tag.bajo { background: rgba(255,71,87,0.12); color: var(--brand-danger); }

.rubro-razon {
  font-size: 11.5px;
  color: var(--text-muted);
  line-height: 1.45;
  margin-bottom: 12px;
}

.rubro-tech-box {
  background: var(--bg-surface-3, rgba(0,0,0,0.03));
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 12px;
  font-size: 11.5px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.rubro-tech-item {
  line-height: 1.35;
}

.rubro-tech-label {
  font-weight: 700;
  color: var(--text-muted);
  display: block;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-bottom: 2px;
}

.rubro-tech-val {
  color: var(--text-primary);
  font-weight: 500;
}

.rubro-tech-val.roi {
  color: var(--brand-success);
  font-weight: 700;
  background: rgba(46, 213, 115, 0.08);
  padding: 2px 6px;
  border-radius: 4px;
  display: inline-block;
}

.rubro-tech-val.inception {
  font-style: italic;
  color: var(--text-secondary);
}

.rubro-btn-crear {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  padding: 8px 12px;
  border-radius: 8px;
  background: rgba(79, 124, 255, 0.1);
  color: var(--brand-primary);
  border: 1.5px solid transparent;
  transition: all var(--transition);
  cursor: pointer;
  margin-top: auto;
}

.rubro-card:hover .rubro-btn-crear {
  background: var(--brand-primary);
  color: #ffffff;
}

/* ---- ACTION CELL ---- */
.action-cell {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ---- PHASE LABEL ---- */
.phase-label {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.phase-label.maps { background: rgba(66,133,244,0.12); color: var(--brand-maps); }
.phase-label.whatsapp { background: rgba(37,211,102,0.12); color: var(--brand-whatsapp); }
.phase-label.telegram { background: rgba(79,124,255,0.12); color: var(--brand-primary); }
.phase-label.pack { background: rgba(0,198,162,0.12); color: var(--brand-secondary); }
.phase-label.web { background: rgba(139,92,246,0.14); color: #a78bfa; }

/* ---- SERVICIO / FASE CHECKBOX LIST (SELECCIÓN DIRECTA) ---- */
.service-check-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  max-height: 290px;
  overflow-y: auto;
  padding: 4px;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-sm);
}

.service-check-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  user-select: none;
}

.service-check-row:hover {
  background: var(--bg-hover);
  border-color: var(--brand-primary);
}

.service-check-row.selected {
  background: rgba(79, 124, 255, 0.08);
  border-color: rgba(79, 124, 255, 0.4);
}

.service-check-row.service-check-featured {
  border-color: rgba(0, 198, 162, 0.3);
  background: rgba(0, 198, 162, 0.03);
}

.service-check-row.service-check-featured:hover {
  border-color: var(--brand-secondary);
  background: rgba(0, 198, 162, 0.08);
}

.service-check-row.service-check-featured.selected {
  background: rgba(0, 198, 162, 0.12);
  border-color: var(--brand-secondary);
}

.service-check-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.service-check-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--brand-primary);
  cursor: pointer;
  flex-shrink: 0;
  margin: 0;
}

.service-check-row.service-check-featured input[type="checkbox"] {
  accent-color: var(--brand-secondary);
}

.service-check-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.service-check-price {
  font-size: 11.5px;
  font-weight: 700;
  flex-shrink: 0;
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.service-check-price.tag-onetime {
  background: rgba(255, 181, 71, 0.12);
  color: #FFB547;
  border: 1px solid rgba(255, 181, 71, 0.25);
}

.service-check-price.tag-monthly {
  background: rgba(46, 213, 115, 0.12);
  color: #2ED573;
  border: 1px solid rgba(46, 213, 115, 0.25);
}

.service-check-price.tag-package {
  background: rgba(0, 198, 162, 0.12);
  color: #00C6A2;
  border: 1px solid rgba(0, 198, 162, 0.3);
}

.service-check-price.tag-both {
  background: rgba(139, 92, 246, 0.12);
  color: #a78bfa;
  border: 1px solid rgba(139, 92, 246, 0.3);
}

.service-pricing-badge {
  font-size: 11.5px;
  padding: 3px 10px;
  background: rgba(79, 124, 255, 0.1);
  border: 1px solid rgba(79, 124, 255, 0.25);
  border-radius: var(--radius-full);
  color: var(--brand-primary);
}

.service-pricing-badge strong {
  color: var(--text-primary);
}


/* ---- SIDEBAR OVERLAY (mobile) ---- */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--overlay);
  z-index: 90;
}

/* ---- GOOGLE SHEETS STATUS ---- */
.sheets-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background: var(--bg-surface-2);
  color: var(--text-muted);
}

.sheets-status.connected { border-color: rgba(46,213,115,0.3); color: var(--brand-success); }
.sheets-status.error { border-color: rgba(255,71,87,0.3); color: var(--brand-danger); }

/* =====================================================
   RESPONSIVE — TABLET & MOBILE
   ===================================================== */

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

@media (max-width: 900px) {
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    transform: translateX(-100%);
    box-shadow: var(--shadow-lg);
  }

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

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

  .hamburger-btn {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .main-content {
    width: 100%;
  }

  .topbar {
    padding: 0 12px;
    height: 56px;
    min-height: 56px;
    gap: 8px;
  }

  .topbar-left {
    gap: 8px;
    min-width: 0;
    flex: 1;
  }

  .page-title {
    font-size: 15px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 140px;
  }

  .page-subtitle {
    display: none !important;
  }

  .sheets-status-el {
    display: none !important;
  }

  .vps-status-el {
    padding: 3px 7px;
    font-size: 11px;
  }

  .user-auth-badge {
    padding: 4px 6px;
    gap: 4px;
  }

  .user-auth-badge .user-name-text,
  .user-auth-badge .btn-logout-icon span {
    display: none !important;
  }

  .topbar-btn {
    display: none !important;
  }

  .page-container {
    padding: 12px 10px;
  }
}

@media (max-width: 640px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .form-group.full { grid-column: 1; }
  .converter-inputs { flex-direction: column; }
  .converter-arrow { transform: rotate(90deg); }
  .modal { max-width: 100%; margin: 0; }
  .modal-overlay { align-items: flex-end; padding: 0; }
  .modal { border-radius: var(--radius) var(--radius) 0 0; }
  .page-title { font-size: 15px; }
  .topbar-btn .btn-text { display: none; }
  .filter-bar { gap: 6px; }
  .filter-btn { padding: 6px 10px; font-size: 11.5px; }

  /* Fix Alertas Cards on Mobile */
  .alert-item {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 10px !important;
    padding: 14px 12px !important;
  }

  .alert-badge {
    align-self: flex-start;
  }

  .alert-info {
    width: 100% !important;
  }

  .alert-name {
    font-size: 14px !important;
    white-space: normal !important;
    word-break: break-word;
  }

  .alert-detail {
    white-space: normal !important;
    font-size: 11.5px !important;
    line-height: 1.4 !important;
  }

  .alert-actions {
    width: 100% !important;
    justify-content: flex-end !important;
    gap: 8px !important;
    border-top: 1px solid rgba(255, 255, 255, 0.07) !important;
    padding-top: 8px !important;
    margin-top: 2px !important;
  }

  .alert-actions .btn {
    padding: 6px 10px !important;
    font-size: 11.5px !important;
  }

  /* Fix Reportes Mensuales on Mobile */
  .reporte-item {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 10px !important;
    padding: 12px !important;
  }

  .reporte-info {
    width: 100% !important;
  }

  .reporte-header-row {
    flex-wrap: wrap !important;
    gap: 6px !important;
  }

  .reporte-notas {
    white-space: normal !important;
    line-height: 1.45 !important;
    word-break: break-word !important;
  }

  .reporte-actions {
    width: 100% !important;
    justify-content: space-between !important;
    border-top: 1px solid var(--border) !important;
    padding-top: 8px !important;
  }

  /* Fix WhatsApp Message Cards on Mobile */
  .ws-msg-card {
    padding: 12px 10px !important;
  }

  .ws-msg-card-top {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 8px !important;
  }

  .ws-msg-meta-top {
    width: 100% !important;
    justify-content: space-between !important;
  }

  .ws-msg-snippet-row {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 8px !important;
  }

  .ws-msg-actions {
    width: 100% !important;
    justify-content: flex-end !important;
    border-top: 1px solid var(--border) !important;
    padding-top: 6px !important;
  }

  .ws-hero-banner {
    padding: 16px 14px !important;
    gap: 12px !important;
  }

  .ws-hero-actions {
    width: 100% !important;
  }

  .ws-hero-actions .btn {
    width: 100% !important;
    justify-content: center !important;
  }

  /* Fix Operaciones Header on Mobile */
  #section-operaciones .card-body {
    padding: 14px !important;
  }

  #section-operaciones select#op_cliente_select {
    max-width: 100% !important;
    width: 100% !important;
  }

  #section-operaciones button#op_btn_whatsapp_avance,
  #section-operaciones button#op_btn_copiar_reporte {
    width: 100% !important;
    justify-content: center !important;
  }
}

@media (max-width: 400px) {
  .stats-grid { grid-template-columns: 1fr; }
  .stat-value { font-size: 22px; }
}

/* ---- UTILITY CLASSES ---- */
.text-primary { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--brand-success); }
.text-warning { color: var(--brand-warning); }
.text-danger { color: var(--brand-danger); }
.text-brand { color: var(--brand-primary); }

.font-mono { font-family: var(--font-mono); }
.font-bold { font-weight: 700; }
.font-medium { font-weight: 500; }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.flex-1 { flex: 1; }
.min-w-0 { min-width: 0; }

.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }

.hidden { display: none !important; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 16px 0;
}

/* ---- COPY SUCCESS ANIMATION ---- */
.copy-success {
  animation: flash-green 0.4s ease;
}

@keyframes flash-green {
  0%, 100% { background: inherit; }
  50% { background: rgba(46,213,115,0.2); }
}

/* ---- GOOGLE SHEETS CONFIG AREA ---- */
.sheets-config-box {
  background: var(--bg-surface-2);
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius);
  padding: 28px;
  text-align: center;
  margin-bottom: 20px;
}

.sheets-config-box .sheets-icon {
  font-size: 40px;
  margin-bottom: 12px;
}

.sheets-config-box h3 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 6px;
}

.sheets-config-box p {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 16px;
  max-width: 400px;
  margin-left: auto;
  margin-right: auto;
}

/* ---- PLAN FASES TABLE ---- */
.fase-badge {
  font-size: 10.5px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  white-space: nowrap;
}

.fase-badge.f1 { background: rgba(66,133,244,0.12); color: var(--brand-maps); }
.fase-badge.f2 { background: rgba(37,211,102,0.12); color: var(--brand-whatsapp); }
.fase-badge.f3 { background: rgba(79,124,255,0.12); color: var(--brand-primary); }

.positive-value { color: var(--brand-success); font-weight: 700; }
.negative-value { color: var(--brand-danger); font-weight: 700; }

/* ---- WELCOME BANNER ---- */
.welcome-banner {
  background: linear-gradient(135deg, #4F7CFF 0%, #7B9FFF 50%, #00C6A2 100%);
  border-radius: var(--radius);
  padding: 24px 28px;
  margin-bottom: 24px;
  color: white;
  position: relative;
  overflow: hidden;
}

.welcome-banner::before {
  content: '';
  position: absolute;
  top: -30px;
  right: -20px;
  width: 160px;
  height: 160px;
  background: rgba(255,255,255,0.07);
  border-radius: 50%;
}

.welcome-banner::after {
  content: '';
  position: absolute;
  bottom: -40px;
  right: 80px;
  width: 120px;
  height: 120px;
  background: rgba(255,255,255,0.05);
  border-radius: 50%;
}

.welcome-banner h2 {
  font-size: 20px;
  font-weight: 800;
  margin-bottom: 4px;
  position: relative;
  z-index: 1;
}

.welcome-banner p {
  font-size: 13px;
  opacity: 0.85;
  position: relative;
  z-index: 1;
}

/* ---- TABLA DE CLIENTES (mobile scroll) ---- */
.client-table-container {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* ---- TOOLTIP ---- */
[data-tooltip] {
  position: relative;
}

[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--text-primary);
  color: var(--text-inverse);
  font-size: 11px;
  font-weight: 500;
  padding: 4px 8px;
  border-radius: var(--radius-xs);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 50;
}

[data-tooltip]:hover::after { opacity: 1; }

/* ---- SIDEBAR collapse (animación) ---- */
@media (min-width: 901px) {
  .sidebar.collapsed {
    width: 64px;
    min-width: 64px;
  }
  .sidebar.collapsed .nav-item span,
  .sidebar.collapsed .logo-name,
  .sidebar.collapsed .logo-sub,
  .sidebar.collapsed .sidebar-section-label,
  .sidebar.collapsed .bcv-widget,
  .sidebar.collapsed .nav-badge {
    display: none;
  }
  .sidebar.collapsed .nav-item {
    justify-content: center;
    padding: 10px;
  }
  .sidebar.collapsed .sidebar-logo {
    padding: 20px 12px;
  }
  .sidebar.collapsed .nav-icon {
    width: 24px;
    height: 24px;
  }
}


/* ---- CONTROL DE FASES / OPERACIONES GRID ---- */
.fases-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  align-items: start;
}

/* ---- OPERACIONES HEADER CONTROLS ---- */
.op-header-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  width: 100%;
}

.op-header-selector-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1 1 360px;
  min-width: 0;
}

.op-header-selector-wrap select#op_cliente_select {
  flex: 1;
  min-width: 0;
  width: 100%;
  max-width: 100%;
}

.op-header-btn-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

@media (max-width: 1120px) {
  .op-header-controls {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 14px !important;
  }
  .op-header-selector-wrap {
    width: 100% !important;
    flex: 1 1 100% !important;
  }
  .op-header-btn-wrap {
    width: 100% !important;
    justify-content: flex-start !important;
  }
}

@media (min-width: 1200px) {
  .fases-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.fase-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  transition: transform var(--transition), box-shadow var(--transition);
}

.fase-card:hover {
  box-shadow: var(--shadow-md);
  border-color: rgba(66, 133, 244, 0.3);
}

.fase-card-header {
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
}

.fase-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.fase-badge {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 3px 8px;
  border-radius: var(--radius-full);
}

.fase-mes {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
}

.fase-nombre {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.fase-progress-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.fase-progress-bar {
  flex: 1;
  height: 6px;
  background: var(--bg-surface-3);
  border-radius: 99px;
  overflow: hidden;
}

.fase-progress-fill {
  height: 100%;
  border-radius: 99px;
  transition: width 0.35s ease;
}

.fase-progress-text {
  font-size: 11.5px;
  font-weight: 700;
  font-family: var(--font-mono);
}

.fase-tasks-list {
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--bg-surface);
}

.fase-task-item {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface-2);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.fase-task-item:hover {
  background: var(--bg-hover);
  border-color: rgba(66, 133, 244, 0.35);
}

.fase-task-item.completed {
  border-color: rgba(0, 198, 162, 0.4);
  background: rgba(0, 198, 162, 0.06);
}

.fase-task-checkbox {
  width: 17px;
  height: 17px;
  cursor: pointer;
  flex-shrink: 0;
  margin-top: 2px;
}

.fase-task-label {
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1.4;
  color: var(--text-primary);
  transition: all 0.15s ease;
}

.fase-task-item.completed .fase-task-label {
  color: var(--text-muted);
  text-decoration: line-through;
}


/* ---- BOTÓN PDF AUDITORÍA EN TABLA ---- */
.btn-pdf {
  background: rgba(255, 71, 87, 0.12);
  color: #FF4757;
  border: 1px solid rgba(255, 71, 87, 0.3);
  font-size: 13px;
  line-height: 1;
  text-decoration: none;
}

.btn-pdf:hover {
  background: #FF4757;
  color: white;
  border-color: #FF4757;
}

.btn-pdf.disabled {
  opacity: 0.35;
  filter: grayscale(1);
  cursor: not-allowed;
  pointer-events: none;
  background: transparent;
  border-color: var(--border);
  color: var(--text-muted);
}

/* ---- TABLA / CARDS DE REPORTES MENSUALES ---- */
.reporte-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  background: var(--bg-surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
  transition: border-color var(--transition), background var(--transition);
}

.reporte-item:hover {
  border-color: rgba(66, 133, 244, 0.35);
  background: var(--bg-hover);
}

.reporte-info {
  flex: 1;
  min-width: 0;
}

.reporte-header-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}

.reporte-badge {
  font-size: 11px;
  font-weight: 800;
  color: var(--brand-primary);
  background: rgba(66, 133, 244, 0.1);
  border: 1px solid rgba(66, 133, 244, 0.25);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-family: var(--font-mono);
}

.reporte-fecha {
  font-size: 11.5px;
  color: var(--text-muted);
}

.reporte-notas {
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.4;
  word-break: break-word;
}

.reporte-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}


/* ---- BOTÓN DRIVE CARPETA EN TABLA ---- */
.btn-drive {
  background: rgba(255, 181, 71, 0.12);
  color: #FFA502;
  border: 1px solid rgba(255, 181, 71, 0.35);
  font-size: 13px;
  line-height: 1;
  text-decoration: none;
}

.btn-drive:hover {
  background: #FFA502;
  color: #1A1D2E;
  border-color: #FFA502;
}

.btn-drive.unlinked {
  background: transparent;
  color: var(--text-muted);
  border-color: var(--border);
  opacity: 0.65;
}

.btn-drive.unlinked:hover {
  background: var(--bg-hover);
  color: var(--brand-warning);
  border-color: var(--brand-warning);
  opacity: 1;
}

/* ---- ACCORDION CODE BOX ---- */
.code-accordion {
  background: var(--bg-surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-top: 16px;
  overflow: hidden;
}

.code-accordion-header {
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  background: var(--bg-surface-3);
  font-size: 13px;
  font-weight: 700;
  user-select: none;
}

.code-accordion-header:hover {
  background: var(--bg-hover);
}

.code-accordion-content {
  padding: 16px;
  display: none;
}

.code-accordion-content.open {
  display: block;
}

.code-block-preview {
  background: #0d1117;
  color: #e6edf3;
  padding: 14px;
  border-radius: var(--radius-xs);
  font-family: var(--font-mono);
  font-size: 12px;
  max-height: 280px;
  overflow-y: auto;
  white-space: pre;
  border: 1px solid rgba(255,255,255,0.1);
  margin-bottom: 12px;
}

/* =====================================================
   SECCIÓN: HISTORIAL DE MENSAJES WHATSAPP (AESTHETIC CRM)
   ===================================================== */

/* Hero Banner */
.ws-hero-banner {
  background: linear-gradient(135deg, #0b141a 0%, #111b21 50%, #0d2822 100%);
  border: 1px solid rgba(37, 211, 102, 0.25);
  border-radius: 16px;
  padding: 24px 28px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 20px;
  margin-bottom: 22px;
  position: relative;
  overflow: hidden;
}

[data-theme="light"] .ws-hero-banner {
  background: linear-gradient(135deg, #075e54 0%, #008069 55%, #128c7e 100%);
  border-color: rgba(255, 255, 255, 0.2);
}

.ws-hero-content {
  flex: 1;
  min-width: 280px;
}

.ws-hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: rgba(37, 211, 102, 0.15);
  color: #25D366;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.8px;
  padding: 4px 12px;
  border-radius: 20px;
  border: 1px solid rgba(37, 211, 102, 0.35);
  margin-bottom: 10px;
}

[data-theme="light"] .ws-hero-badge {
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.35);
}

.ws-badge-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #25D366;
  box-shadow: 0 0 8px #25D366;
}

[data-theme="light"] .ws-badge-dot {
  background: #ffffff;
  box-shadow: 0 0 8px #ffffff;
}

.ws-hero-title {
  font-size: 22px;
  font-weight: 800;
  margin: 0 0 6px 0;
  color: #ffffff;
  letter-spacing: -0.3px;
}

.ws-hero-subtitle {
  font-size: 13.5px;
  color: rgba(255, 255, 255, 0.75);
  margin: 0;
  max-width: 600px;
  line-height: 1.5;
}

.ws-hero-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.ws-btn-nuevo {
  background: linear-gradient(135deg, #25D366 0%, #1ebc57 100%) !important;
  color: #ffffff !important;
  border: none !important;
  font-weight: 700 !important;
  font-size: 13.5px !important;
  padding: 10px 20px !important;
  border-radius: 10px !important;
  box-shadow: 0 4px 14px rgba(37, 211, 102, 0.35) !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 8px !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
}

.ws-btn-nuevo:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(37, 211, 102, 0.5) !important;
  filter: brightness(1.06);
}

.ws-btn-restore {
  border: 1px solid rgba(255, 255, 255, 0.25) !important;
  color: rgba(255, 255, 255, 0.85) !important;
  font-size: 12px !important;
  border-radius: 8px !important;
}

.ws-btn-restore:hover {
  background: rgba(255, 255, 255, 0.1) !important;
  color: #ffffff !important;
}

/* 4 Premium Stat Cards */
.ws-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}

.ws-stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px 20px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  transition: all 0.25s ease;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.ws-stat-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  border-radius: 4px 0 0 4px;
}

.ws-stat-card.stat-total::before { background: #25D366; }
.ws-stat-card.stat-mes::before { background: #38bdf8; }
.ws-stat-card.stat-clientes::before { background: #a855f7; }
.ws-stat-card.stat-cobros::before { background: #f59e0b; }

.ws-stat-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  border-color: var(--border-strong);
}

.ws-stat-icon-wrap {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-total .ws-stat-icon-wrap { background: rgba(37, 211, 102, 0.12); color: #25D366; }
.stat-mes .ws-stat-icon-wrap { background: rgba(56, 189, 248, 0.12); color: #38bdf8; }
.stat-clientes .ws-stat-icon-wrap { background: rgba(168, 85, 247, 0.12); color: #a855f7; }
.stat-cobros .ws-stat-icon-wrap { background: rgba(245, 158, 11, 0.12); color: #f59e0b; }

.ws-stat-info {
  display: flex;
  flex-direction: column;
}

.ws-stat-num {
  font-size: 26px;
  font-weight: 800;
  font-family: var(--font-mono);
  color: var(--text-primary);
  line-height: 1.1;
  margin-bottom: 4px;
}

.ws-stat-label {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 2px;
}

.ws-stat-hint {
  font-size: 11px;
  color: var(--text-muted);
}

/* Filter & Search Panel */
.ws-filter-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px 20px;
  margin-bottom: 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: var(--shadow-sm);
}

.ws-filter-top-row {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.ws-search-wrapper {
  position: relative;
  flex: 2;
  min-width: 260px;
}

.ws-search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.ws-search-field {
  width: 100%;
  padding: 10px 36px 10px 40px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-surface-2);
  color: var(--text-primary);
  font-size: 13px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.ws-search-field:focus {
  border-color: #25D366;
  outline: none;
  box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.18);
}

.ws-search-clear {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 12px;
  display: none;
  padding: 4px;
  border-radius: 50%;
}

.ws-client-select-wrapper {
  flex: 1.4;
  min-width: 230px;
}

.ws-select-control {
  width: 100%;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-surface-2);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.2s;
}

.ws-select-control:focus {
  border-color: #25D366;
  outline: none;
}

.ws-accordion-btns {
  display: flex;
  gap: 6px;
}

.ws-filter-chips-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  border-top: 1px dashed var(--border);
  padding-top: 14px;
}

.ws-chips-label {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.ws-chips-scroll {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.ws-chip {
  background: var(--bg-surface-2);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.ws-chip:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border-strong);
}

.ws-chip.active {
  background: rgba(37, 211, 102, 0.15);
  border-color: #25D366;
  color: #25D366;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(37, 211, 102, 0.2);
}

/* Months Container & Accordion Group */
.ws-months-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.ws-month-group {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.ws-month-group:hover {
  border-color: var(--border-strong);
}

.ws-month-group.open {
  border-color: rgba(37, 211, 102, 0.35);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
}

/* Accordion Header */
.ws-month-header {
  padding: 16px 22px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  background: var(--bg-surface-2);
  user-select: none;
  transition: background var(--transition);
  border-bottom: 1px solid transparent;
}

.ws-month-header:hover {
  background: var(--bg-hover);
}

.ws-month-group.open .ws-month-header {
  border-bottom-color: var(--border);
}

.ws-month-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ws-month-chevron {
  font-size: 13px;
  color: var(--text-muted);
  transition: transform 0.25s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--bg-surface);
}

.ws-month-group.open .ws-month-chevron {
  transform: rotate(180deg);
  color: #25D366;
}

.ws-month-title {
  font-size: 15px;
  font-weight: 800;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 10px;
}

.ws-month-count-badge {
  background: rgba(37, 211, 102, 0.12);
  color: #25D366;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  border: 1px solid rgba(37, 211, 102, 0.25);
}

.ws-month-header-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.ws-month-clients-pill {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
}

/* Accordion Body */
.ws-month-body {
  display: none;
  padding: 16px 20px;
  background: var(--bg-surface);
}

.ws-month-group.open .ws-month-body {
  display: block;
}

/* Message List */
.ws-msg-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Individual Message Card */
.ws-msg-card {
  background: var(--bg-surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 18px;
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  transition: all 0.2s ease;
  position: relative;
}

.ws-msg-card:hover {
  border-color: rgba(37, 211, 102, 0.4);
  background: var(--bg-hover);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

.ws-msg-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  flex-wrap: wrap;
}

.ws-msg-client-side {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ws-msg-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #008069 0%, #25D366 100%);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 15px;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(37, 211, 102, 0.25);
}

.ws-msg-client-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ws-msg-client-name {
  font-size: 14.5px;
  font-weight: 800;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.ws-msg-contact {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.ws-msg-meta-top {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.ws-msg-date {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Badges for Motives */
.ws-badge-motivo {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 11px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.2px;
  white-space: nowrap;
}

.ws-badge-motivo.motivo-cobro {
  background: rgba(255, 181, 71, 0.15);
  color: var(--brand-warning);
  border: 1px solid rgba(255, 181, 71, 0.35);
}

.ws-badge-motivo.motivo-avance {
  background: rgba(79, 124, 255, 0.15);
  color: var(--brand-primary);
  border: 1px solid rgba(79, 124, 255, 0.35);
}

.ws-badge-motivo.motivo-auditoria {
  background: #8b5cf6;
  color: #ffffff;
  border: 1px solid #7c3aed;
}

.ws-badge-motivo.motivo-auditoria span,
.ws-badge-motivo.motivo-auditoria * {
  color: #ffffff !important;
}

.ws-badge-motivo.motivo-fidelizacion {
  background: rgba(0, 198, 162, 0.15);
  color: var(--brand-secondary);
  border: 1px solid rgba(0, 198, 162, 0.35);
}

.ws-badge-motivo.motivo-personalizado {
  background: rgba(148, 163, 196, 0.15);
  color: var(--text-secondary);
  border: 1px solid rgba(148, 163, 196, 0.30);
}

/* Message Snippet & Card Bottom */
.ws-msg-snippet-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.ws-msg-snippet {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  background: rgba(37, 211, 102, 0.04);
  border-radius: 8px;
  padding: 10px 14px;
  border-left: 3px solid #25D366;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  font-style: normal;
  word-break: break-word;
}

[data-theme="light"] .ws-msg-snippet {
  background: #f0fdf4;
}

.ws-msg-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

/* WhatsApp Icon Button on Message Row */
.btn-ws-preview {
  background: linear-gradient(135deg, #25D366 0%, #1ebc57 100%);
  color: #ffffff;
  border: none;
  font-weight: 700;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 8px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(37, 211, 102, 0.3);
  transition: all 0.2s ease;
}

.btn-ws-preview:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(37, 211, 102, 0.45);
}

/* ══════════════════════════════════════════════════════════
   MODAL DE PREVISUALIZACIÓN ESTILO CHAT WHATSAPP
   ══════════════════════════════════════════════════════════ */
.modal-ws-preview {
  max-width: 580px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
}

.ws-modal-header {
  background: #1f2c34;
  color: #e9edef;
  padding: 14px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

[data-theme="light"] .ws-modal-header {
  background: #008069;
  color: #ffffff;
}

.ws-modal-header .ws-badge-motivo,
#wsPreviewMotiveBadge {
  background: rgba(255, 255, 255, 0.22) !important;
  color: #ffffff !important;
  border: 1px solid rgba(255, 255, 255, 0.45) !important;
  font-weight: 700 !important;
  letter-spacing: 0.3px !important;
}

.ws-modal-header .ws-badge-motivo span,
.ws-modal-header .ws-badge-motivo *,
#wsPreviewMotiveBadge span,
#wsPreviewMotiveBadge * {
  color: #ffffff !important;
}

.ws-modal-header-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ws-modal-avatar {
  width: 40px;
  height: 40px;
  background: #25D366;
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.ws-modal-client {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.2;
}

.ws-modal-sub {
  font-size: 11.5px;
  opacity: 0.8;
  margin-top: 2px;
}

.ws-preview-body {
  padding: 24px 20px !important;
  background-color: #0b141a !important;
  background-image: radial-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 0);
  background-size: 24px 24px;
  min-height: 280px;
  max-height: 60vh;
  overflow-y: auto;
}

[data-theme="light"] .ws-preview-body {
  background-color: #efeae2 !important;
  background-image: radial-gradient(rgba(0, 0, 0, 0.04) 1px, transparent 0);
}

.ws-chat-canvas {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ws-chat-date-pill {
  align-self: center;
  background: rgba(30, 42, 50, 0.85);
  color: #8696a0;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

[data-theme="light"] .ws-chat-date-pill {
  background: rgba(255, 255, 255, 0.85);
  color: #54656f;
}

.ws-chat-bubble-wrapper {
  display: flex;
  justify-content: flex-end;
  width: 100%;
}

.ws-chat-bubble-out {
  background: #005c4b;
  color: #e9edef;
  border-radius: 8px 0px 8px 8px;
  padding: 10px 14px 8px 14px;
  max-width: 88%;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  position: relative;
  word-break: break-word;
}

[data-theme="light"] .ws-chat-bubble-out {
  background: #d9fdd3;
  color: #111b21;
}

.ws-chat-text {
  font-size: 13.5px;
  line-height: 1.5;
  white-space: pre-wrap;
}

.ws-chat-text strong {
  font-weight: 700;
  color: #ffffff;
}

[data-theme="light"] .ws-chat-text strong {
  color: #0b141a;
}

.ws-chat-text em {
  font-style: italic;
  opacity: 0.9;
}

.ws-chat-meta {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: rgba(233, 237, 239, 0.6);
  margin-top: 4px;
  text-align: right;
}

[data-theme="light"] .ws-chat-meta {
  color: rgba(17, 27, 33, 0.6);
}

.ws-ticks {
  color: #53bdeb;
  font-weight: bold;
  letter-spacing: -2px;
}

.ws-preview-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px;
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 10px;
}

.ws-preview-footer-note {
  font-size: 12px;
  color: var(--text-muted);
}

/* =====================================================
   AUTENTICACIÓN & LOGIN (ESTILO FACTURIA / MAPPEATE)
   ===================================================== */
.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: #f8fafc;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

[data-theme="dark"] .login-overlay {
  background: #070b14;
}

.login-theme-btn {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  background: #ffffff;
  color: #334155;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  transition: all 0.2s;
}

[data-theme="dark"] .login-theme-btn {
  background: #0f172a;
  border-color: #1e293b;
  color: #f8fafc;
}

.login-card {
  width: 100%;
  max-width: 440px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 24px;
  padding: 32px 28px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.08), 0 10px 10px -5px rgba(0, 0, 0, 0.03);
  position: relative;
  animation: loginAppear 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme="dark"] .login-card {
  background: #0f172a;
  border-color: #1e293b;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

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

.login-fade-out {
  opacity: 0 !important;
  pointer-events: none !important;
  transform: scale(0.98);
}

.login-header {
  text-align: center;
  margin-bottom: 24px;
}

.login-logo-pill {
  padding: 10px 20px;
  max-width: 220px;
  margin: 0 auto 14px;
  background: #ffffff;
  border-radius: 16px;
  border: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

[data-theme="dark"] .login-logo-pill {
  background: rgba(2, 6, 23, 0.8);
  border-color: #1e293b;
}

.login-logo-img {
  height: 36px;
  width: auto;
  object-fit: contain;
}

[data-theme="dark"] .login-logo-light {
  display: none !important;
}
[data-theme="dark"] .login-logo-dark {
  display: block !important;
}
[data-theme="light"] .login-logo-dark {
  display: none !important;
}
[data-theme="light"] .login-logo-light {
  display: block !important;
}

.login-title {
  font-size: 24px;
  font-weight: 900;
  color: #0f172a;
  letter-spacing: -0.02em;
  margin: 0 0 6px 0;
}

[data-theme="dark"] .login-title {
  color: #ffffff;
}

.login-subtitle {
  font-size: 13px;
  color: #64748b;
  margin: 0;
}

[data-theme="dark"] .login-subtitle {
  color: #94a3b8;
}

/* Error Alert */
.login-error-alert {
  padding: 12px 14px;
  background: #fff1f2;
  border: 1px solid #fecdd3;
  border-radius: 12px;
  color: #be123c;
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
  line-height: 1.4;
}

[data-theme="dark"] .login-error-alert {
  background: rgba(76, 5, 25, 0.5);
  border-color: #881337;
  color: #fda4af;
}

.login-error-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: #e11d48;
}

@keyframes loginShake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}

.animate-shake {
  animation: loginShake 0.4s ease;
}

/* Form Fields */
.login-field {
  margin-bottom: 16px;
}

.login-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: #334155;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
}

[data-theme="dark"] .login-label {
  color: #cbd5e1;
}

.login-input {
  width: 100%;
  padding: 11px 16px;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  font-size: 14px;
  color: #0f172a;
  outline: none;
  transition: all 0.2s;
  box-sizing: border-box;
  font-family: inherit;
}

[data-theme="dark"] .login-input {
  background: rgba(30, 41, 59, 0.8);
  border-color: #334155;
  color: #ffffff;
}

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

.login-input:focus {
  border-color: #f97316 !important;
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.2) !important;
  background: #ffffff;
}

[data-theme="dark"] .login-input:focus {
  background: #0f172a;
}

.login-pwd-wrapper {
  position: relative;
  width: 100%;
}

.login-pwd-wrapper .login-input {
  padding-right: 42px;
}

.login-pwd-toggle {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: #94a3b8;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s;
}

.login-pwd-toggle:hover {
  color: #475569;
}

[data-theme="dark"] .login-pwd-toggle:hover {
  color: #e2e8f0;
}

/* Submit Button */
.login-btn-submit {
  width: 100%;
  padding: 13px 18px;
  background: #f97316;
  color: #ffffff;
  font-weight: 700;
  font-size: 14px;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(249, 115, 22, 0.3);
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 18px;
}

.login-btn-submit:hover:not(:disabled) {
  background: #ea580c;
  box-shadow: 0 6px 16px rgba(249, 115, 22, 0.4);
}

.login-btn-submit:active:not(:disabled) {
  transform: scale(0.99);
}

.login-btn-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.login-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid #ffffff;
  border-top-color: transparent;
  border-radius: 50%;
  animation: loginSpin 0.7s linear infinite;
  display: inline-block;
}

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

/* User Profile Badge (Topbar) */
.user-auth-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px;
  border-radius: 9999px;
  background: var(--bg-surface-2);
  border: 1px solid var(--border);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
}

.user-avatar-circle {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
}

.user-name-text {
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-logout-icon {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.btn-logout-icon:hover {
  color: #f97316;
  background: rgba(249, 115, 22, 0.1);
}

/* Sidebar User Info */
.sidebar-user-card {
  margin-top: 10px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.sidebar-user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #f97316;
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar-user-details {
  flex: 1;
  min-width: 0;
}

.sidebar-user-name {
  font-size: 12px;
  font-weight: 700;
  color: var(--sidebar-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-role {
  font-size: 10px;
  color: var(--text-muted);
}

.sidebar-logout-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.sidebar-logout-btn:hover {
  color: #f97316;
  background: rgba(249, 115, 22, 0.12);
}

/* =====================================================
   LOGO EN SIDEBAR
   ===================================================== */
.sidebar-brand-wrapper {
  display: flex;
  align-items: center;
  margin-bottom: 4px;
}

.sidebar-brand-img {
  height: 30px;
  width: auto;
  max-width: 175px;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.35));
}

/* =====================================================
   GOOGLE DRIVE COMPACT BANNER
   ===================================================== */
.sheets-config-box.compact-banner {
  background: linear-gradient(135deg, rgba(255,181,71,0.08) 0%, rgba(66,133,244,0.08) 100%);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  text-align: left;
}

.sheets-icon-compact {
  font-size: 22px;
  width: 38px;
  height: 38px;
  background: rgba(255, 181, 71, 0.15);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sheets-config-box-content {
  flex: 1;
  min-width: 0;
}

/* =====================================================
   WHATSAPP BATCH SELECTION BAR
   ===================================================== */
.ws-batch-bar {
  position: sticky;
  top: 10px;
  z-index: 45;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-surface);
  border: 1.5px solid var(--brand-whatsapp);
  border-radius: 14px;
  padding: 10px 16px;
  margin-bottom: 16px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  flex-wrap: wrap;
  gap: 10px;
  animation: slideDown 0.2s ease;
}

.ws-batch-info {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ws-batch-count-badge {
  background: var(--brand-whatsapp);
  color: #ffffff;
  font-weight: 800;
  font-size: 12px;
  padding: 2px 10px;
  border-radius: 999px;
}

.ws-batch-buttons {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.ws-msg-checkbox {
  width: 20px;
  height: 20px;
  accent-color: var(--brand-whatsapp);
  cursor: pointer;
  margin: 0;
  flex-shrink: 0;
}

.ws-msg-card.selected-for-delete {
  border-color: var(--brand-whatsapp) !important;
  background: rgba(37, 211, 102, 0.06) !important;
  box-shadow: 0 0 0 2px rgba(37, 211, 102, 0.25);
}

/* ══════════════════════════════════════════════════════════════
   CATÁLOGO DE SERVICIOS & TARIFAS (GUÍA COMERCIAL)
══════════════════════════════════════════════════════════════ */
.catalog-hero {
  background: linear-gradient(135deg, rgba(79, 124, 255, 0.12) 0%, rgba(0, 198, 162, 0.08) 100%);
  border: 1px solid rgba(79, 124, 255, 0.25);
  border-radius: var(--radius);
  padding: 22px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 20px;
}

.catalog-hero-text h2 {
  font-size: 20px;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.catalog-hero-text p {
  color: var(--text-muted);
  font-size: 13.5px;
  max-width: 650px;
  line-height: 1.5;
  margin: 0;
}

.catalog-kpis {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.catalog-kpi-badge {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  text-align: center;
}

.catalog-kpi-val {
  font-size: 16px;
  font-weight: 800;
  color: var(--brand-primary);
}

.catalog-kpi-lbl {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.services-spec-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 18px;
  margin-bottom: 24px;
}

.service-spec-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 14px;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}

.service-spec-card:hover {
  transform: translateY(-2px);
  border-color: var(--brand-primary);
  box-shadow: var(--shadow-md);
}

.service-spec-card.card-featured-pack {
  border: 1.5px solid rgba(0, 198, 162, 0.45);
  background: linear-gradient(180deg, rgba(0, 198, 162, 0.05) 0%, var(--bg-surface) 100%);
  box-shadow: 0 4px 20px rgba(0, 198, 162, 0.08);
}

.service-spec-card.card-featured-pack:hover {
  border-color: var(--brand-secondary);
  box-shadow: 0 8px 28px rgba(0, 198, 162, 0.18);
}

.service-spec-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.service-spec-icon-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.service-spec-icon {
  font-size: 26px;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-hover);
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.service-spec-title {
  font-size: 15.5px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.25;
}

.service-spec-category {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.service-spec-price-tag {
  text-align: right;
  flex-shrink: 0;
}

.service-spec-price-main {
  font-size: 19px;
  font-weight: 800;
  color: var(--brand-primary);
}

.service-spec-card.card-featured-pack .service-spec-price-main {
  color: var(--brand-secondary);
}

.service-spec-price-sub {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
}

.service-spec-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  font-size: 13px;
  color: var(--text-secondary);
}

.spec-block {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.spec-block-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.spec-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.spec-list li {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  line-height: 1.4;
  font-size: 12px;
}

.spec-list li::before {
  content: "✓";
  color: var(--brand-success);
  font-weight: 800;
  font-size: 12px;
  flex-shrink: 0;
}

.service-pitch-box {
  background: rgba(79, 124, 255, 0.05);
  border-left: 3px solid var(--brand-primary);
  padding: 8px 12px;
  border-radius: 0 var(--radius-xs) var(--radius-xs) 0;
  font-style: italic;
  font-size: 12px;
  color: var(--text-primary);
  line-height: 1.4;
}

.service-spec-card.card-featured-pack .service-pitch-box {
  border-left-color: var(--brand-secondary);
  background: rgba(0, 198, 162, 0.05);
}

.service-spec-footer {
  display: flex;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.service-spec-btn-create {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 12px;
  background: var(--brand-primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}

.service-spec-btn-create:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.service-spec-card.card-featured-pack .service-spec-btn-create {
  background: var(--brand-secondary);
  color: #0b141a;
  font-weight: 700;
}

.service-spec-btn-copy {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 10px;
  background: var(--bg-hover);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}

.service-spec-btn-copy:hover {
  border-color: var(--brand-primary);
  color: var(--brand-primary);
}

/* Cotizador Rápido de Propuestas */
.quote-calc-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 24px;
}

.quote-calc-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 20px;
}

@media (max-width: 900px) {
  .quote-calc-grid {
    grid-template-columns: 1fr;
  }
}

.quote-calc-output {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
}

.quote-calc-totals {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.quote-total-pill {
  flex: 1;
  min-width: 120px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
}

.quote-total-pill-val {
  font-size: 18px;
  font-weight: 800;
  color: var(--brand-primary);
}

.quote-total-pill-lbl {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-top: 2px;
}

.quote-preview-textarea {
  width: 100%;
  min-height: 160px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.5;
  padding: 12px;
  resize: vertical;
}

.quote-preview-actions {
  display: flex;
  gap: 10px;
}

/* ──────────────────────────────────────────────────────────
   CAMPANITA DE NOTIFICACIONES TOPBAR & DROPDOWN
   ────────────────────────────────────────────────────────── */
.topbar-notifications-wrapper {
  position: relative;
  display: inline-block;
}

.topbar-bell-btn {
  background: var(--bg-surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  cursor: pointer;
  position: relative;
  color: var(--text-primary);
  transition: all var(--transition);
}

.topbar-bell-btn:hover {
  background: var(--bg-hover);
  border-color: var(--border-strong);
}

.topbar-bell-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--brand-danger);
  color: white;
  font-size: 10px;
  font-weight: 800;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  box-shadow: 0 0 0 2px var(--bg-surface);
  animation: pulse-badge 2s infinite;
}

@keyframes pulse-badge {
  0% { transform: scale(1); }
  50% { transform: scale(1.15); }
  100% { transform: scale(1); }
}

.notifications-dropdown {
  position: absolute;
  top: 48px;
  right: 0;
  width: 360px;
  max-width: 90vw;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  display: none;
  flex-direction: column;
  overflow: hidden;
  animation: dropdownFadeIn 0.15s ease-out;
}

@keyframes dropdownFadeIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

.notifications-dropdown.open {
  display: flex;
}

.notif-header {
  padding: 12px 16px;
  background: var(--bg-surface-2);
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

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

.notif-body {
  max-height: 380px;
  overflow-y: auto;
  padding: 6px 0;
}

.notif-item {
  padding: 10px 16px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background var(--transition);
}

.notif-item:hover {
  background: var(--bg-hover);
}

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

.notif-icon {
  font-size: 18px;
  flex-shrink: 0;
  margin-top: 2px;
}

.notif-content {
  flex: 1;
  min-width: 0;
}

.notif-headline {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.notif-desc {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.35;
}

.notif-time {
  font-size: 10px;
  font-weight: 700;
  margin-top: 4px;
}

.notif-time.danger { color: var(--brand-danger); }
.notif-time.warning { color: var(--brand-warning); }
.notif-time.info { color: var(--brand-primary); }

/* ──────────────────────────────────────────────────────────
   SECCIÓN CRONOGRAMA MENSUAL DE ENTREGABLES
   ────────────────────────────────────────────────────────── */
.cronograma-card-task {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  transition: all var(--transition);
  cursor: pointer;
}

.cronograma-card-task:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}

.cronograma-card-task.completed {
  background: var(--bg-surface-2);
  border-color: rgba(0, 198, 162, 0.35);
  opacity: 0.85;
}

.cronograma-task-check {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  border: 2px solid var(--border-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 900;
  color: transparent;
  flex-shrink: 0;
  margin-right: 12px;
  background: var(--bg-surface);
  transition: all var(--transition);
}

.cronograma-card-task.completed .cronograma-task-check {
  background: var(--brand-danger);
  border-color: var(--brand-danger);
  color: white;
}

.cronograma-task-date-pill {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 6px;
  font-weight: 700;
  font-family: var(--font-mono);
  background: var(--bg-surface-3);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.cronograma-card-task.completed .cronograma-task-date-pill {
  text-decoration: line-through;
  opacity: 0.6;
  background: rgba(255, 71, 87, 0.1);
  color: var(--brand-danger);
  border-color: rgba(255, 71, 87, 0.25);
}

.cronograma-task-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  flex: 1;
}

.cronograma-card-task.completed .cronograma-task-name {
  text-decoration: line-through;
  color: var(--text-muted);
}


/* ═══════════ POSIBLES CLIENTES: archivos + visor ═══════════ */
.pr-zona{display:flex;align-items:center;gap:14px;padding:14px 16px;border:2px dashed var(--border);border-radius:12px;background:var(--bg-surface-2,rgba(255,255,255,.03));cursor:pointer;transition:all .2s ease;position:relative;font-size:13px;color:var(--text-primary)}
.pr-zona:hover,.pr-zona.drag{border-color:var(--brand-primary,#4F7CFF);background:rgba(79,124,255,.08);transform:translateY(-1px)}
.pr-zona-ico{font-size:26px;width:46px;height:46px;display:flex;align-items:center;justify-content:center;border-radius:12px;background:rgba(79,124,255,.12);flex-shrink:0}
.pr-zona-sub{font-size:11.5px;color:var(--text-muted);margin-top:2px}
.pr-spin{display:none;width:18px;height:18px;border:2.5px solid var(--border);border-top-color:var(--brand-primary,#4F7CFF);border-radius:50%;margin-left:auto;animation:prspin .7s linear infinite}
.pr-zona.subiendo{pointer-events:none;opacity:.8}.pr-zona.subiendo .pr-spin{display:block}
@keyframes prspin{to{transform:rotate(360deg)}}
.pr-lista-pdf{display:flex;flex-direction:column;gap:6px;margin-top:8px}
.pr-lista-img{display:grid;grid-template-columns:repeat(auto-fill,minmax(84px,1fr));gap:8px;margin-top:8px}
.pr-pdf-chip{display:flex;align-items:center;gap:10px;padding:8px 10px;border:1px solid var(--border);border-radius:10px;background:var(--bg-surface)}
.pr-pdf-ico{background:linear-gradient(135deg,#ef4444,#dc2626);color:#fff;font-size:9.5px;font-weight:800;letter-spacing:.5px;padding:5px 6px;border-radius:6px;flex-shrink:0}
.pr-pdf-info{flex:1;min-width:0;cursor:pointer}
.pr-pdf-name{font-size:12.5px;font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.pr-pdf-size{font-size:11px;color:var(--text-muted)}
.pr-x{border:none;background:transparent;color:var(--text-muted);cursor:pointer;font-size:13px;width:26px;height:26px;border-radius:50%;flex-shrink:0}
.pr-x:hover{background:rgba(239,68,68,.15);color:#ef4444}
.pr-thumb{position:relative;aspect-ratio:1;border-radius:10px;overflow:hidden;border:1px solid var(--border);cursor:zoom-in;background:var(--bg-surface-2)}
.pr-thumb img{width:100%;height:100%;object-fit:cover;transition:transform .25s}
.pr-thumb:hover img{transform:scale(1.08)}
.pr-x-abs{position:absolute;top:4px;right:4px;background:rgba(0,0,0,.6);color:#fff;width:22px;height:22px;font-size:11px;opacity:0;transition:opacity .15s}
.pr-thumb:hover .pr-x-abs{opacity:1}
@media (hover:none){.pr-x-abs{opacity:1}}
/* Franja en la ficha: altura fija = todas las fichas iguales */
.pr-media-row{height:46px;display:flex;align-items:center;justify-content:space-between;gap:8px;margin-top:6px;padding:0 2px;flex-shrink:0}
.pr-media-vacia{justify-content:center;font-size:11.5px;color:var(--text-muted);border:1px dashed var(--border);border-radius:10px;opacity:.8}
.pr-pdf-btn{display:flex;align-items:center;gap:6px;height:36px;padding:0 10px;border:1px solid rgba(239,68,68,.35);background:rgba(239,68,68,.08);color:var(--text-primary);border-radius:9px;font-size:12px;font-weight:600;cursor:pointer;transition:all .15s}
.pr-pdf-btn:hover{background:rgba(239,68,68,.16);transform:translateY(-1px)}
.pr-minis{display:flex;gap:6px;margin-left:auto}
.pr-mini{position:relative;width:40px;height:40px;border-radius:9px;overflow:hidden;border:1px solid var(--border);cursor:zoom-in;transition:transform .15s}
.pr-mini:hover{transform:scale(1.1);z-index:1}
.pr-mini img{width:100%;height:100%;object-fit:cover}
.pr-mini-mas{position:absolute;inset:0;background:rgba(0,0,0,.55);color:#fff;font-size:12px;font-weight:700;display:flex;align-items:center;justify-content:center}
/* Visor emergente */
#visorArchivos{position:fixed;inset:0;z-index:100000;background:rgba(8,10,16,.92);backdrop-filter:blur(6px);display:none;flex-direction:column;opacity:0;transition:opacity .2s}
#visorArchivos.open{display:flex;opacity:1;animation:vzin .22s ease}
@keyframes vzin{from{opacity:0}to{opacity:1}}
.vz-top{display:flex;justify-content:space-between;align-items:center;gap:12px;padding:12px 16px;color:#fff}
.vz-title{font-size:14px;font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.vz-actions{display:flex;gap:8px;flex-shrink:0}
.vz-btn{background:rgba(255,255,255,.12);color:#fff;border:none;border-radius:9px;padding:7px 13px;font-size:13px;cursor:pointer;text-decoration:none;transition:background .15s}
.vz-btn:hover{background:rgba(255,255,255,.25)}
.vz-stage{flex:1;min-height:0;display:flex;align-items:center;justify-content:center;padding:0 64px 16px;overflow:hidden}
.vz-stage.zoom{overflow:auto;align-items:flex-start;justify-content:flex-start}
.vz-img{max-width:100%;max-height:100%;object-fit:contain;border-radius:8px;box-shadow:0 20px 60px rgba(0,0,0,.5);cursor:zoom-in;animation:vzpop .25s ease}
.vz-stage.zoom .vz-img{max-width:none;max-height:none;cursor:zoom-out;margin:auto}
@keyframes vzpop{from{transform:scale(.96);opacity:.5}to{transform:scale(1);opacity:1}}
.vz-pdf{width:min(980px,100%);height:100%;border:none;border-radius:10px;background:#fff}
.vz-nav{position:absolute;top:50%;transform:translateY(-50%);width:46px;height:46px;border-radius:50%;border:none;background:rgba(255,255,255,.14);color:#fff;font-size:30px;line-height:1;cursor:pointer;z-index:2;transition:background .15s}
.vz-nav:hover{background:rgba(255,255,255,.3)}.vz-prev{left:12px}.vz-next{right:12px}
.vz-count{position:absolute;bottom:14px;left:50%;transform:translateX(-50%);background:rgba(0,0,0,.55);color:#fff;font-size:12px;padding:4px 12px;border-radius:999px}
@media (max-width:640px){.vz-stage{padding:0 8px 48px}.vz-nav{width:38px;height:38px;font-size:24px}}
