/* =============================================
   STREAM CONTROL VIP — Design System "Control Deck"
   ============================================= */

:root {
  --bg-page: #f8f9fb;
  --bg-surface: #ffffff;
  --bg-elevated: #f3f4f6;
  --bg-inset: #e5e7eb;
  --text-primary: #111827;
  --text-secondary: #4b5563;
  --text-muted: #9ca3af;
  --border-default: #e5e7eb;
  --border-subtle: #f3f4f6;
  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent-soft: #eef2ff;
  --accent-muted: #c7d2fe;
  --success: #059669;
  --success-soft: #ecfdf5;
  --warning: #d97706;
  --warning-soft: #fffbeb;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --info: #0284c7;
  --info-soft: #f0f9ff;
  --whatsapp: #25d366;
  --whatsapp-hover: #1da851;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.08);
  --shadow-xl: 0 8px 32px rgba(0, 0, 0, 0.1);
}

html.dark {
  --bg-page: #0f1117;
  --bg-surface: #1a1d27;
  --bg-elevated: #23262f;
  --bg-inset: #2d313b;
  --text-primary: #f3f4f6;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;
  --border-default: #2d313b;
  --border-subtle: #23262f;
  --accent: #818cf8;
  --accent-hover: #a5b4fc;
  --accent-soft: rgba(99, 102, 241, 0.1);
  --accent-muted: rgba(99, 102, 241, 0.2);
  --success: #34d399;
  --success-soft: rgba(16, 185, 129, 0.1);
  --warning: #fbbf24;
  --warning-soft: rgba(245, 158, 11, 0.1);
  --danger: #f87171;
  --danger-soft: rgba(239, 68, 68, 0.1);
  --info: #38bdf8;
  --info-soft: rgba(14, 165, 233, 0.1);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.35);
  --shadow-xl: 0 8px 32px rgba(0, 0, 0, 0.4);
}

*, *::before, *::after {
  box-sizing: border-box;
}

html {
  scrollbar-width: thin;
  scrollbar-color: var(--border-default) transparent;
}

body.sc-body {
  margin: 0;
  font-family: "Outfit", system-ui, sans-serif;
  background: var(--bg-page);
  background-image:
    radial-gradient(ellipse 120% 80% at 20% 0%, rgba(79, 70, 229, 0.06) 0%, transparent 52%),
    radial-gradient(ellipse 100% 60% at 80% 100%, rgba(79, 70, 229, 0.035) 0%, transparent 48%);
  background-attachment: fixed;
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

html.dark body.sc-body {
  background-image:
    radial-gradient(ellipse 120% 80% at 20% 0%, rgba(129, 140, 248, 0.07) 0%, transparent 52%),
    radial-gradient(ellipse 100% 60% at 80% 100%, rgba(129, 140, 248, 0.04) 0%, transparent 48%);
}

/* --- Sidebar --- */
.sc-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 240px;
  background: var(--bg-surface);
  border-right: 1px solid var(--border-default);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform 0.25s ease;
  box-shadow: var(--shadow-sm);
}

.sc-sidebar-brand {
  padding: 20px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border-subtle);
}

.sc-brand-icon {
  font-size: 28px;
  line-height: 1;
}

.sc-brand-name {
  font-weight: 700;
  font-size: 16px;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.sc-brand-sub {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.sc-brand-logo {
  object-fit: contain;
  flex-shrink: 0;
}

.sc-brand-logo--sidebar {
  height: 40px;
  width: auto;
  max-width: 132px;
}

.sc-brand-logo--login {
  display: block;
  max-width: 220px;
  width: auto;
  height: auto;
  max-height: 72px;
  margin: 0 auto 4px;
}

.sc-brand-icon--login {
  font-size: 2.5rem;
  line-height: 1;
  margin-bottom: 4px;
}

.sc-landing-topbar {
  align-items: center;
}

.sc-nav {
  list-style: none;
  margin: 0;
  padding: 8px;
  overflow-y: auto;
}

.sc-nav li {
  margin: 0;
}

.sc-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  margin: 1px 8px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.sc-nav-item:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
  transform: translateX(2px);
}

.sc-nav-item.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
  position: relative;
}

.sc-nav-item.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
  box-shadow: 0 0 10px rgba(79, 70, 229, 0.35);
}

html.dark .sc-nav-item.active::before {
  box-shadow: 0 0 14px rgba(129, 140, 248, 0.35);
}

.sc-nav-item i {
  width: 18px;
  text-align: center;
  font-size: 14px;
}

.sc-nav-section-label {
  margin-top: 12px;
  padding: 14px 20px 6px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  border-top: 1px solid var(--border-subtle);
}

.sc-topbar .sc-badge-count {
  margin-left: 0;
}

.sc-badge-count {
  margin-left: auto;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  padding: 1px 7px;
  border-radius: 10px;
  font-family: "IBM Plex Mono", monospace;
  box-shadow: 0 0 8px rgba(220, 38, 38, 0.35);
  animation: notifPulse 3s ease-in-out infinite;
}

@keyframes notifPulse {
  0%, 100% { box-shadow: 0 0 6px rgba(220, 38, 38, 0.3); }
  50% { box-shadow: 0 0 14px rgba(220, 38, 38, 0.55); }
}

.sc-sidebar-footer {
  margin-top: auto;
  padding: 12px 16px;
  border-top: 1px solid var(--border-default);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.sc-theme-toggle {
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: 8px;
  padding: 6px 8px;
  cursor: pointer;
  color: var(--text-muted);
  transition: color 0.15s ease, background 0.15s ease;
}

.sc-theme-toggle:hover {
  color: var(--text-primary);
  background: var(--bg-inset);
}

html.dark .sc-theme-toggle .light-icon {
  display: inline;
}

html.dark .sc-theme-toggle .dark-icon {
  display: none;
}

html:not(.dark) .sc-theme-toggle .light-icon {
  display: none;
}

html:not(.dark) .sc-theme-toggle .dark-icon {
  display: inline;
}

.sc-user-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
  padding: 4px 8px;
  border-radius: 8px;
  text-decoration: none;
  color: var(--text-primary);
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  font-size: 13px;
  font-weight: 600;
}

.sc-user-pill:hover {
  background: var(--bg-inset);
  color: var(--text-primary);
}

.sc-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}

.sc-username {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sc-logout-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid var(--border-default);
  color: var(--danger);
  background: var(--bg-surface);
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
}

.sc-logout-btn:hover {
  background: var(--danger-soft);
  color: var(--danger);
}

.sc-sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(2px);
  z-index: 99;
}

.sc-sidebar-overlay.active {
  display: block;
}

.sc-mobile-menu-btn {
  display: none;
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 101;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  border: 1px solid var(--border-default);
  background: var(--bg-surface);
  color: var(--text-primary);
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-md);
}

.sc-main {
  margin-left: 240px;
  min-height: 100vh;
  padding: 0;
  background: transparent;
  animation: fadeIn 0.35s ease-out;
}

.sc-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 16px 32px 18px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-surface);
}

.sc-topbar-text {
  min-width: 0;
}

.sc-topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.sc-topbar-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
  background: var(--bg-elevated);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
  font-family: "IBM Plex Mono", monospace;
}

.sc-content {
  padding: 24px 32px 48px;
}

.sc-page-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  margin: 0;
}

.sc-page-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin: 4px 0 0;
}

.sc-footer {
  margin-top: 32px;
  padding: 16px 0 8px;
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  border-top: 1px solid var(--border-default);
}

.sc-footer a {
  color: var(--accent);
}

@media (max-width: 768px) {
  .sc-sidebar {
    transform: translateX(-100%);
  }

  .sc-sidebar.open {
    transform: translateX(0);
  }

  .sc-main {
    margin-left: 0;
  }

  .sc-content {
    padding: 56px 16px 32px;
  }

  .sc-mobile-menu-btn {
    display: flex;
  }

  .sc-topbar {
    padding: 16px 16px 12px 56px;
  }
}

