/* ============================================================
   Streamly — Streaming Account Manager
   Dark Mode Professional UI — CSS3 Vanilla
   ============================================================ */

/* ── Google Fonts (loaded via <link> in HTML — @import removed for faster render) ── */
/* Fonts already preloaded in index.html with preconnect */

/* ── CSS Custom Properties (Design Tokens) ──────────────── */
:root {
  /* Colores base */
  --bg-primary:    #0a0a0f;
  --bg-secondary:  #121218;
  --bg-card:       #1b1b24;
  --bg-card-hover: #22222e;
  --bg-input:      #16161e;
  --bg-modal:      rgba(0, 0, 0, 0.75);

  /* Acento principal — Violeta / Azul neón */
  --accent:        #7c3aed;
  --accent-light:  #a78bfa;
  --accent-glow:   rgba(124, 58, 237, 0.35);
  --accent-subtle: rgba(124, 58, 237, 0.10);

  /* Texto */
  --text-primary:   #f0f0f5;
  --text-secondary: #9ca3af;
  --text-muted:     #6b7280;
  --text-inverse:   #0a0a0f;

  /* Estados */
  --success:       #22c55e;
  --success-bg:    rgba(34, 197, 94, 0.12);
  --warning:       #f59e0b;
  --warning-bg:    rgba(245, 158, 11, 0.12);
  --danger:        #ef4444;
  --danger-bg:     rgba(239, 68, 68, 0.12);
  --info:          #3b82f6;

  /* WhatsApp */
  --whatsapp:      #25d366;
  --whatsapp-dark: #128c7e;

  /* Bordes */
  --border-color:  rgba(255, 255, 255, 0.06);
  --border-light:  rgba(255, 255, 255, 0.10);

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

  /* Radios */
  --radius-sm:   8px;
  --radius-md:   12px;
  --radius-lg:   16px;
  --radius-xl:   20px;
  --radius-full: 9999px;

  /* Transiciones */
  --transition-fast:   0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow:   0.4s  cubic-bezier(0.4, 0, 0.2, 1);

  /* Glassmorphism */
  --glass-bg:      rgba(27, 27, 36, 0.60);
  --glass-border:  rgba(255, 255, 255, 0.08);
  --glass-blur:    16px;

  /* Layout */
  --sidebar-width: 260px;
  --header-height: 64px;
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

a { color: var(--accent-light); text-decoration: none; }
a:hover { color: var(--accent); }

img { max-width: 100%; display: block; }

/* Scrollbar personalizada */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-secondary); }
::-webkit-scrollbar-thumb { 
  background: var(--bg-card-hover); 
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ── Utilidades ──────────────────────────────────────────── */
.hidden     { display: none !important; }
.flex       { display: flex; }
.flex-col   { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center  { justify-content: center; }
.gap-sm     { gap: 8px; }
.gap-md     { gap: 16px; }
.gap-lg     { gap: 24px; }
.text-center { text-align: center; }
.w-full     { width: 100%; }
.truncate   { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-primary);
  position: relative;
  overflow: hidden;
}

/* Fondo animado (will-change para composición en GPU) */
.login-page::before {
  content: '';
  position: absolute;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, var(--accent-glow), transparent 70%);
  top: -150px;
  right: -150px;
  animation: floatBg 8s ease-in-out infinite alternate;
  will-change: transform;
}
.login-page::after {
  content: '';
  position: absolute;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(59,130,246,0.15), transparent 70%);
  bottom: -100px;
  left: -100px;
  animation: floatBg 10s ease-in-out infinite alternate-reverse;
  will-change: transform;
}

@keyframes floatBg {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(30px, -30px) scale(1.1); }
}

.login-container {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
  padding: 40px;
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.6s var(--transition-normal);
}

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

.login-logo {
  text-align: center;
  margin-bottom: 32px;
}

.login-logo h1 {
  font-family: 'Poppins', sans-serif;
  font-weight: 700;
  font-size: 2rem;
  background: linear-gradient(135deg, var(--accent-light), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.5px;
}

.login-logo p {
  color: var(--text-secondary);
  font-size: 0.875rem;
  margin-top: 4px;
}

/* ── Formularios (compartido) ───────────────────────────── */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
  letter-spacing: 0.3px;
}

.form-control {
  width: 100%;
  padding: 12px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.9375rem;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  outline: none;
}

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

.form-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-subtle);
}

.form-control:hover:not(:focus) {
  border-color: var(--border-light);
}

select.form-control {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%239ca3af' viewBox='0 0 16 16'%3E%3Cpath d='M4.646 6.646a.5.5 0 0 1 .708 0L8 9.293l2.646-2.647a.5.5 0 0 1 .708.708l-3 3a.5.5 0 0 1-.708 0l-3-3a.5.5 0 0 1 0-.708z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

/* ── Botones ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
  white-space: nowrap;
  line-height: 1;
}

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

.btn-primary {
  background: linear-gradient(135deg, var(--accent), #6d28d9);
  color: #fff;
  box-shadow: var(--shadow-accent);
}
.btn-primary:hover {
  background: linear-gradient(135deg, var(--accent-light), var(--accent));
  box-shadow: 0 6px 24px var(--accent-glow);
  transform: translateY(-1px);
}

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

.btn-danger {
  background: var(--danger);
  color: #fff;
}
.btn-danger:hover {
  background: #dc2626;
}

.btn-success {
  background: var(--whatsapp);
  color: #fff;
}
.btn-success:hover {
  background: var(--whatsapp-dark);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  padding: 8px 12px;
}
.btn-ghost:hover {
  background: var(--accent-subtle);
  color: var(--accent-light);
}

.btn-icon {
  padding: 8px;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  border: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn-icon:hover {
  background: var(--accent-subtle);
  color: var(--accent-light);
}

.btn-sm { padding: 8px 16px; font-size: 0.8125rem; }
.btn-lg { padding: 14px 28px; font-size: 1rem; }
.btn-block { width: 100%; }

/* ============================================================
   LAYOUT: SIDEBAR + MAIN
   ============================================================ */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ─────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 100;
  transition: transform var(--transition-normal);
}

