:root {
    --bg: #f5f7fb;
    --surface: #ffffff;
    --text: #1f2937;
    --muted: #6b7280;
    --primary: #2563eb;
    --primary-2: #1d4ed8;
    --border: #e5e7eb;
    --shadow: 0 20px 40px rgba(37, 99, 235, .08);
    --radius: 22px;
}

body {
    background: var(--bg);
    color: var(--text);
}

/* LOGIN */

.login-body {
    min-height: 100vh;
    background: linear-gradient(135deg, #eff6ff, #f8fafc, #dbeafe);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.login-wrapper {
    width: 100%;
    max-width: 460px;
}

.login-card {
    background: rgba(255, 255, 255, .92);
    backdrop-filter: blur(10px);
    border-radius: 28px;
    padding: 36px;
    border: 1px solid rgba(255, 255, 255, .7);
}

.login-logo {
    width: 88px;
    height: 88px;
    border-radius: 24px;
    object-fit: cover;
    box-shadow: var(--shadow);
}

/* SELECTOR DE BASE EN LOGIN */

.login-db-box {
    margin-bottom: 14px;
    text-align: left;
}

.login-db-label {
    display: block;
    margin-bottom: 6px;
    font-size: .92rem;
    font-weight: 700;
    color: var(--text);
}

.login-db-input-group {
    display: flex;
    align-items: stretch;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 3px 10px rgba(37, 99, 235, .08);
}

.login-db-select {
    min-height: 42px;
    padding: .58rem .75rem !important;
    border: none !important;
    border-radius: 0 !important;
    font-size: .92rem;
    box-shadow: none !important;
}

.login-db-select:focus {
    box-shadow: none !important;
}

.login-db-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 78px;
    padding: 0 12px;
    border: none;
    background: var(--primary);
    color: #fff;
    font-size: .88rem;
    font-weight: 700;
}

.login-db-badge:hover {
    background: var(--primary-2);
}

/* LINKS */

.db-manager-link {
    color: #2f5bea;
    font-weight: 700;
    text-decoration: none;
}

.db-manager-link:hover {
    text-decoration: underline;
}

/* LAYOUT GENERAL */

.app-shell {
    display: flex;
    min-height: 100vh;
}

.app-content {
    flex: 1;
    padding: 28px;
}

.page-title {
    font-size: 1.6rem;
    font-weight: 700;
}

/* SIDEBAR */

.sidebar {
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    width: 270px;
    height: 100vh;
    padding: 24px;
    background: #0f172a;
    color: #fff;
}

.sidebar .brand {
    display: flex;
    align-items: center;
    gap: 14px;
}

.sidebar .brand img {
    width: 56px;
    height: 56px;
    padding: 8px;
    border-radius: 18px;
    background: #fff;
}

.sidebar .nav-link {
    padding: 12px 14px;
    border-radius: 14px;
    color: #cbd5e1;
}

.sidebar .nav-link:hover {
    background: rgba(255, 255, 255, .08);
    color: #fff;
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 18px;
    border-top: 1px solid rgba(255, 255, 255, .08);
    color: #94a3b8;
    font-size: .9rem;
    line-height: 1.5;
}

.sidebar-footer span {
    color: #cbd5e1;
    font-size: .82rem;
}

/* TOPBAR */

.topbar {
    padding: 18px 22px;
    border: 1px solid var(--border);
    border-radius: 22px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.topbar-inner {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    flex-wrap: wrap;
}

.topbar-left {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-left: auto;
}

.topbar-user {
    text-align: right;
}

.topbar-user-name {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text);
}

.topbar-user-role {
    font-size: .95rem;
    color: var(--muted);
}

/* BASE ACTIVA */

.current-db-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border: 1px solid #bfdbfe;
    border-radius: 14px;
    background: #eff6ff;
    color: #1d4ed8;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}

.current-db-badge strong {
    color: #1e3a8a;
    font-weight: 700;
}

.current-db-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #2563eb;
}

/* CARDS Y TABLAS */

.card {
    border: none;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.card-header {
    padding: 18px 20px;
    border-bottom: 1px solid var(--border);
    background: transparent;
    font-weight: 700;
}

.card-body {
    padding: 20px;
}

.stat-card {
    background: linear-gradient(180deg, #fff, #eff6ff);
}

.table> :not(caption)>*>* {
    padding: .9rem;
}

/* FORMULARIOS Y BOTONES */

.btn,
.form-control,
.form-select {
    border-radius: 14px;
}

.form-control,
.form-select {
    padding: .8rem 1rem;
    border-color: var(--border);
}

.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
}

.btn-primary:hover {
    background: var(--primary-2);
    border-color: var(--primary-2);
}

.year-select {
    min-width: 95px;
    padding-right: 2.2rem;
}

/* RESPONSIVE */

@media (max-width: 991px) {
    .app-shell {
        display: block;
    }

    .sidebar {
        position: relative;
        width: 100%;
        height: auto;
    }

    .app-content {
        padding: 16px;
    }

    .topbar-inner {
        flex-direction: column;
        align-items: flex-start;
    }

    .topbar-right {
        width: 100%;
        justify-content: space-between;
        margin-left: 0;
    }

    .topbar-user {
        text-align: left;
    }
}

/* PRINT */

@media print {

    .sidebar,
    .topbar,
    .d-print-none {
        display: none !important;
    }

    .app-content {
        padding: 0;
    }

    .card {
        box-shadow: none;
    }
}