@media (min-width: 769px) {
  .sc-sidebar-overlay {
    display: none !important;
  }
}

/* --- Cards & Bootstrap bridge --- */
.sc-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: 14px;
  padding: 20px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.25s cubic-bezier(0.4, 0, 0.2, 1), border-color 0.25s ease, transform 0.25s ease;
  position: relative;
}

.sc-card:hover {
  box-shadow: var(--shadow-md);
  border-color: rgba(99, 102, 241, 0.14);
}

html.dark .sc-card {
  background: rgba(26, 29, 39, 0.72);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

html.dark .sc-card:hover {
  background: rgba(26, 29, 39, 0.88);
  border-color: rgba(129, 140, 248, 0.14);
  box-shadow: var(--shadow-md), 0 0 28px rgba(129, 140, 248, 0.05);
}

.sc-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-subtle);
}

.sc-card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.sc-card-title i {
  font-size: 14px;
  color: var(--accent);
}

.sc-card-badge {
  font-size: 11px;
  font-weight: 600;
  font-family: "IBM Plex Mono", monospace;
  color: var(--text-muted);
  background: var(--bg-elevated);
  padding: 2px 8px;
  border-radius: 6px;
}

.sc-content .card,
.sc-content .widget-card {
  background: var(--bg-surface) !important;
  border: 1px solid var(--border-default) !important;
  border-radius: 12px !important;
  color: var(--text-primary) !important;
  box-shadow: var(--shadow-sm);
}

.sc-content .card-header,
.sc-content .widget-header {
  background: var(--bg-elevated) !important;
  color: var(--text-primary) !important;
  border-bottom: 1px solid var(--border-default) !important;
}

.sc-content .widget-footer,
.sc-content .card-footer {
  background: var(--bg-elevated) !important;
  border-top: 1px solid var(--border-default) !important;
  color: var(--text-secondary) !important;
}

.sc-content .text-muted {
  color: var(--text-muted) !important;
}

.sc-content .bg-light {
  background: var(--bg-elevated) !important;
  color: var(--text-primary) !important;
}

.sc-content .btn-light {
  background: var(--bg-elevated);
  border-color: var(--border-default);
  color: var(--text-primary);
}

.sc-content .btn-light:hover {
  background: var(--bg-inset);
  border-color: var(--border-default);
  color: var(--text-primary);
}

/* Fondos claros de Bootstrap → superficie tema (evita cajas blancas con texto oscuro ilegible en dark) */
.sc-content .bg-white {
  background-color: var(--bg-surface) !important;
  color: var(--text-primary) !important;
}

/* .text-dark fuerza #212529; en dark suele quedar ilegible sobre fondos de tema */
html.dark .sc-content .text-dark {
  color: var(--text-primary) !important;
}

/* Sobre amarillo/ámbar el texto debe seguir oscuro */
html.dark .sc-content .bg-warning.text-dark,
html.dark .sc-content .badge.bg-warning.text-dark {
  color: #111827 !important;
}

.sc-content .table {
  --bs-table-color: var(--text-primary);
  --bs-table-bg: transparent;
  --bs-table-border-color: var(--border-default);
  --bs-table-striped-color: var(--text-primary);
  --bs-table-striped-bg: var(--bg-elevated);
  --bs-table-active-color: var(--text-primary);
  --bs-table-active-bg: var(--bg-inset);
  --bs-table-hover-color: var(--text-primary);
  --bs-table-hover-bg: var(--bg-elevated);
  color: var(--text-primary);
  border-color: var(--border-default);
}

.sc-content .table > :not(caption) > * > * {
  color: var(--text-primary);
  border-bottom-color: var(--border-default);
}

.sc-content .table thead th {
  background-color: var(--bg-elevated);
  color: var(--text-secondary);
  font-weight: 600;
  border-bottom-color: var(--border-default);
}

.sc-content .table-bordered {
  border-color: var(--border-default);
}

.sc-content .table-bordered > :not(caption) > * {
  border-width: 1px 0;
  border-color: var(--border-default);
}

.sc-content .table-bordered > :not(caption) > * > * {
  border-width: 0 1px;
  border-color: var(--border-default);
}

/* Cabeceras Bootstrap “claras” (p. ej. finance.php): sin gris claro + texto negro en dark */
.sc-content thead.table-light,
.sc-content thead.table-light th,
.sc-content thead.table-light td {
  --bs-table-bg: var(--bg-elevated);
  --bs-table-color: var(--text-primary);
  background-color: var(--bg-elevated) !important;
  color: var(--text-primary) !important;
  border-color: var(--border-default) !important;
}

.sc-content thead.table-dark th,
.sc-content thead.table-dark td {
  border-color: rgba(255, 255, 255, 0.12);
}

.sc-content .table tbody tr td,
.sc-content .table tbody tr th {
  background-color: transparent;
  vertical-align: middle;
}

.sc-content .table pre,
.sc-content .table code {
  color: var(--text-primary);
  background: var(--bg-inset);
  border-radius: 6px;
  padding: 0.25rem 0.4rem;
}

.sc-content .table pre {
  padding: 0.5rem;
}

/* Listas tipo tabla (cliente, notificaciones, modales calendario) */
.sc-content .list-group-item {
  background-color: var(--bg-surface);
  color: var(--text-primary);
  border-color: var(--border-default);
}

.sc-content .list-group-item-action:hover,
.sc-content .list-group-item-action:focus {
  background-color: var(--bg-elevated);
  color: var(--text-primary);
}

.sc-content .list-group-flush > .list-group-item {
  border-width: 0 0 1px;
}

/* Pestañas con datos tabulados (finanzas, etc.) */
.sc-content .nav-tabs {
  border-bottom-color: var(--border-default);
}

.sc-content .nav-tabs .nav-link {
  color: var(--text-muted);
  background: transparent;
  border-color: transparent;
}

.sc-content .nav-tabs .nav-link:hover {
  color: var(--text-primary);
  border-color: var(--border-default) var(--border-default) transparent;
}

.sc-content .nav-tabs .nav-link.active {
  color: var(--text-primary);
  background-color: var(--bg-surface);
  border-color: var(--border-default) var(--border-default) var(--bg-surface);
}

/* Búsqueda / filtros junto a tablas (manage_users, etc.) */
.sc-content .input-group-text {
  background: var(--bg-elevated);
  border-color: var(--border-default);
  color: var(--text-secondary);
}

.sc-content .dropdown-menu {
  background: var(--bg-surface);
  border-color: var(--border-default);
  box-shadow: var(--shadow-lg);
}

.sc-content .dropdown-item {
  color: var(--text-primary);
}

.sc-content .dropdown-item:hover,
.sc-content .dropdown-item:focus {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

/* --- Admin / superadmin: tarjetas y tablas sin CSS previo --- */
.sc-content .content-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  color: var(--text-primary);
}

.sc-content .content-card-header {
  padding: 0.75rem 1rem;
  font-weight: 600;
  background: var(--bg-elevated);
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-default);
}

.sc-content .content-card-body {
  color: var(--text-primary);
}

.sc-content .table-container,
.sc-content .table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 0 0 12px 12px;
}

.sc-content .table-scroll .table {
  margin-bottom: 0;
}

.sc-content .role-badge {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
  margin-left: 6px;
  vertical-align: middle;
}

.sc-content .role-badge-admin {
  background: var(--danger-soft);
  color: var(--danger);
}

.sc-content .role-badge-reseller {
  background: var(--info-soft);
  color: var(--info);
}

.sc-content .role-badge-seller {
  background: var(--accent-soft);
  color: var(--accent);
}

.sc-content .status-badge {
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 8px;
}

.sc-content .status-active {
  background: var(--success-soft);
  color: var(--success);
}

.sc-content .status-inactive {
  background: var(--bg-inset);
  color: var(--text-muted);
}