.sidebar-header {
  padding: 24px 20px;
  border-bottom: 1px solid var(--border-color);
}

.sidebar-header h1 {
  font-family: 'Poppins', sans-serif;
  font-size: 1.375rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent-light), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.sidebar-header span {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: block;
  margin-top: 2px;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  overflow-y: auto;
}

.nav-section-title {
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 12px 12px 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  margin-bottom: 2px;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: inherit;
}

.nav-item:hover {
  background: var(--accent-subtle);
  color: var(--text-primary);
}

.nav-item.active {
  background: linear-gradient(135deg, var(--accent-subtle), rgba(124, 58, 237, 0.18));
  color: var(--accent-light);
  font-weight: 600;
}

.nav-item i {
  font-size: 1.125rem;
  width: 20px;
  text-align: center;
}

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

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition-fast);
}
.sidebar-user:hover { background: var(--accent-subtle); }

.sidebar-user-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--accent), #6d28d9);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.875rem;
  color: #fff;
  flex-shrink: 0;
}

.sidebar-user-info {
  overflow: hidden;
}
.sidebar-user-name {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sidebar-user-email {
  font-size: 0.6875rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Main Content ────────────────────────────────────────── */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.top-header {
  height: var(--header-height);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.menu-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 1.25rem;
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius-sm);
  transition: background var(--transition-fast);
}
.menu-toggle:hover { background: var(--accent-subtle); }

.page-title {
  font-family: 'Poppins', sans-serif;
  font-size: 1.125rem;
  font-weight: 600;
}

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

.header-date {
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

/* ── Page Content ────────────────────────────────────────── */
.page-content {
  flex: 1;
  padding: 28px;
}

/* ── Sections / Tabs ─────────────────────────────────────── */
.section {
  display: none;
  animation: fadeIn 0.2s ease;
}
.section.active {
  display: block;
  content-visibility: auto;
  contain-intrinsic-size: auto 500px;
}

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

/* ============================================================
   DASHBOARD — STATS CARDS
   ============================================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: all var(--transition-normal);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-light));
  opacity: 0;
  transition: opacity var(--transition-normal);
}

.stat-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-light);
  box-shadow: var(--shadow-md);
}

.stat-card:hover::before {
  opacity: 1;
}

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

.stat-card-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
}

.stat-card-icon.purple { background: var(--accent-subtle); color: var(--accent-light); }
.stat-card-icon.green  { background: var(--success-bg); color: var(--success); }
.stat-card-icon.red    { background: var(--danger-bg); color: var(--danger); }
.stat-card-icon.blue   { background: rgba(59,130,246,0.12); color: var(--info); }
.stat-card-icon.yellow { background: var(--warning-bg); color: var(--warning); }

.stat-card-badge {
  font-size: 0.6875rem;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-weight: 600;
}
.badge-up   { background: var(--success-bg); color: var(--success); }
.badge-down { background: var(--danger-bg); color: var(--danger); }

.stat-card-value {
  font-family: 'Poppins', sans-serif;
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.stat-card-label {
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

/* ============================================================
   TABLES
   ============================================================ */
.table-container {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

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

.table-header h3 {
  font-family: 'Poppins', sans-serif;
  font-size: 1.0625rem;
  font-weight: 600;
}

.table-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.search-input-wrapper {
  position: relative;
}

.search-input-wrapper i {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.875rem;
}

.search-input {
  padding: 8px 12px 8px 36px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.8125rem;
  width: 220px;
  transition: all var(--transition-fast);
  outline: none;
}
.search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-subtle);
  width: 260px;
}

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

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

thead th {
  padding: 14px 20px;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

tbody td {
  padding: 14px 20px;
  font-size: 0.875rem;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}

tbody tr {
  transition: background var(--transition-fast);
}

tbody tr:hover {
  background: rgba(124, 58, 237, 0.04);
}

tbody tr:last-child td {
  border-bottom: none;
}

/* Badges de estado */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.badge-active {
  background: var(--success-bg);
  color: var(--success);
}

.badge-expired {
  background: var(--danger-bg);
  color: var(--danger);
}

.badge-warning {
  background: var(--warning-bg);
  color: var(--warning);
}

.badge-info {
  background: rgba(59,130,246,0.12);
  color: var(--info);
}

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

/* Row Actions */
.row-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.table-empty {
  padding: 48px 24px;
  text-align: center;
  color: var(--text-muted);
}

.table-empty i {
  font-size: 2.5rem;
  margin-bottom: 12px;
  display: block;
  color: var(--text-muted);
  opacity: 0.5;
}

.table-empty p {
  font-size: 0.875rem;
}

/* ============================================================
   MODALES
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-modal);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-normal);
  padding: 20px;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  transform: scale(0.9) translateY(20px);
  transition: transform var(--transition-normal);
}

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

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 24px 0;
}

.modal-header h3 {
  font-family: 'Poppins', sans-serif;
  font-size: 1.125rem;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.25rem;
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}
.modal-close:hover {
  background: var(--danger-bg);
  color: var(--danger);
}

.modal-body {
  padding: 24px;
}

.modal-footer {
  padding: 0 24px 24px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

/* Form grid inside modals */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* ============================================================
   TABS (sub-navegación interna)
   ============================================================ */
.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 24px;
  background: var(--bg-secondary);
  padding: 4px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  overflow-x: auto;
}

.tab-btn {
  padding: 8px 20px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  border-radius: 6px;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.tab-btn:hover {
  color: var(--text-primary);
}

.tab-btn.active {
  background: var(--accent);
  color: #fff;
  font-weight: 600;
}

/* ============================================================
   TOAST / NOTIFICACIONES
   ============================================================ */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  min-width: 300px;
  animation: toastIn 0.35s ease;
  position: relative;
  overflow: hidden;
}

.toast::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
}

