/* OnTech CRM — identidad visual sobre AdminLTE 4 (doc 05 §3).
   Colores del sitio web de OnTech: azul #1B3B8D (primario) y naranja #F4831F (acento). */

:root {
    --crm-primary: #1B3B8D;
    --crm-primary-dark: #142C6A;
    --crm-primary-rgb: 27, 59, 141;
    --crm-accent: #F4831F;
    --crm-accent-dark: #D96E0F;
    --crm-ink: #171A1F;
    --bs-primary: var(--crm-primary);
    --bs-primary-rgb: var(--crm-primary-rgb);
    --bs-link-color: var(--crm-primary);
    --bs-link-color-rgb: var(--crm-primary-rgb);
    --bs-link-hover-color: var(--crm-primary-dark);
    --bs-body-font-family: "Source Sans 3", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

[data-bs-theme="dark"] {
    --crm-primary: #6F8FE0;
    --crm-primary-rgb: 111, 143, 224;
    --bs-link-color: #8FA8EA;
    --bs-link-color-rgb: 143, 168, 234;
    --bs-link-hover-color: #B3C4F1;
}

/* ---- Botones ---- */
.btn-primary {
    --bs-btn-bg: #1B3B8D; --bs-btn-border-color: #1B3B8D;
    --bs-btn-hover-bg: #142C6A; --bs-btn-hover-border-color: #142C6A;
    --bs-btn-active-bg: #142C6A; --bs-btn-active-border-color: #142C6A;
    --bs-btn-disabled-bg: #1B3B8D; --bs-btn-disabled-border-color: #1B3B8D;
}
.btn-outline-primary {
    --bs-btn-color: var(--crm-primary); --bs-btn-border-color: var(--crm-primary);
    --bs-btn-hover-bg: var(--crm-primary); --bs-btn-hover-border-color: var(--crm-primary);
    --bs-btn-active-bg: var(--crm-primary); --bs-btn-active-border-color: var(--crm-primary);
}
/* Acción destacada ("+ Nuevo", "Generar Factura DGI"). */
.btn-accent {
    --bs-btn-color: #fff; --bs-btn-bg: #F4831F; --bs-btn-border-color: #F4831F;
    --bs-btn-hover-color: #fff; --bs-btn-hover-bg: #D96E0F; --bs-btn-hover-border-color: #D96E0F;
    --bs-btn-active-color: #fff; --bs-btn-active-bg: #D96E0F; --bs-btn-active-border-color: #D96E0F;
    --bs-btn-disabled-bg: #F4831F; --bs-btn-disabled-border-color: #F4831F;
}
.text-accent { color: var(--crm-accent) !important; }
.bg-accent { background-color: var(--crm-accent) !important; }

/* ---- Menú lateral y barra superior ---- */
.app-sidebar { background-color: #14254F !important; }
.app-sidebar .sidebar-brand { border-bottom: 1px solid rgba(255, 255, 255, .08); }
.app-sidebar .brand-link { display: flex; align-items: center; gap: .5rem; }
.app-sidebar .brand-image { max-height: 34px; width: auto; opacity: 1; box-shadow: none; }
.app-sidebar .brand-text { color: #fff; font-weight: 600; }
.app-sidebar .nav-link { color: rgba(255, 255, 255, .78); }
.app-sidebar .nav-link:hover { color: #fff; background-color: rgba(255, 255, 255, .06); }
.app-sidebar .nav-link.active,
.app-sidebar .menu-open > .nav-link { color: #fff !important; background-color: var(--crm-primary) !important; }
.app-sidebar .nav-header { color: rgba(255, 255, 255, .45); font-size: .75rem; letter-spacing: .04em; }
.app-header .global-search { max-width: 460px; }
.app-header .btn-new { white-space: nowrap; }
[data-bs-theme="dark"] .app-sidebar { background-color: #10172A !important; }

/* ---- Contenido ---- */
.app-main { background-color: #F4F6F9; }
[data-bs-theme="dark"] .app-main { background-color: var(--bs-body-bg); }
.app-content-header h1, .app-content-header .h3 { font-weight: 600; }
.card { border: 0; box-shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08); }
.table > thead th { font-weight: 600; font-size: .85rem; text-transform: none; color: var(--bs-secondary-color); }
.form-label { font-weight: 600; font-size: .9rem; }
.required::after { content: " *"; color: var(--bs-danger); }

/* ---- Colores de estado fijos en todo el sistema (doc 05 §3.3): siempre texto + color ---- */
.status { display: inline-block; padding: .2rem .55rem; border-radius: 999px; font-size: .78rem; font-weight: 600; line-height: 1.3; border: 1px solid transparent; }
.status-draft { background: #E9ECEF; color: #495057; }
.status-sent, .status-open { background: #DCE6FB; color: #1B3B8D; }
.status-ok { background: #D7F2E3; color: #146C43; }
.status-warn { background: #FFF1CC; color: #8A5A00; }
.status-bad { background: #F8D7DA; color: #9B1C2B; }
.status-closed { background: #E4DDF7; color: #4B2E91; }
.status-muted { background: #DEE2E6; color: #343A40; }
.status-outline { background: transparent; color: #6C757D; border-color: #ADB5BD; }

/* ---- Pantallas de acceso ---- */
.auth-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #14254F 0%, #1B3B8D 60%, #2E5BC7 100%); padding: 1rem; }
.auth-card { width: 100%; max-width: 420px; border-radius: 14px; }
.auth-card .auth-logo { max-height: 56px; max-width: 100%; }
.auth-card .card-body { padding: 2rem; }

/* ---- Matriz de permisos ---- */
.perm-matrix td, .perm-matrix th { vertical-align: middle; }
.perm-matrix .module-name { font-weight: 600; }
.perm-matrix .form-check { margin: 0; display: flex; justify-content: center; }
.perm-special .form-check { justify-content: flex-start; }

/* ---- Vista previa de logos sobre fondo claro y oscuro ---- */
.logo-preview { height: 72px; border-radius: 8px; display: flex; align-items: center; justify-content: center; padding: .5rem; border: 1px dashed var(--bs-border-color); }
.logo-preview img { max-height: 100%; max-width: 100%; }
.logo-preview.on-light { background: #fff; }
.logo-preview.on-dark { background: #14254F; }

/* ---- Notificaciones ---- */
.notif-item { white-space: normal; min-width: 320px; }
.notif-item.unread { background-color: rgba(var(--crm-primary-rgb), .07); }
.notif-item small { color: var(--bs-secondary-color); }

.impersonation-bar { background: var(--crm-accent); color: #fff; text-align: center; padding: .35rem 1rem; font-weight: 600; }

/* Resumen de validación: oculto si no hay errores. */
.validation-summary-valid { display: none !important; }

/* Logo según el tema: se muestra la versión para fondo claro u oscuro. */
.logo-on-dark { display: none; }
[data-bs-theme="dark"] .logo-on-light { display: none; }
[data-bs-theme="dark"] .logo-on-dark { display: inline-block; }
