:root {
    --feb-cyan: #00bcd4;
    --feb-cyan-dark: #0097a7;
    --feb-teal: #007a8a;
    --feb-slate: #1f2430;
    --feb-slate-light: #2b3242;
    --feb-canvas: #eef1f5;
    --feb-pink: #d81b60;
    --feb-green: #2e7d32;
    --feb-red: #d32f2f;
    --feb-amber: #f59e0b;
    --feb-sidebar-width: 256px;
}

body {
    background-color: var(--feb-canvas);
    font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
    color: #1e293b;
}

/* =========================================================
 * Pantalla de Login Multi-Tenant (2 Pasos)
 * ========================================================= */
.auth-bg {
    min-height: 100vh;
    background: radial-gradient(circle at 20% 20%, rgba(0, 188, 212, 0.25), transparent 45%),
                radial-gradient(circle at 80% 80%, rgba(0, 122, 138, 0.28), transparent 50%),
                linear-gradient(135deg, #121722 0%, #1f2430 55%, #16222f 100%);
    color: #fff;
}

.auth-card {
    width: 100%;
    max-width: 440px;
    border: 0;
    border-radius: 1rem;
    overflow: visible;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
    background: #fff;
    color: #1e293b;
}

.auth-card-header {
    background: linear-gradient(135deg, var(--feb-cyan) 0%, var(--feb-teal) 100%);
    color: #fff;
    border-radius: 0.85rem;
    margin: -1.75rem 1.25rem 1.25rem;
    padding: 1.25rem 1.25rem;
    box-shadow: 0 10px 25px rgba(0, 188, 212, 0.35);
}

.auth-step-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

.btn-feb-primary {
    background-color: var(--feb-cyan);
    border-color: var(--feb-cyan);
    color: #fff;
    font-weight: 600;
}

.btn-feb-primary:hover,
.btn-feb-primary:focus {
    background-color: var(--feb-cyan-dark);
    border-color: var(--feb-cyan-dark);
    color: #fff;
}

.tenant-badge-box {
    background: #f0fdff;
    border: 1px solid #b2ebf2;
    border-radius: 0.75rem;
    padding: 0.85rem 1rem;
}

/* =========================================================
 * Layout App (Sidebar + Topbar + Contenido)
 * ========================================================= */
.app-shell {
    display: flex;
    min-height: 100vh;
}

.app-sidebar {
    width: var(--feb-sidebar-width);
    background: var(--feb-slate);
    color: #cbd5e1;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: margin-left 0.22s ease, transform 0.22s ease;
    z-index: 1040;
}

.app-sidebar.collapsed {
    margin-left: calc(-1 * var(--feb-sidebar-width));
}

.sidebar-brand {
    padding: 1.1rem 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sidebar-brand-icon {
    width: 38px;
    height: 38px;
    border-radius: 0.65rem;
    background: linear-gradient(135deg, var(--feb-cyan), var(--feb-teal));
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.sidebar-nav {
    padding: 0.85rem 0.75rem;
    flex: 1;
    overflow-y: auto;
}

.sidebar-section-label {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #64748b;
    padding: 0.65rem 0.75rem 0.35rem;
    font-weight: 700;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.62rem 0.85rem;
    border-radius: 0.6rem;
    color: #cbd5e1;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 0.2rem;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.sidebar-link i {
    width: 20px;
    text-align: center;
    font-size: 0.95rem;
}

.sidebar-link:hover {
    background: var(--feb-slate-light);
    color: #fff;
}

.sidebar-link.active {
    background: var(--feb-cyan);
    color: #fff;
    box-shadow: 0 4px 14px rgba(0, 188, 212, 0.35);
}

.sidebar-footer {
    padding: 0.85rem 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 0.78rem;
    color: #94a3b8;
}

.app-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.app-topbar {
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    padding: 0.65rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    position: sticky;
    top: 0;
    z-index: 1020;
}

.app-content {
    padding: 1.35rem;
    flex: 1;
}

.kpi-card {
    border: 0;
    border-radius: 0.9rem;
    box-shadow: 0 2px 14px rgba(15, 23, 42, 0.06);
    background: #fff;
    height: 100%;
}

.kpi-accent-cyan { border-left: 4px solid var(--feb-cyan) !important; }
.kpi-accent-green { border-left: 4px solid var(--feb-green) !important; }
.kpi-accent-amber { border-left: 4px solid var(--feb-amber) !important; }
.kpi-accent-pink { border-left: 4px solid var(--feb-pink) !important; }

.surface-card {
    border: 0;
    border-radius: 0.9rem;
    box-shadow: 0 2px 14px rgba(15, 23, 42, 0.06);
    background: #fff;
}

.badge-soft-cyan { background: #e0f7fa; color: #006064; }
.badge-soft-green { background: #e8f5e9; color: #1b5e20; }
.badge-soft-amber { background: #fef3c7; color: #92400e; }
.badge-soft-red { background: #ffebee; color: #b71c1c; }

.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    z-index: 1035;
}

@media (max-width: 991.98px) {
    .app-sidebar {
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        margin-left: 0;
        transform: translateX(-100%);
    }

    .app-sidebar.mobile-open {
        transform: translateX(0);
    }

    .sidebar-backdrop.show {
        display: block;
    }
}