.sc-content .message-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: 10px;
  padding: 1rem;
  margin-bottom: 0.75rem;
  color: var(--text-primary);
}

.sc-content .message-card.unread {
  border-left: 4px solid var(--accent);
}

.sc-content .message-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.sc-content .message-sender {
  font-weight: 600;
  color: var(--text-primary);
}

.sc-content .message-content {
  color: var(--text-primary);
  font-size: 0.9375rem;
  line-height: 1.5;
}

.sc-content .search-container {
  margin-bottom: 1rem;
}

/* --- Clientes: filas resaltadas y etiquetas --- */
.sc-content tr.date-danger td {
  background: var(--danger-soft);
  color: var(--text-primary);
}

.sc-content tr.date-danger td:first-child {
  box-shadow: inset 3px 0 0 0 var(--danger);
}

.sc-content tr.date-warning td {
  background: var(--warning-soft);
  color: var(--text-primary);
}

.sc-content tr.date-warning td:first-child {
  box-shadow: inset 3px 0 0 0 var(--warning);
}

.sc-content .client-tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  margin: 2px 4px 2px 0;
  border-radius: 6px;
  background: var(--bg-inset);
  color: var(--text-secondary);
}

html.dark .sc-content .client-tag {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

/* --- Calendario (tabla mensual) --- */
.sc-content .calendar-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.sc-content .calendar-card .table thead th.week-days {
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-color: var(--border-default);
}

.sc-content .calendar-cell {
  background: var(--bg-surface);
  color: var(--text-primary);
  border-color: var(--border-default) !important;
  vertical-align: top;
  min-height: 88px;
}

.sc-content .calendar-cell.other-month {
  background: var(--bg-elevated);
  color: var(--text-muted);
}

.sc-content .calendar-cell.today {
  background: var(--accent-soft);
  outline: 1px solid var(--accent-muted);
}

.sc-content .calendar-cell .cell-date {
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.sc-content .calendar-cell.other-month .cell-date {
  color: var(--text-muted);
}

.sc-content .calendar-event {
  font-size: 11px;
  line-height: 1.35;
  padding: 4px 6px;
  margin-top: 4px;
  border-radius: 6px;
  cursor: pointer;
  color: var(--text-primary);
}

.sc-content .calendar-event.event-expiration {
  background: var(--danger-soft);
  border: 1px solid rgba(220, 38, 38, 0.25);
}

.sc-content .calendar-event.event-payment {
  background: var(--success-soft);
  border: 1px solid rgba(5, 150, 105, 0.25);
}

.sc-content .day-badge .badge {
  font-size: 10px;
}

.sc-grid-kpi {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.sc-grid-kpi--dense {
  grid-template-columns: repeat(auto-fit, minmax(148px, 1fr));
}

.sc-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.sc-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

@media (max-width: 768px) {
  .sc-grid-2,
  .sc-grid-3,
  .sc-grid-kpi {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 769px) and (max-width: 1024px) {
  .sc-grid-3 {
    grid-template-columns: repeat(2, 1fr);
  }
}

.sc-kpi {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sc-kpi-value {
  font-size: 28px;
  font-weight: 700;
  font-family: "IBM Plex Mono", monospace;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.sc-kpi-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.sc-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  text-decoration: none;
  font-family: "Outfit", sans-serif;
}

.sc-btn-primary {
  background: var(--accent);
  color: #fff !important;
  border: none;
  box-shadow: 0 2px 10px rgba(79, 70, 229, 0.28);
  transition: background 0.2s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.2s ease, transform 0.2s ease, color 0.2s ease;
}

.sc-btn-primary:hover {
  background: var(--accent-hover);
  color: #fff !important;
  box-shadow: 0 4px 18px rgba(79, 70, 229, 0.38);
  transform: translateY(-1px);
}

.sc-btn-primary:active {
  transform: translateY(0);
  box-shadow: 0 1px 6px rgba(79, 70, 229, 0.22);
}

.sc-btn-secondary {
  background: var(--bg-surface);
  color: var(--text-secondary);
  border: 1.5px solid var(--border-default);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.sc-btn-secondary:hover {
  background: var(--bg-elevated);
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: var(--shadow-sm), 0 0 0 3px rgba(79, 70, 229, 0.07);
}

.sc-btn-whatsapp {
  background: #25d366;
  color: #fff !important;
  box-shadow: 0 2px 10px rgba(37, 211, 102, 0.28);
  transition: background 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease, color 0.2s ease;
}

.sc-btn-whatsapp:hover {
  background: #1da851;
  color: #fff !important;
  box-shadow: 0 4px 18px rgba(37, 211, 102, 0.38);
  transform: translateY(-1px);
}

.sc-btn-sm {
  padding: 5px 10px;
  font-size: 12px;
  border-radius: 6px;
}

.sc-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 14px;
  border: 1px solid var(--border-default);
  background: var(--bg-surface);
  box-shadow: var(--shadow-sm);
}

.sc-table-wrap .table tbody tr {
  transition: background 0.15s ease;
}

.sc-table-wrap .table tbody tr:nth-child(even) {
  background: rgba(0, 0, 0, 0.02);
}

html.dark .sc-table-wrap .table tbody tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.02);
}

.sc-table-wrap .table tbody tr:hover {
  background: var(--accent-soft) !important;
}

html.dark .sc-table-wrap .table tbody tr:hover {
  background: rgba(129, 140, 248, 0.06) !important;
}

.sc-table-wrap .cell-name {
  font-weight: 600;
}

.sc-table-wrap .cell-mono {
  font-family: "IBM Plex Mono", monospace;
  font-size: 12.5px;
  color: var(--text-secondary);
}

.sc-table {
  width: 100%;
  border-collapse: collapse;
}

.sc-table th {
  text-align: left;
  padding: 10px 16px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-default);
}

.sc-table td {
  padding: 12px 16px;
  font-size: 13.5px;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-subtle);
}

.sc-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  font-family: "IBM Plex Mono", monospace;
  letter-spacing: 0.02em;
  border: 1px solid transparent;
}

.sc-badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.sc-badge-success {
  background: var(--success-soft);
  color: var(--success);
  border-color: rgba(5, 150, 105, 0.18);
}

.sc-badge-success .sc-badge-dot {
  background: var(--success);
  animation: badgePulse 2s ease-in-out infinite;
}

.sc-badge-warning {
  background: var(--warning-soft);
  color: var(--warning);
  border-color: rgba(217, 119, 6, 0.2);
}

.sc-badge-warning .sc-badge-dot {
  background: var(--warning);
  animation: badgePulse 2s ease-in-out infinite;
}

.sc-badge-danger {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: rgba(220, 38, 38, 0.18);
}

.sc-badge-danger .sc-badge-dot {
  background: var(--danger);
}

.sc-badge-info {
  background: var(--info-soft);
  color: var(--info);
  border-color: rgba(2, 132, 199, 0.18);
}

@keyframes badgePulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.55; transform: scale(0.78); }
}

.sc-money {
  font-family: "IBM Plex Mono", monospace;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.sc-money-positive {
  color: var(--success);
}

.sc-money-negative {
  color: var(--danger);
}

.sc-wa-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 6px;
  background: rgba(37, 211, 102, 0.1);
  color: #25d366;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid rgba(37, 211, 102, 0.2);
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
}

.sc-wa-btn:hover {
  background: #25d366;
  color: #fff;
}

.sc-pill-expiring {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  font-family: "IBM Plex Mono", monospace;
}

.sc-pill-expiring.danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.sc-pill-expiring.warning {
  background: var(--warning-soft);
  color: var(--warning);
}

.sc-pill-expiring.ok {
  background: var(--success-soft);
  color: var(--success);
}

.modal-content {
  background: var(--bg-surface) !important;
  border: 1px solid var(--border-default) !important;
  border-radius: 18px !important;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.2), 0 0 0 1px rgba(255, 255, 255, 0.04) !important;
  color: var(--text-primary) !important;
  overflow: hidden;
  animation: modalIn 0.32s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
}

