/* ==============================================================
   FARMAMED Asys - Rediseño Bento-Box SaaS Premium (Estilo ACRU)
   ============================================================== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=JetBrains+Mono:wght@500;600;700&display=swap');

:root {
  /* Paleta Corporativa FARMAMED + Estilo Bento SaaS */
  --primary: #4d8c1e;
  --primary-light: #f2f8ec;
  --primary-hover: #3d7017;
  --primary-gradient: linear-gradient(135deg, #74b816 0%, #4d8c1e 100%);
  
  --secondary: #0056b3;
  --secondary-light: #edf5fd;
  
  --accent-lime: #84cc16;
  --accent-yellow: #facc15;
  --accent-amber: #f59e0b;
  --accent-red: #ef4444;

  /* Neutros Premium */
  --bg-body: #f4f5f8;
  --bg-card: #ffffff;
  --bg-input: #f8fafc;
  --bg-hover: #f1f5f9;
  --border: #e8ecf1;
  --border-focus: #74b816;

  /* Tipografía */
  --text-main: #111827;
  --text-secondary: #4b5563;
  --text-muted: #9ca3af;

  /* Dimensiones y Radios Bento */
  --radius-xs: 8px;
  --radius-sm: 12px;
  --radius-md: 16px;
  --radius-lg: 20px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* Sombras ultra suaves */
  --shadow-subtle: 0 1px 3px rgba(0, 0, 0, 0.02), 0 4px 12px rgba(0, 0, 0, 0.03);
  --shadow-hover: 0 10px 25px -3px rgba(0, 0, 0, 0.06), 0 4px 6px -2px rgba(0, 0, 0, 0.02);
  --shadow-glow-green: 0 4px 12px rgba(0, 0, 0, 0.08);

  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==============================================================
   5 PALETAS DE COLOR DEL SISTEMA (CONFIGURACIÓN)
   ============================================================== */
body[data-theme="verde"], [data-theme="verde"] {
  --primary: #4d8c1e;
  --primary-light: #f2f8ec;
  --primary-hover: #3d7017;
  --primary-gradient: linear-gradient(135deg, #74b816 0%, #4d8c1e 100%);
  --border-focus: #74b816;
  --accent-lime: #84cc16;
}
body[data-theme="verde"] .hikvision-credit-card {
  background: linear-gradient(135deg, #4d8c1e 0%, #366c15 100%);
  border-color: #65a30d;
}

body[data-theme="azul"], [data-theme="azul"] {
  --primary: #2563eb;
  --primary-light: #eff6ff;
  --primary-hover: #1d4ed8;
  --primary-gradient: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  --border-focus: #3b82f6;
  --accent-lime: #38bdf8;
}
body[data-theme="azul"] .hikvision-credit-card {
  background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
  border-color: #3b82f6;
}

body[data-theme="rojo"], [data-theme="rojo"] {
  --primary: #dc2626;
  --primary-light: #fef2f2;
  --primary-hover: #b91c1c;
  --primary-gradient: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  --border-focus: #ef4444;
  --accent-lime: #f87171;
}
body[data-theme="rojo"] .hikvision-credit-card {
  background: linear-gradient(135deg, #dc2626 0%, #991b1b 100%);
  border-color: #ef4444;
}

body[data-theme="morado"], [data-theme="morado"] {
  --primary: #7c3aed;
  --primary-light: #f5f3ff;
  --primary-hover: #6d28d9;
  --primary-gradient: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
  --border-focus: #8b5cf6;
  --accent-lime: #a78bfa;
}
body[data-theme="morado"] .hikvision-credit-card {
  background: linear-gradient(135deg, #7c3aed 0%, #5b21b6 100%);
  border-color: #8b5cf6;
}

body[data-theme="naranja"], [data-theme="naranja"] {
  --primary: #ea580c;
  --primary-light: #fff7ed;
  --primary-hover: #c2410c;
  --primary-gradient: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
  --border-focus: #f97316;
  --accent-lime: #fb923c;
}
body[data-theme="naranja"] .hikvision-credit-card {
  background: linear-gradient(135deg, #ea580c 0%, #c2410c 100%);
  border-color: #f97316;
}

/* ==============================================================
   MODO OSCURO - DEFINICIÓN BASE Y 5 PALETAS
   ============================================================== */
body[data-theme*="-oscuro"], [data-theme*="-oscuro"] {
  --bg-body: #0b0f19;
  --bg-card: #131b2e;
  --bg-input: #0f172a;
  --bg-hover: #1e293b;
  --border: #222f46;
  --text-main: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --shadow-subtle: 0 1px 3px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-hover: 0 10px 25px -3px rgba(0, 0, 0, 0.55);
}

body[data-theme*="-oscuro"] .app-sidebar {
  background-color: #0d1322;
  border-right-color: #1a2538;
}
body[data-theme*="-oscuro"] .app-topbar {
  background-color: #0d1322;
  border-bottom-color: #1a2538;
}
body[data-theme*="-oscuro"] .topbar-search-box {
  background-color: #131b2e;
  border-color: #222f46;
}
body[data-theme*="-oscuro"] .topbar-search-box input {
  color: #f8fafc;
}
body[data-theme*="-oscuro"] .icon-btn {
  background-color: #131b2e;
  border-color: #222f46;
  color: #94a3b8;
}
body[data-theme*="-oscuro"] .icon-btn:hover {
  background-color: #1e293b;
  color: #f8fafc;
}
body[data-theme*="-oscuro"] .user-profile-pill {
  background-color: #131b2e;
  border-color: #222f46;
}
body[data-theme*="-oscuro"] .nav-item.active {
  background-color: var(--primary);
  color: #ffffff;
}
body[data-theme*="-oscuro"] .nav-item.active svg {
  stroke: #ffffff;
}
body[data-theme*="-oscuro"] .table th {
  background-color: #0d1322;
  border-bottom-color: #222f46;
}
body[data-theme*="-oscuro"] .table td {
  border-bottom-color: #1a2538;
}
body[data-theme*="-oscuro"] .table tbody tr:hover {
  background-color: #1a2538;
}
body[data-theme*="-oscuro"] .transaction-row {
  background-color: #131b2e;
}
body[data-theme*="-oscuro"] .transaction-row:hover {
  background-color: #1a2538;
  border-color: #222f46;
}
body[data-theme*="-oscuro"] .form-control,
body[data-theme*="-oscuro"] .form-select {
  background-color: #0f172a;
  border-color: #222f46;
  color: #f8fafc;
}
body[data-theme*="-oscuro"] .btn-outline {
  background-color: #131b2e;
  border-color: #222f46;
  color: #f8fafc;
}
body[data-theme*="-oscuro"] .btn-outline:hover {
  background-color: #1e293b;
}
body[data-theme*="-oscuro"] .modal-box {
  background-color: #131b2e;
  border: 1px solid #222f46;
}
body[data-theme*="-oscuro"] .theme-card-option {
  background-color: #131b2e;
  border-color: #222f46;
}
body[data-theme*="-oscuro"] .theme-card-option:hover {
  border-color: #3b4e6b;
}
body[data-theme*="-oscuro"] .brand-logo-img {
  background: #ffffff;
  padding: 3px;
}
body[data-theme*="-oscuro"] .avatar-wrapper {
  background-color: #1a2538;
  border-color: #222f46;
}
body[data-theme*="-oscuro"] .avatar-dot-online {
  border-color: #131b2e;
}
body[data-theme*="-oscuro"] .segment-item {
  background: #1e293b;
}
body[data-theme*="-oscuro"] .segment-item.active-green {
  background: var(--accent-lime);
}
body[data-theme*="-oscuro"] .segment-item.active-darkgreen {
  background: var(--primary);
}

/* 5 PALETAS OSCURAS */
body[data-theme="azul-oscuro"], [data-theme="azul-oscuro"] {
  --primary: #3b82f6;
  --primary-light: rgba(59, 130, 246, 0.18);
  --primary-hover: #2563eb;
  --primary-gradient: linear-gradient(135deg, #60a5fa 0%, #3b82f6 100%);
  --border-focus: #3b82f6;
  --accent-lime: #38bdf8;
}
body[data-theme="azul-oscuro"] .hikvision-credit-card {
  background: linear-gradient(135deg, #1e3a8a 0%, #0f172a 100%);
  border-color: #3b82f6;
}

body[data-theme="rojo-oscuro"], [data-theme="rojo-oscuro"] {
  --primary: #ef4444;
  --primary-light: rgba(239, 68, 68, 0.18);
  --primary-hover: #dc2626;
  --primary-gradient: linear-gradient(135deg, #f87171 0%, #ef4444 100%);
  --border-focus: #ef4444;
  --accent-lime: #f87171;
}
body[data-theme="rojo-oscuro"] .hikvision-credit-card {
  background: linear-gradient(135deg, #7f1d1d 0%, #0f172a 100%);
  border-color: #ef4444;
}

body[data-theme="morado-oscuro"], [data-theme="morado-oscuro"] {
  --primary: #8b5cf6;
  --primary-light: rgba(139, 92, 246, 0.18);
  --primary-hover: #7c3aed;
  --primary-gradient: linear-gradient(135deg, #a78bfa 0%, #8b5cf6 100%);
  --border-focus: #8b5cf6;
  --accent-lime: #a78bfa;
}
body[data-theme="morado-oscuro"] .hikvision-credit-card {
  background: linear-gradient(135deg, #581c87 0%, #0f172a 100%);
  border-color: #8b5cf6;
}

body[data-theme="verde-oscuro"], [data-theme="verde-oscuro"] {
  --primary: #4ade80;
  --primary-light: rgba(74, 222, 128, 0.18);
  --primary-hover: #22c55e;
  --primary-gradient: linear-gradient(135deg, #86efac 0%, #4ade80 100%);
  --border-focus: #4ade80;
  --accent-lime: #84cc16;
}
body[data-theme="verde-oscuro"] .hikvision-credit-card {
  background: linear-gradient(135deg, #14532d 0%, #0f172a 100%);
  border-color: #22c55e;
}

body[data-theme="naranja-oscuro"], [data-theme="naranja-oscuro"] {
  --primary: #f97316;
  --primary-light: rgba(249, 115, 22, 0.18);
  --primary-hover: #ea580c;
  --primary-gradient: linear-gradient(135deg, #fb923c 0%, #f97316 100%);
  --border-focus: #f97316;
  --accent-lime: #fb923c;
}
body[data-theme="naranja-oscuro"] .hikvision-credit-card {
  background: linear-gradient(135deg, #7c2d12 0%, #0f172a 100%);
  border-color: #ea580c;
}

/* Selector Visual de Colores */
.theme-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 16px;
  margin-top: 14px;
}

.theme-card-option {
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  background: var(--bg-card);
  transition: var(--transition);
  position: relative;
  text-align: center;
}

.theme-card-option:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-subtle);
  border-color: #cbd5e1;
}

.theme-card-option.active {
  border-color: var(--primary);
  background: var(--primary-light);
}

.theme-color-circle {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-weight: 800;
  font-size: 1.1rem;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.12);
  position: relative;
}

.theme-circle-split {
  border: 2px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}

.theme-color-circle .check-mark {
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
}

.theme-card-name {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-main);
}

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

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-body);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  -webkit-font-smoothing: antialiased;
}

/* Layout */
.app-container {
  display: flex;
  width: 100%;
  min-height: 100vh;
}

/* ==============================================================
   SIDEBAR BENTO
   ============================================================== */
.app-sidebar {
  width: 260px;
  background-color: #ffffff;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 40;
  padding: 24px 16px;
  transition: var(--transition);
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 8px 24px 8px;
}

.brand-logo-img {
  width: 42px;
  height: 42px;
  object-fit: contain;
  border-radius: var(--radius-sm);
}

.brand-text h1 {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.5px;
  line-height: 1.1;
}

.brand-text span {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 10px;
}

.nav-section-title {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 12px 12px 6px 12px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 16px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.nav-item svg {
  width: 20px;
  height: 20px;
  stroke-width: 2;
  transition: var(--transition);
}

.nav-item:hover {
  background-color: var(--bg-hover);
  color: var(--text-main);
}

.nav-item.active {
  background-color: #111827; /* Dark active pill igual que el Dashboard en la imagen de referencia */
  color: #ffffff;
}

.nav-item.active svg {
  stroke: #ffffff;
}

/* Tarjeta Widget Inferior en Sidebar (Estilo 'Upgrade to Pro' del diseño) */
.sidebar-promo-card {
  background: #111827;
  color: #ffffff;
  padding: 18px;
  border-radius: var(--radius-md);
  margin-top: auto;
  position: relative;
  overflow: hidden;
  border: 1px solid #1f2937;
}

.promo-badge-icon {
  width: 32px;
  height: 32px;
  background: #1f2937;
  border: 1px solid #374151;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
}

.sidebar-promo-card h4 {
  font-size: 0.92rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.sidebar-promo-card p {
  font-size: 0.74rem;
  color: #9ca3af;
  line-height: 1.4;
  margin-bottom: 12px;
}

.sidebar-promo-btn {
  display: block;
  width: 100%;
  background: var(--primary);
  color: #ffffff;
  text-align: center;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  font-weight: 700;
  text-decoration: none;
  transition: var(--transition);
}

.sidebar-promo-btn:hover {
  background: var(--primary-hover);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* ==============================================================
   TOPBAR PREMIUM
   ============================================================== */
.app-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow-y: auto;
}

.app-topbar {
  background: var(--bg-card);
  padding: 14px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 30;
}

.topbar-search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-body);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  padding: 8px 18px;
  width: 320px;
  transition: var(--transition);
}

.topbar-search-box:focus-within {
  border-color: var(--primary);
  background: var(--bg-card);
  box-shadow: 0 0 0 3px rgba(116, 184, 22, 0.15);
}

.topbar-search-box input {
  border: none;
  background: transparent;
  outline: none;
  font-size: 0.85rem;
  color: var(--text-main);
  width: 100%;
}

.topbar-user-area {
  display: flex;
  align-items: center;
  gap: 14px;
}

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
}

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

/* Notificaciones del Lector Dropdown */
.notif-wrapper {
  position: relative;
}

.notif-btn {
  position: relative;
}

.notif-badge-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 0 2px var(--bg-card);
  animation: pulse-live-dot 2s infinite ease-in-out;
}

@keyframes pulse-live-dot {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1.15); box-shadow: 0 0 0 5px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.notif-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 380px;
  max-width: 90vw;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: 0 20px 40px -8px rgba(0, 0, 0, 0.22);
  z-index: 1000;
  display: none;
  flex-direction: column;
  overflow: hidden;
  animation: dropdown-fade-in 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.notif-dropdown.show {
  display: flex;
}

@keyframes dropdown-fade-in {
  from {
    opacity: 0;
    transform: translateY(-8px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

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

.notif-device-strip {
  padding: 10px 16px;
  background: var(--bg-hover);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.notif-device-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.notif-device-info .ip-tag {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--primary);
}

.notif-device-info .status-text {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.notif-section-title {
  padding: 10px 16px 6px 16px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  text-transform: uppercase;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.notif-list {
  max-height: 290px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.notif-item {
  padding: 10px 16px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s ease;
  text-decoration: none;
  color: inherit;
}

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

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

.notif-item-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}

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

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

.notif-item-meta {
  font-size: 0.72rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
  flex-wrap: wrap;
}

.notif-footer {
  padding: 10px 16px;
  background: var(--bg-body);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.notif-footer a {
  color: var(--primary);
  font-weight: 700;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.notif-footer a:hover {
  text-decoration: underline;
}

.bg-blue {
  background: #eff6ff;
  color: #2563eb;
}

body[data-theme*="-oscuro"] .bg-blue {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
}

.user-profile-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 12px 5px 6px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
}

.user-avatar-circle {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--primary);
  color: #ffffff;
  font-weight: 700;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.user-info-text {
  line-height: 1.2;
}

.user-info-text .name {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-main);
}

.user-info-text .role {
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* ==============================================================
   CONTENIDO & TARJETAS BENTO
   ============================================================== */
.content-wrapper {
  padding: 24px 32px 48px 32px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  max-width: 1440px;
  width: 100%;
}

/* Soporte unificado para .card y .bento-card */
.card, .bento-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-subtle);
  position: relative;
  transition: var(--transition);
}

.card {
  overflow: hidden;
}

.bento-card {
  padding: 24px;
  display: flex;
  flex-direction: column;
}

.card:hover, .bento-card:hover {
  box-shadow: var(--shadow-hover);
}

.card-header, .bento-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-card);
  border-top-left-radius: inherit;
  border-top-right-radius: inherit;
}

.bento-header {
  margin-bottom: 20px;
}

.card-body {
  padding: 24px;
}

.card-title, .bento-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.3px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Gran Tarjeta Verde 'My Card' (Terminal Hikvision) */
.hikvision-credit-card {
  background: #366c15;
  border-radius: var(--radius-lg);
  padding: 22px;
  color: #ffffff;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-subtle);
  border: 1px solid #43841a;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 180px;
}

.card-chip {
  width: 36px;
  height: 26px;
  background: #eab308;
  border-radius: 6px;
  margin-bottom: 16px;
  border: 1px solid #ca8a04;
}

.card-num {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1rem;
  letter-spacing: 2px;
  font-weight: 600;
  margin-bottom: 12px;
  text-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.card-holder {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.75rem;
  opacity: 0.9;
}

/* Botones Cuadrados de Acción Rápida (Top up, Send, etc.) */
.quick-action-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-top: 16px;
}

.quick-action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 6px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  text-decoration: none;
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 600;
  transition: var(--transition);
}

.quick-action-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-light);
  transform: translateY(-2px);
}

.quick-action-btn svg {
  width: 22px;
  height: 22px;
}

/* Fila de Avatares Circulares (Quick Payment / Personal de Turno) */
.avatars-quick-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 10px;
}

.avatar-person-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  text-decoration: none;
}

.avatar-wrapper {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: var(--text-main);
  position: relative;
  font-size: 0.95rem;
  border: 2px solid #ffffff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
  transition: var(--transition);
}

.avatar-person-item:hover .avatar-wrapper {
  transform: scale(1.08);
  border-color: var(--primary);
}

.avatar-dot-online {
  width: 11px;
  height: 11px;
  background: var(--primary);
  border: 2px solid #ffffff;
  border-radius: 50%;
  position: absolute;
  bottom: 0;
  right: 0;
}

.avatar-name-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-main);
}

/* Barra de Progreso Segmentada (Estilo 'Monthly spending limit' en referencia) */
.segmented-progress-bar {
  display: flex;
  gap: 4px;
  height: 14px;
  margin: 14px 0 8px 0;
}

.segment-item {
  flex: 1;
  border-radius: 4px;
  background: #e2e8f0;
}

.segment-item.active-green { background: var(--accent-lime); }
.segment-item.active-darkgreen { background: var(--primary); }
.segment-item.active-yellow { background: #facc15; }
.segment-item.active-amber { background: #f59e0b; }

/* Lista de Actividad / Marcas (Estilo 'Transaction History' en referencia) */
.transaction-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.transaction-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  border: 1px solid transparent;
  transition: var(--transition);
}

.transaction-row:hover {
  background: var(--bg-hover);
  border-color: var(--border);
}

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

.tx-icon-box {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

.tx-icon-box.green { background: var(--primary-light); color: var(--primary); }
.tx-icon-box.blue { background: var(--secondary-light); color: var(--secondary); }
.tx-icon-box.amber { background: #fffbeb; color: var(--accent-amber); }
.tx-icon-box.dark { background: #111827; color: #ffffff; }

.tx-info h5 {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 2px;
}

.tx-info p {
  font-size: 0.74rem;
  color: var(--text-muted);
}

.tx-right {
  text-align: right;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.tx-time {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--text-main);
}

/* Badges y Pastillas */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  font-size: 0.72rem;
  font-weight: 700;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-theme { background: var(--primary-light); color: var(--primary); }
.badge-success { background: #ecfdf5; color: #059669; }
.badge-warning { background: #fffbeb; color: #d97706; }
.badge-danger { background: #fef2f2; color: #dc2626; }
.badge-primary { background: var(--primary-light); color: var(--primary); }
.badge-neutral { background: var(--bg-hover); color: var(--text-secondary); }

/* Botones Generales */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 18px;
  font-size: 0.84rem;
  font-weight: 700;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: var(--transition);
}

.btn-primary {
  background: #111827;
  color: #ffffff;
}

.btn-primary:hover {
  background: #1f2937;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
}

.btn-green {
  background: var(--primary);
  color: #ffffff;
}

.btn-green:hover {
  background: var(--primary-hover);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.btn-danger {
  background: #dc2626;
  color: #ffffff;
  border-color: #dc2626;
}

.btn-danger:hover {
  background: #b91c1c;
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.25);
}

.btn-outline {
  background: var(--bg-card);
  border-color: var(--border);
  color: var(--text-main);
}

.btn-outline:hover {
  background: var(--bg-hover);
}

.btn-sm {
  padding: 6px 14px;
  font-size: 0.78rem;
  border-radius: var(--radius-sm);
}

.btn-xs {
  padding: 3px 8px;
  font-size: 0.72rem;
  border-radius: var(--radius-xs);
}

/* Botón de Ciclo de Período Animado (Día -> Semana -> Mes -> Año) */
.btn-period-cycle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--primary);
  color: #ffffff;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 700;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
  user-select: none;
  position: relative;
  overflow: hidden;
}

.btn-period-cycle:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.16);
}

.btn-period-cycle:active {
  transform: translateY(0) scale(0.97);
}

.btn-period-cycle .cycle-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.btn-period-cycle.is-cycling .cycle-icon {
  animation: cycle-spin-kf 0.45s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes cycle-spin-kf {
  0% { transform: rotate(0deg) scale(1); }
  50% { transform: rotate(180deg) scale(1.22); }
  100% { transform: rotate(360deg) scale(1); }
}

.btn-period-cycle .period-text-wrapper {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.1;
  min-width: 58px;
}

.btn-period-cycle .period-tag {
  font-size: 0.62rem;
  opacity: 0.82;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}

.btn-period-cycle .period-current-label {
  font-size: 0.86rem;
  font-weight: 800;
  display: inline-block;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.btn-period-cycle.is-cycling .period-current-label {
  transform: translateY(-8px) scale(0.85);
  opacity: 0;
}

.btn-period-cycle .cycle-next-hint {
  font-size: 0.72rem;
  opacity: 0.88;
  background: rgba(255, 255, 255, 0.2);
  padding: 2px 7px;
  border-radius: var(--radius-xs);
  font-weight: 700;
  letter-spacing: 0.2px;
  transition: background 0.15s ease;
}

.btn-period-cycle:hover .cycle-next-hint {
  background: rgba(255, 255, 255, 0.32);
}

/* Chips de Selección de Días Laborales */
.day-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
  margin: 0;
}

.day-chip input[type="checkbox"] {
  display: none;
}

.day-chip span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  border: 1px solid var(--border);
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--text-secondary);
  transition: all 0.15s ease;
  min-width: 42px;
  text-align: center;
}

.day-chip input[type="checkbox"]:checked + span {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.day-chip:hover span {
  border-color: var(--primary);
}

/* Tablas */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.table th {
  background: var(--bg-body);
  padding: 12px 16px;
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  border-bottom: 1px solid var(--border);
}

.table td {
  padding: 14px 16px;
  font-size: 0.86rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-main);
  vertical-align: middle;
}

.table tbody tr:hover {
  background: #fbfcfd;
}

/* ==============================================================
   PAGINACIÓN UNIVERSAL PARA TABLAS (BENTO-BOX SAAS)
   ============================================================== */
.table-pagination-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  background: var(--bg-card);
  border-bottom-left-radius: inherit;
  border-bottom-right-radius: inherit;
}

.pagination-left,
.pagination-right {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.pagination-info {
  font-size: 0.82rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.pagination-info strong {
  color: var(--text-main);
  font-weight: 700;
}

.pagination-size-wrapper {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.pagination-size-select {
  padding: 5px 8px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-main);
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: var(--transition);
  outline: none;
}

.pagination-size-select:focus {
  border-color: var(--border-focus);
}

.pagination-nav {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.pagination-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 34px;
  padding: 0 8px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-main);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  user-select: none;
}

.pagination-btn:hover:not(:disabled):not(.active) {
  background: var(--bg-hover);
  border-color: var(--border-focus);
  color: var(--primary);
}

.pagination-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff !important;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(77, 140, 30, 0.28);
}

.pagination-btn:disabled,
.pagination-btn.disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
  background: var(--bg-body);
}

.pagination-ellipsis {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 34px;
  font-size: 0.85rem;
  color: var(--text-muted);
  user-select: none;
}

/* Soporte para modo oscuro */
body[data-theme*="-oscuro"] .table-pagination-container {
  background: var(--bg-card);
  border-top-color: var(--border);
}

body[data-theme*="-oscuro"] .pagination-size-select {
  background: var(--bg-input);
  border-color: var(--border);
  color: var(--text-main);
}

body[data-theme*="-oscuro"] .pagination-btn {
  background: var(--bg-card);
  border-color: var(--border);
  color: var(--text-main);
}

body[data-theme*="-oscuro"] .pagination-btn:hover:not(:disabled):not(.active) {
  background: var(--bg-hover);
  border-color: var(--border-focus);
  color: var(--primary);
}

/* Ocultar en impresión y forzar despliegue de todas las filas */
@media print {
  .table-pagination-container {
    display: none !important;
  }
  .table tbody tr[data-paged-hidden] {
    display: table-row !important;
  }
}

@media (max-width: 640px) {
  .table-pagination-container {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
    gap: 12px;
  }
  .pagination-left,
  .pagination-right {
    justify-content: center;
    width: 100%;
  }
}

/* Modales: Solo oscurecer fondo, sin blur */
.modal-backdrop,
.permiso-modal-overlay,
.reports-modal-overlay,
#modalPunches,
#modalRawPunches {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.65);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 999;
}