.toast-success::before { background: var(--success); }
.toast-error::before   { background: var(--danger); }
.toast-warning::before { background: var(--warning); }
.toast-info::before    { background: var(--info); }

.toast i {
  font-size: 1.125rem;
}
.toast-success i { color: var(--success); }
.toast-error i   { color: var(--danger); }
.toast-warning i { color: var(--warning); }
.toast-info i    { color: var(--info); }

.toast-message {
  flex: 1;
  font-size: 0.875rem;
}

.toast-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px;
  font-size: 1rem;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(30px); }
  to   { opacity: 1; transform: translateX(0); }
}

.toast.removing {
  animation: toastOut 0.3s ease forwards;
}

@keyframes toastOut {
  to { opacity: 0; transform: translateX(30px); }
}

/* ============================================================
   PLATFORM ICONS / TAGS
   ============================================================ */
.platform-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--accent-subtle);
  color: var(--accent-light);
}

.platform-tag.netflix    { background: rgba(229, 9, 20, 0.12); color: #e50914; }
.platform-tag.disney     { background: rgba(17, 60, 207, 0.12); color: #1a73e8; }
.platform-tag.hbo        { background: rgba(151, 71, 255, 0.12); color: #9747ff; }
.platform-tag.spotify    { background: rgba(30, 215, 96, 0.12); color: #1ed760; }
.platform-tag.prime      { background: rgba(0, 168, 225, 0.12); color: #00a8e1; }
.platform-tag.crunchyroll { background: rgba(245, 130, 31, 0.12); color: #f5821f; }
.platform-tag.youtube    { background: rgba(255, 0, 0, 0.12); color: #ff0000; }
.platform-tag.paramount  { background: rgba(0, 100, 255, 0.12); color: #0064ff; }
.platform-tag.apple      { background: rgba(168, 168, 168, 0.12); color: #a8a8a8; }

/* ============================================================
   PROFILE SLOTS (visual de perfiles disponibles)
   ============================================================ */
.profile-slots {
  display: flex;
  gap: 4px;
}

.profile-slot {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6875rem;
  font-weight: 700;
}

.profile-slot.occupied {
  background: var(--accent-subtle);
  color: var(--accent-light);
  border: 1px solid rgba(124, 58, 237, 0.3);
}

.profile-slot.available {
  background: var(--bg-input);
  color: var(--text-muted);
  border: 1px dashed var(--border-light);
}

/* ============================================================
   CREDENTIALS COPY
   ============================================================ */
.credentials-cell {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.credential-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8125rem;
}

.credential-row .label-text {
  color: var(--text-muted);
  font-size: 0.6875rem;
  min-width: 36px;
}

.credential-row .value-text {
  color: var(--text-primary);
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 0.8125rem;
}

.copy-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px;
  font-size: 0.75rem;
  transition: color var(--transition-fast);
}
.copy-btn:hover { color: var(--accent-light); }

/* ============================================================
   WHATSAPP BUTTON
   ============================================================ */
.btn-whatsapp {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: rgba(37, 211, 102, 0.12);
  color: var(--whatsapp);
  border: 1px solid rgba(37, 211, 102, 0.2);
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all var(--transition-fast);
}
.btn-whatsapp:hover {
  background: rgba(37, 211, 102, 0.2);
  border-color: rgba(37, 211, 102, 0.35);
  transform: translateY(-1px);
}

/* ============================================================
   QUICK-ACTIONS PANEL (dashboard)
   ============================================================ */
.quick-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 28px;
}

.quick-action-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.quick-action-btn:hover {
  border-color: var(--accent);
  background: var(--accent-subtle);
  transform: translateY(-1px);
}
.quick-action-btn i {
  font-size: 1.125rem;
  color: var(--accent-light);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

/* Tablet */
@media (max-width: 1024px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .form-row {
    grid-template-columns: 1fr;
  }
}

/* Mobile */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }

  .sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 99;
    display: none;
  }
  .sidebar-overlay.active {
    display: block;
  }

  .main-content {
    margin-left: 0;
  }

  .menu-toggle {
    display: flex;
  }

  .page-content {
    padding: 16px;
  }

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

  .table-header {
    flex-direction: column;
    align-items: stretch;
  }

  .search-input {
    width: 100%;
  }
  .search-input:focus {
    width: 100%;
  }

  .top-header {
    padding: 0 16px;
  }

  .modal {
    max-width: 100%;
    margin: 12px;
    border-radius: var(--radius-lg);
  }

  .header-date {
    display: none;
  }

  .quick-actions {
    grid-template-columns: 1fr;
  }

  /* Tablas responsivas: scroll horizontal */
  .table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  table {
    min-width: 700px;
  }
}

@media (max-width: 480px) {
  .login-container {
    padding: 28px 20px;
    margin: 12px;
  }

  .stat-card {
    padding: 18px;
  }

  .stat-card-value {
    font-size: 1.5rem;
  }
}

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.5; }
}

.loading-skeleton {
  background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-card-hover) 50%, var(--bg-card) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── Confirm Dialog ──────────────────────────────────────── */
.confirm-dialog {
  text-align: center;
  padding: 12px 0;
}
.confirm-dialog i {
  font-size: 2.5rem;
  color: var(--danger);
  margin-bottom: 16px;
}
.confirm-dialog h4 {
  font-size: 1.0625rem;
  margin-bottom: 8px;
}
.confirm-dialog p {
  color: var(--text-secondary);
  font-size: 0.875rem;
}

/* ── Sign Out Button ──────────────────────────────────────── */
.btn-signout {
  width: 100%;
  justify-content: flex-start;
  gap: 12px;
  padding: 10px 14px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  border-radius: var(--radius-sm);
  font-family: inherit;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
}
.btn-signout:hover {
  background: var(--danger-bg);
  color: var(--danger);
}
.btn-signout i {
  font-size: 1.125rem;
  width: 20px;
  text-align: center;
}

/* ── Google Sign-In Button ────────────────────────────────── */
.btn-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  padding: 12px 24px;
  background: var(--bg-input);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
  line-height: 1;
}
.btn-google:hover {
  background: var(--bg-card-hover);
  border-color: rgba(255, 255, 255, 0.18);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}
.btn-google:active {
  transform: scale(0.97);
}
.btn-google img {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

/* ============================================================
   CHATBOT — Estilos
   ============================================================ */

/* Textarea en formularios */
textarea.form-control {
  resize: vertical;
  min-height: 60px;
  font-family: inherit;
  line-height: 1.5;
}

/* Chat test area */
.chat-test-messages {
  max-height: 350px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
  background: var(--bg-primary);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  min-height: 120px;
}

.chat-msg {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 0.875rem;
  line-height: 1.5;
  word-wrap: break-word;
}

.chat-msg-user {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--accent), #6d28d9);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.chat-msg-bot {
  align-self: flex-start;
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-bottom-left-radius: 4px;
}

/* ====== Config Wizard Styles ====== */
#configWizardChat .chat-test-messages {
  max-height: 700px;
  min-height: 200px;
  scroll-behavior: smooth;
  overflow-y: auto;
}

#configWizardChat .wizard-config-review {
  max-width: 100%;
}

