/* ═══════════════════════════════════════════════════════════════════════════
   ADRIAPP — Premium Dark UI
   Estética: Linear / Vercel / Raycast — oscuro, preciso, sin ruido
   Fuente: DM Sans (display) + JetBrains Mono (datos/códigos)
   ═══════════════════════════════════════════════════════════════════════════ */

/* Fonts loaded via <link> in index.html — no @import needed */

/* ── Variables base (modo oscuro por defecto) ─────────────────────────── */
:root {
  /* Fondos */
  --bg-color:     #080c14;
  --surface-bg:   #0d1117;
  --surface-2:    #161b24;
  --surface-3:    #1c2333;

  /* Texto */
  --text-main:    #e6edf3;
  --text-muted:   #7d8590;
  --text-subtle:  #3d444d;

  /* Bordes */
  --border-color: #21262d;
  --border-muted: #161b22;

  /* Acento principal (configurable) */
  --primary:        #4493f8;
  --primary-hover:  #58a6ff;
  --primary-dim:    rgba(68, 147, 248, 0.12);
  --primary-glow:   rgba(68, 147, 248, 0.25);

  /* Semánticos */
  --secondary:      #bc8cff;
  --danger:         #f85149;
  --danger-light:   rgba(248, 81, 73, 0.1);
  --danger-text:    #ff7b72;
  --warning:        #e3b341;
  --warning-light:  rgba(227, 179, 65, 0.1);
  --warning-text:   #f0c040;
  --success:        #3fb950;
  --success-light:  rgba(63, 185, 80, 0.1);
  --success-text:   #56d364;
  --accent:         #e3b341;

  /* Layout */
  --sidebar-w:          220px;
  --sidebar-w-collapsed: 60px;
  --radius:             8px;
  --radius-sm:          6px;
  --radius-lg:          12px;

  /* Sombras */
  --shadow-sm:  0 1px 2px rgba(0,0,0,0.4);
  --shadow-md:  0 4px 12px rgba(0,0,0,0.5);
  --shadow-lg:  0 8px 32px rgba(0,0,0,0.6);

  /* Tipografía */
  --font-sans: 'DM Sans', -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  /* Transición */
  --transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Modo claro ──────────────────────────────────────────────────────────── */
body.light-mode {
  --bg-color:     #f6f8fa;
  --surface-bg:   #ffffff;
  --surface-2:    #f6f8fa;
  --surface-3:    #eaeef2;
  --text-main:    #1f2328;
  --text-muted:   #636c76;
  --text-subtle:  #adb5bd;
  --border-color: #d0d7de;
  --border-muted: #eaeef2;
  --primary-dim:  rgba(9, 105, 218, 0.08);
  --primary:      #0969da;
  --primary-hover:#0550ae;
  --shadow-sm:    0 1px 3px rgba(27,31,35,0.08);
  --shadow-md:    0 4px 12px rgba(27,31,35,0.12);
}

/* ── Paletas de acento ───────────────────────────────────────────────────── */
[data-accent="blue"]   { --primary:#4493f8; --primary-hover:#58a6ff; --secondary:#bc8cff; }
[data-accent="purple"] { --primary:#bc8cff; --primary-hover:#d2a8ff; --secondary:#79c0ff; }
[data-accent="green"]  { --primary:#3fb950; --primary-hover:#56d364; --secondary:#4493f8; }
[data-accent="orange"] { --primary:#e3b341; --primary-hover:#f0c040; --secondary:#f85149; }
[data-accent="pink"]   { --primary:#f778ba; --primary-hover:#ff9bce; --secondary:#bc8cff; }
[data-accent="cyan"]   { --primary:#39c5cf; --primary-hover:#56d4e0; --secondary:#4493f8; }

/* ── Reset & base ────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.6;
  background: var(--bg-color);
  color: var(--text-main);
  display: flex;
  height: 100vh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background 0.3s ease, color 0.3s ease;
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
}

/* ── Utilities ───────────────────────────────────────────────────────────── */
.hidden { display: none !important; }

/* ── Scrollbar ───────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-subtle); }

/* ═══════════════════════════════════════════════════════════════════════════
   SIDEBAR
   ═══════════════════════════════════════════════════════════════════════════ */
.sidebar {
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--surface-bg);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: width 0.22s ease;
  overflow: hidden;
  position: relative;
  z-index: 100;
}

.sidebar.collapsed { width: var(--sidebar-w-collapsed); }

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 16px;
  border-bottom: 1px solid var(--border-color);
  min-height: 60px;
}

.sidebar-header .logo-icon {
  width: 32px;
  height: 32px;
  background: var(--primary);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: #fff;
  flex-shrink: 0;
  font-weight: 700;
}

.logo-text {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-main);
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  transition: opacity 0.2s;
}

.sidebar.collapsed .logo-text { opacity: 0; width: 0; }

.btn-toggle-sidebar {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  flex-shrink: 0;
}
.btn-toggle-sidebar:hover { color: var(--text-main); background: var(--surface-2); }

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

.nav-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  width: 100%;
  text-align: left;
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 500;
  transition: var(--transition);
  white-space: nowrap;
  overflow: hidden;
  position: relative;
}

.nav-btn i {
  font-size: 0.9rem;
  width: 18px;
  text-align: center;
  flex-shrink: 0;
  transition: color 0.18s;
}

.nav-btn span { overflow: hidden; transition: opacity 0.2s; }
.sidebar.collapsed .nav-btn span { opacity: 0; width: 0; }
.sidebar.collapsed .nav-btn { justify-content: center; padding: 10px; }
.sidebar.collapsed .nav-btn i { width: auto; }

.nav-btn:hover {
  color: var(--text-main);
  background: var(--surface-2);
}

.nav-btn.active {
  color: var(--primary);
  background: var(--primary-dim);
}

.nav-btn.active i { color: var(--primary); }

.sidebar-footer {
  border-top: 1px solid var(--border-color);
  padding: 8px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   CONTENT WRAPPER
   ═══════════════════════════════════════════════════════════════════════════ */
.content-wrapper {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  overflow-x: auto;
  background: var(--bg-color);
  padding: 0;
}

/* ── Vista sections ─────────────────────────────────────────────────────── */
.view-section { display: none; min-height: 100vh; width: 100%; }
.view-section.active { display: block; }

/* ── Top header ─────────────────────────────────────────────────────────── */
.top-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px 24px;
  border-bottom: 1px solid var(--border-color);
  background: var(--surface-bg);
  position: sticky;
  top: 0;
  z-index: 50;
}

.header-titles h1 {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-main);
  letter-spacing: -0.02em;
}

.header-titles p {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 1px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   DASHBOARD HERO — KPIs
   ═══════════════════════════════════════════════════════════════════════════ */
#dashboard-hero {
  padding: 16px 24px 0;
}

.dh-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.dh-kpi {
  background: var(--surface-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 16px 18px;
  transition: var(--transition);
  cursor: default;
  position: relative;
  overflow: hidden;
}

.dh-kpi::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--primary-dim) 0%, transparent 60%);
  opacity: 0;
  transition: opacity 0.25s;
}

.dh-kpi:hover { border-color: var(--primary); }
.dh-kpi:hover::before { opacity: 1; }