.modal-backdrop.show {
  display: flex;
}

.modal-box {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-hover);
}

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

.modal-body {
  padding: 24px;
}

.modal-footer {
  padding: 18px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  background: var(--bg-body);
}

/* ==============================================================
   TARJETAS DE MÉTRICAS & KPIS (STATS GRID)
   ============================================================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 20px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  box-shadow: var(--shadow-subtle);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  transition: var(--transition);
}

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

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

.stat-info p {
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 6px;
}

.stat-info h3 {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.5px;
  margin-bottom: 6px;
  color: var(--text-main);
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-icon.green { background: var(--primary-light); color: var(--primary); }
.stat-icon.blue { background: #eff6ff; color: #2563eb; }
.stat-icon.amber { background: #fffbeb; color: #d97706; }
.stat-icon.red { background: #fef2f2; color: #dc2626; }

/* ==============================================================
   ELEMENTOS DE FORMULARIO
   ============================================================== */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 6px;
}

.form-control, .form-select {
  width: 100%;
  padding: 9px 14px;
  font-size: 0.86rem;
  font-family: inherit;
  color: var(--text-main);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: var(--transition);
  outline: none;
}

.form-control:focus, .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(116, 184, 22, 0.15);
  background: var(--bg-card);
}


/* Responsive */
@media (max-width: 1200px) {
  .dashboard-bento-grid {
    grid-template-columns: 1fr !important;
  }
}