@keyframes modalIn {
  0% { opacity: 0; transform: scale(0.96) translateY(10px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  border-bottom: 1px solid var(--border-subtle) !important;
  padding: 18px 22px !important;
  background: var(--bg-elevated) !important;
}

.modal-title {
  font-weight: 700 !important;
  font-size: 16px !important;
  font-family: "Outfit", sans-serif !important;
}

.modal-body {
  padding: 22px 24px !important;
}

.modal-footer {
  border-top: 1px solid var(--border-default) !important;
}

.modal-backdrop.show {
  opacity: 0.5 !important;
  backdrop-filter: blur(6px) !important;
  -webkit-backdrop-filter: blur(6px) !important;
}

.sc-content .form-control,
.sc-content .form-select {
  background: var(--bg-page);
  border: 1.5px solid var(--border-default);
  color: var(--text-primary);
  border-radius: 10px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

html.dark .sc-content .form-control,
html.dark .sc-content .form-select {
  background: rgba(15, 17, 23, 0.55);
  border-color: rgba(255, 255, 255, 0.08);
}

.sc-content .form-control:focus,
.sc-content .form-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.14), 0 0 18px rgba(79, 70, 229, 0.06);
}

html.dark .sc-content .form-control:focus,
html.dark .sc-content .form-select:focus {
  box-shadow: 0 0 0 3px rgba(129, 140, 248, 0.12), 0 0 22px rgba(129, 140, 248, 0.06);
}

/* Flatpickr */
.flatpickr-calendar {
  background: var(--bg-surface) !important;
  border: 1px solid var(--border-default) !important;
  box-shadow: var(--shadow-lg) !important;
  color: var(--text-primary) !important;
}

.flatpickr-day.selected,
.flatpickr-day.startRange,
.flatpickr-day.endRange {
  background: var(--accent) !important;
  border-color: var(--accent) !important;
}

/* Select2 */
.select2-container--default .select2-selection--single {
  background-color: var(--bg-elevated) !important;
  border-color: var(--border-default) !important;
  color: var(--text-primary) !important;
  min-height: 38px !important;
}

.select2-dropdown {
  background-color: var(--bg-surface) !important;
  border-color: var(--border-default) !important;
  color: var(--text-primary) !important;
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(16px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.fade-in {
  animation: fadeIn 0.25s ease-out;
}

.animate-fade-in-up {
  animation: fadeInUp 0.3s ease-out both;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-thumb {
  background: var(--border-default);
  border-radius: 3px;
}

/* --- Auth: login / landing helpers --- */
.sc-auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--bg-page);
}

.sc-auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: 16px;
  padding: 32px;
  box-shadow: var(--shadow-xl);
}

.sc-input {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-page);
  border: 1.5px solid var(--border-default);
  border-radius: 10px;
  font-size: 14px;
  color: var(--text-primary);
  font-family: "Outfit", sans-serif;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

html.dark .sc-input {
  background: rgba(15, 17, 23, 0.55);
  border-color: rgba(255, 255, 255, 0.08);
}

.sc-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.14), 0 0 16px rgba(79, 70, 229, 0.06);
}

html.dark .sc-input:focus {
  box-shadow: 0 0 0 3px rgba(129, 140, 248, 0.12), 0 0 20px rgba(129, 140, 248, 0.05);
}

.sc-input::placeholder {
  color: var(--text-muted);
}

.sc-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.sc-login-brand {
  text-align: center;
  margin-bottom: 24px;
}

.sc-login-brand h1 {
  font-size: 1.35rem;
  font-weight: 800;
  margin: 8px 0 0;
  letter-spacing: -0.02em;
}

.sc-login-error {
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 13px;
  margin-bottom: 16px;
  border: 1px solid var(--danger);
}

/* Landing */
.sc-landing-hero {
  max-width: 720px;
  margin: 0 auto;
  text-align: center;
  padding: 56px 24px 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.sc-landing-hero-logo {
  display: flex;
  justify-content: center;
  width: 100%;
  margin-bottom: 28px;
}

.sc-brand-logo--hero {
  width: auto;
  height: auto;
  max-width: min(92vw, 340px);
  max-height: clamp(100px, 22vw, 160px);
  object-fit: contain;
}

.sc-landing-hero-lead {
  max-width: 520px;
  margin: 0;
  font-size: 15px;
  line-height: 1.55;
  color: var(--text-muted) !important;
}

.sc-landing-hero h1 {
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 16px;
}

.sc-landing-cta {
  display: inline-flex;
  margin-top: 24px;
  padding: 14px 28px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 15px;
  background: var(--accent);
  color: #fff !important;
  text-decoration: none;
  box-shadow: var(--shadow-md);
}

.sc-landing-cta:hover {
  background: var(--accent-hover);
  color: #fff !important;
}

.sc-landing-features {
  max-width: 960px;
  margin: 0 auto;
  padding: 24px 24px 80px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
}

.sc-landing-foot {
  padding: 24px;
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  border-top: 1px solid var(--border-default);
}

.chart-container {
  position: relative;
  height: 280px;
}

.stat-card,
.widget-card {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.clients-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
}

.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: 12px;
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
}

.stat-icon {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  font-family: "IBM Plex Mono", monospace;
  color: var(--text-primary);
}

.stat-title {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

/* --- Servicios (logos uniformes + tarjetas) --- */
.services-header {
  margin-bottom: 1.5rem;
}

.services-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
}

.services-header p {
  color: var(--text-secondary);
  font-size: 0.9375rem;
}

.filter-container {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: 12px;
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.service-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.service-card:hover {
  box-shadow: var(--shadow-md);
}

/* Área fija para logos: mismo alto en todas las tarjetas */
.service-img-container {
  position: relative;
  flex-shrink: 0;
  height: 152px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border-default);
}

.service-img-container .text-center.text-muted {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  margin: 0;
}

.service-img-container .text-center.text-muted i {
  font-size: 2.75rem !important;
  opacity: 0.45;
}

.service-img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 120px;
  object-fit: contain;
  object-position: center;
}

.service-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  box-shadow: var(--shadow-sm);
  line-height: 1.2;
}

.service-badge-default {
  background: var(--info-soft);
  color: var(--info);
}

.service-badge-active {
  background: var(--success-soft);
  color: var(--success);
}

.service-badge-inactive {
  background: var(--bg-inset);
  color: var(--text-muted);
}

html.dark .service-badge-inactive {
  background: var(--bg-elevated);
}

.service-info {
  padding: 1rem 1.125rem 0.75rem;
  flex: 1;
  min-height: 0;
}

.service-title {
  font-size: 1.0625rem;
  font-weight: 700;
  margin: 0 0 0.35rem;
  color: var(--text-primary);
  line-height: 1.3;
  word-break: break-word;
}

.service-url {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin: 0;
  word-break: break-all;
}

.service-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.875rem 1.125rem 1rem;
  border-top: 1px solid var(--border-subtle);
  margin-top: auto;
}

.service-actions .btn-action {
  padding: 0.35rem 0.55rem;
  line-height: 1;
}

/* Toggle servicios (checkbox + slider) */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 46px;
  height: 26px;
  cursor: pointer;
  flex-shrink: 0;
}

.toggle-switch .toggle-checkbox {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  margin: 0;
}

.toggle-switch .toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--border-default);
  border-radius: 999px;
  transition: background 0.2s ease;
}

.toggle-switch .toggle-slider::before {
  content: "";
  position: absolute;
  width: 20px;
  height: 20px;
  left: 3px;
  top: 50%;
  transform: translateY(-50%);
  background: #fff;
  border-radius: 50%;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease;
}

.toggle-switch .toggle-checkbox:checked + .toggle-slider {
  background: var(--success);
}