.wizard-typing {
  align-self: flex-start;
  padding: 10px 18px;
  font-style: italic;
  color: var(--text-secondary);
  font-size: 0.8125rem;
}

.wizard-typing .dots {
  display: inline-block;
  animation: wizardDots 1.4s infinite steps(4, end);
}

@keyframes wizardDots {
  0%   { content: ''; }
  25%  { content: '.'; }
  50%  { content: '..'; }
  75%  { content: '...'; }
}

#wizardQuickReplies {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

#wizardQuickReplies .quick-reply-btn {
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid var(--accent);
  background: transparent;
  color: var(--accent);
  font-size: 0.8125rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

#wizardQuickReplies .quick-reply-btn:hover {
  background: var(--accent);
  color: #fff;
}

.wizard-summary {
  background: var(--bg-card);
  border: 1px solid var(--accent);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  margin-top: 6px;
  font-size: 0.85rem;
  line-height: 1.6;
}

.wizard-summary strong {
  color: var(--accent-light);
}

.wizard-done-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}

/* Bot Context Help Box */
.bot-context-help {
  background: rgba(99,102,241,0.08);
  border: 1px solid rgba(99,102,241,0.2);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-bottom: 10px;
}
.bot-context-help p {
  margin: 0;
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.5;
}
.bot-context-help i {
  color: var(--accent);
  margin-right: 4px;
}

#botContext {
  font-family: 'Inter', monospace;
  font-size: 0.85rem;
  line-height: 1.6;
  min-height: 280px;
  resize: vertical;
}

.wizard-done-actions .btn {
  font-size: 0.8125rem;
}

/* Wizard Config Review Card */
.wizard-config-review {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-top: 10px;
}

.wizard-review-header {
  background: linear-gradient(135deg, var(--accent), #6d28d9);
  color: #fff;
  padding: 12px 18px;
  font-weight: 600;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.wizard-review-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--border-color);
}

