/* Ajustes sobre Bootstrap 5.3 (modo dark). Paleta tomada de la plantilla de factura. */
:root {
    --bs-primary: #4a7fe0;
    --bs-primary-rgb: 74, 127, 224;
    --bs-link-color: #7ea6ee;
    --bs-link-color-rgb: 126, 166, 238;
    --bs-link-hover-color: #a3c0f5;
    --bs-link-hover-color-rgb: 163, 192, 245;
}

[data-bs-theme="dark"] {
    --bs-body-bg: #11141a;
    --bs-body-bg-rgb: 17, 20, 26;
    --bs-secondary-bg: #181c24;
    --bs-secondary-bg-rgb: 24, 28, 36;
    --bs-tertiary-bg: #1e232d;
    --bs-tertiary-bg-rgb: 30, 35, 45;
    --bs-border-color: #2b3240;
    --bs-primary-text-emphasis: #a3c0f5;
}

.btn-primary {
    --bs-btn-bg: #4a7fe0;
    --bs-btn-border-color: #4a7fe0;
    --bs-btn-hover-bg: #3f6fc9;
    --bs-btn-hover-border-color: #3a67bd;
    --bs-btn-active-bg: #3a67bd;
    --bs-btn-active-border-color: #355fb0;
    --bs-btn-disabled-bg: #4a7fe0;
    --bs-btn-disabled-border-color: #4a7fe0;
}

.btn-outline-primary {
    --bs-btn-color: #7ea6ee;
    --bs-btn-border-color: #4a7fe0;
    --bs-btn-hover-bg: #4a7fe0;
    --bs-btn-hover-border-color: #4a7fe0;
    --bs-btn-active-bg: #4a7fe0;
    --bs-btn-active-border-color: #4a7fe0;
}

/* ---------- Estructura de la app ---------- */
.app-shell { display: flex; min-height: 100vh; }
.app-main { flex: 1 1 auto; min-width: 0; }

.sidebar {
    --bs-offcanvas-width: 17rem;
    --bs-offcanvas-bg: var(--bs-secondary-bg);
}

@media (min-width: 992px) {
    .sidebar-col {
        flex: 0 0 16rem;
        position: sticky;
        top: 0;
        height: 100vh;
        background: var(--bs-secondary-bg);
        border-right: var(--bs-border-width) solid var(--bs-border-color);
    }
}

.sidebar .nav-link {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .65rem .85rem;
    border-radius: var(--bs-border-radius);
    color: var(--bs-body-color);
}
.sidebar .nav-link:hover { background: var(--bs-tertiary-bg); }
.sidebar .nav-link.active {
    background: rgba(var(--bs-primary-rgb), .2);
    color: #fff;
    font-weight: 600;
}

.brand-logo { max-height: 2.5rem; max-width: 100%; object-fit: contain; }

.topbar {
    position: sticky;
    top: 0;
    z-index: 1020;
    background: var(--bs-body-bg);
    border-bottom: var(--bs-border-width) solid var(--bs-border-color);
}

.stat-value { font-size: 1.75rem; font-weight: 700; line-height: 1.1; }

/* Vista previa del logo: la factura se imprime en blanco, asi que se muestra sobre blanco */
.logo-preview {
    background: #fff;
    border-radius: var(--bs-border-radius);
    padding: .75rem;
    min-height: 6rem;
    display: grid;
    place-items: center;
}
.logo-preview img { max-width: 100%; max-height: 7rem; object-fit: contain; }

/* Barra de guardar fija abajo (util en telefono) */
.save-bar {
    position: sticky;
    bottom: 0;
    z-index: 1010;
    margin: 1.5rem -1rem -1rem;
    padding: .75rem 1rem;
    background: var(--bs-body-bg);
    border-top: var(--bs-border-width) solid var(--bs-border-color);
}
@media (min-width: 992px) { .save-bar { margin: 1.5rem -1.5rem -1.5rem; padding: .75rem 1.5rem; } }

/* ---------- Login ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; }
.login-card { width: 100%; max-width: 24rem; }