.toggle-switch .toggle-checkbox:checked + .toggle-slider::before {
  transform: translate(20px, -50%);
}

.toggle-switch .toggle-checkbox:focus-visible + .toggle-slider {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.toggle-switch .toggle-checkbox:disabled + .toggle-slider {
  opacity: 0.55;
  cursor: wait;
}

.modal-header-primary {
  background: var(--accent-soft) !important;
  color: var(--text-primary) !important;
  border-bottom-color: var(--border-default) !important;
}

.modal-header-success {
  background: var(--success-soft) !important;
  color: var(--text-primary) !important;
  border-bottom-color: var(--border-default) !important;
}

.modal-header-danger {
  background: var(--danger-soft) !important;
  color: var(--text-primary) !important;
  border-bottom-color: var(--border-default) !important;
}

.thumbnail-preview-container {
  padding: 12px;
  background: var(--bg-elevated);
  border: 1px dashed var(--border-default);
  border-radius: 10px;
}

.thumbnail-preview-image {
  display: block;
  max-width: 160px;
  max-height: 160px;
  width: auto;
  height: auto;
  object-fit: contain;
  margin: 0 auto;
}

.custom-table {
  width: 100%;
}

.sc-content .dashboard-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
}

/* ========== Polish pass — KPI hero cards ========== */
.sc-kpi-card {
  position: relative;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: 16px;
  padding: 24px 20px 22px;
  overflow: hidden;
  transition: border-color 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-sm);
  text-align: left;
}

.sc-kpi-card::before {
  content: "";
  position: absolute;
  top: -44px;
  right: -44px;
  width: 128px;
  height: 128px;
  border-radius: 50%;
  opacity: 0.09;
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: none;
}

.sc-kpi-card:hover::before {
  opacity: 0.16;
  transform: scale(1.15);
}

.sc-kpi-card.kpi-clients::before { background: var(--accent); }
.sc-kpi-card.kpi-active::before { background: var(--success); }
.sc-kpi-card.kpi-expiring::before { background: var(--warning); }
.sc-kpi-card.kpi-revenue::before { background: var(--info); }
.sc-kpi-card.kpi-overdue::before { background: var(--danger); }
.sc-kpi-card.kpi-events::before { background: var(--accent); }
.sc-kpi-card.kpi-inactive::before { background: var(--text-muted); }

.sc-kpi-card:hover {
  border-color: rgba(99, 102, 241, 0.2);
  box-shadow: var(--shadow-md), 0 0 0 1px rgba(99, 102, 241, 0.06);
  transform: translateY(-2px);
}

html.dark .sc-kpi-card:hover {
  border-color: rgba(129, 140, 248, 0.22);
  box-shadow: var(--shadow-md), 0 0 24px rgba(129, 140, 248, 0.06);
}

.sc-kpi-card .sc-kpi-icon {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sc-kpi-card:hover .sc-kpi-icon {
  transform: scale(1.08) rotate(-3deg);
}

.sc-kpi-card .sc-kpi-icon.icon-clients { background: var(--accent-soft); color: var(--accent); }
.sc-kpi-card .sc-kpi-icon.icon-active { background: var(--success-soft); color: var(--success); }
.sc-kpi-card .sc-kpi-icon.icon-expiring { background: var(--warning-soft); color: var(--warning); }
.sc-kpi-card .sc-kpi-icon.icon-revenue { background: var(--info-soft); color: var(--info); }
.sc-kpi-card .sc-kpi-icon.icon-overdue { background: var(--danger-soft); color: var(--danger); }
.sc-kpi-card .sc-kpi-icon.icon-events { background: var(--accent-soft); color: var(--accent); }
.sc-kpi-card .sc-kpi-icon.icon-inactive { background: var(--bg-elevated); color: var(--text-secondary); }

.sc-kpi-card .sc-kpi-value {
  font-size: 36px;
  font-weight: 800;
  font-family: "IBM Plex Mono", monospace;
  color: var(--text-primary);
  letter-spacing: -0.03em;
  line-height: 1;
  margin: 0 0 8px;
  padding-right: 48px;
}

.sc-kpi-card .sc-kpi-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 0;
}

.sc-stagger > * {
  opacity: 0;
  animation: fadeInUp 0.42s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.sc-stagger > *:nth-child(1) { animation-delay: 0.04s; }
.sc-stagger > *:nth-child(2) { animation-delay: 0.1s; }
.sc-stagger > *:nth-child(3) { animation-delay: 0.16s; }
.sc-stagger > *:nth-child(4) { animation-delay: 0.22s; }
.sc-stagger > *:nth-child(5) { animation-delay: 0.28s; }
.sc-stagger > *:nth-child(6) { animation-delay: 0.34s; }

.sc-table-animated tbody tr {
  opacity: 0;
  animation: fadeInUp 0.32s ease-out forwards;
}

.sc-table-animated tbody tr:nth-child(1) { animation-delay: 0.03s; }
.sc-table-animated tbody tr:nth-child(2) { animation-delay: 0.06s; }
.sc-table-animated tbody tr:nth-child(3) { animation-delay: 0.09s; }
.sc-table-animated tbody tr:nth-child(4) { animation-delay: 0.12s; }
.sc-table-animated tbody tr:nth-child(5) { animation-delay: 0.15s; }
.sc-table-animated tbody tr:nth-child(6) { animation-delay: 0.18s; }
.sc-table-animated tbody tr:nth-child(7) { animation-delay: 0.21s; }
.sc-table-animated tbody tr:nth-child(8) { animation-delay: 0.24s; }
.sc-table-animated tbody tr:nth-child(9) { animation-delay: 0.27s; }
.sc-table-animated tbody tr:nth-child(10) { animation-delay: 0.3s; }

/* Acciones compactas en tablas */
.cell-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.sc-action-btn {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
  background: transparent;
  color: var(--text-muted);
  text-decoration: none;
  padding: 0;
}

.sc-action-btn:hover {
  background: var(--accent-soft);
  color: var(--accent);
  transform: scale(1.06);
}

.sc-action-btn.action-wa:hover {
  background: rgba(37, 211, 102, 0.12);
  color: #25d366;
}

.sc-action-btn.action-danger:hover {
  background: var(--danger-soft);
  color: var(--danger);
}

.sc-action-more {
  position: relative;
}

.sc-action-dropdown {
  display: none;
  position: absolute;
  right: 0;
  top: 100%;
  margin-top: 6px;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  padding: 4px;
  min-width: 168px;
  z-index: 80;
}

.sc-action-dropdown.show {
  display: block;
  animation: fadeInUp 0.15s ease-out;
}

.sc-action-dropdown button,
.sc-action-dropdown a.sc-action-dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 12px;
  border: none;
  background: none;
  border-radius: 6px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  text-decoration: none;
  text-align: left;
  transition: background 0.12s ease, color 0.12s ease;
}

.sc-action-dropdown button:hover,
.sc-action-dropdown a.sc-action-dropdown-item:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

.sc-action-dropdown button.danger:hover {
  background: var(--danger-soft);
  color: var(--danger);
}

.sc-action-dropdown form button[type="submit"].danger {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 13px;
  background: none;
  color: var(--danger);
}

.sc-action-dropdown hr {
  border: 0;
  border-top: 1px solid var(--border-subtle);
  margin: 4px 0;
}

/* Calendario — rejilla viva */
.sc-calendar-grid {
  width: 100%;
  border-collapse: separate;
  border-spacing: 4px;
}

.sc-calendar-grid th {
  padding: 10px 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  text-align: center;
  border: none;
}

.sc-content .calendar-cell {
  border-radius: 10px;
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  border: 1px solid transparent;
}

.sc-content .calendar-cell:hover {
  background: var(--accent-soft);
  border-color: rgba(99, 102, 241, 0.14);
}

.sc-content .calendar-cell.today {
  background: transparent;
  box-shadow: none;
}

