:root {
    --primary: #1e3a8a;
    --primary-light: #3b82f6;
    --sidebar-width: 260px;
    --bg-body: #f1f5f9;
    --bg-card: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --shadow: 0 1px 3px rgba(0,0,0,0.08);
}

[data-theme="dark"] {
    --bg-body: #0f172a;
    --bg-card: #1e293b;
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    --border: #334155;
}

* { box-sizing: border-box; }

body {
    font-family: 'Segoe UI', system-ui, sans-serif;
    background: var(--bg-body);
    color: var(--text-main);
    margin: 0;
}

/* Loader */
.loader-overlay {
    position: fixed; inset: 0; background: rgba(30,58,138,0.7);
    display: none; align-items: center; justify-content: center;
    z-index: 9999;
}
.loader-overlay.show { display: flex; }

/* Layout */
.app-wrapper { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-width);
    background: var(--primary);
    color: #fff;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 1000;
    transition: transform 0.3s;
    overflow-y: auto;
}

.sidebar-brand {
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-brand-link {
    display: block;
    line-height: 0;
    text-decoration: none;
}

/* Menú lateral: tamaño del logo */
.sidebar-logo {
    max-height: 44px;
    max-width: min(200px, 100%);
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
    margin: 0 auto;
}

.auth-logo-wrap {
    padding: 0.5rem 0 0;
    margin-bottom: 1rem !important;
    max-height: 72px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Login: tamaño del logo — editar max-width / max-height aquí */
.auth-logo {
    display: block;
    margin: 0 auto;
    max-width: min(460px, 100%);
    max-height: 56px;
    width: auto;
    height: auto;
    object-fit: contain;
}

.app-logo-preview {
    max-height: 100px;
    max-width: 100%;
    object-fit: contain;
}

.sidebar-nav { padding: 1rem 0; }

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem;
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    transition: all 0.2s;
}

.sidebar-nav .nav-link:hover,
.sidebar-nav .nav-link.active {
    background: rgba(255,255,255,0.15);
    color: #fff;
}

.nav-section {
    padding: 0.5rem 1.5rem;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.5;
    margin-top: 0.5rem;
}

.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    min-height: 100vh;
}

.top-navbar {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    height: 60px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
}

.content-area { min-height: calc(100vh - 60px); }

/* Cards */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
}

.stat-card {
    border-radius: 0.75rem;
    padding: 1.5rem;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: var(--shadow);
}

.stat-card h3 { font-size: 1.5rem; margin: 0; font-weight: 700; }
.stat-card p { margin: 0; opacity: 0.9; font-size: 0.85rem; }
.stat-icon { font-size: 2.5rem; opacity: 0.8; }

/* Auth */
.auth-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
}

.auth-container { width: 100%; max-width: 420px; padding: 1rem; }
.auth-card {
    background: #fff;
    border-radius: 1rem;
    padding: 2rem;
}

[data-theme="dark"] .auth-card { background: var(--bg-card); }

/* DataTables dark */
[data-theme="dark"] .table { color: var(--text-main); }
[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select { background: #0f172a; color: var(--text-main); border-color: var(--border); }

/* Responsive */
@media (max-width: 991px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.show { transform: translateX(0); }
    .main-content { margin-left: 0; }
}

.page-title { color: var(--text-main); }