.dh-kpi-icon {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.dh-kpi-value {
  font-size: 1.85rem;
  font-weight: 600;
  color: var(--text-main);
  letter-spacing: -0.04em;
  line-height: 1;
  margin-bottom: 4px;
  font-variant-numeric: tabular-nums;
}

.dh-kpi-label {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.dh-kpi-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 6px;
}

.month-insight-bar {
  margin-top: 12px;
  display: flex;
  align-items: stretch;
  gap: 12px;
  background: var(--surface-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 12px;
}

.month-insight-picker {
  min-width: 210px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.month-insight-picker span,
.month-insight-label {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.month-insight-picker select {
  height: 38px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-color);
  color: var(--text-main);
  padding: 0 10px;
  outline: none;
}

.month-insight-metrics {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.month-insight-item {
  border-left: 1px solid var(--border-color);
  padding-left: 14px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
}

.month-insight-item + .month-insight-item {
  margin-left: 0;
}

.month-insight-item strong {
  margin-top: 3px;
  font-size: 1.05rem;
  color: var(--text-main);
  font-variant-numeric: tabular-nums;
}

.dashboard-personal-grid {
  margin-top: 12px;
  display: grid;
  grid-template-columns: 0.86fr 1.14fr 1fr;
  gap: 12px;
  align-items: start;
}

.dashboard-panel {
  background: var(--surface-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 14px;
  min-width: 0;
}

.dashboard-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.dashboard-panel-head strong {
  display: block;
  color: var(--text-main);
  font-size: 0.98rem;
}

.dashboard-panel-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.dashboard-panel-kicker,
.month-client-meta,
.month-close-status {
  color: var(--text-muted);
  font-size: 0.72rem;
}

.dashboard-panel-kicker {
  display: block;
  margin-bottom: 3px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.dashboard-link-btn {
  background: transparent;
  border: none;
  color: var(--primary);
  cursor: pointer;
  font: inherit;
  font-size: 0.78rem;
  padding: 2px 0;
}

.dashboard-link-btn.is-active {
  color: var(--success);
}

.dashboard-link-btn:disabled {
  color: var(--text-muted);
  cursor: not-allowed;
  opacity: 0.55;
}

.dashboard-count-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  border: 1px solid var(--border-color);
  border-radius: 999px;
  padding: 3px 9px;
  color: var(--text-muted);
  font-size: 0.74rem;
  font-weight: 700;
  white-space: nowrap;
}

.dashboard-alerts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.dashboard-alert-card {
  min-height: 70px;
  background: var(--surface-2);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 5px 8px;
  padding: 10px;
  text-align: left;
  transition: var(--transition);
}

.dashboard-alert-card:hover,
.dashboard-alert-card.is-active {
  border-color: currentColor;
  background: var(--surface-bg);
}

.dashboard-alert-card i { font-size: 0.85rem; }
.dashboard-alert-card span { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; }
.dashboard-alert-card strong {
  grid-column: 1 / -1;
  color: var(--text-main);
  font-size: 1.3rem;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.dashboard-alert-card--expired { color: #ef4444; }
.dashboard-alert-card--today { color: #f59e0b; }
.dashboard-alert-card--soon { color: var(--primary); }
.dashboard-alert-card--invalid { color: #fb7185; }

.month-client-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 304px;
  overflow: auto;
  padding-right: 2px;
}

.month-client-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 9px 10px;
  background: var(--surface-2);
}

.month-client-main {
  min-width: 0;
}

.month-client-name {
  color: var(--text-main);
  font-size: 0.88rem;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.month-client-meta {
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.month-client-amount {
  color: var(--text-main);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.dashboard-empty-state {
  color: var(--text-muted);
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-sm);
  padding: 18px 12px;
  text-align: center;
  font-size: 0.82rem;
}

.month-close-status {
  min-height: 50px;
  line-height: 1.45;
}

.month-compare-line {
  margin-top: 7px;
  color: var(--text-muted);
  font-size: 0.7rem;
}

.month-compare-up { color: var(--success); }
.month-compare-down { color: var(--danger); }
.month-compare-flat { color: var(--text-muted); }

.dashboard-action-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.dashboard-action-btn {
  width: 100%;
  min-height: 38px;
  white-space: normal;
  text-align: center;
}

.dashboard-action-row > .dashboard-action-btn:first-child {
  grid-column: 1 / -1;
}

.month-closing-history {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-top: 12px;
}

.month-closing-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 8px 9px;
}

.month-closing-row.is-active {
  border-color: var(--primary);
  background: var(--primary-dim);
}

.month-closing-main {
  min-width: 0;
  cursor: pointer;
}

.month-closing-label {
  color: var(--text-main);
  font-size: 0.82rem;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.month-closing-meta {
  color: var(--text-muted);
  font-size: 0.7rem;
  margin-top: 2px;
}

.month-closing-profit {
  color: var(--text-main);
  font-size: 0.8rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.month-closing-delete {
  color: var(--text-muted);
}

.month-closing-footer {
  display: flex;
  justify-content: flex-end;
}

.dashboard-next-actions-panel {
  margin-top: 12px;
}

.dashboard-next-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.dashboard-next-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border-color);
  border-left-width: 4px;
  border-radius: var(--radius-sm);
  padding: 10px;
}

.dashboard-next-row--expired { border-left-color: #ef4444; }
.dashboard-next-row--today { border-left-color: #f59e0b; }
.dashboard-next-row--soon { border-left-color: var(--primary); }
.dashboard-next-row--invalid { border-left-color: #fb7185; }

.dashboard-next-row.is-notified {
  background: color-mix(in srgb, var(--surface-2) 78%, var(--success) 22%);
}

.dashboard-next-row.is-follow-up {
  background: color-mix(in srgb, var(--surface-2) 82%, #f59e0b 18%);
}

.dashboard-next-row.is-snoozed {
  background: color-mix(in srgb, var(--surface-2) 84%, var(--primary) 16%);
}

.dashboard-next-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 68px;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.dashboard-next-row--expired .dashboard-next-badge { background: rgba(239, 68, 68, 0.12); color: #ef4444; }
.dashboard-next-row--today .dashboard-next-badge { background: rgba(245, 158, 11, 0.14); color: #f59e0b; }
.dashboard-next-row--soon .dashboard-next-badge { background: var(--primary-dim); color: var(--primary); }
.dashboard-next-row--invalid .dashboard-next-badge { background: rgba(251, 113, 133, 0.14); color: #fb7185; }
.dashboard-next-row.is-follow-up .dashboard-next-badge { background: rgba(245, 158, 11, 0.16); color: #f59e0b; }
.dashboard-next-row.is-snoozed .dashboard-next-badge { background: var(--primary-dim); color: var(--primary); }

.dashboard-next-main {
  min-width: 0;
}

.dashboard-next-name {
  color: var(--text-main);
  font-size: 0.9rem;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-next-meta {
  color: var(--text-muted);
  font-size: 0.73rem;
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-next-notice {
  color: var(--success);
  font-size: 0.7rem;
  margin-top: 3px;
  font-weight: 700;
}

.dashboard-next-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.btn-icon--notified {
  color: var(--success);
}

.btn-icon--snooze {
  color: var(--primary);
}

.dashboard-week-panel {
  margin-top: 12px;
}

.weekly-wa-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.weekly-wa-summary div {
  background: var(--surface-2);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}

.weekly-wa-summary span {
  display: block;
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.weekly-wa-summary strong {
  display: block;
  color: var(--text-main);
  font-size: 1.08rem;
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}

.weekly-wa-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.weekly-wa-group {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.weekly-wa-group-title {
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 4px 0 -2px;
}

.weekly-wa-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 10px;
}

.weekly-wa-row.is-notified {
  background: color-mix(in srgb, var(--surface-2) 82%, var(--success) 18%);
}

.weekly-wa-row.is-no-phone {
  background: color-mix(in srgb, var(--surface-2) 86%, var(--danger) 14%);
}

.weekly-wa-date {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 54px;
  border-radius: var(--radius-sm);
  background: var(--surface-bg);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 6px 8px;
}

.weekly-wa-date strong {
  font-size: 1.05rem;
  line-height: 1;
}

.weekly-wa-date span {
  color: var(--text-muted);
  font-size: 0.64rem;
  font-weight: 800;
  margin-top: 3px;
  text-transform: uppercase;
}

.weekly-wa-main {
  min-width: 0;
}

.weekly-wa-name {
  color: var(--text-main);
  font-size: 0.9rem;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.weekly-wa-meta {
  color: var(--text-muted);
  font-size: 0.73rem;
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.weekly-wa-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   DATA SECTION & TABLE
   ═══════════════════════════════════════════════════════════════════════════ */
.data-section {
  padding: 16px 24px 24px;
  width: 100%;
  box-sizing: border-box;
}

/* Dashboard table - no lateral padding so table reaches edge */
#view-dashboard .data-section {
  padding: 0 0 24px;
}

.table-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: nowrap;
  padding: 12px 24px;
  width: 100%;
  box-sizing: border-box;
  border-bottom: 1px solid var(--border-color);
  background: var(--surface-bg);
  overflow-x: auto;
}

.table-toolbar label { display: none; }

.table-toolbar select {
  background: var(--surface-2);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  font-size: 0.8rem;
  font-family: var(--font-sans);
  transition: var(--transition);
  outline: none;
  cursor: pointer;
  white-space: nowrap;
}

.table-toolbar select:focus,
.table-toolbar select:hover {
  border-color: var(--primary);
  color: var(--text-main);
}

/* ── Search box ─────────────────────────────────────────────────────────── */
.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  transition: var(--transition);
  cursor: text;
  position: relative;
  z-index: 20;
  pointer-events: auto;
}

.search-box:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-dim);
}

.search-box i { color: var(--text-muted); font-size: 0.8rem; pointer-events: none; }
.search-box input {
  border: none;
  background: transparent;
  color: var(--text-main);
  outline: none;
  font-size: 0.85rem;
  font-family: var(--font-sans);
  width: 100%;
  cursor: text;
  position: relative;
  z-index: 21;
  pointer-events: auto;
}
.search-box input::placeholder { color: var(--text-muted); }
.search-clear-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
  border-radius: 4px;
  transition: var(--transition);
}
.search-clear-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.08);
}

/* ── Table container ─────────────────────────────────────────────────────── */
.table-container {
  background: var(--surface-bg);
  border: 1px solid var(--border-color);
  border-left: none;
  border-right: none;
  border-radius: 0;
  overflow: hidden;
  width: 100%;
}

.styled-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
  table-layout: auto;
}

.styled-table thead th {
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
  user-select: none;
  cursor: pointer;
}

.styled-table thead th:hover { color: var(--text-main); }

.styled-table tbody tr {
  border-bottom: 1px solid var(--border-muted);
  transition: background 0.12s;
}

.styled-table tbody tr:last-child { border-bottom: none; }
.styled-table tbody tr:hover { background: var(--surface-2); }

.styled-table tbody td {
  padding: 10px 14px;
  color: var(--text-main);
  vertical-align: middle;
}

.styled-table th i.fa-sort { opacity: 0.35; margin-left: 4px; font-size: 0.65rem; }
.styled-table th i.fa-sort-up,
.styled-table th i.fa-sort-down { color: var(--primary); margin-left: 4px; font-size: 0.65rem; }

.loader-cell {
  text-align: center;
  padding: 40px !important;
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* ── Checkbox ───────────────────────────────────────────────────────────── */
input[type="checkbox"] {
  accent-color: var(--primary);
  width: 15px;
  height: 15px;
  cursor: pointer;
}

/* ═══════════════════════════════════════════════════════════════════════════
   BADGES
   ═══════════════════════════════════════════════════════════════════════════ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 99px;
  font-size: 0.7rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.badge.green  { background: var(--success-light); color: var(--success-text); }
.badge.orange { background: var(--warning-light);  color: var(--warning-text); }
.badge.red    { background: var(--danger-light);   color: var(--danger-text); }
.badge.dark   { background: rgba(100, 116, 139, 0.18); color: #cbd5e1; }
.badge.vip    { background: rgba(188,140,255,0.12); color: #bc8cff; }
.badge.gift   { background: rgba(227,179,65,0.12);  color: #e3b341; }
.badge.friend { background: rgba(63,185,80,0.12);   color: var(--success-text); }

/* Tags en tabla */
.tag-badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 0.66rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.tag-badge--vip    { background: rgba(188,140,255,0.15); color: #bc8cff; }
.tag-badge--gift   { background: rgba(227,179,65,0.15);  color: #e3b341; }
.tag-badge--friend { background: rgba(63,185,80,0.15);   color: #56d364; }
.tag-badge--default{ background: var(--surface-2);       color: var(--text-muted); }
.tag-badge--warning{ background: rgba(248,81,73,0.15);   color: #f85149; }
.tag-badge--new    { background: rgba(59,130,246,0.15);  color: #4493f8; }

/* ─── Client table row elements ─────────────────────────────────────── */
.client-name-link {
  cursor: pointer;
  color: var(--primary);
  font-size: 0.95rem;
  font-weight: 700;
}
.client-name-link:hover { text-decoration: underline; }

.client-name-icon {
  font-size: 0.75rem;
  margin-right: 5px;
}

.client-tags-row {
  margin-top: 2px;
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
}

.client-contact {
  font-size: 0.75rem;
  margin-top: 2px;
}

.client-phone-icon {
  font-size: 0.7rem;
}

/* ═══════════════════════════════════════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════════════════════════════════════ */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 7px 14px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 0.84rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  text-decoration: none;
  width: 100%;
}

.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px var(--primary-glow);
}

.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

.btn-icon {
  background: none;
  border: 1px solid transparent;
  color: var(--text-muted);
  padding: 5px 7px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  font-size: 0.82rem;
}

.btn-icon:hover {
  color: var(--text-main);
  background: var(--surface-2);
  border-color: var(--border-color);
}

/* ── Renew button ───────────────────────────────────────────────────────── */
.btn-renew-quick {
  background: none;
  border: 1px solid transparent;
  color: var(--text-muted);
  padding: 5px 7px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  font-size: 0.82rem;
}

.btn-renew-quick:hover {
  color: var(--warning);
  border-color: var(--warning);
  background: var(--warning-light);
}

/* ═══════════════════════════════════════════════════════════════════════════
   FORMS
   ═══════════════════════════════════════════════════════════════════════════ */
.form-group { display: flex; flex-direction: column; gap: 6px; }

.form-group label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.form-group input,
.form-group select,
.form-group textarea {
  background: var(--surface-2);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-size: 0.875rem;
  font-family: var(--font-sans);
  transition: var(--transition);
  outline: none;
  width: 100%;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-dim);
  background: var(--surface-bg);
}

.form-group select option { background: var(--surface-2); }

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

/* ═══════════════════════════════════════════════════════════════════════════
   CONTENT CARDS
   ═══════════════════════════════════════════════════════════════════════════ */
.content-card {
  background: var(--surface-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 20px;
}

.section-title {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-title i { color: var(--primary); }

/* ═══════════════════════════════════════════════════════════════════════════
   MODALS
   ═══════════════════════════════════════════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.15s ease;
}

.modal-overlay.hidden { display: none; }

.modal-content {
  background: var(--surface-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 500px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.modal-header h3 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-main);
}

.modal-body { padding: 20px; }

.btn-close-modal {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.1rem;
  padding: 4px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}
.btn-close-modal:hover { color: var(--text-main); background: var(--surface-2); }

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

/* ═══════════════════════════════════════════════════════════════════════════
   SPOTLIGHT (Ctrl+K)
   ═══════════════════════════════════════════════════════════════════════════ */
#spotlight-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(6px);
  z-index: 2000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 15vh;
}

#spotlight-modal.hidden { display: none; }

.spotlight-modal-content {
  background: var(--surface-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 560px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: slideUp 0.18s ease;
}

.spotlight-modal-content input {
  width: 100%;
  padding: 14px 18px;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-main);
  font-size: 0.95rem;
  font-family: var(--font-sans);
  outline: none;
}

.spotlight-section-title {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 10px 14px 4px;
}

.spotlight-action {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 14px;
  cursor: pointer;
  transition: background 0.12s;
  border-radius: var(--radius-sm);
  margin: 2px 6px;
}

.spotlight-action:hover, .spotlight-action.active {
  background: var(--primary-dim);
}

.spotlight-action-icon {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  background: var(--primary-dim);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  flex-shrink: 0;
}

.spotlight-action-label { font-size: 0.875rem; font-weight: 500; color: var(--text-main); }
.spotlight-action-sub   { font-size: 0.72rem; color: var(--text-muted); }

.sp-search-bar {
  padding: 20px 25px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
  gap: 15px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   STATUS & INDICATORS
   ═══════════════════════════════════════════════════════════════════════════ */
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.status-dot.green  { background: var(--success); box-shadow: 0 0 6px var(--success); }
.status-dot.orange { background: var(--warning); box-shadow: 0 0 6px var(--warning); }
.status-dot.red    { background: var(--danger);  box-shadow: 0 0 6px var(--danger); }
.status-dot.gray   { background: var(--text-muted); opacity: 0.5; }

#sync-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* ── Toast ──────────────────────────────────────────────────────────────── */
.voice-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--surface-3);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 10px 18px;
  border-radius: 99px;
  font-size: 0.82rem;
  font-weight: 500;
  z-index: 9000;
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
  box-shadow: var(--shadow-md);
  white-space: nowrap;
  max-width: 90vw;
  text-overflow: ellipsis;
  overflow: hidden;
}

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

.voice-toast i { margin-right: 6px; color: var(--primary); }

/* ── Mass action bar ────────────────────────────────────────────────────── */
.mass-action-bar {
  display: none;
  align-items: center;
  gap: 10px;
  padding: 10px 24px;
  background: var(--primary-dim);
  border-bottom: 1px solid var(--primary);
  font-size: 0.84rem;
  flex-wrap: wrap;
}

.mass-action-bar button {
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.8rem;
  font-family: var(--font-sans);
  font-weight: 500;
  transition: var(--transition);
}

.mass-action-bar button:hover { background: var(--primary-hover); }

/* ═══════════════════════════════════════════════════════════════════════════
   EXPIRY TIMELINE (Dashboard)
   ═══════════════════════════════════════════════════════════════════════════ */
#expiry-timeline-card {
  background: var(--surface-bg);
  border: 1px solid var(--border-color);
  border-left: none;
  border-right: none;
  border-radius: 0;
  padding: 14px 24px;
  margin: 0 0 1px;
}

.an-timeline-bars {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 56px;
  margin-bottom: 6px;
}

.an-timeline-bar {
  flex: 1;
  border-radius: 3px 3px 0 0;
  cursor: pointer;
  transition: opacity 0.15s;
  min-width: 4px;
}
.an-timeline-bar:hover { opacity: 0.75; }

.an-timeline-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.62rem;
  color: var(--text-muted);
}

/* ═══════════════════════════════════════════════════════════════════════════
   ANALYTICS
   ═══════════════════════════════════════════════════════════════════════════ */
#analytics-summary-card {
  margin: 20px 24px;
  background: var(--surface-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 24px;
  display: flex;
  align-items: stretch;
  gap: 0;
}

.asc-main {
  display: flex;
  align-items: center;
  gap: 28px;
  flex-wrap: wrap;
  flex: 1;
}

.asc-block h2 {
  font-size: 2.4rem;
  font-weight: 600;
  letter-spacing: -0.05em;
  color: var(--text-main);
  font-variant-numeric: tabular-nums;
}

.asc-block small {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}

.asc-result {
  border-left: 1px solid var(--border-color);
  padding-left: 28px;
  margin-left: 8px;
  min-width: 220px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.asc-formula {
  font-size: 0.85rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.asc-formula strong { color: var(--success); font-size: 1.5rem; }

.an-row { margin: 0 24px 20px; }
.an-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.an-3col { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

.an-card {
  background: var(--surface-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 18px;
}

.an-card h3 {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 7px;
}

.chart-container {
  background: var(--surface-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 20px;
}

.chart-container h3 {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 7px;
}

.an-canvas-wrap { position: relative; min-height: 220px; }

.chart-subtitle {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-left: 8px;
}

/* ── Cycle analysis bars ────────────────────────────────────────────────── */
#cycle-analysis-card {
  background: var(--surface-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 20px;
}

#cycle-analysis-card h3 {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 7px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   NUEVO CLIENTE
   ═══════════════════════════════════════════════════════════════════════════ */
.nc-block {
  background: var(--surface-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}

.nc-line-row {
  background: var(--surface-2);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  position: relative;
}

#section-quick-import {
  background: var(--surface-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin: 16px 24px 0;
}

/* highlight flash when imported */
@keyframes highlightFlash {
  0%   { background: var(--primary-dim); }
  100% { background: transparent; }
}
.highlight-flash { animation: highlightFlash 1s ease; }

/* ═══════════════════════════════════════════════════════════════════════════
   CLIENT DETAILS PAGE
   ═══════════════════════════════════════════════════════════════════════════ */
#view-details { padding: 0; }

.details-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 24px;
  background: var(--surface-bg);
  border-bottom: 1px solid var(--border-color);
  flex-wrap: wrap;
  position: sticky;
  top: 0;
  z-index: 40;
}

.details-grid {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 20px;
  padding: 20px 24px;
}

/* Activity timeline */
.activity-timeline {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.timeline-item {
  display: flex;
  gap: 12px;
  padding-bottom: 14px;
  position: relative;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: 11px;
  top: 22px;
  bottom: 0;
  width: 1px;
  background: var(--border-color);
}

.timeline-item:last-child::before { display: none; }

.timeline-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6rem;
  margin-top: 1px;
}

.timeline-content { flex: 1; }
.timeline-content strong { font-size: 0.82rem; color: var(--text-main); font-weight: 500; }
.timeline-content span  { font-size: 0.72rem; color: var(--text-muted); display: block; }

/* ═══════════════════════════════════════════════════════════════════════════
   WHATSAPP
   ═══════════════════════════════════════════════════════════════════════════ */
.wa-template-card {
  background: var(--surface-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 18px;
}

.wa-template-card h4 {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 10px;
}

.wa-template-card p {
  font-size: 0.83rem;
  color: var(--text-main);
  line-height: 1.6;
  white-space: pre-wrap;
}

.btn-copy-wa {
  margin-top: 10px;
  background: rgba(37, 211, 102, 0.1);
  color: #25d366;
  border: 1px solid rgba(37, 211, 102, 0.25);
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-family: var(--font-sans);
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn-copy-wa:hover { background: rgba(37, 211, 102, 0.18); }

/* ═══════════════════════════════════════════════════════════════════════════
   ADRI CHAT
   ═══════════════════════════════════════════════════════════════════════════ */
.adri-chat-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 380px;
  max-height: 540px;
  background: var(--surface-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  z-index: 500;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.2s ease;
}

.adri-chat-container.hidden { display: none; }

.adri-chat-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color);
  cursor: move;
}

.adri-chat-header h4 {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-main);
  flex: 1;
}

.adri-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 200px;
  max-height: 360px;
}

.adri-chat-messages::-webkit-scrollbar { display: none; }

.adri-chat-messages .message {
  max-width: 85%;
  padding: 9px 13px;
  border-radius: var(--radius);
  font-size: 0.83rem;
  line-height: 1.55;
}

.adri-chat-messages .message.user {
  align-self: flex-end;
  background: var(--primary);
  color: #fff;
  border-bottom-right-radius: 3px;
}

.adri-chat-messages .message.adri {
  align-self: flex-start;
  background: var(--surface-2);
  color: var(--text-main);
  border-bottom-left-radius: 3px;
  border: 1px solid var(--border-color);
}

.adri-chat-input-area {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--border-color);
}

.adri-chat-input-area input {
  flex: 1;
  background: var(--surface-2);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 0.83rem;
  font-family: var(--font-sans);
  outline: none;
  transition: var(--transition);
}

.adri-chat-input-area input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-dim);
}

.adri-chat-input-area button {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  width: 34px;
  height: 34px;
  cursor: pointer;
  transition: var(--transition);
  font-size: 0.82rem;
  flex-shrink: 0;
}

.adri-chat-input-area button:hover {
  background: var(--primary-hover);
  transform: scale(1.05);
}

.adri-chat-input-area button.adri-mic-btn {
  background: var(--surface-2);
  color: var(--text-muted);
  border: 1px solid var(--border-color);
}

.adri-chat-input-area button.adri-mic-btn:hover {
  color: var(--danger);
  border-color: var(--danger);
  background: var(--danger-light);
}

.adri-chat-input-area button.adri-mic-btn.recording {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
  animation: pulse-mic 1s ease-in-out infinite;
}

@keyframes pulse-mic {
  0%, 100% { box-shadow: 0 0 0 0 var(--danger); }
  50%       { box-shadow: 0 0 0 6px transparent; }
}

/* Chat toggle — uses .adri-trigger class (see below) */

/* Adri chips */
.adri-chip {
  background: var(--surface-2);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 4px 10px;
  border-radius: 99px;
  font-size: 0.72rem;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  font-family: var(--font-sans);
}

.adri-chip:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-dim);
}

/* ═══════════════════════════════════════════════════════════════════════════
   SETTINGS
   ═══════════════════════════════════════════════════════════════════════════ */
.settings-section {
  background: var(--surface-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 16px;
}

.settings-section h3 {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Accent color pills */
.accent-pill {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  transition: var(--transition);
}

.accent-pill.active,
.accent-pill:hover { border-color: #fff; transform: scale(1.15); }

/* ═══════════════════════════════════════════════════════════════════════════
   AUDITORÍA
   ═══════════════════════════════════════════════════════════════════════════ */
/* El styled-table ya cubre esto */

/* ═══════════════════════════════════════════════════════════════════════════
   CALENDARIO
   ═══════════════════════════════════════════════════════════════════════════ */
#cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  background: var(--border-color);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  overflow: hidden;
}

#cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  margin-bottom: 1px;
}

#cal-day-panel {
  margin-top: 16px;
  background: var(--surface-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 18px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   PRESENTATION MODE
   ═══════════════════════════════════════════════════════════════════════════ */
.blur-sensitive { filter: blur(6px); user-select: none; transition: filter 0.3s; }
.blur-sensitive:hover { filter: blur(0); }

#presentation-banner {
  background: var(--warning);
  color: #000;
  text-align: center;
  padding: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* ═══════════════════════════════════════════════════════════════════════════
   FILTER GROUP
   ═══════════════════════════════════════════════════════════════════════════ */
.filter-group {
  display: flex;
  align-items: center;
}

.filter-group label {
  display: none;
}

.filter-group select {
  background: var(--surface-2);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  font-size: 0.8rem;
  font-family: var(--font-sans);
  outline: none;
  transition: var(--transition);
  cursor: pointer;
}

.filter-group select:focus,
.filter-group select:hover {
  border-color: var(--primary);
  color: var(--text-main);
}

/* ═══════════════════════════════════════════════════════════════════════════
   MISC
   ═══════════════════════════════════════════════════════════════════════════ */

/* Mono data display */
.mono { font-family: var(--font-mono); font-size: 0.82rem; }

/* Week filter badge */
#week-filter-badge {
  display: none;
  background: var(--primary-dim);
  border: 1px solid var(--primary);
  color: var(--primary);
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
}

/* Pagination */
#table-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-top: 1px solid var(--border-color);
  font-size: 0.78rem;
  color: var(--text-muted);
}

#table-pagination button {
  background: var(--surface-2);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.78rem;
  font-family: var(--font-sans);
  transition: var(--transition);
}

#table-pagination button:hover { border-color: var(--primary); color: var(--primary); }
#table-pagination button:disabled { opacity: 0.3; cursor: not-allowed; }

/* ── Pagination classes (renderPagination) ──────────────────────────────── */
.pag-container {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 4px; font-size: 0.85rem; color: var(--text-muted);
  flex-wrap: wrap; gap: 10px;
}
.pag-info { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pag-size-select {
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  background: var(--surface-bg);
  color: var(--text-main);
  font-size: 0.8rem;
  cursor: pointer;
  outline: none;
  transition: var(--transition);
}
.pag-size-select:hover, .pag-size-select:focus {
  border-color: var(--primary);
}
.pag-nav { display: flex; gap: 6px; align-items: center; }
.pag-nav-btn {
  padding: 4px 10px; border-radius: 6px;
  border: 1px solid var(--border-color);
  background: var(--surface-bg); color: var(--text-main);
  cursor: pointer; transition: var(--transition);
}
.pag-nav-btn:hover  { border-color: var(--primary); color: var(--primary); }
.pag-nav-btn--disabled { opacity: 0.4; cursor: not-allowed; }
.pag-label { font-weight: 700; color: var(--text-main); }
.pag-csv-btn {
  padding: 4px 10px; border-radius: 6px;
  border: 1px solid var(--border-color);
  background: var(--surface-bg); color: var(--text-main);
  cursor: pointer; margin-left: 8px; transition: var(--transition);
}
.pag-csv-btn:hover { border-color: var(--primary); color: var(--primary); }

/* ── Table action buttons ────────────────────────────────────────────────── */
.td-actions-row  { display: flex; gap: 6px; align-items: center; }
.btn-icon--wa    { color: var(--success); }
.btn-icon--renew { color: #f59e0b; }


/* ═══════════════════════════════════════════════════════════════════════════
   ANIMATIONS
   ═══════════════════════════════════════════════════════════════════════════ */
@keyframes spin { to { transform: rotate(360deg); } }
.fa-spin { animation: spin 1s linear infinite; }

@keyframes shimmer {
  0%   { opacity: 0.4; }
  50%  { opacity: 0.8; }
  100% { opacity: 0.4; }
}

/* Skeleton loading */
.skeleton {
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  animation: shimmer 1.5s ease infinite;
}

/* ═══════════════════════════════════════════════════════════════════════════
   RESPONSIVE — MÓVIL
   ═══════════════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  body { flex-direction: column; overflow: hidden; }

  .sidebar {
    width: 100% !important;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--border-color);
    flex-direction: row;
    align-items: center;
    padding: 6px 8px;
    position: sticky;
    top: 0;
    z-index: 200;
    overflow: visible;
    padding-left: max(8px, env(safe-area-inset-left));
    padding-right: max(8px, env(safe-area-inset-right));
  }

  .sidebar-header {
    padding: 6px 8px;
    border-bottom: none;
    min-height: auto;
    flex-shrink: 0;
  }

  .sidebar-nav {
    flex-direction: row;
    overflow-x: auto;
    overflow-y: visible;
    gap: 2px;
    padding: 0 4px;
    flex: 1;
    scrollbar-width: none;
  }

  .sidebar-nav::-webkit-scrollbar { display: none; }

  .nav-btn {
    flex-direction: column;
    padding: 6px 8px;
    font-size: 0.6rem;
    gap: 2px;
    min-width: 48px;
    text-align: center;
    justify-content: center;
  }

  .nav-btn i { width: auto; font-size: 0.95rem; }
  .nav-btn span { overflow: visible; opacity: 1; width: auto; font-size: 0.58rem; }

  .sidebar-footer { display: none; }
  .btn-toggle-sidebar { display: none; }

  .content-wrapper {
    flex: 1;
    overflow-y: auto;
    padding-bottom: max(16px, env(safe-area-inset-bottom));
  }

  .top-header { padding: 14px 16px 12px; }

  #dashboard-hero { padding: 14px 16px; }

  .dh-kpis { grid-template-columns: 1fr 1fr; gap: 8px; }

  .month-insight-bar { margin-top: 10px; }
  .month-insight-picker { width: 100%; }
  .month-insight-metrics { grid-template-columns: 1fr; }
  .month-insight-item { border-left: 0; padding: 0; margin: 0; }
  .month-insight-item + .month-insight-item {
    border-left: 0;
    border-top: 1px solid var(--border-color);
    padding: 10px 0 0;
    margin: 10px 0 0;
  }
  .dashboard-grid-new { grid-template-columns: 1fr; }
  .dashboard-alerts { grid-template-columns: 1fr 1fr; }
  .dashboard-action-row { grid-template-columns: 1fr; }
  .dashboard-action-row > .dashboard-action-btn:first-child { grid-column: auto; }
  .weekly-wa-summary { grid-template-columns: 1fr 1fr; }
  .weekly-wa-group { grid-template-columns: 1fr; }
  .weekly-wa-row { grid-template-columns: auto minmax(0, 1fr); }
  .weekly-wa-actions { grid-column: 1 / -1; justify-content: flex-end; }
  .dashboard-next-list { grid-template-columns: 1fr; }
  .dashboard-next-row { grid-template-columns: 1fr; align-items: flex-start; }
  .dashboard-next-actions { width: 100%; justify-content: flex-end; }

  .dh-kpi { padding: 14px 16px; }
  .dh-kpi-value { font-size: 1.5rem; }

  .data-section { padding: 0 16px 16px; }

  .table-toolbar { padding: 12px 0 8px; }

  .details-grid { grid-template-columns: 1fr; padding: 16px; }

  .an-2col, .an-3col { grid-template-columns: 1fr; }
  .an-row { margin: 0 16px 16px; }
  #analytics-summary-card { margin: 16px; }
  .asc-main { gap: 16px; }
  .asc-result { border-left: none; border-top: 1px solid var(--border-color); padding-left: 0; padding-top: 16px; margin-left: 0; min-width: 100%; }
  #analytics-summary-card { flex-direction: column; }

  .form-grid { grid-template-columns: 1fr; }

  .adri-chat-container { width: calc(100vw - 24px); right: 12px; bottom: 12px; }

  #section-quick-import { margin: 12px 16px 0; }
}

@media (max-width: 480px) {
  .dh-kpi-value { font-size: 1.3rem; }
  .dh-kpis { grid-template-columns: 1fr 1fr; }
}

/* Light mode adjustments */
body.light-mode .dh-kpi { box-shadow: var(--shadow-sm); }
body.light-mode .table-container { box-shadow: var(--shadow-sm); }
body.light-mode .content-card { box-shadow: var(--shadow-sm); }
body.light-mode .an-card { box-shadow: var(--shadow-sm); }
body.light-mode .adri-chat-container { box-shadow: var(--shadow-md); }

/* ── Datalist styling ───────────────────────────────────────────────────── */
datalist { display: none; }

/* ── Creds modal textarea ──────────────────────────────────────────────── */
#creds-text, #creds-m3u {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  background: var(--surface-2);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  width: 100%;
  resize: vertical;
}


/* Dark mode: :root ya define el tema oscuro por defecto */

/* ═══════════════════════════════════════════════════════════════════════════
   CLASES COMPLEMENTARIAS — añadidas en revisión post-diseño
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Adri trigger (botón flotante) ──────────────────────────────────────── */
.adri-trigger {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 48px;
  height: 48px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.1rem;
  box-shadow: var(--shadow-md), 0 0 20px var(--primary-glow);
  transition: var(--transition);
  z-index: 490;
  display: flex;
  align-items: center;
  justify-content: center;
}

.adri-trigger:hover {
  transform: scale(1.08);
  box-shadow: var(--shadow-lg), 0 0 28px var(--primary-glow);
}

/* ── Adri header buttons ────────────────────────────────────────────────── */
.adri-header-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 7px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  transition: var(--transition);
}
.adri-header-btn:hover { color: var(--text-main); background: var(--surface-2); }
.adri-header-btn.close { font-size: 1.1rem; }

/* ── Adri pulse ─────────────────────────────────────────────────────────── */
.adri-pulse {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 6px var(--success);
}

.adri-pulse-status { display: flex; align-items: center; gap: 6px; font-size: 0.72rem; color: var(--text-muted); }

/* ── Adri avatar ────────────────────────────────────────────────────────── */
.adri-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--primary-dim);
  border: 1px solid var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.8rem; color: var(--primary); flex-shrink: 0;
}

/* ── Message .ai (alias para .adri) ─────────────────────────────────────── */
.message.ai {
  align-self: flex-start;
  background: var(--surface-2);
  color: var(--text-main);
  border-bottom-left-radius: 3px;
  border: 1px solid var(--border-color);
}

/* ── Analytics summary blocks ───────────────────────────────────────────── */
.asc-block--total .asc-num { color: var(--primary); }
.asc-block--paid  .asc-num { color: var(--success); }
.asc-block--gift  .asc-num { color: var(--warning); }

.asc-num  { font-size: 2.4rem; font-weight: 600; letter-spacing: -0.05em; font-variant-numeric: tabular-nums; line-height: 1; margin-bottom: 4px; }
.asc-lbl  { font-size: 0.68rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; }
.asc-sub  { font-size: 0.72rem; color: var(--text-muted); margin-top: 2px; }
.asc-op   { font-size: 1.8rem; color: var(--text-subtle); font-weight: 200; line-height: 1; flex-shrink: 0; }
.asc-divider {
  font-size: 1.8rem;
  color: var(--text-subtle);
  font-weight: 200;
  line-height: 1;
  flex-shrink: 0;
}
.asc-icon { font-size: 1.2rem; margin-bottom: 6px; }
.asc-result-label { font-size: 0.68rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 6px; }

/* ── KPI color variants ─────────────────────────────────────────────────── */
.dh-kpi--primary { border-top: 3px solid var(--primary); }
.dh-kpi--success { border-top: 3px solid var(--success); }
.dh-kpi--warning { border-top: 3px solid var(--warning); }
.dh-kpi--danger  { border-top: 3px solid var(--danger); }
.dh-kpi--purple  { border-top: 3px solid var(--secondary); }
.dh-kpi--emerald { border-top: 3px solid #10b981; }
.dh-kpi--invalid { border-top-color: #ef4444; box-shadow: inset 0 0 0 1px rgba(239, 68, 68, 0.18); }
.dh-kpi--invalid .dh-kpi-label,
.dh-kpi--invalid .dh-kpi-value { color: #ef4444; }
.dh-kpi--emerald .dh-kpi-icon { color: #10b981; }
.dh-kpi--emerald .dh-kpi-value { color: #10b981; }

/* ── Btn success ────────────────────────────────────────────────────────── */
.btn-success {
  background: var(--success); color: #fff; border: none;
  padding: 7px 14px; border-radius: var(--radius-sm);
  font-family: var(--font-sans); font-size: 0.84rem; font-weight: 500;
  cursor: pointer; transition: var(--transition); display: inline-flex;
  align-items: center; gap: 7px;
}
.btn-success:hover { background: var(--success-text); transform: translateY(-1px); }

/* ── Chart header ───────────────────────────────────────────────────────── */
.chart-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}
.chart-header h3 {
  font-size: 0.78rem; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.06em;
  display: flex; align-items: center; gap: 7px;
}

/* ── Close / close-modal ────────────────────────────────────────────────── */
.close, .close-modal {
  background: none; border: none; color: var(--text-muted);
  cursor: pointer; font-size: 1.2rem; padding: 4px;
  border-radius: var(--radius-sm); transition: var(--transition); line-height: 1;
}
.close:hover, .close-modal:hover { color: var(--text-main); background: var(--surface-2); }

/* ── Details app tabs ───────────────────────────────────────────────────── */
.details-app-tabs {
  display: flex; gap: 4px; overflow-x: auto; padding: 0 2px;
  scrollbar-width: none;
}
.details-app-tabs::-webkit-scrollbar { display: none; }

.details-app-tab {
  padding: 5px 12px; border-radius: var(--radius-sm);
  background: var(--surface-2); border: 1px solid var(--border-color);
  color: var(--text-muted); cursor: pointer; font-size: 0.78rem;
  font-family: var(--font-sans); white-space: nowrap; transition: var(--transition);
}
.details-app-tab.active {
  background: var(--primary-dim); border-color: var(--primary); color: var(--primary);
}
.details-app-tab:hover { color: var(--text-main); background: var(--surface-3); }

/* ── Filters container ──────────────────────────────────────────────────── */
.filters-container {
  display: contents;
}

/* ── Form section ───────────────────────────────────────────────────────── */
.form-section {
  background: var(--surface-bg); border: 1px solid var(--border-color);
  border-radius: var(--radius); padding: 20px; margin-bottom: 16px;
}

.form-section h3 {
  font-size: 0.72rem; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 16px;
  display: flex; align-items: center; gap: 8px;
}

/* ── Glass (presentación mode) ──────────────────────────────────────────── */
.glass {
  background: rgba(13,17,23,0.7); backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
}

/* ── Input with action ──────────────────────────────────────────────────── */
.input-with-action {
  display: flex; gap: 8px; align-items: stretch;
}
.input-with-action input { flex: 1; }
.input-with-action button { flex-shrink: 0; }

/* ── Logo container ─────────────────────────────────────────────────────── */
.logo-container { display: flex; align-items: center; gap: 10px; }

/* ── Logout btn ─────────────────────────────────────────────────────────── */
.logout-btn {
  background: none; border: none; color: var(--danger); cursor: pointer;
  padding: 8px 10px; border-radius: var(--radius-sm); font-size: 0.85rem;
  font-family: var(--font-sans); transition: var(--transition);
  display: flex; align-items: center; gap: 8px; width: 100%;
}
.logout-btn:hover { background: var(--danger-light); }

/* ── Presentation banner ────────────────────────────────────────────────── */
#presentation-banner { display: none; }
body.presentation-mode #presentation-banner { display: block; }

/* ── Nav salir ──────────────────────────────────────────────────────────── */
.nav-btn.nav-salir { color: var(--danger); margin-top: auto; }
.nav-btn.nav-salir:hover { background: var(--danger-light); }

/* ── Sync status indicator ──────────────────────────────────────────────── */
#sync-status-text { font-size: 0.72rem; color: var(--text-muted); }
#sync-status-indicator { display: inline-block; }

/* ── Utility spacing ─────────────────────────────────────────────────────── */
.mt-1 { margin-top: 4px; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }

/* ── NC block title ─────────────────────────────────────────────────────── */
.nc-block-title {
  font-size: 0.72rem; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 14px;
  display: flex; align-items: center; gap: 8px;
}

/* ── Stats grid (usado en algunas vistas) ───────────────────────────────── */
.stats-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px;
}

.stat-card {
  background: var(--surface-bg); border: 1px solid var(--border-color);
  border-radius: var(--radius); padding: 16px;
  display: flex; align-items: center; gap: 12px;
}

.stat-icon {
  width: 36px; height: 36px; border-radius: var(--radius-sm);
  background: var(--primary-dim); color: var(--primary);
  display: flex; align-items: center; justify-content: center; font-size: 0.9rem; flex-shrink: 0;
}

.stat-info { flex: 1; }
.stat-label { font-size: 0.68rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; }

/* ── Toggle sidebar btn (alias) ─────────────────────────────────────────── */
.toggle-sidebar-btn {
  background: none; border: none; color: var(--text-muted); cursor: pointer;
  padding: 4px; border-radius: var(--radius-sm); transition: var(--transition);
}
.toggle-sidebar-btn:hover { color: var(--text-main); background: var(--surface-2); }

@media (max-width: 768px) {
  .table-container {
    border-left: 1px solid var(--border-color);
    border-right: 1px solid var(--border-color);
    border-radius: var(--radius);
    margin: 0 16px;
    width: calc(100% - 32px);
  }
  .table-toolbar { padding: 12px 16px 8px; }
  #expiry-timeline-card { padding: 12px 16px; }
}
/* ── Forzar ancho completo tabla dashboard ──────────────────────────────── */
#view-dashboard .table-toolbar,
#view-dashboard .table-container,
#view-dashboard #clients-table {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

/* ═══════════════════════════════════════════════════════════════════════════
   MEJORAS — Nuevas clases añadidas en revisión de código
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Animación de guardado exitoso ──────────────────────────────────────── */
@keyframes fieldSavedFlash {
  0%   { box-shadow: 0 0 0 0 rgba(63,185,80,0.5); border-color: var(--success); }
  50%  { box-shadow: 0 0 0 4px rgba(63,185,80,0.15); border-color: var(--success); }
  100% { box-shadow: none; border-color: var(--border-color); }
}

.field-saved {
  animation: fieldSavedFlash 1.5s ease forwards;
}

/* ── Indicador de última sincronización ─────────────────────────────────── */
#last-sync-time {
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-left: 4px;
  font-variant-numeric: tabular-nums;
}

/* ── Botón exportar gráfico ─────────────────────────────────────────────── */
.btn-export-chart {
  background: none;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.7rem;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.btn-export-chart:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-dim);
}

/* ── Logs date filter ───────────────────────────────────────────────────── */
.logs-date-filter {
  display: flex;
  align-items: center;
  gap: 6px;
}
.logs-date-filter input[type="date"] {
  background: var(--surface-2);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  padding: 5px 8px;
  font-size: 0.78rem;
  font-family: var(--font-sans);
  outline: none;
  transition: var(--transition);
  cursor: pointer;
}
.logs-date-filter input[type="date"]:focus {
  border-color: var(--primary);
  color: var(--text-main);
}
.logs-date-filter span {
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* ── Aria / Accesibilidad ───────────────────────────────────────────────── */
.btn-icon:focus-visible,
.btn-primary:focus-visible,
.nav-btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* ── Log action badges (reemplaza estilos inline) ───────────────────────── */
.log-action-badge {
  border-radius: 6px;
  padding: 3px 9px;
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
  display: inline-block;
}

/* ═══════════════════════════════════════════════════════════════════════════
   FASE 2 — Clases semánticas (reemplazan estilos inline)
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Details view ──────────────────────────────────────────────────────── */
.details-header-nav  { display: flex; align-items: center; gap: 15px; }
.details-actions-bar { display: flex; gap: 10px; }
.details-back-btn    { background: var(--surface-bg); }
.details-name        { font-size: 1.4rem; margin: 0; }
.details-btn-wa      { width: auto; background: #10b981; }
.details-btn-save    { width: auto; }
.details-sidebar-col { display: flex; flex-direction: column; gap: 20px; }
.details-main-grid   { display: grid; grid-template-columns: 1.5fr 1fr; gap: 25px; }
.details-bottom-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; margin-top: 0; }

.details-card-padded { padding: 25px; }
.details-form-1col   { grid-template-columns: 1fr; }
.details-section-gap { margin-top: 30px; }
.details-section-top { margin-top: 0; }

/* Quick actions panel */
.quick-actions-panel {
  margin-top: 25px; padding: 20px;
  background: rgba(59,130,246,0.1); border: 1px solid var(--primary); border-radius: 12px;
}
.quick-actions-title { margin: 0 0 15px 0; color: var(--primary); font-size: 0.9rem; }
.quick-actions-grid  { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.quick-actions-btn   { font-size: 0.8rem; padding: 10px; }

/* Danger zone */
.danger-zone {
  margin-top: 16px; padding: 16px 20px;
  background: rgba(239,68,68,0.05); border: 1px solid rgba(239,68,68,0.25); border-radius: 12px;
}
.danger-zone-inner   { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.danger-zone-label   { font-size: 0.8rem; font-weight: 700; color: #ef4444; }
.danger-zone-sub     { font-size: 0.72rem; color: var(--text-muted); margin-top: 2px; }
.danger-zone-btn {
  padding: 8px 14px; font-size: 0.8rem; font-weight: 700;
  background: rgba(239,68,68,0.12); color: #ef4444;
  border: 1px solid rgba(239,68,68,0.35); border-radius: 8px;
  cursor: pointer; white-space: nowrap; transition: all 0.2s;
}
.danger-zone-btn:hover { background: rgba(239,68,68,0.25); }

/* Renew button inline & group */
.renew-btn-group { display: flex; gap: 4px; align-items: center; }
.renew-btn-inline {
  padding: 6px 10px; border-radius: 6px;
  border: 1px solid rgba(245,158,11,0.4); background: rgba(245,158,11,0.1);
  color: #f59e0b; cursor: pointer; font-weight: 700;
  white-space: nowrap; font-size: 0.8rem; transition: all 0.2s ease;
}
.renew-btn-inline:hover { background: rgba(245,158,11,0.25); transform: translateY(-1px); }
.renew-btn-inline--year { border-color: rgba(16,185,129,0.45); background: rgba(16,185,129,0.12); color: #10b981; }
.renew-btn-inline--year:hover { background: rgba(16,185,129,0.25); color: #34d399; }

/* Expiration field row */
.expiry-field-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.expiry-field-row input { flex: 1; min-width: 130px; }

/* Notes input */
.notes-input-row  { display: flex; gap: 6px; border-top: 1px solid var(--border-color); padding-top: 12px; }
.notes-input {
  flex: 1; border-radius: var(--radius-sm); border: 1px solid var(--border-color);
  background: var(--surface-2); color: var(--text-main); padding: 7px 10px;
  font-size: 0.82rem; outline: none;
}
.notes-add-btn { padding: 7px 12px; font-size: 0.8rem; }

/* Notes list */
.notes-scroll { flex: 1; display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; max-height: 180px; overflow-y: auto; }

/* Payment area */
.payments-scroll { flex: 1; display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; max-height: 180px; overflow-y: auto; }
.payment-form    { border-top: 1px solid var(--border-color); padding-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.payment-row     { display: flex; gap: 6px; }
.payment-input {
  flex: 1; border-radius: var(--radius-sm); border: 1px solid var(--border-color);
  background: var(--surface-2); color: var(--text-main); padding: 7px 10px;
  font-size: 0.82rem; outline: none; min-width: 0;
}
.payment-select {
  flex: 1; border-radius: var(--radius-sm); border: 1px solid var(--border-color);
  background: var(--surface-2); color: var(--text-main); padding: 7px 8px;
  font-size: 0.8rem; outline: none; min-width: 0;
}
.payment-btn { font-size: 0.8rem; padding: 7px; }

/* ── Dashboard ─────────────────────────────────────────────────────────── */
.kpi-status-corner {
  position: absolute; top: 12px; right: 12px;
  display: flex; align-items: center; gap: 4px;
}
.kpi-status-text { font-size: 0.62rem; color: var(--text-muted); }
.kpi-sync-time   { font-size: 0.58rem; color: var(--text-subtle); margin-left: 2px; }
.hidden-legacy   { display: none; }

/* ── Calendar ──────────────────────────────────────────────────────────── */
.cal-nav-bar { display: flex; gap: 10px; align-items: center; }
.cal-nav-btn { width: auto; padding: 8px 14px; }
.cal-month-lbl { font-weight: 700; font-size: 1rem; min-width: 140px; text-align: center; }
.cal-today-btn { width: auto; padding: 8px 14px; background: var(--surface-bg); color: var(--text-main); border: 1px solid var(--border-color); }
.cal-weekdays-grid { display: grid; grid-template-columns: repeat(7,1fr); border-bottom: 1px solid var(--border-color); }
.cal-days-grid { display: grid; grid-template-columns: repeat(7,1fr); min-height: 480px; }

/* Calendar cells (rendered in JS) */
.cal-cell {
  border: 1px solid var(--border-color); min-height: 80px; padding: 6px;
  transition: background 0.15s;
}
.cal-cell--clickable { cursor: pointer; }
.cal-cell--today { background: rgba(59,130,246,0.08); }
.cal-cell:hover  { background: rgba(59,130,246,0.06); }
.cal-cell--today:hover { background: rgba(59,130,246,0.08); }
.cal-cell--empty { opacity: 0.3; }
.cal-cell-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.cal-day-num  { font-size: 0.8rem; font-weight: 500; color: var(--text-main); }
.cal-day-num--today {
  font-weight: 800; background: var(--primary); color: #fff;
  border-radius: 50%; width: 22px; height: 22px;
  display: flex; align-items: center; justify-content: center;
}
.cal-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}
.cal-chips { display: flex; flex-direction: column; gap: 2px; }
.cal-chip {
  font-size: 0.65rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  padding: 1px 4px; border-radius: 4px; color: var(--text-main);
}
.cal-chip--red    { background: rgba(239,68,68,0.15); }
.cal-chip--orange { background: rgba(245,158,11,0.15); }
.cal-chip--green  { background: rgba(16,185,129,0.15); }
.cal-more { font-size: 0.6rem; color: var(--text-muted); padding-left: 4px; }

/* Calendar weekday header (rendered in JS) */
.cal-weekday-label {
  text-align: center; padding: 10px 0; font-size: 0.75rem;
  font-weight: 700; color: var(--text-muted); text-transform: uppercase;
}

/* Calendar day panel detail rows */
.cal-day-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 0; border-bottom: 1px solid var(--border-color);
}
.cal-day-row-name { font-weight: 700; }
.cal-day-row-sub  { font-size: 0.8rem; color: var(--text-muted); }
.cal-day-row-actions { display: flex; gap: 8px; align-items: center; }
.cal-day-row-wa      { color: #25d366; }

/* ── WhatsApp Center ───────────────────────────────────────────────────── */
.wa-stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); margin-bottom: 25px; }
.wa-stat-icon--urgent   { background: rgba(239, 68, 68, 0.1); color: #ef4444; }
.wa-stat-icon--warning  { background: rgba(245, 158, 11, 0.1); color: #f59e0b; }
.wa-stat-icon--total    { background: rgba(37, 99, 235, 0.1); color: #2563eb; }
.wa-section-divider {
  display: flex; align-items: center; gap: 12px; margin: 28px 0 20px;
}
.wa-section-divider-line { flex: 1; height: 1px; background: var(--border-color); }
.wa-section-divider-text {
  font-size: 0.75rem; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.08em; white-space: nowrap;
}
.wa-hint { font-size: 0.75rem; color: var(--text-muted); margin-bottom: 14px; }
.wa-templates-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; }

/* WA row (rendered in JS) */
.wa-row-name  { font-weight: 700; }
.wa-row-phone { font-size: 0.75rem; color: var(--text-muted); }
.wa-send-btn {
  background: #25d366; color: white; border: none;
  padding: 6px 12px; font-size: 0.8rem; border-radius: 6px; font-weight: 700;
}
.wa-send-cell { text-align: right; }
/* WA empty state */
.wa-empty-state { text-align: center; padding: 40px; color: var(--text-muted); }
.wa-empty-icon  { font-size: 2rem; display: block; margin-bottom: 10px; color: var(--success); }

/* ── Header section ────────────────────────────────────────────────────── */
.view-header-title { font-size: 1.4rem; }
.view-header-btn   { width: auto; padding: 8px 14px; font-size: 0.85rem; }
.view-header-btn--outline {
  width: auto; background: var(--surface-bg); color: var(--text-main); border: 1px solid var(--border-color);
}

/* ── Modal WA queue ────────────────────────────────────────────────────── */
/* Revision view */
.review-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding: 0 24px 18px;
}
.review-summary-card {
  background: var(--panel-bg);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.review-summary-card strong { font-size: 1.6rem; line-height: 1; }
.review-summary-card--critical strong { color: #ef4444; }
.review-summary-card--warning strong { color: #f59e0b; }
.review-summary-card--info strong { color: var(--primary); }
.review-summary-label { color: var(--text-muted); font-size: 0.78rem; }
.review-section { padding-top: 0; }
.review-list { display: flex; flex-direction: column; gap: 12px; }
.review-item {
  background: var(--panel-bg);
  border: 1px solid var(--border-color);
  border-left-width: 4px;
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.review-item--critical { border-left-color: #ef4444; }
.review-item--warning { border-left-color: #f59e0b; }
.review-item--info { border-left-color: var(--primary); }
.review-item-top { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; flex-wrap: wrap; }
.review-client-name { font-size: 0.98rem; }
.review-item-message { font-size: 0.9rem; }
.review-item-meta { font-size: 0.76rem; color: var(--text-muted); margin-top: 4px; }
.review-item-actions { display: flex; gap: 8px; align-items: center; }
.review-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
}
.review-badge--critical { background: rgba(239, 68, 68, 0.12); color: #ef4444; }
.review-badge--warning { background: rgba(245, 158, 11, 0.14); color: #f59e0b; }
.review-badge--info { background: rgba(59, 130, 246, 0.12); color: #3b82f6; }
.review-empty-state { text-align: center; color: var(--text-muted); padding: 32px 12px; }

@media (max-width: 720px) {
  .review-summary-grid { grid-template-columns: 1fr; padding: 0 16px 14px; }
  .review-item { align-items: flex-start; flex-direction: column; }
  .review-item-actions { width: 100%; justify-content: flex-end; }
}

.waq-card {
  background: var(--bg-color); border: 1px solid var(--border-color);
  border-radius: 12px; padding: 20px; margin-bottom: 16px;
}
.waq-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.waq-name   { font-weight: 700; font-size: 1.1rem; }
.waq-phone  { font-size: 0.8rem; color: var(--text-muted); }
.waq-progress { margin-bottom: 16px; font-size: 0.85rem; color: var(--text-muted); }
.waq-textarea {
  width: 100%; min-height: 100px; background: var(--surface-2);
  border: 1px solid var(--border-color); border-radius: 8px;
  padding: 12px; color: var(--text-main); font-family: inherit;
  font-size: 0.82rem; resize: vertical;
}
.waq-actions { display: flex; gap: 10px; margin-top: 16px; }
.waq-btn-send { flex: 1; background: #25d366; }
.waq-btn-skip { flex: 1; background: var(--surface-2); color: var(--text-main); border: 1px solid var(--border-color); }
.waq-sent-count { text-align: center; font-size: 0.82rem; color: var(--text-muted); margin-top: 8px; }

/* ── Daily list modal (rendered in JS) ─────────────────────────────────── */
.daily-list-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.6); z-index: 9999;
  display: flex; align-items: center; justify-content: center;
}
.daily-list-card {
  background: var(--surface-bg); border-radius: 16px; padding: 24px;
  max-width: 500px; width: 90%; max-height: 80vh;
  display: flex; flex-direction: column; gap: 16px;
}
.daily-list-header { display: flex; justify-content: space-between; align-items: center; }
.daily-list-header h3 { margin: 0; }
.daily-list-close {
  background: none; border: none; font-size: 1.5rem;
  cursor: pointer; color: var(--text-muted);
}
.daily-list-textarea {
  flex: 1; min-height: 300px; background: var(--bg-color);
  border: 1px solid var(--border-color); border-radius: 8px;
  padding: 12px; color: var(--text-main); font-family: inherit;
  font-size: 0.85rem; line-height: 1.6; resize: none;
}
.daily-list-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.daily-list-btn-copy {
  padding: 12px; border-radius: 8px; border: 1px solid var(--border-color);
  background: var(--surface-bg); color: var(--text-main); cursor: pointer; font-weight: 600;
}
.daily-list-btn-queue {
  padding: 12px; border-radius: 8px; border: none;
  background: #25d366; color: #fff; cursor: pointer; font-weight: 800;
}

/* ── Timeline events (rendered in JS) ──────────────────────────────────── */
.tl-event     { display: flex; gap: 12px; position: relative; }
.tl-event--spaced { padding-bottom: 16px; }
.tl-connector {
  position: absolute; left: 13px; top: 26px; bottom: 0;
  width: 2px; background: var(--border-color);
}
.tl-dot {
  width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; margin-top: 2px; border-width: 2px; border-style: solid;
}
.tl-dot i   { font-size: 0.65rem; }
.tl-body    { flex: 1; min-width: 0; }
.tl-label   { font-size: 0.82rem; font-weight: 600; color: var(--text-main); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tl-date    { font-size: 0.72rem; color: var(--text-muted); margin-top: 1px; }
.tl-empty   { color: var(--text-muted); font-size: 0.82rem; padding: 12px 0; }

/* ── Client notes (rendered in JS) ─────────────────────────────────────── */
.note-card {
  background: rgba(245,158,11,0.07); border: 1px solid rgba(245,158,11,0.2);
  border-radius: 10px; padding: 10px 12px; position: relative;
}
.note-text   { font-size: 0.82rem; color: var(--text-main); line-height: 1.4; }
.note-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 5px; }
.note-date   { font-size: 0.68rem; color: var(--text-muted); }
.note-delete {
  background: none; border: none; color: var(--text-muted);
  cursor: pointer; font-size: 0.75rem; padding: 0; line-height: 1;
}
.notes-empty { color: var(--text-muted); font-size: 0.82rem; text-align: center; padding: 16px 0; }

/* ── Client payments (rendered in JS) ──────────────────────────────────── */
.pay-row {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 0; border-bottom: 1px solid var(--border-muted);
}
.pay-amount { font-size: 0.78rem; font-weight: 600; color: var(--text-main); font-variant-numeric: tabular-nums; }
.pay-method {
  padding: 2px 7px; border-radius: 99px;
  font-size: 0.65rem; font-weight: 700;
}
.pay-date { font-size: 0.7rem; color: var(--text-muted); flex: 1; }
.pay-delete {
  background: none; border: none; color: var(--text-muted);
  cursor: pointer; padding: 2px 4px; font-size: 0.75rem;
}
.pay-total {
  margin-top: 8px; font-size: 0.75rem; font-weight: 600;
  color: var(--text-muted); text-align: right;
}
.pay-total-amount { color: var(--success); }
.payments-empty {
  font-size: 0.78rem; color: var(--text-muted); text-align: center; padding: 12px 0;
}

/* ── App row (addNewAppRow) ────────────────────────────────────────────── */
.nc-line-row {
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 15px;
  margin-bottom: 15px;
  position: relative;
}

/* ── App row badge (addNewAppRow) ──────────────────────────────────────── */
.nc-app-badge {
  position: absolute; top: -10px; left: 15px;
  background: var(--surface-bg); padding: 0 8px;
  font-size: 0.7rem; font-weight: 800; color: var(--primary);
  border: 1px solid var(--border-color); border-radius: 4px;
}
.nc-remove-btn {
  position: absolute; top: 10px; right: 10px;
  background: transparent; border: none; color: var(--danger);
  cursor: pointer; font-size: 0.9rem;
}

/* ── Responsive overrides for new classes ──────────────────────────────── */
@media (max-width: 768px) {
  .details-main-grid   { grid-template-columns: 1fr; }
  .details-bottom-grid { grid-template-columns: 1fr; }
  .wa-stats-grid       { grid-template-columns: 1fr; }
}

/* ── Log table cells (renderLogs) ───────────────────────────────────────── */
.log-empty-state {
  text-align: center; padding: 30px; color: var(--text-muted);
}
.log-empty-icon {
  font-size: 2rem; display: block; margin-bottom: 10px; opacity: 0.3;
}
.log-cell-date {
  white-space: nowrap; font-size: 0.8rem; color: var(--text-muted); padding: 10px 12px;
}
.log-cell-client {
  font-weight: 600; color: var(--text-main); padding: 10px 12px;
}
.log-cell-action { padding: 10px 12px; }
.log-cell-detail {
  font-size: 0.82rem; color: var(--text-muted); padding: 10px 12px;
  max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
/* log-action-badge border color is set inline (dynamic) */
.log-action-badge { border-style: solid; }

/* ── Daily list header icon ──────────────────────────────────────────────── */
.daily-list-header-icon { color: var(--primary); margin-right: 8px; }

/* ── Adri suggestions ────────────────────────────────────────────────────── */
.adri-suggestions { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 12px; }
.adri-suggestion-btn {
  background: var(--surface-bg);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  border-radius: 20px;
  padding: 5px 12px;
  font-size: 0.75rem;
  cursor: pointer;
  font-family: var(--font-sans);
  transition: var(--transition);
}
.adri-suggestion-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-dim);
}

/* ── Spotlight search results ────────────────────────────────────────────── */
.sp-client-name    { font-weight: 700; }
.sp-client-name--lg { font-weight: 800; font-size: 1rem; }
.sp-client-sub     { font-size: 0.78rem; color: var(--text-muted); margin-top: 2px; }
.sp-badge--sm      { font-size: 0.7rem; }
.sp-phone-icon     { margin-right: 4px; }
.sp-phone-body     { flex: 1; }
.sp-phone-actions  { text-align: right; }
.sp-action-btns    { margin-top: 6px; display: flex; gap: 6px; justify-content: flex-end; }
.sp-wa-btn {
  padding: 4px 10px; border-radius: 6px; border: none;
  background: #25d366; color: #fff; font-size: 0.75rem; font-weight: 700; cursor: pointer;
}
.sp-renew-btn {
  padding: 4px 10px; border-radius: 6px;
  border: 1px solid rgba(245,158,11,0.3);
  background: rgba(245,158,11,0.15); color: #f59e0b;
  font-size: 0.75rem; font-weight: 700; cursor: pointer;
}
.sp-no-results {
  padding: 20px; text-align: center; color: var(--text-muted); font-size: 0.9rem;
}

/* ── WhatsApp header action buttons ─────────────────────────────────────── */
.wa-header-actions { display: flex; gap: 10px; }
.wa-btn--refresh {
  width: auto; background: var(--surface-bg);
  color: var(--text-main); border: 1px solid var(--border-color);
}
.wa-btn--daily  { width: auto; background: #f59e0b; }
.wa-btn--queue  { width: auto; background: #25d366; }

/* ── WA table header alignment ───────────────────────────────────────────── */
.th-right { text-align: right; }

/* ── WA section divider icon ──────────────────────────────────────────────  */
.wa-divider-icon { color: var(--primary); margin-right: 6px; }

/* ── WA templates section wrapper ────────────────────────────────────────── */
.wa-templates-section { padding: 0 24px 25px; }

/* ── WA template card ────────────────────────────────────────────────────── */
.wa-tpl-card {
  background: var(--surface-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: var(--transition);
  user-select: none;
}
.wa-tpl-card:hover {
  border-color: var(--primary);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}

/* ── Renovación card — special highlight ─────────────────────────────────── */
.wa-tpl-card--renew {
  border-color: rgba(245,158,11,0.3);
}
.wa-tpl-card--renew:hover {
  border-color: #f59e0b;
  box-shadow: 0 4px 16px rgba(245,158,11,0.15);
}

/* ── Card header row ─────────────────────────────────────────────────────── */
.wa-tpl-header {
  display: flex; align-items: center; gap: 8px; margin-bottom: 10px;
}
.wa-tpl-icon {
  width: 28px; height: 28px; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.8rem; flex-shrink: 0;
}
.wa-tpl-icon--renew {
  background: rgba(245,158,11,0.2); color: #f59e0b;
}
.wa-tpl-label {
  font-size: 0.72rem; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.06em;
}
.wa-tpl-label--renew { color: #f59e0b; }
.wa-tpl-copy-icon {
  margin-left: auto; color: var(--text-muted); font-size: 0.75rem;
  transition: color 0.15s;
}
.wa-tpl-card:hover .wa-tpl-copy-icon { color: var(--primary); }

/* ── Card preview text ───────────────────────────────────────────────────── */
.wa-tpl-preview {
  font-size: 0.78rem; color: var(--text-muted); line-height: 1.5;
  white-space: pre-line;
  max-height: 80px; overflow: hidden;
  display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical;
}

/* ═══════════════════════════════════════════════════════════════════════════
   CLEANUP PHASE 3 — Settings, Logs, Dashboard, New, Spotlight
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Utility ─────────────────────────────────────────────────────────────── */
.hidden            { display: none !important; }
.btn-auto          { width: auto; }
.btn-full          { width: 100%; }
.btn-sm            { padding: 5px 14px; font-size: 0.8rem; }
.btn-secondary-style { background: var(--surface-bg); color: var(--text-main); border: 1px solid var(--border-color); }
.view-h1           { font-size: 1.4rem; }
.link-primary      { color: var(--primary); }
.required-star     { color: #ef4444; }
.form-hint         { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 8px; }
.log-empty-state   { text-align: center; padding: 20px; color: var(--text-muted); }
.hr-divider        { border-color: var(--border-color); margin: 10px 0; }
.logo-accent       { color: var(--primary); }

/* ── Dashboard toolbar ───────────────────────────────────────────────────── */
.search-box--flex  { flex: 1; min-width: 200px; max-width: 400px; }
.search-box-input  { border: none; background: transparent; color: var(--text-main); outline: none; width: 100%; }
.th-sort           { cursor: pointer; }
.mass-action-bar   { display: flex; align-items: center; gap: 8px; }
.mass-action-count { color: var(--warning); font-weight: 700; font-size: 0.78rem; }
.mass-btn--warn    { color: var(--warning); border-color: var(--warning); }
.mass-btn--danger  { color: var(--danger); }

/* ── Logs filter bar ──────────────────────────────────────────────────────── */
.logs-filter-bar   { display: flex; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.logs-select       { padding: 8px 14px; border-radius: 10px; border: 1px solid var(--border-color); background: var(--surface-bg); color: var(--text-main); font-size: 0.85rem; }

/* ── Settings page ───────────────────────────────────────────────────────── */
.settings-section-header { display: flex; align-items: center; gap: 10px; margin-bottom: 20px; }
.settings-header-icon    { color: var(--primary); font-size: 1.1rem; }
.settings-section-title  { font-size: 1rem; color: var(--primary); margin: 0; font-weight: 700; }
.settings-sublabel       { font-size: 0.72rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; display: block; margin-bottom: 8px; }
.settings-appearance-row { display: flex; flex-wrap: wrap; gap: 32px; align-items: flex-start; }
.settings-divider-section { border-top: 1px solid var(--border-color); padding-top: 25px; margin-top: 25px; }
.settings-section-h2    { font-size: 1.1rem; color: var(--primary); margin-bottom: 20px; }
.settings-tool-card     { background: rgba(30,41,59,0.5); padding: 20px; border-radius: 12px; border: 1px solid var(--border-color); }
.settings-tool-title    { font-size: 0.95rem; margin-top: 0; margin-bottom: 10px; }
.settings-tool-desc     { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 15px; }
.settings-tool-grid     { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 15px; align-items: end; }
.settings-select        { width: 100%; border: 1px solid var(--border-color); border-radius: 8px; background: var(--bg-color); color: var(--text-main); padding: 10px; }
.settings-exec-btn      { height: 42px; background: var(--primary); border: none; font-weight: 700; }
.settings-pricing-grid  { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 8px; }

.settings-block         { grid-column: 1 / -1; border-radius: 12px; padding: 18px; margin-bottom: 10px; }
.settings-block--primary { background: rgba(59,130,246,0.07); border: 1px solid var(--primary); }
.settings-block--danger  { background: rgba(239,68,68,0.06); border: 1px solid rgba(239,68,68,0.3); }
.settings-block-label        { font-weight: 700; font-size: 0.95rem; }
.settings-block-label--primary { color: var(--primary); }
.settings-block-label--danger  { color: #ef4444; }
.connection-test-row    { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.connection-test-result { font-size: 0.82rem; color: var(--text-muted); }
.connection-test-result.is-success { color: var(--success-text); font-weight: 600; }
.connection-test-result.is-error   { color: var(--danger); font-weight: 600; }
.connection-test-result.is-loading { color: var(--warning); }
.settings-textarea      { width: 100%; border: 1px solid var(--border-color); border-radius: 8px; background: var(--bg-color); color: var(--text-main); font-family: inherit; padding: 10px 14px; font-size: 0.95rem; resize: vertical; }
.form-label--sm         { font-size: 0.75rem; }
.form-sublabel          { font-size: 0.7rem; text-transform: uppercase; font-weight: 700; color: var(--text-muted); display: block; margin-bottom: 5px; }
.fg-fullcol             { grid-column: 1 / -1; margin-top: 10px; }
.fg-ai-block            { padding-top: 20px; border-top: 1px solid var(--border-color); }
.fg-mb15                { margin-bottom: 15px; }
.fg-mb20                { margin-bottom: 20px; }

/* ── Theme + Accent swatches ─────────────────────────────────────────────── */
.theme-btn-group   { display: flex; gap: 8px; }
.theme-btn         { padding: 8px 16px; font-size: 0.82rem; border-radius: 10px; }
.theme-btn--inactive { background: var(--surface-bg); color: var(--text-main); border: 1px solid var(--border-color); }
.accent-swatches   { display: flex; gap: 10px; align-items: center; }
.accent-swatch {
  width: 34px; height: 34px; border-radius: 50%;
  background: attr(data-color color, #3b82f6);
  border: 3px solid transparent; cursor: pointer; transition: transform 0.15s;
}
[id="accent-blue"]   { background: #3b82f6; }
[id="accent-purple"] { background: #8b5cf6; }
[id="accent-green"]  { background: #10b981; }
[id="accent-orange"] { background: #f59e0b; }
[id="accent-pink"]   { background: #ec4899; }
[id="accent-cyan"]   { background: #06b6d4; }
.accent-swatch:hover { transform: scale(1.15); }



/* ── Quick import box ────────────────────────────────────────────────────── */
.quick-import-box   { background: rgba(59,130,246,0.06); border: 1px dashed var(--primary); border-radius: 14px; padding: 16px 20px; margin-bottom: 20px; }
.qi-header          { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.qi-icon            { color: var(--primary); font-size: 0.95rem; }
.qi-title           { font-weight: 700; font-size: 0.85rem; color: var(--primary); }
.qi-hint            { font-size: 0.75rem; color: var(--text-muted); }
.qi-grid            { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: end; }
.qi-textarea        { width: 100%; background: var(--bg-color); border: 1px solid var(--border-color); border-radius: 8px; color: var(--text-main); padding: 10px 12px; font-size: 0.82rem; resize: none; font-family: monospace; line-height: 1.5; box-sizing: border-box; }
.qi-btn             { padding: 10px 20px; font-size: 0.85rem; white-space: nowrap; height: fit-content; }
.nc-block-title--flex { display: flex; justify-content: space-between; align-items: center; }
.nc-textarea        { width: 100%; border: 1px solid var(--border-color); border-radius: 8px; background: var(--bg-color); color: var(--text-main); font-family: inherit; padding: 10px; resize: vertical; }
.nc-submit-section  { padding-top: 16px; border-top: 1px solid var(--border-color); }

/* ── Analytics icon accents ──────────────────────────────────────────────── */
.icon--primary { color: var(--primary); }
.icon--green   { color: #10b981; }
.icon--amber   { color: #f59e0b; }
.icon--purple  { color: #8b5cf6; }
.icon--cyan    { color: #06b6d4; }
.icon--wa      { color: #25d366; }
.chart-header-actions   { display: flex; align-items: center; gap: 8px; }
.an-canvas-wrap--tall   { min-height: 200px; }

/* ── Calendar section ────────────────────────────────────────────────────── */
.cal-data-section   { padding: 0 24px 24px; }
.cal-day-panel      { margin-top: 16px; }
.cal-day-panel-title { margin: 0 0 12px; }

/* ── WA Queue modal ──────────────────────────────────────────────────────── */
.modal-content--sm  { max-width: 560px; }
.modal-content--md  { max-width: 500px; }
.waq-actions-grid   { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.daily-list-btn-copy--danger { color: var(--danger); }
.waq-sent-count--success { color: var(--success); font-weight: 700; }

/* ── Spotlight modal ─────────────────────────────────────────────────────── */
.sp-modal           { align-items: flex-start; padding-top: 80px; }
.sp-modal-content   { max-width: 600px; background: var(--surface-bg); border: 1px solid var(--primary); box-shadow: 0 25px 50px rgba(0,0,0,0.5); border-radius: var(--radius); width: 100%; }
.sp-search-bar      { padding: 20px 25px; display: flex; align-items: center; border-bottom: 1px solid var(--border-color); gap: 16px; }
.sp-search-icon     { font-size: 1.4rem; color: var(--primary); }
.sp-input           { flex: 1; background: transparent; border: none; outline: none; color: var(--text-main); font-size: 1.1rem; }
.sp-esc-badge       { background: var(--bg-color); }
.sp-results         { max-height: 350px; overflow-y: auto; }

/* ── Details section ─────────────────────────────────────────────────────── */
.quick-actions-btn--danger { background: var(--danger); }
.details-card--flex { display: flex; flex-direction: column; }

/* ── Credentials modal ───────────────────────────────────────────────────── */
.creds-textarea     { width: 100%; padding: 15px; background: var(--bg-color); border: 1px solid var(--border-color); border-radius: 8px; color: var(--text-main); font-family: monospace; font-size: 0.85rem; resize: none; }
.creds-btn-grid     { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.m3u-container      { margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--border-color); }
.m3u-label          { font-size: 0.8rem; color: var(--text-muted); }
.creds-m3u          { font-size: 0.8rem; }

/* ── Adri AI widget ──────────────────────────────────────────────────────── */
.adri-header-row    { display: flex; align-items: center; gap: 12px; }
.adri-title         { font-weight: 700; font-size: 1rem; letter-spacing: 0.5px; }
.adri-status-label  { font-size: 0.7rem; color: rgba(255,255,255,0.6); display: flex; align-items: center; gap: 4px; }
.adri-status-dot    { width: 6px; height: 6px; }
.adri-btn-row       { display: flex; gap: 8px; }

/* ── Product Badges (IPTV & P2P) ─────────────────────────────────────────── */
.client-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.prod-badge {
  font-size: 0.62rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: inline-flex;
  align-items: center;
  line-height: 1;
}

.prod-badge--iptv {
  background-color: rgba(139, 92, 246, 0.15); /* Purple light */
  color: #a78bfa; /* Light purple */
  border: 1px solid rgba(139, 92, 246, 0.3);
}

.prod-badge--p2p {
  background-color: rgba(16, 185, 129, 0.15); /* Emerald light */
  color: #34d399; /* Light emerald */
  border: 1px solid rgba(16, 185, 129, 0.3);
}

/* ── New Dashboard Layout (2-column Grid) ────────────────────────────────── */
.dashboard-grid-new {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 16px;
  margin-top: 16px;
  align-items: start;
}

.scroll-container {
  max-height: 300px;
  overflow-y: auto;
  padding-right: 4px;
}

.scroll-container::-webkit-scrollbar {
  width: 5px;
}

.scroll-container::-webkit-scrollbar-track {
  background: transparent;
}

.scroll-container::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 99px;
}

.month-insight-picker-new select {
  height: 32px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-color);
  color: var(--text-main);
  padding: 0 8px;
  outline: none;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.month-insight-picker-new select:hover {
  border-color: var(--primary);
}

.month-insight-metrics-new {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 10px;
  margin-bottom: 16px;
}

.month-insight-item-new {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
}

.month-insight-item-new .month-insight-label {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.month-insight-item-new strong {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-main);
  margin-top: 2px;
}

.month-list-header-new {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border-color);
}

.month-list-title-new {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ═══════════════════════════════════════════════════════════════════════════
   CINEMATIC FACELIFT & FLOAT SYSTEM (ANTIGRAVITY THEME)
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── 1. Fondo Oscuro Gradiente y Efecto Volumétrico ─────────────────────── */
body.dark-mode {
  background: radial-gradient(circle at 50% 110%, #0b111e 0%, #030712 100%) !important;
  overflow-x: hidden;
}

#bg-particles {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  pointer-events: none;
}

body.dark-mode .volumetric-light-shafts {
  position: fixed;
  bottom: -200px;
  left: -10%;
  width: 120%;
  height: 800px;
  background: 
    radial-gradient(ellipse at bottom left, rgba(56, 189, 248, 0.07) 0%, rgba(56, 189, 248, 0) 50%),
    radial-gradient(ellipse at bottom right, rgba(139, 92, 246, 0.07) 0%, rgba(139, 92, 246, 0) 50%),
    radial-gradient(circle at 50% 100%, rgba(59, 130, 246, 0.04) 0%, rgba(59, 130, 246, 0) 65%);
  filter: blur(100px);
  pointer-events: none;
  z-index: -1;
  animation: drift-lights 25s ease-in-out infinite alternate;
  mix-blend-mode: screen;
}

@keyframes drift-lights {
  0% {
    transform: translateY(0) scale(1) rotate(0deg);
    opacity: 0.7;
  }
  100% {
    transform: translateY(-40px) scale(1.08) rotate(3deg);
    opacity: 1;
  }
}

/* ── 2. Rejillas y Paneles en Modo Oscuro ──────────────── */
/* Vidrios Translúcidos (Glassmorphism) */
body.dark-mode .sidebar,
body.dark-mode .dh-kpi,
body.dark-mode .dashboard-panel,
body.dark-mode .table-toolbar,
body.dark-mode .table-container,
body.dark-mode .adri-chat-container.glass {
  background: rgba(10, 16, 28, 0.65) !important;
  backdrop-filter: blur(16px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(16px) saturate(180%) !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
}

/* ── 3. Niveles de Sombras y Elevación ──────────────── */
body.dark-mode .sidebar {
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.05), 10px 0 35px rgba(0, 0, 0, 0.55);
}

body.dark-mode #stat-annual {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 10px 24px rgba(0, 0, 0, 0.45);
}

body.dark-mode #stat-profit {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.09), 0 8px 18px rgba(0, 0, 0, 0.4);
}

body.dark-mode #stat-forecast {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15), 0 14px 30px rgba(0, 0, 0, 0.5);
}

body.dark-mode #stat-urgent-count {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 10px 20px rgba(0, 0, 0, 0.42);
}

/* Columna Izquierda (Alertas y Avisos) */
body.dark-mode .dashboard-grid-new > section:first-child {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 12px 28px rgba(0, 0, 0, 0.45);
}

/* Columna Derecha (Resumen Mensual) */
body.dark-mode .dashboard-grid-new > section:last-child {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 8px 20px rgba(0, 0, 0, 0.4);
}

/* Contenedores de Tablas en el Dashboard */
body.dark-mode .table-toolbar {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 8px 22px rgba(0, 0, 0, 0.42);
  border-radius: var(--radius);
  margin-bottom: 12px;
  position: relative;
  z-index: 10;
}

body.dark-mode .table-container {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07), 0 10px 26px rgba(0, 0, 0, 0.38);
  border-radius: var(--radius);
}

/* ── 4. Estados de Hover ────────────── */
body.dark-mode .dh-kpi,
body.dark-mode .dashboard-panel,
body.dark-mode .table-toolbar,
body.dark-mode .table-container {
  transition: 
    transform 0.25s ease, 
    box-shadow 0.25s ease, 
    border-color 0.25s ease !important;
}

body.dark-mode #stat-annual:hover {
  transform: translateY(-4px);
  border-color: rgba(56, 189, 248, 0.3) !important;
  box-shadow: 
    inset 0 1px 0 rgba(255, 255, 255, 0.25), 
    0 16px 32px rgba(0, 0, 0, 0.65),
    0 0 20px rgba(56, 189, 248, 0.2);
}

body.dark-mode #stat-profit:hover {
  transform: translateY(-4px);
  border-color: rgba(52, 211, 153, 0.3) !important;
  box-shadow: 
    inset 0 1px 0 rgba(255, 255, 255, 0.25), 
    0 16px 32px rgba(0, 0, 0, 0.65),
    0 0 20px rgba(52, 211, 153, 0.2);
}

body.dark-mode #stat-forecast:hover {
  transform: translateY(-4px);
  border-color: rgba(245, 158, 11, 0.3) !important;
  box-shadow: 
    inset 0 1px 0 rgba(255, 255, 255, 0.25), 
    0 20px 40px rgba(0, 0, 0, 0.72),
    0 0 20px rgba(245, 158, 11, 0.22);
}

body.dark-mode #stat-urgent-count:hover {
  transform: translateY(-4px);
  border-color: rgba(248, 113, 113, 0.3) !important;
  box-shadow: 
    inset 0 1px 0 rgba(255, 255, 255, 0.25), 
    0 16px 32px rgba(0, 0, 0, 0.65),
    0 0 20px rgba(248, 113, 113, 0.2);
}

body.dark-mode .dashboard-grid-new > section:first-child:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.16) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15), 0 16px 32px rgba(0, 0, 0, 0.6);
}

body.dark-mode .dashboard-grid-new > section:last-child:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.16) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15), 0 16px 32px rgba(0, 0, 0, 0.55);
}

body.dark-mode .table-toolbar:hover {
  border-color: rgba(255, 255, 255, 0.15) !important;
}

body.dark-mode .table-container:hover {
  border-color: rgba(255, 255, 255, 0.15) !important;
}

/* ── 5. Iluminación y Neón en Iconos e Interfaces ───────────────────────── */
body.dark-mode .dh-kpi--primary .dh-kpi-icon i {
  color: #38bdf8;
  filter: drop-shadow(0 0 5px #38bdf8);
}
body.dark-mode .dh-kpi--emerald .dh-kpi-icon i {
  color: #34d399;
  filter: drop-shadow(0 0 5px #34d399);
}
body.dark-mode .dh-kpi--warning .dh-kpi-icon i {
  color: #f59e0b;
  filter: drop-shadow(0 0 5px #f59e0b);
}
body.dark-mode .dh-kpi--danger .dh-kpi-icon i {
  color: #f87171;
  filter: drop-shadow(0 0 5px #f87171);
}

body.dark-mode .nav-btn.active {
  color: #38bdf8 !important;
  background: rgba(56, 189, 248, 0.1) !important;
  border: 1px solid rgba(56, 189, 248, 0.22) !important;
  box-shadow: 
    inset 0 1px 0 rgba(255, 255, 255, 0.08), 
    0 0 15px rgba(56, 189, 248, 0.15) !important;
  text-shadow: 0 0 6px rgba(56, 189, 248, 0.4);
}

body.dark-mode .nav-btn.active i {
  color: #38bdf8 !important;
  filter: drop-shadow(0 0 4px #38bdf8);
}

/* Aumento de nitidez neón para tags */
body.dark-mode .prod-badge--iptv {
  background-color: rgba(192, 132, 252, 0.15) !important;
  color: #c084fc !important;
  border-color: rgba(192, 132, 252, 0.35) !important;
  box-shadow: 0 0 8px rgba(192, 132, 252, 0.1);
}

body.dark-mode .prod-badge--p2p {
  background-color: rgba(52, 211, 153, 0.15) !important;
  color: #34d399 !important;
  border-color: rgba(52, 211, 153, 0.35) !important;
  box-shadow: 0 0 8px rgba(52, 211, 153, 0.1);
}

/* ── 6. Botón Perlado 3D "Cerrar mes" ──────────────────────────────────── */
.month-close-container-new {
  margin-top: 18px;
  width: 100%;
}

.btn-cerrar-mes {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 12px 20px;
  font-weight: 700;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #ffffff;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  outline: none;
  box-sizing: border-box;
}

.btn-3d-pearlescent {
  background: linear-gradient(135deg, 
    #0ea5e9 0%, 
    #3b82f6 25%, 
    #8b5cf6 50%, 
    #6366f1 75%, 
    #0ea5e9 100%
  );
  background-size: 200% 200%;
  box-shadow: 
    0 4px 0 #1d4ed8, 
    0 10px 20px rgba(59, 130, 246, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.5),
    inset 0 -1px 0 rgba(0, 0, 0, 0.2);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275), background-position 0.6s ease;
  animation: pearlescent-glow 8s ease infinite alternate;
}

@keyframes pearlescent-glow {
  0% { background-position: 0% 50%; }
  100% { background-position: 100% 50%; }
}

.btn-3d-pearlescent:hover {
  transform: translateY(-2px);
  box-shadow: 
    0 6px 0 #1d4ed8, 
    0 15px 25px rgba(59, 130, 246, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.6);
  background-position: 50% 100%;
}

.btn-3d-pearlescent:active {
  transform: translateY(3px);
  box-shadow: 
    0 1px 0 #1d4ed8, 
    0 5px 10px rgba(59, 130, 246, 0.3);
}

.btn-cerrar-mes--closed {
  background: rgba(16, 185, 129, 0.12) !important;
  color: #34d399 !important;
  border: 1px solid rgba(16, 185, 129, 0.3) !important;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.1) !important;
  cursor: not-allowed;
  transform: none !important;
}

/* Corregir margen e integración del contenedor en la columna derecha */
#view-dashboard .dashboard-panel {
  padding-bottom: 20px;
}


/* ==========================================================================
   DASHBOARD REVAMP & QUICK CHIPS STYLING
   ========================================================================== */

/* Quick Filter Chips */
.dashboard-quick-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 12px;
  padding: 4px 0;
}

.quick-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid var(--border-color);
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.quick-chip i {
  font-size: 0.85rem;
}

.quick-chip:hover {
  background: var(--surface-bg);
  color: var(--text-main);
  border-color: var(--primary);
  transform: translateY(-1px);
}

.quick-chip.active {
  background: rgba(59, 130, 246, 0.15);
  border-color: #3b82f6;
  color: #60a5fa;
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.2);
}

.quick-chip--danger.active {
  background: rgba(239, 68, 68, 0.15);
  border-color: #ef4444;
  color: #f87171;
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.2);
}

.quick-chip--newest.active {
  background: rgba(16, 185, 129, 0.15);
  border-color: #10b981;
  color: #34d399;
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.2);
}

.quick-chip--gift.active {
  background: rgba(168, 85, 247, 0.15);
  border-color: #a855f7;
  color: #c084fc;
  box-shadow: 0 0 12px rgba(168, 85, 247, 0.2);
}

/* Enhanced Expiration & Created Rows */
.weekly-wa-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 3px;
}

.days-badge {
  font-size: 0.68rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 12px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  display: inline-flex;
  align-items: center;
}

.days-badge.urgency-today {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.5);
  animation: pulse-danger 2s infinite ease-in-out;
}

.days-badge.urgency-soon {
  background: rgba(249, 115, 22, 0.18);
  color: #fb923c;
  border: 1px solid rgba(249, 115, 22, 0.4);
}

.days-badge.urgency-week {
  background: rgba(234, 179, 8, 0.16);
  color: #facc15;
  border: 1px solid rgba(234, 179, 8, 0.35);
}

.days-badge.urgency-month {
  background: rgba(59, 130, 246, 0.12);
  color: #93c5fd;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.weekly-wa-date.urgency-today {
  border-color: rgba(239, 68, 68, 0.5);
  color: #ef4444;
  background: rgba(239, 68, 68, 0.1);
}

.weekly-wa-date.urgency-soon {
  border-color: rgba(249, 115, 22, 0.4);
  color: #f97316;
  background: rgba(249, 115, 22, 0.08);
}

.notice-pill {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.notice-pill.is-notified {
  background: rgba(16, 185, 129, 0.18);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.notice-pill.is-pending {
  background: rgba(148, 163, 184, 0.12);
  color: #94a3b8;
  border: 1px solid rgba(148, 163, 184, 0.2);
}

.badge-gift {
  background: rgba(168, 85, 247, 0.2);
  color: #c084fc;
  font-size: 0.7rem;
  padding: 1px 6px;
  border-radius: 6px;
  font-weight: 700;
}

@keyframes pulse-danger {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4);
  }
  50% {
    box-shadow: 0 0 0 4px rgba(239, 68, 68, 0);
  }
}


/* Month Insight Profit Highlight */
.month-insight-item-new--profit {
  border-color: rgba(16, 185, 129, 0.35) !important;
  background: rgba(16, 185, 129, 0.08) !important;
}

.month-insight-item-new--profit strong {
  color: #34d399 !important;
}


/* ==========================================================================
   FULL-WIDTH HORIZONTAL DASHBOARD SECTIONS
   ========================================================================== */

.dashboard-full-section {
  background: var(--surface-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
}

.dashboard-full-section:hover {
  border-color: rgba(59, 130, 246, 0.4);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
}

.dfs-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-color);
}

.dfs-title-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.dfs-icon-badge {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

.dfs-icon-badge--primary {
  background: rgba(59, 130, 246, 0.15);
  color: #3b82f6;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.dfs-icon-badge--warning {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.dfs-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-main);
  margin: 0;
  letter-spacing: -0.01em;
}

.dfs-subtitle {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin: 2px 0 0;
}

.dfs-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.dfs-actions-btns {
  display: flex;
  gap: 8px;
}

.dfs-summary-row {
  margin-bottom: 14px;
}

.full-section-table-container {
  overflow-x: auto;
  overflow-y: auto !important;
  max-height: 380px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--surface-bg);
  scrollbar-width: thin;
  scrollbar-color: var(--primary) var(--surface-2);
  -webkit-overflow-scrolling: touch;
}

.full-section-table-container::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.full-section-table-container::-webkit-scrollbar-track {
  background: var(--surface-2);
  border-radius: 4px;
}

.full-section-table-container::-webkit-scrollbar-thumb {
  background: rgba(59, 130, 246, 0.6);
  border-radius: 4px;
}

.full-section-table-container::-webkit-scrollbar-thumb:hover {
  background: var(--primary);
}

.clients-table-full {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  text-align: left;
}

.clients-table-full th {
  position: sticky;
  top: 0;
  background: var(--surface-2);
  color: var(--text-muted);
  font-weight: 700;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-color);
  z-index: 2;
}

.clients-table-full td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-main);
  vertical-align: middle;
}

.clients-table-full tbody tr {
  transition: background 0.15s ease;
}

.clients-table-full tbody tr:hover {
  background: var(--surface-2);
}

.dfs-service-badge {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-main);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.date-badge-created {
  font-size: 0.78rem;
  color: var(--primary);
  background: rgba(59, 130, 246, 0.1);
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid rgba(59, 130, 246, 0.25);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.date-badge-exp {
  font-size: 0.78rem;
  color: #f59e0b;
  background: rgba(245, 158, 11, 0.1);
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid rgba(245, 158, 11, 0.25);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.row-index {
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 700;
}

.tr-urgent-pulse {
  background: rgba(239, 68, 68, 0.04);
}

.dashboard-link-btn--primary {
  background: rgba(16, 185, 129, 0.15) !important;
  color: #10b981 !important;
  border-color: rgba(16, 185, 129, 0.4) !important;
}

.dashboard-link-btn--primary:hover {
  background: rgba(16, 185, 129, 0.25) !important;
}


/* Clean Pill Highlights */
.count-pill-highlight {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 800;
  background: rgba(59, 130, 246, 0.15);
  color: #3b82f6;
  border: 1px solid rgba(59, 130, 246, 0.35);
}

.count-pill-highlight--warn {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
  border-color: rgba(245, 158, 11, 0.35);
}