.wizard-review-item {
  background: var(--bg-card);
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.wizard-review-item.wizard-review-wide {
  grid-column: 1 / -1;
}

.wizard-review-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.wizard-review-label i {
  color: var(--accent);
  font-size: 0.75rem;
}

.wizard-review-value {
  font-size: 0.85rem;
  color: var(--text-primary);
  line-height: 1.4;
  word-break: break-word;
  max-height: 80px;
  overflow-y: auto;
}

.wizard-review-actions {
  display: flex;
  gap: 10px;
  padding: 16px 18px;
  flex-wrap: wrap;
  border-top: 1px solid var(--border-color);
  background: var(--bg-primary);
}

.wizard-review-actions .btn {
  font-size: 0.85rem;
  padding: 10px 20px;
  border-radius: 10px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.wizard-review-actions .btn-primary,
.wizard-review-actions .btn:first-child {
  background: linear-gradient(135deg, var(--accent), #6d28d9);
  color: #fff;
  border: none;
  box-shadow: 0 2px 8px rgba(139, 92, 246, 0.3);
}

.wizard-review-actions .btn-primary:hover,
.wizard-review-actions .btn:first-child:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(139, 92, 246, 0.45);
}

.wizard-review-actions .btn-secondary {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.wizard-review-actions .btn-secondary:hover {
  border-color: var(--accent);
  color: var(--accent-light);
  background: rgba(139, 92, 246, 0.08);
}
}

@media (max-width: 600px) {
  .wizard-review-grid {
    grid-template-columns: 1fr;
  }
}

/* Instructions box */
.chatbot-instructions {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
}

.chatbot-instructions code {
  background: var(--bg-card);
  color: var(--accent-light);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  font-family: 'Consolas', 'Monaco', monospace;
}

/* Bot connection panel */
.bot-connection-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.bot-status-bar-mini {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.bot-status-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--bg-primary);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.bot-auto-connecting {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 40px 20px;
}

.bot-connection-error {
  padding: 10px;
}

.bot-advanced-settings {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
}

.bot-advanced-settings summary {
  cursor: pointer;
  font-size: 0.8rem;
  color: var(--text-muted);
  user-select: none;
}

.bot-advanced-settings summary:hover {
  color: var(--text-secondary);
}

.bot-qr-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  width: 100%;
}

.bot-qr-steps {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 20px;
  width: 100%;
  max-width: 300px;
}

.bot-qr-step {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.bot-qr-step span {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent-light);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  flex-shrink: 0;
}

.bot-logs-details {
  background: var(--bg-primary);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  padding: 8px 12px;
}

.bot-status-indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.bot-status-indicator.disconnected { background: var(--danger); }
.bot-status-indicator.connected { background: var(--success); box-shadow: 0 0 8px rgba(34, 197, 94, 0.6); }
.bot-status-indicator.qr { background: var(--warning); animation: pulse-dot 1.5s infinite; }
.bot-status-indicator.connecting { background: var(--accent-light); animation: pulse-dot 1s infinite; }

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

.bot-status-bar span {
  flex: 1;
}

/* QR Container */
.bot-qr-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px;
  background: var(--bg-primary);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.bot-qr-code {
  background: #fff;
  padding: 12px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
}

.bot-qr-code img {
  width: 256px;
  height: 256px;
  display: block;
}

/* Connected info */
.bot-connected-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 32px;
  background: var(--bg-primary);
  border-radius: var(--radius-md);
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.bot-connected-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(34, 197, 94, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: var(--success);
}

.bot-connected-info h4 {
  color: var(--success);
  font-weight: 600;
  margin: 0;
}

.bot-connected-info p {
  color: var(--text-muted);
  font-size: 0.8125rem;
  margin: 0;
}

/* Bot logs */
.bot-logs {
  background: var(--bg-primary);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  overflow: hidden;
}

.bot-logs-content {
  max-height: 200px;
  overflow-y: auto;
  padding: 8px 12px;
  font-family: 'Consolas', 'Monaco', monospace;
  font-size: 0.75rem;
  line-height: 1.7;
}

.bot-log-entry {
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bot-log-time {
  color: var(--accent-light);
  margin-right: 8px;
}

/* ============================================================
   CHATBOT — Filtros / Toggle Cards
   ============================================================ */
.bot-settings-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.bot-toggle-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: border-color 0.2s;
}

.bot-toggle-card:hover {
  border-color: var(--accent-light);
}

.bot-toggle-info {
  display: flex;
  align-items: center;
  gap: 14px;
}

.bot-toggle-info i {
  font-size: 1.3rem;
  color: var(--accent-light);
  width: 32px;
  text-align: center;
}

.bot-toggle-info strong {
  display: block;
  font-size: 0.875rem;
  color: var(--text-primary);
}

.bot-toggle-info small {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Toggle switch */
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: rgba(255,255,255,0.1);
  border-radius: 24px;
  transition: 0.3s;
}

.slider::before {
  content: "";
  position: absolute;
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: #fff;
  border-radius: 50%;
  transition: 0.3s;
}

input:checked + .slider {
  background-color: var(--accent);
}

input:checked + .slider::before {
  transform: translateX(20px);
}

/* ============================================================
   CHATBOT — Cuentas Disponibles (Inventario)
   ============================================================ */
.available-accounts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}

.avail-card {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  transition: border-color 0.2s;
}

.avail-card.available {
  border-color: rgba(34, 197, 94, 0.3);
}

.avail-card.sold-out {
  border-color: rgba(239, 68, 68, 0.2);
  opacity: 0.7;
}

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

.avail-card-header strong {
  font-size: 0.875rem;
  color: var(--text-primary);
}

.avail-card-body {
  display: flex;
  gap: 12px;
  margin-bottom: 10px;
}

.avail-stat {
  text-align: center;
  flex: 1;
}

.avail-stat span {
  display: block;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.avail-stat small {
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

.avail-card-status {
  text-align: center;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
}

.avail-card-status.available {
  background: rgba(34, 197, 94, 0.15);
  color: var(--success);
}

.avail-card-status.sold-out {
  background: rgba(239, 68, 68, 0.15);
  color: var(--danger);
}

/* ============================================================
   CHATBOT — Conversaciones Layout
   ============================================================ */
.conv-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  min-height: 500px;
  max-height: 600px;
}

.conv-list {
  border-right: 1px solid var(--border-color);
  overflow-y: auto;
  background: var(--bg-primary);
}

.conv-list-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 40px 20px;
  text-align: center;
  color: var(--text-muted);
}

.conv-list-empty i {
  font-size: 2.5rem;
  margin-bottom: 12px;
  opacity: 0.4;
}

.conv-list-empty p {
  font-weight: 600;
  margin: 0 0 4px 0;
}

.conv-list-empty small {
  font-size: 0.75rem;
}

/* Conversation item */
.conv-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color);
  cursor: pointer;
  transition: background 0.15s;
}

.conv-item:hover {
  background: rgba(255,255,255,0.03);
}

.conv-item.active {
  background: rgba(139, 92, 246, 0.1);
  border-left: 3px solid var(--accent);
}

.conv-item-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(139, 92, 246, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-light);
  font-size: 1rem;
  flex-shrink: 0;
}

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

.conv-item-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.conv-item-name {
  font-size: 0.85rem;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.conv-item-time {
  font-size: 0.7rem;
  color: var(--text-muted);
  flex-shrink: 0;
  margin-left: 8px;
}

.conv-item-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.conv-item-preview {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.conv-item-badges {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  margin-left: 8px;
}

.conv-unread-badge {
  background: var(--accent);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  min-width: 20px;
  height: 20px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
}

.conv-paused-badge {
  color: var(--warning);
  font-size: 0.7rem;
}

/* Conversation chat area */
.conv-chat {
  display: flex;
  flex-direction: column;
  position: relative;
  background: var(--bg-card);
}

.conv-chat-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-muted);
  text-align: center;
  padding: 40px;
}