.sc-content .calendar-cell.today .cell-date,
.sc-content .calendar-cell.today .sc-calendar-day {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
}

.sc-content .calendar-cell.has-events {
  border-color: var(--border-default);
}

.sc-calendar-dots {
  display: flex;
  justify-content: center;
  gap: 4px;
  margin-top: 6px;
  min-height: 6px;
  flex-wrap: wrap;
}

.sc-calendar-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  flex-shrink: 0;
}

.sc-calendar-dot.dot-expiry { background: var(--danger); }
.sc-calendar-dot.dot-payment { background: var(--success); }

.sc-money-lg {
  font-family: "IBM Plex Mono", monospace;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.sc-money-lg.positive { color: var(--success); }
.sc-money-lg.negative { color: var(--danger); }
.sc-money-lg.neutral { color: var(--text-primary); }

.sc-balance-card {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  text-align: center;
}

.sc-balance-card > div {
  padding: 16px 12px;
}

.sc-balance-card > div:not(:last-child) {
  border-right: 1px solid var(--border-subtle);
}

.sc-balance-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}

.sc-toast {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 10000;
  padding: 14px 20px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 400px;
  animation: toastIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

@keyframes toastIn {
  0% { opacity: 0; transform: translateX(36px) scale(0.96); }
  100% { opacity: 1; transform: translateX(0) scale(1); }
}

.sc-toast-success {
  background: rgba(5, 150, 105, 0.14);
  color: var(--success);
  border: 1px solid rgba(5, 150, 105, 0.22);
  box-shadow: 0 4px 24px rgba(5, 150, 105, 0.1);
}

.sc-toast-error {
  background: rgba(220, 38, 38, 0.14);
  color: var(--danger);
  border: 1px solid rgba(220, 38, 38, 0.22);
  box-shadow: 0 4px 24px rgba(220, 38, 38, 0.1);
}

html.reduced-motion * {
  animation: none !important;
  transition-duration: 0.01ms !important;
}

.btn-telegram {
  background: #0088cc;
  border-color: #0088cc;
  color: #fff !important;
}

.btn-telegram:hover {
  background: #0077b5;
  border-color: #0077b5;
  color: #fff !important;
}

.btn-floating {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 90;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-lg);
}

/* =============================================
   STREAM CONTROL VIP — Final Polish Layer
   "Next-Gen SaaS" — Cierre definitivo
   ============================================= */

/* ============================================
   SECCIÓN: Cards de contenido con header
   ============================================ */

.sc-section-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.3s ease;
}
.sc-section-card:hover {
  box-shadow: var(--shadow-md);
}

html.dark .sc-section-card {
  background: rgba(26, 29, 39, 0.65);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-color: rgba(255, 255, 255, 0.05);
}

/* Header de la card-sección con línea de acento */
.sc-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
}
html.dark .sc-section-header {
  background: rgba(255, 255, 255, 0.015);
}

.sc-section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}
.sc-section-title i {
  font-size: 15px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent);
}
.sc-section-title .sc-section-counter {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--bg-inset);
  color: var(--text-muted);
}

.sc-section-action {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s;
}
.sc-section-action:hover {
  color: var(--accent-hover);
  gap: 6px;
}

/* Cuerpo de la card-sección */
.sc-section-body {
  padding: 20px;
}
.sc-section-body.no-pad {
  padding: 0;
}


/* ============================================
   SECCIÓN: Notificaciones rediseñadas
   ============================================ */

.sc-notif-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sc-notif-item {
  display: flex;
  gap: 14px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-subtle);
  transition: background 0.15s;
  position: relative;
}
.sc-notif-item:last-child {
  border-bottom: none;
}
.sc-notif-item:hover {
  background: var(--accent-soft);
}
html.dark .sc-notif-item:hover {
  background: rgba(129, 140, 248, 0.03);
}

/* Ícono de la notificación */
.sc-notif-icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}
.sc-notif-icon.notif-system  { background: var(--warning-soft); color: var(--warning); }
.sc-notif-icon.notif-update  { background: var(--info-soft); color: var(--info); }
.sc-notif-icon.notif-alert   { background: var(--danger-soft); color: var(--danger); }
.sc-notif-icon.notif-success { background: var(--success-soft); color: var(--success); }

/* Contenido */
.sc-notif-content {
  flex: 1;
  min-width: 0;
}
.sc-notif-date {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.sc-notif-text {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}
.sc-notif-text strong {
  color: var(--text-primary);
  font-weight: 600;
}

/* Botón cerrar/dismiss */
.sc-notif-dismiss {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  transition: all 0.15s;
  align-self: flex-start;
  margin-top: 2px;
}
.sc-notif-dismiss:hover {
  background: var(--danger-soft);
  color: var(--danger);
}

/* Footer de la sección de notificaciones */
.sc-section-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
  background: var(--bg-elevated);
}
html.dark .sc-section-footer {
  background: rgba(255, 255, 255, 0.01);
}
.sc-section-footer a {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.sc-section-footer a:hover {
  color: var(--accent-hover);
}

/* Estado vacío elegante */
.sc-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  text-align: center;
}
.sc-empty-state-icon {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: var(--bg-elevated);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: var(--text-muted);
  margin-bottom: 12px;
}
.sc-empty-state-text {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}
.sc-empty-state-sub {
  font-size: 12px;
  color: var(--text-label);
  margin-top: 4px;
}


/* ============================================
   SECCIÓN: Balance Financiero mejorado
   ============================================ */

.sc-finance-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
}

.sc-finance-cell {
  padding: 20px;
  text-align: center;
  position: relative;
}
.sc-finance-cell:not(:last-child)::after {
  content: '';
  position: absolute;
  right: 0;
  top: 20%;
  height: 60%;
  width: 1px;
  background: var(--border-default);
}

.sc-finance-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.sc-finance-value {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.sc-finance-value.income  { color: var(--success); }
.sc-finance-value.expense { color: var(--danger); }
.sc-finance-value.balance { color: var(--text-primary); }

/* Indicador de tendencia debajo del valor */
.sc-finance-trend {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-top: 6px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
}
.sc-finance-trend.up   { color: var(--success); background: var(--success-soft); }
.sc-finance-trend.down { color: var(--danger); background: var(--danger-soft); }

@media (max-width: 640px) {
  .sc-finance-grid { grid-template-columns: 1fr; }
  .sc-finance-cell:not(:last-child)::after { display: none; }
  .sc-finance-cell:not(:last-child) {
    border-bottom: 1px solid var(--border-subtle);
  }
}


/* ============================================
   SECCIÓN: Gráficos (Chart.js wrapper)
   ============================================ */

.sc-chart-container {
  padding: 20px;
  position: relative;
}
.sc-chart-container canvas {
  max-height: 280px;
}


/* ============================================
   SECCIÓN: Tablas definitivas
   ============================================ */

.sc-table-wrap {
  border: 1px solid var(--border-default);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  background: var(--bg-surface);
}
html.dark .sc-table-wrap {
  background: rgba(26, 29, 39, 0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-color: rgba(255, 255, 255, 0.05);
}

.sc-table {
  width: 100%;
  border-collapse: collapse;
}

.sc-table thead tr {
  background: var(--bg-elevated);
}
html.dark .sc-table thead tr {
  background: rgba(255, 255, 255, 0.025);
}

.sc-table th {
  padding: 12px 16px;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  text-align: left;
  border-bottom: 1px solid var(--border-default);
  white-space: nowrap;
  font-family: 'IBM Plex Mono', monospace;
}

.sc-table td {
  padding: 14px 16px;
  font-size: 13.5px;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
}

/* Zebra striping premium */
.sc-table tbody tr:nth-child(even) {
  background: rgba(0, 0, 0, 0.012);
}
html.dark .sc-table tbody tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.012);
}

