* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Segoe UI', Roboto, Arial, sans-serif; }
body { background-color: #f4f6f9; color: #333; min-height: 100vh; }
.d-none { display: none !important; }
.text-center { text-align: center; }
.text-right { text-align: right; }

.top-right-panel {
  position: fixed; top: 15px; right: 20px; z-index: 2000;
  display: flex; flex-direction: column; align-items: flex-end; gap: 6px;
}
.db-status-fixed {
  display: flex; align-items: center; gap: 8px; padding: 7px 14px;
  border-radius: 20px; background-color: #ffffff; font-size: 13px; font-weight: 600;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12); transition: all 0.3s ease;
}
.fecha-actual {
  font-size: 11px; font-weight: 600; color: #555; background: #ffffff;
  padding: 4px 10px; border-radius: 12px; box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}
.db-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; background-color: currentColor; }
.destello { animation: efectoGlow 1.2s infinite ease-in-out; }
@keyframes efectoGlow {
  0% { transform: scale(0.85); box-shadow: 0 0 2px currentColor; opacity: 0.5; }
  50% { transform: scale(1.25); box-shadow: 0 0 8px currentColor, 0 0 14px currentColor; opacity: 1; }
  100% { transform: scale(0.85); box-shadow: 0 0 2px currentColor; opacity: 0.5; }
}
.status-connecting { color: #d97706; }
.status-connected  { color: #059669; }
.status-reading    { color: #2563eb; }
.status-writing    { color: #ea580c; }
.status-error      { color: #dc2626; }

.toast-container {
  position: fixed; bottom: 25px; right: 25px; z-index: 9999;
  display: flex; flex-direction: column; gap: 10px; pointer-events: none;
}
.toast-notification {
  min-width: 280px; max-width: 380px; padding: 14px 18px; border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15); color: #ffffff; font-size: 14px; font-weight: 500;
  display: flex; align-items: center; justify-content: space-between; pointer-events: auto;
  opacity: 0; transform: translateY(20px); transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}
.toast-notification.show { opacity: 1; transform: translateY(0); }
.toast-success { background-color: #059669; border-left: 5px solid #047857; }
.toast-error   { background-color: #dc2626; border-left: 5px solid #b91c1c; }
.toast-warning { background-color: #d97706; border-left: 5px solid #b45309; }
.toast-info    { background-color: #2563eb; border-left: 5px solid #1d4ed8; }
.toast-content { display: flex; align-items: center; gap: 10px; flex: 1; }
.toast-close { background: transparent; border: none; color: white; font-size: 16px; cursor: pointer; padding: 0 4px; opacity: 0.8; }
.toast-close:hover { opacity: 1; }

.login-wrapper {
  display: flex; width: 100vw; height: 100vh; overflow: hidden; background: #f0f2f5;
}
.login-sidebar-brand {
  flex: 1.1; background: linear-gradient(135deg, #001830 0%, #003366 100%); color: white;
  display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 40px; text-align: center;
  position: relative; box-shadow: 5px 0 15px rgba(0,0,0,0.1);
}
.login-sidebar-brand::after {
  content: ''; position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  background: radial-gradient(circle at 80% 20%, rgba(0, 168, 255, 0.15) 0%, transparent 50%);
  pointer-events: none;
}
.login-logo-icon {
  width: 80px; height: 80px; background: rgba(255, 255, 255, 0.1); border-radius: 20px;
  display: flex; align-items: center; justify-content: center; font-size: 38px; margin-bottom: 20px;
  box-shadow: 0 8px 20px rgba(0,0,0,0.2); border: 1px solid rgba(255,255,255,0.2);
}
.login-sidebar-brand h1 { font-size: 28px; font-weight: 700; margin-bottom: 10px; letter-spacing: 0.5px; }
.login-sidebar-brand h3 { font-size: 16px; font-weight: 400; color: #93c5fd; margin-bottom: 25px; }
.login-sidebar-brand p { font-size: 14px; color: #cbd5e1; max-width: 380px; line-height: 1.5; }

.login-main-form {
  flex: 1; display: flex; align-items: center; justify-content: center; padding: 30px; background: #ffffff;
}
.login-card {
  width: 100%; max-width: 400px; padding: 40px; background: #ffffff; border-radius: 12px;
}
.login-card h2 { color: #0f172a; font-size: 24px; font-weight: 700; margin-bottom: 8px; }
.login-card p.subtitle { color: #64748b; font-size: 14px; margin-bottom: 30px; }

.form-group { margin-bottom: 20px; }
.form-group label { display: block; margin-bottom: 8px; font-size: 13px; font-weight: 600; color: #334155; }
.form-group input, .form-select {
  width: 100%; padding: 12px 14px; border: 1px solid #cbd5e1; border-radius: 8px; font-size: 14px;
  transition: all 0.2s ease; background: #f8fafc; color: #1e293b;
}
.form-group input:focus, .form-select:focus {
  outline: none; border-color: #003366; background: #ffffff; box-shadow: 0 0 0 3px rgba(0, 51, 102, 0.1);
}

button { cursor: pointer; border: none; border-radius: 8px; font-weight: 600; transition: all 0.2s; }
#btnLogin {
  width: 100%; padding: 13px; background-color: #003366; color: white; font-size: 15px;
  box-shadow: 0 4px 12px rgba(0, 51, 102, 0.25);
}
#btnLogin:hover { background-color: #002244; transform: translateY(-1px); }

.mensaje { margin-top: 15px; padding: 12px; border-radius: 8px; font-size: 13px; text-align: center; display: none; }
.mensaje.error { background-color: #fef2f2; color: #dc2626; border: 1px solid #fecaca; display: block; }
.mensaje.exito { background-color: #f0fdf4; color: #16a34a; border: 1px solid #bbf7d0; display: block; }

.app-layout { display: flex; height: 100vh; overflow: hidden; }
.sidebar { width: 260px; background-color: #002244; color: #ffffff; display: flex; flex-direction: column; justify-content: space-between; }
.sidebar-brand { padding: 20px; background-color: #001830; display: flex; align-items: center; justify-content: space-between; }
.sidebar-brand h3 { font-size: 18px; }
.badge-version { background: #0055a5; font-size: 10px; padding: 2px 6px; border-radius: 10px; }

.user-card { display: flex; align-items: center; padding: 15px 20px; background-color: rgba(255,255,255,0.05); border-bottom: 1px solid rgba(255,255,255,0.1); }
.user-avatar { width: 38px; height: 38px; border-radius: 50%; background-color: #0055a5; display: flex; align-items: center; justify-content: center; font-weight: bold; margin-right: 12px; }
.user-info h4 { font-size: 14px; }
.user-role-badge { font-size: 11px; background: #28a745; color: white; padding: 2px 6px; border-radius: 4px; }

.sidebar-menu { flex: 1; padding-top: 15px; overflow-y: auto; }
.sidebar-menu ul { list-style: none; }
.menu-item { padding: 12px 20px; display: flex; align-items: center; color: #c2c7d0; cursor: pointer; transition: 0.2s; font-size: 14px; }
.menu-item .icon { margin-right: 12px; font-size: 16px; }
.menu-item:hover { background-color: rgba(255,255,255,0.1); color: #fff; }
.menu-item.active { background-color: #0055a5; color: #fff; border-left: 4px solid #00a8ff; }

.sidebar-footer { padding: 15px 20px; border-top: 1px solid rgba(255,255,255,0.1); }
.btn-logout { width: 100%; padding: 9px; background-color: #dc3545; color: white; font-size: 13px; }

.main-content { flex: 1; display: flex; flex-direction: column; overflow-y: auto; }
.top-bar { background: #ffffff; padding: 15px 30px; padding-right: 200px; display: flex; justify-content: space-between; align-items: center; box-shadow: 0 2px 5px rgba(0,0,0,0.05); }
.content-body { padding: 25px; flex: 1; }
.welcome-box { background: white; padding: 25px; border-radius: 8px; border-left: 5px solid #003366; }

.module-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.btn-primary { background-color: #003366; color: white; padding: 8px 16px; font-size: 13px; }

.table-responsive { background: white; border-radius: 8px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.05); }
.tabla-custom { width: 100%; border-collapse: collapse; text-align: left; }
.tabla-custom th, .tabla-custom td { padding: 12px 15px; border-bottom: 1px solid #eee; font-size: 14px; }
.tabla-custom th { background-color: #f8f9fa; color: #495057; font-weight: 600; }

.badge-activo { background-color: #d1fae5; color: #065f46; padding: 3px 8px; border-radius: 12px; font-size: 12px; font-weight: bold; }
.badge-inactivo { background-color: #fee2e2; color: #991b1b; padding: 3px 8px; border-radius: 12px; font-size: 12px; font-weight: bold; }

.action-buttons { display: flex; justify-content: center; gap: 6px; }
.btn-action { padding: 5px 10px; font-size: 12px; border-radius: 4px; border: none; cursor: pointer; color: white; transition: 0.2s; }
.btn-action.edit { background-color: #0284c7; }
.btn-action.toggle { background-color: #d97706; }
.btn-action.delete { background-color: #dc2626; }
.btn-action:hover { opacity: 0.85; }

.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.5); display: flex; justify-content: center; align-items: center; z-index: 3000; }
.modal-content { background: #ffffff; width: 90%; max-width: 500px; border-radius: 8px; overflow: hidden; }
.modal-header { background-color: #003366; color: white; padding: 15px 20px; display: flex; justify-content: space-between; }
.btn-close { font-size: 20px; cursor: pointer; }
.modal-body { padding: 20px; }
.modal-footer { padding: 12px 20px; background-color: #f8f9fa; display: flex; justify-content: flex-end; gap: 10px; }
.form-row { display: flex; gap: 15px; }
.form-group.half { flex: 1; }
.btn-secondary { background-color: #6c757d; color: white; padding: 8px 16px; }

.report-container { width: 100%; }
.report-header { background: #ffffff; padding: 20px 25px; border-radius: 8px; border-left: 5px solid #003366; margin-bottom: 20px; box-shadow: 0 2px 8px rgba(0,0,0,0.05); }
.report-header h2 { color: #003366; font-size: 22px; margin-bottom: 5px; }
.report-header h3 { color: #666; font-size: 15px; font-weight: 500; }
.report-summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 15px; margin-bottom: 20px; }
.report-card { background: #ffffff; border-radius: 8px; padding: 18px; box-shadow: 0 2px 8px rgba(0,0,0,0.05); border-top: 4px solid #003366; }
.report-card span { display: block; color: #6b7280; font-size: 12px; font-weight: 600; margin-bottom: 8px; text-transform: uppercase; }
.report-card strong { display: block; color: #003366; font-size: 22px; }
.report-table { width: 100%; border-collapse: collapse; background: #ffffff; }
.report-table th { background: #003366; color: #ffffff; padding: 12px 10px; font-size: 12px; font-weight: 600; text-align: left; white-space: nowrap; }
.report-table td { padding: 11px 10px; border-bottom: 1px solid #eeeeee; font-size: 13px; color: #374151; }
.report-table tbody tr:hover { background-color: #f8fafc; }
.report-table tfoot td { background: #f1f5f9; color: #003366; border-top: 2px solid #003366; font-size: 13px; }
.report-table .text-right { text-align: right; }
.report-table .text-center { text-align: center; }
.report-table td:last-child { color: #059669; font-weight: 600; }
.report-table tfoot td:last-child { color: #059669; }
.table-container { background: #ffffff; border-radius: 8px; overflow-x: auto; box-shadow: 0 2px 8px rgba(0,0,0,0.05); }

@media (max-width: 768px) {
  .login-wrapper { flex-direction: column; }
  .login-sidebar-brand { padding: 25px; }
}