@media (max-width: 992px) {
  .app-sidebar {
    position: fixed;
    left: -260px;
  }
  .app-sidebar.open {
    left: 0;
  }
  .content-wrapper {
    padding: 16px;
  }
  .app-topbar {
    padding: 12px 16px;
  }
}

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

/* Pestañas de Métodos de Registro Biométrico */
.method-tab {
  background: transparent;
  border: 1px solid transparent;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.method-tab:hover {
  background: var(--bg-hover);
  color: var(--text-main);
}
.method-tab.active {
  background: var(--primary-light);
  color: var(--primary);
  border-color: rgba(var(--primary), 0.2);
}
body[data-theme*="-oscuro"] .method-tab.active {
  background: var(--primary-light);
  color: var(--primary);
}
body[data-theme*="-oscuro"] .badge-warning {
  background: rgba(217, 119, 6, 0.2);
  color: #fbbf24;
}
body[data-theme*="-oscuro"] .badge-success {
  background: rgba(5, 150, 105, 0.2);
  color: #34d399;
}
body[data-theme*="-oscuro"] .badge-danger {
  background: rgba(220, 38, 38, 0.2);
  color: #f87171;
}

/* Chips de Selección de Días Laborales */
.day-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  height: 34px;
  padding: 0 10px;
  font-size: 0.76rem;
  font-weight: 700;
  border-radius: var(--radius-sm, 6px);
  border: 1px solid var(--border);
  background: var(--bg-surface, #fff);
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

.day-chip input[type="checkbox"] {
  display: none;
}

.day-chip:hover {
  border-color: var(--primary);
  color: var(--text-main);
}

.day-chip:has(input[type="checkbox"]:checked),
.day-chip.active {
  background: var(--primary) !important;
  color: #ffffff !important;
  border-color: var(--primary) !important;
  box-shadow: 0 2px 6px rgba(13, 148, 136, 0.25);
}

.btn-xs {
  padding: 3px 8px;
  font-size: 0.72rem;
  font-weight: 600;
  border-radius: var(--radius-sm, 6px);
  line-height: 1.3;
}

/* ==============================================================
   SISTEMA DE NOTIFICACIONES Y ALERTAS PREMIUM (TOAST & BANNERS)
   ============================================================== */

/* Contenedor Flotante de Toasts */
#toastContainer {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 100000;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 440px;
  width: calc(100vw - 48px);
  pointer-events: none;
}

.toast-item {
  pointer-events: auto;
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px 18px;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: var(--radius-md, 14px);
  box-shadow: 0 16px 36px -6px rgba(0, 0, 0, 0.14), 0 0 0 1px rgba(0, 0, 0, 0.06);
  border-left: 5px solid #6b7280;
  overflow: hidden;
  animation: toastSlideIn 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  transition: all 0.25s ease;
}

.toast-item.toast-leave {
  animation: toastSlideOut 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes toastSlideIn {
  from {
    opacity: 0;
    transform: translateX(110%) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

@keyframes toastSlideOut {
  from {
    opacity: 1;
    transform: translateX(0) scale(1);
    max-height: 140px;
    margin-bottom: 0;
  }
  to {
    opacity: 0;
    transform: translateX(110%) scale(0.92);
    max-height: 0;
    margin-bottom: -12px;
    padding-top: 0;
    padding-bottom: 0;
  }
}

.toast-item.toast-success {
  border-left-color: #10b981;
}
.toast-item.toast-danger,
.toast-item.toast-error {
  border-left-color: #ef4444;
}
.toast-item.toast-warning {
  border-left-color: #f59e0b;
}
.toast-item.toast-info {
  border-left-color: var(--primary, #4d8c1e);
}

.toast-icon-box {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}
.toast-success .toast-icon-box {
  background: rgba(16, 185, 129, 0.12);
  color: #10b981;
}
.toast-danger .toast-icon-box,
.toast-error .toast-icon-box {
  background: rgba(239, 68, 68, 0.12);
  color: #ef4444;
}
.toast-warning .toast-icon-box {
  background: rgba(245, 158, 11, 0.12);
  color: #f59e0b;
}
.toast-info .toast-icon-box {
  background: rgba(59, 130, 246, 0.12);
  color: #3b82f6;
}

.toast-content {
  flex: 1;
  min-width: 0;
}
.toast-title {
  font-size: 0.86rem;
  font-weight: 800;
  color: var(--text-main, #111827);
  margin-bottom: 3px;
  line-height: 1.25;
}
.toast-message {
  font-size: 0.8rem;
  color: var(--text-secondary, #4b5563);
  line-height: 1.45;
  word-break: break-word;
}
.toast-close-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-muted, #9ca3af);
  padding: 4px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  flex-shrink: 0;
}
.toast-close-btn:hover {
  color: var(--text-main, #111827);
  background: rgba(0, 0, 0, 0.05);
}
.toast-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  background: rgba(0, 0, 0, 0.08);
  width: 100%;
}
.toast-progress-bar {
  height: 100%;
  width: 100%;
  transition: width linear;
}
.toast-success .toast-progress-bar { background: #10b981; }
.toast-danger .toast-progress-bar,
.toast-error .toast-progress-bar { background: #ef4444; }
.toast-warning .toast-progress-bar { background: #f59e0b; }
.toast-info .toast-progress-bar { background: var(--primary, #4d8c1e); }

/* Alertas fijas embebidas en la página (Alert Cards) */
.alert-card {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px 20px;
  border-radius: var(--radius-md, 14px);
  margin-bottom: 22px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.03);
  animation: alertFadeIn 0.3s ease-out;
  transition: all 0.2s ease;
}

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

.alert-card-success {
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-left: 5px solid #10b981;
}
.alert-card-danger,
.alert-card-error {
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-left: 5px solid #ef4444;
}
.alert-card-warning {
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-left: 5px solid #f59e0b;
}
.alert-card-info {
  background: rgba(59, 130, 246, 0.08);
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-left: 5px solid #3b82f6;
}

.alert-card-icon {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}
.alert-card-success .alert-card-icon { background: rgba(16, 185, 129, 0.15); color: #059669; }
.alert-card-danger .alert-card-icon,
.alert-card-error .alert-card-icon { background: rgba(239, 68, 68, 0.15); color: #dc2626; }
.alert-card-warning .alert-card-icon { background: rgba(245, 158, 11, 0.15); color: #d97706; }
.alert-card-info .alert-card-icon { background: rgba(59, 130, 246, 0.15); color: #2563eb; }

.alert-card-content {
  flex: 1;
}
.alert-card-title {
  font-weight: 800;
  font-size: 0.88rem;
  margin-bottom: 3px;
}
.alert-card-success .alert-card-title { color: #065f46; }
.alert-card-danger .alert-card-title,
.alert-card-error .alert-card-title { color: #991b1b; }
.alert-card-warning .alert-card-title { color: #92400e; }
.alert-card-info .alert-card-title { color: #1e40af; }

.alert-card-text {
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.45;
}
.alert-card-success .alert-card-text { color: #047857; }
.alert-card-danger .alert-card-text,
.alert-card-error .alert-card-text { color: #b91c1c; }
.alert-card-warning .alert-card-text { color: #b45309; }
.alert-card-info .alert-card-text { color: #1d4ed8; }

.alert-card-close {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  opacity: 0.6;
  color: var(--text-muted, #9ca3af);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.15s ease;
}
.alert-card-close:hover {
  opacity: 1;
  color: var(--text-main, #111827);
}

/* ==============================================================
   MODAL DE COPIA DE SEGURIDAD & RESTAURACIÓN (BACKUP & RESTORE)
   ============================================================== */
.backup-tabs {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  background: var(--bg-body);
}

.backup-tab-btn {
  padding: 14px 18px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-secondary);
  font-weight: 700;
  font-size: 0.84rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
  position: relative;
  top: 1px;
}

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

.backup-tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  background: var(--bg-card);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

.backup-tab-badge {
  background: var(--primary-light);
  color: var(--primary);
  font-size: 0.7rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: var(--radius-full);
}

.backup-type-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  background: var(--bg-card);
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.backup-type-card:hover {
  border-color: var(--primary);
  transform: translateY(-1px);
  box-shadow: var(--shadow-subtle);
}

.backup-type-card.selected {
  border-color: var(--primary);
  background: rgba(77, 140, 30, 0.04);
}

.backup-dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 32px 24px;
  text-align: center;
  background: var(--bg-body);
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.backup-dropzone:hover,
.backup-dropzone.dragover {
  border-color: var(--primary);
  background: rgba(77, 140, 30, 0.05);
}

.backup-file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  transition: all 0.15s ease;
  gap: 12px;
}

.backup-file-item:hover {
  border-color: rgba(77, 140, 30, 0.4);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