.conv-chat-placeholder i {
  font-size: 3rem;
  opacity: 0.3;
  margin-bottom: 16px;
}

.conv-chat-placeholder p {
  font-weight: 600;
  margin: 0 0 4px 0;
}

.conv-chat-placeholder small {
  font-size: 0.75rem;
}

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

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

.conv-chat-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(139, 92, 246, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-light);
}

.conv-chat-header-info strong {
  font-size: 0.9rem;
  color: var(--text-primary);
}

.conv-chat-header-info small {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.conv-chat-header-actions {
  display: flex;
  gap: 8px;
}

/* Messages area */
.conv-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.conv-msg {
  max-width: 75%;
  padding: 8px 14px;
  border-radius: 16px;
  font-size: 0.85rem;
  line-height: 1.5;
  word-wrap: break-word;
  position: relative;
}

.conv-msg-customer {
  align-self: flex-start;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-bottom-left-radius: 4px;
}

.conv-msg-bot {
  align-self: flex-end;
  background: rgba(139, 92, 246, 0.15);
  color: var(--text-primary);
  border-bottom-right-radius: 4px;
}

.conv-msg-agent {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--accent), #6d28d9);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.conv-msg-label {
  display: block;
  font-size: 0.65rem;
  font-weight: 600;
  margin-bottom: 2px;
  opacity: 0.8;
}

.conv-msg-text {
  display: block;
}

.conv-msg-time {
  display: block;
  font-size: 0.6rem;
  opacity: 0.6;
  text-align: right;
  margin-top: 4px;
}

/* Reply input */
.conv-reply {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--border-color);
  background: var(--bg-primary);
}

.conv-reply .form-control {
  flex: 1;
}

/* Warning button (for pause) */
.btn-warning {
  background: var(--warning);
  color: #000;
  border: none;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
}

.btn-warning:hover {
  opacity: 0.85;
}

/* Responsive */
@media (max-width: 768px) {
  .conv-layout {
    grid-template-columns: 1fr;
    min-height: unset;
    max-height: unset;
  }
  
  .conv-list {
    border-right: none;
    border-bottom: 1px solid var(--border-color);
    max-height: 250px;
  }
  
  .conv-chat {
    min-height: 400px;
  }
  
  .bot-settings-grid {
    gap: 8px;
  }
  
  .available-accounts-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  }
}

/* ── Pedidos Pendientes — Notificación ───────────────────── */
#pendingOrdersContainer {
  border: 1px solid var(--warning);
  border-radius: var(--radius-lg);
  animation: pendingGlow 2s ease-in-out infinite alternate;
}

@keyframes pendingGlow {
  from { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0); }
  to   { box-shadow: 0 0 12px 2px rgba(245, 158, 11, 0.15); }
}

#pendingOrdersContainer .table-header h3 {
  display: flex;
  align-items: center;
  gap: 8px;
}

.order-status-pendiente {
  background: rgba(245, 158, 11, 0.15);
  color: var(--warning);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.order-status-completado {
  background: rgba(16, 185, 129, 0.15);
  color: var(--success);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
}

.order-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

.order-actions .btn-icon {
  width: 30px;
  height: 30px;
}

/* Notification banner that slides in */
.order-notification {
  position: fixed;
  top: 20px;
  right: 20px;
  background: var(--bg-card);
  border: 1px solid var(--warning);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: 0 8px 32px rgba(245, 158, 11, 0.25);
  z-index: 10000;
  animation: slideInRight 0.4s ease-out;
  max-width: 400px;
  cursor: pointer;
  transition: transform 0.2s;
}

.order-notification:hover {
  transform: scale(1.02);
}

.order-notification-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(245, 158, 11, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  color: var(--warning);
  flex-shrink: 0;
}

.order-notification-body {
  flex: 1;
}

.order-notification-title {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.order-notification-detail {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.order-notification-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1rem;
  padding: 4px;
  flex-shrink: 0;
}

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

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

/* ── Send Credentials Button ─────────────────────────────── */
.btn-send-creds {
  transition: transform 0.15s, background 0.15s;
}

.btn-send-creds:hover {
  background: rgba(124, 58, 237, 0.15) !important;
  transform: scale(1.15);
}

/* ── Accessibility: reduce motion for users who prefer it ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ── Performance: GPU-composited animations ────────────────── */
.toast-notification,
.modal-content,
.order-card {
  will-change: transform, opacity;
}

/* ── Pause Button ── */
#botPauseBtn.paused {
  background: var(--success) !important;
  color: #fff !important;
}
#botPauseBtn.paused i {
  animation: none;
}