/* Hover con borde izquierdo de acento */
.sc-table tbody tr {
  transition: all 0.15s ease;
  position: relative;
}
.sc-table tbody tr:hover {
  background: var(--accent-soft) !important;
}
html.dark .sc-table tbody tr:hover {
  background: rgba(129, 140, 248, 0.04) !important;
}
.sc-table tbody tr:hover td:first-child {
  box-shadow: inset 3px 0 0 var(--accent);
}

/* Última fila sin borde */
.sc-table tbody tr:last-child td {
  border-bottom: none;
}

/* Celdas especiales */
.sc-table .cell-name {
  font-weight: 600;
  color: var(--text-primary);
}
.sc-table .cell-email {
  color: var(--text-secondary);
  font-size: 12.5px;
}
.sc-table .cell-mono {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  color: var(--text-secondary);
  letter-spacing: -0.01em;
}
.sc-table .cell-date {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  color: var(--text-muted);
}
.sc-table .cell-date .date-start {
  color: var(--text-secondary);
}
.sc-table .cell-date .date-end {
  color: var(--danger);
}

/* Acciones por fila: 2 visibles + menú contextual */
.sc-table .cell-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  justify-content: flex-end;
}

.sc-action-btn {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  background: transparent;
  color: var(--text-muted);
  text-decoration: none;
}
.sc-action-btn:hover {
  background: var(--accent-soft);
  color: var(--accent);
  transform: scale(1.12);
}
.sc-action-btn.action-view:hover    { background: var(--accent-soft); color: var(--accent); }
.sc-action-btn.action-edit:hover    { background: var(--info-soft); color: var(--info); }
.sc-action-btn.action-wa:hover      { background: rgba(37, 211, 102, 0.10); color: #25D366; }
.sc-action-btn.action-share:hover   { background: var(--warning-soft); color: var(--warning); }
.sc-action-btn.action-danger:hover  { background: var(--danger-soft); color: var(--danger); transform: scale(1.12); }

/* Menú contextual de tres puntos */
.sc-action-more {
  position: relative;
}
.sc-action-dropdown {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  padding: 6px;
  min-width: 180px;
  z-index: 50;
  animation: dropdownIn 0.18s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
html.dark .sc-action-dropdown {
  background: #1e2030;
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

@keyframes dropdownIn {
  0% { opacity: 0; transform: scale(0.95) translateY(-4px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}

.sc-action-dropdown.show { display: block; }

.sc-action-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 12px;
  border: none;
  background: none;
  border-radius: 8px;
  font-size: 13px;
  font-family: 'Outfit', sans-serif;
  color: var(--text-secondary);
  cursor: pointer;
  text-decoration: none;
  transition: all 0.12s;
}
.sc-action-dropdown-item:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
}
.sc-action-dropdown-item i {
  width: 16px;
  text-align: center;
  font-size: 13px;
}
.sc-action-dropdown-item.danger:hover {
  background: var(--danger-soft);
  color: var(--danger);
}
.sc-action-dropdown-divider {
  height: 1px;
  background: var(--border-subtle);
  margin: 4px 8px;
}


/* ============================================
   SECCIÓN: Paginación definitiva
   ============================================ */

.sc-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 16px;
}

.sc-pagination-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 34px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid var(--border-default);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: 12.5px;
  font-weight: 600;
  font-family: 'IBM Plex Mono', monospace;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
}
.sc-pagination-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}
.sc-pagination-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.25);
}
.sc-pagination-btn.disabled {
  opacity: 0.3;
  cursor: not-allowed;
  pointer-events: none;
}
.sc-pagination-ellipsis {
  padding: 0 6px;
  color: var(--text-muted);
  font-size: 12px;
}

.sc-pagination-info {
  font-size: 12px;
  color: var(--text-muted);
  font-family: 'IBM Plex Mono', monospace;
}


/* ============================================
   SECCIÓN: Cards de formulario (WhatsApp, contacto)
   ============================================ */

/* Usar .sc-section-card como base, con inputs mejorados */
.sc-form-section .sc-input,
.sc-form-section .sc-select,
.sc-form-section .sc-textarea {
  background: var(--bg-page);
  border: 1.5px solid var(--border-default);
}
html.dark .sc-form-section .sc-input,
html.dark .sc-form-section .sc-select,
html.dark .sc-form-section .sc-textarea {
  background: rgba(5, 5, 7, 0.5);
  border-color: rgba(255, 255, 255, 0.08);
}

/* Select2 override para tema oscuro */
html.dark .select2-container--default .select2-selection--single {
  background: rgba(5, 5, 7, 0.5) !important;
  border-color: rgba(255, 255, 255, 0.08) !important;
  border-radius: 10px !important;
  height: 42px !important;
  padding: 6px 12px !important;
}
html.dark .select2-container--default .select2-selection--single .select2-selection__rendered {
  color: var(--text-primary) !important;
  font-family: 'Outfit', sans-serif !important;
  font-size: 13.5px !important;
}
html.dark .select2-dropdown {
  background: #1e2030 !important;
  border-color: rgba(255, 255, 255, 0.08) !important;
  border-radius: 12px !important;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5) !important;
}
html.dark .select2-results__option--highlighted {
  background: rgba(129, 140, 248, 0.08) !important;
  color: var(--text-primary) !important;
}


/* ============================================
   SECCIÓN: Botones mejorados
   ============================================ */

/* Botón con ícono — más presencia */
.sc-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  text-decoration: none;
  font-family: 'Outfit', sans-serif;
  white-space: nowrap;
}

.sc-btn-primary {
  background: var(--accent);
  color: white;
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.20), 0 0 0 0 rgba(79, 70, 229, 0);
}
.sc-btn-primary:hover {
  background: var(--accent-hover);
  color: white;
  box-shadow: 0 4px 16px rgba(79, 70, 229, 0.30), 0 0 0 3px rgba(79, 70, 229, 0.08);
  transform: translateY(-1px);
}
.sc-btn-primary:active {
  transform: translateY(0);
  box-shadow: 0 1px 4px rgba(79, 70, 229, 0.15);
}

.sc-btn-success {
  background: var(--success);
  color: white;
  box-shadow: 0 2px 8px rgba(5, 150, 105, 0.20);
}
.sc-btn-success:hover {
  box-shadow: 0 4px 16px rgba(5, 150, 105, 0.30);
  transform: translateY(-1px);
  filter: brightness(1.1);
  color: white;
}

.sc-btn-whatsapp {
  background: #25D366;
  color: white;
  box-shadow: 0 2px 8px rgba(37, 211, 102, 0.20);
}
.sc-btn-whatsapp:hover {
  background: #1ebe5d;
  color: white;
  box-shadow: 0 4px 16px rgba(37, 211, 102, 0.30);
  transform: translateY(-1px);
}

.sc-btn-telegram {
  background: #2AABEE;
  color: white;
  box-shadow: 0 2px 8px rgba(42, 171, 238, 0.20);
}
.sc-btn-telegram:hover {
  background: #229ed9;
  color: white;
  box-shadow: 0 4px 16px rgba(42, 171, 238, 0.30);
  transform: translateY(-1px);
}

.sc-btn-secondary {
  background: var(--bg-surface);
  color: var(--text-secondary);
  border: 1.5px solid var(--border-default);
  box-shadow: var(--shadow-sm);
}
.sc-btn-secondary:hover {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.06);
  transform: translateY(-1px);
}

.sc-btn-danger {
  background: var(--danger-soft);
  color: var(--danger);
  border: 1px solid rgba(220, 38, 38, 0.12);
}
.sc-btn-danger:hover {
  background: var(--danger);
  color: white;
  box-shadow: 0 4px 16px rgba(220, 38, 38, 0.25);
  transform: translateY(-1px);
}

.sc-btn-sm { padding: 6px 12px; font-size: 12px; border-radius: 8px; }
.sc-btn-lg { padding: 12px 24px; font-size: 14px; border-radius: 12px; }


/* ============================================
   SECCIÓN: Barra de filtros mejorada
   ============================================ */

.sc-filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 14px 18px;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: 14px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}
html.dark .sc-filter-bar {
  background: rgba(26, 29, 39, 0.5);
  border-color: rgba(255, 255, 255, 0.04);
}

.sc-filter-bar .sc-input,
.sc-filter-bar .sc-select {
  max-width: 280px;
  padding: 8px 12px;
  font-size: 13px;
  border-radius: 8px;
}

.sc-filter-bar .sc-filter-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}


/* ============================================
   SECCIÓN: Badges definitivos
   ============================================ */

.sc-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  font-family: 'IBM Plex Mono', monospace;
  letter-spacing: 0.01em;
  border: 1px solid transparent;
  white-space: nowrap;
}

.sc-badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.sc-badge-success {
  background: var(--success-soft);
  color: var(--success);
  border-color: rgba(5, 150, 105, 0.12);
}
.sc-badge-success .sc-badge-dot { background: var(--success); animation: badgePulse 2s ease-in-out infinite; }

.sc-badge-danger {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: rgba(220, 38, 38, 0.12);
}
.sc-badge-danger .sc-badge-dot { background: var(--danger); }

.sc-badge-warning {
  background: var(--warning-soft);
  color: var(--warning);
  border-color: rgba(217, 119, 6, 0.12);
}
.sc-badge-warning .sc-badge-dot { background: var(--warning); animation: badgePulse 2s ease-in-out infinite; }

.sc-badge-info {
  background: var(--info-soft);
  color: var(--info);
  border-color: rgba(2, 132, 199, 0.12);
}

.sc-badge-neutral {
  background: var(--bg-elevated);
  color: var(--text-secondary);
  border-color: var(--border-default);
}

@keyframes badgePulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.4; transform: scale(0.7); }
}


/* ============================================
   SECCIÓN: Sidebar glow en item activo
   ============================================ */

.sc-nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 3px;
  border-radius: 0 4px 4px 0;
  background: var(--accent);
}
html.dark .sc-nav-item.active::before {
  box-shadow: 0 0 12px rgba(129, 140, 248, 0.3), 0 0 4px rgba(129, 140, 248, 0.5);
}


/* ============================================
   SECCIÓN: Animaciones y transiciones finales
   ============================================ */

/* Página entera */
.sc-main {
  animation: pageIn 0.35s ease-out;
}
@keyframes pageIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Stagger grid — para KPIs y cards */
.sc-stagger > * {
  opacity: 0;
  animation: cardIn 0.45s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}
@keyframes cardIn {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.sc-stagger > *:nth-child(1) { animation-delay: 0.04s; }
.sc-stagger > *:nth-child(2) { animation-delay: 0.08s; }
.sc-stagger > *:nth-child(3) { animation-delay: 0.12s; }
.sc-stagger > *:nth-child(4) { animation-delay: 0.16s; }
.sc-stagger > *:nth-child(5) { animation-delay: 0.20s; }
.sc-stagger > *:nth-child(6) { animation-delay: 0.24s; }

/* Tabla rows stagger */
.sc-table-animated tbody tr {
  opacity: 0;
  animation: rowIn 0.3s ease-out forwards;
}
@keyframes rowIn {
  from { opacity: 0; transform: translateX(-8px); }
  to   { opacity: 1; transform: translateX(0); }
}
.sc-table-animated tbody tr:nth-child(1)  { animation-delay: 0.03s; }
.sc-table-animated tbody tr:nth-child(2)  { animation-delay: 0.05s; }
.sc-table-animated tbody tr:nth-child(3)  { animation-delay: 0.07s; }
.sc-table-animated tbody tr:nth-child(4)  { animation-delay: 0.09s; }
.sc-table-animated tbody tr:nth-child(5)  { animation-delay: 0.11s; }
.sc-table-animated tbody tr:nth-child(6)  { animation-delay: 0.13s; }
.sc-table-animated tbody tr:nth-child(7)  { animation-delay: 0.15s; }
.sc-table-animated tbody tr:nth-child(8)  { animation-delay: 0.17s; }
.sc-table-animated tbody tr:nth-child(9)  { animation-delay: 0.19s; }
.sc-table-animated tbody tr:nth-child(10) { animation-delay: 0.21s; }


/* ============================================
   SECCIÓN: Modales — polish final
   ============================================ */

.modal-backdrop.show {
  opacity: 0.55 !important;
  backdrop-filter: blur(8px) !important;
  -webkit-backdrop-filter: blur(8px) !important;
}
.modal-content {
  background: var(--bg-surface) !important;
  border: 1px solid var(--border-default) !important;
  border-radius: 20px !important;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(255,255,255,0.02) !important;
  color: var(--text-primary) !important;
  overflow: hidden;
  animation: modalPop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
}
html.dark .modal-content {
  background: #1a1d27 !important;
  border-color: rgba(255, 255, 255, 0.06) !important;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.03) !important;
}

@keyframes modalPop {
  0%   { opacity: 0; transform: scale(0.92) translateY(12px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  border-bottom: 1px solid var(--border-subtle) !important;
  padding: 18px 24px !important;
  background: var(--bg-elevated) !important;
}
html.dark .modal-header {
  background: rgba(255, 255, 255, 0.02) !important;
}
.modal-title {
  font-weight: 700 !important;
  font-size: 16px !important;
  font-family: 'Outfit', sans-serif !important;
}
.modal-body { padding: 24px !important; }
.modal-footer {
  border-top: 1px solid var(--border-subtle) !important;
  padding: 14px 24px !important;
  background: var(--bg-elevated) !important;
}
html.dark .modal-footer {
  background: rgba(255, 255, 255, 0.015) !important;
}


/* ============================================
   SECCIÓN: Toast definitivo
   ============================================ */

.sc-toast {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 10000;
  padding: 14px 20px;
  border-radius: 14px;
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 420px;
  animation: toastBounce 0.45s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

@keyframes toastBounce {
  0%   { opacity: 0; transform: translateX(40px) scale(0.9); }
  60%  { opacity: 1; transform: translateX(-4px) scale(1.02); }
  100% { opacity: 1; transform: translateX(0) scale(1); }
}

.sc-toast i:first-child {
  font-size: 16px;
  flex-shrink: 0;
}

.sc-toast-success {
  background: rgba(5, 150, 105, 0.10);
  color: var(--success);
  border: 1px solid rgba(5, 150, 105, 0.18);
  box-shadow: 0 4px 24px rgba(5, 150, 105, 0.12);
}
.sc-toast-error {
  background: rgba(220, 38, 38, 0.10);
  color: var(--danger);
  border: 1px solid rgba(220, 38, 38, 0.18);
  box-shadow: 0 4px 24px rgba(220, 38, 38, 0.12);
}
.sc-toast-info {
  background: rgba(79, 70, 229, 0.10);
  color: var(--accent);
  border: 1px solid rgba(79, 70, 229, 0.18);
  box-shadow: 0 4px 24px rgba(79, 70, 229, 0.12);
}


/* ============================================
   SECCIÓN: Scrollbar refinada
   ============================================ */

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--border-default);
  border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}
html { scrollbar-width: thin; scrollbar-color: var(--border-default) transparent; }


/* ============================================
   SECCIÓN: Focus global
   ============================================ */

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Bridge: Bootstrap form controls dentro de secciones de formulario */
.sc-form-section .form-control,
.sc-form-section .form-select,
.sc-form-section textarea.form-control {
  background: var(--bg-page);
  border: 1.5px solid var(--border-default);
  border-radius: 10px;
}
html.dark .sc-form-section .form-control,
html.dark .sc-form-section .form-select,
html.dark .sc-form-section textarea.form-control {
  background: rgba(5, 5, 7, 0.5);
  border-color: rgba(255, 255, 255, 0.08);
}

.sc-empty-state-sub {
  color: var(--text-label, var(--text-muted));
}