/* ── Scheduled Messages ── */
.scheduled-form-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  overflow: hidden;
}
.scheduled-form-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  background: linear-gradient(135deg, var(--accent), #7c3aed);
  color: #fff;
  font-weight: 700;
  font-size: 0.95rem;
}
.scheduled-form-card-header i {
  font-size: 1.1rem;
}
.scheduled-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 20px;
}
.scheduled-form-row {
  display: flex;
  gap: 14px;
  align-items: flex-end;
}
.scheduled-form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.scheduled-form-field label {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.scheduled-form-field label i {
  color: var(--accent);
  font-size: 0.85rem;
}
.scheduled-form-field select,
.scheduled-form-field input,
.scheduled-form-field textarea {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 0.85rem;
  font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.scheduled-form-field select:focus,
.scheduled-form-field input:focus,
.scheduled-form-field textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
  outline: none;
}
.scheduled-form-field textarea {
  resize: vertical;
  min-height: 70px;
}
.scheduled-refresh-btn {
  background: var(--bg-primary) !important;
  color: var(--text-muted) !important;
  border: 1px solid var(--border-color) !important;
  border-radius: 10px !important;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}
.scheduled-refresh-btn:hover {
  border-color: var(--accent) !important;
  color: var(--accent) !important;
}
.scheduled-create-btn {
  margin-top: 4px;
  background: linear-gradient(135deg, var(--accent), #7c3aed) !important;
  color: #fff !important;
  border: none !important;
  border-radius: 10px !important;
  padding: 12px 20px !important;
  font-size: 0.9rem !important;
  font-weight: 600 !important;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.1s;
}
.scheduled-create-btn:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}
.scheduled-create-btn:active {
  transform: translateY(0);
}

.scheduled-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  margin-bottom: 10px;
  transition: border-color 0.2s;
}
.scheduled-card:hover {
  border-color: var(--accent);
}
.scheduled-card-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}
.scheduled-card-icon.active {
  background: rgba(16, 185, 129, 0.15);
  color: var(--success);
}
.scheduled-card-icon.paused-sched {
  background: rgba(245, 158, 11, 0.15);
  color: var(--warning);
}
.scheduled-card-body {
  flex: 1;
  min-width: 0;
}
.scheduled-card-body h5 {
  font-size: 0.85rem;
  margin: 0 0 4px 0;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.scheduled-card-body p {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin: 2px 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.scheduled-card-body .scheduled-meta {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 6px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.scheduled-card-body .scheduled-meta span {
  display: flex;
  align-items: center;
  gap: 4px;
}
.scheduled-card-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
}
.scheduled-card-actions button {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  transition: all 0.2s;
}
.scheduled-card-actions button:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.scheduled-card-actions button.btn-delete:hover {
  border-color: var(--danger);
  color: var(--danger);
}

@media (max-width: 600px) {
  .scheduled-form-row {
    flex-direction: column;
    align-items: stretch;
  }
}

/* ── Language Selector ── */
.lang-selector {
  position: relative;
}
.lang-toggle-btn {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-radius: 10px;
  padding: 6px 12px;
  font-size: 0.82rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
  font-family: inherit;
}
.lang-toggle-btn:hover {
  border-color: var(--accent);
  background: var(--bg-secondary);
}
.lang-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 6px;
  min-width: 170px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.25);
  z-index: 999;
  display: none;
}
.lang-dropdown.show {
  display: block;
  animation: fadeInDown 0.15s ease;
}
@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}
.lang-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-size: 0.84rem;
  cursor: pointer;
  border-radius: 8px;
  width: 100%;
  text-align: left;
  font-family: inherit;
  transition: background 0.15s;
}
.lang-option:hover {
  background: var(--bg-primary);
}
.lang-option.active {
  background: rgba(99, 102, 241, 0.12);
  color: var(--accent);
  font-weight: 600;
}

/* ── Light Theme ─────────────────────────────────────────── */
[data-theme="light"] {
  --bg-primary:    #f5f5f9;
  --bg-secondary:  #eeeef3;
  --bg-card:       #ffffff;
  --bg-card-hover: #f0f0f5;
  --bg-input:      #f8f8fb;
  --bg-modal:      rgba(0, 0, 0, 0.45);
  --text-primary:   #1a1a2e;
  --text-secondary: #555570;
  --text-muted:     #888899;
  --text-inverse:   #ffffff;
  --border-color:  rgba(0, 0, 0, 0.08);
  --border-light:  rgba(0, 0, 0, 0.12);
  --shadow-sm:  0 1px 2px rgba(0,0,0,0.06);
  --shadow-md:  0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg:  0 8px 32px rgba(0,0,0,0.12);
  --glass-bg:      rgba(255, 255, 255, 0.80);
  --glass-border:  rgba(0, 0, 0, 0.06);
}
[data-theme="light"] .sidebar {
  background: #ffffff;
  border-right: 1px solid var(--border-color);
}
[data-theme="light"] .top-header {
  background: rgba(255,255,255,0.85);
  border-bottom: 1px solid var(--border-color);
}
[data-theme="light"] .stat-card,
[data-theme="light"] .table-container,
[data-theme="light"] .chart-card {
  background: #ffffff;
  border: 1px solid var(--border-color);
}
[data-theme="light"] .nav-item:hover,
[data-theme="light"] .nav-item.active {
  background: rgba(124, 58, 237, 0.08);
}
[data-theme="light"] table thead {
  background: #f3f3f8;
}
[data-theme="light"] table tbody tr:hover {
  background: #f8f8fc;
}
[data-theme="light"] .form-control {
  background: #f3f3f8;
  border-color: rgba(0,0,0,0.1);
  color: #1a1a2e;
}
[data-theme="light"] .modal {
  background: #ffffff;
}

/* ── Theme Toggle ────────────────────────────────────────── */
.theme-toggle-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-light);
  background: var(--bg-card);
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  transition: all var(--transition-fast);
}
.theme-toggle-btn:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* ── Currency Selector ───────────────────────────────────── */
.currency-selector {
  position: relative;
}
.currency-select {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 0.8rem;
  font-family: inherit;
  cursor: pointer;
  outline: none;
  transition: border-color var(--transition-fast);
}
.currency-select:focus {
  border-color: var(--accent);
}
.currency-select option {
  background: var(--bg-card);
  color: var(--text-primary);
}

/* ── Charts Row ──────────────────────────────────────────── */
.charts-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}
.chart-card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 20px;
  border: 1px solid var(--border-color);
}
.chart-card h4 {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.chart-card h4 i {
  color: var(--accent);
}

/* ── Profit Calculator ───────────────────────────────────── */
.profit-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  padding: 0 20px 20px;
}
.profit-card {
  background: var(--bg-input);
  border-radius: var(--radius-md);
  padding: 20px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.profit-card i {
  font-size: 1.5rem;
}
.profit-card.income i { color: var(--success); }
.profit-card.expense i { color: var(--danger); }
.profit-card.net i { color: var(--accent); }
.profit-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.profit-value {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-primary);
}
.profit-card.income .profit-value { color: var(--success); }
.profit-card.expense .profit-value { color: var(--danger); }
.profit-card.net .profit-value { color: var(--accent-light); }

/* ── Calendar ────────────────────────────────────────────── */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  padding: 0 16px 16px;
}
.calendar-day-header {
  text-align: center;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  padding: 8px 0;
  text-transform: uppercase;
}
.calendar-day {
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 4px;
  font-size: 0.8rem;
  color: var(--text-secondary);
  background: var(--bg-input);
  position: relative;
  cursor: default;
  min-height: 60px;
  overflow: hidden;
}
.calendar-day.empty {
  background: transparent;
}
.calendar-day.today {
  border: 2px solid var(--accent);
  font-weight: 700;
  color: var(--accent-light);
}
.calendar-day .day-number {
  font-weight: 600;
  margin-bottom: 2px;
}
.calendar-day .cal-dots {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  justify-content: center;
}
.calendar-day .cal-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}
.calendar-day .cal-dot.active { background: var(--success); }
.calendar-day .cal-dot.expiring { background: var(--warning); }
.calendar-day .cal-dot.expired { background: var(--danger); }

/* Calendar day hover & click */
.calendar-day.has-events {
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s, background 0.15s;
}
.calendar-day.has-events:hover {
  transform: scale(1.08);
  box-shadow: 0 4px 16px rgba(99,102,241,0.25);
  background: rgba(99,102,241,0.12);
  z-index: 2;
}
.calendar-day .cal-count {
  position: absolute;
  top: 2px;
  right: 4px;
  font-size: 0.6rem;
  font-weight: 700;
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* Calendar Day Modal Styles */
.cal-modal-summary {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.cal-modal-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
}
.cal-modal-badge.expired { background: rgba(239,68,68,0.15); color: var(--danger); }
.cal-modal-badge.expiring { background: rgba(245,158,11,0.15); color: var(--warning); }
.cal-modal-badge.active { background: rgba(16,185,129,0.15); color: var(--success); }

.cal-modal-clients-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.cal-modal-client {
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  padding: 12px;
  border-left: 4px solid var(--text-muted);
}
.cal-modal-client.cal-modal-expired { border-left-color: var(--danger); }
.cal-modal-client.cal-modal-expiring { border-left-color: var(--warning); }
.cal-modal-client.cal-modal-active { border-left-color: var(--success); }

.cal-modal-client-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
  gap: 8px;
}
.cal-modal-client-info {
  display: flex;
  flex-direction: column;
}
.cal-modal-client-info strong {
  font-size: 0.95rem;
}
.cal-modal-platform {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 2px;
}
.cal-modal-status {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 12px;
  white-space: nowrap;
}
.cal-modal-status-expired { background: rgba(239,68,68,0.15); color: var(--danger); }
.cal-modal-status-expiring { background: rgba(245,158,11,0.15); color: var(--warning); }
.cal-modal-status-active { background: rgba(16,185,129,0.15); color: var(--success); }

.cal-modal-client-details {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
}
.cal-modal-client-details span {
  display: flex;
  align-items: center;
  gap: 4px;
}
.cal-modal-client-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.calendar-legend {
  display: flex;
  gap: 20px;
  justify-content: center;
  padding: 12px;
  font-size: 0.8rem;
  color: var(--text-secondary);
}
.calendar-legend span {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ── Templates ───────────────────────────────────────────── */
.templates-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 20px;
}
.template-card {
  background: var(--bg-input);
  border-radius: var(--radius-md);
  padding: 16px;
  border: 1px solid var(--border-color);
  transition: border-color var(--transition-fast);
}
.template-card:hover {
  border-color: var(--accent);
}
.template-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.template-card-header h4 {
  font-size: 0.95rem;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}
.template-card-header .badge {
  font-size: 0.7rem;
  padding: 2px 8px;
}
.template-card-body {
  font-size: 0.85rem;
  color: var(--text-secondary);
  white-space: pre-wrap;
  line-height: 1.5;
  background: var(--bg-card);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
}
.template-card-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

/* ── Activity Logs ───────────────────────────────────────── */
.activity-logs-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px 20px;
  max-height: 600px;
  overflow-y: auto;
}
.log-entry {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  font-size: 0.84rem;
}
.log-entry .log-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.8rem;
}
.log-entry .log-icon.create { background: var(--success-bg); color: var(--success); }
.log-entry .log-icon.edit   { background: rgba(124,58,237,0.12); color: var(--accent); }
.log-entry .log-icon.delete { background: var(--danger-bg); color: var(--danger); }
.log-entry .log-icon.renew  { background: rgba(59,130,246,0.12); color: var(--info); }
.log-entry .log-icon.payment{ background: var(--success-bg); color: var(--success); }
.log-entry .log-icon.export { background: var(--warning-bg); color: var(--warning); }
.log-entry .log-body {
  flex: 1;
}
.log-entry .log-body .log-text {
  color: var(--text-primary);
}
.log-entry .log-body .log-time {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ── Debtors overdue badge ───────────────────────────────── */
.overdue-badge {
  background: var(--danger-bg);
  color: var(--danger);
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
}

/* ── Responsive adjustments for new features ─────────────── */
@media (max-width: 768px) {
  .charts-row {
    grid-template-columns: 1fr;
  }
  .profit-grid {
    grid-template-columns: 1fr;
  }
  .calendar-grid {
    font-size: 0.7rem;
  }
  .calendar-day {
    min-height: 40px;
    padding: 2px;
  }
}
