:root {
    /* MANIFIESTO: Paleta Corporativa */
    --clr-azul-oscuro: #005574;
    --clr-azul-acento: #00B4D8;
    --clr-fondo-app: #f4f7f9;

    /* MANIFIESTO: Paleta Semántica */
    --clr-success: #8CC63F;
    --clr-danger: #b91c1c;
    --clr-warning: #b45309;
    --clr-info: #0369a1;

    /* Utilidades base */
    --bg-white: #FFFFFF;
    --bg-gray: var(--clr-fondo-app);
    --text-dark: #334155;
    /* Texto oscuro suave */
    --text-light: #FFFFFF;
    --border-color: #e2e8f0;
    --shadow-soft: 0 2px 4px rgba(0, 0, 0, 0.05);
    /* MANIFIESTO: Header box-shadow */
    --shadow-medium: 0 8px 30px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;

    /* Colores Login (adaptados al Manifiesto) */
    --clr-verde-energia: var(--clr-azul-oscuro);
    --clr-azul-principal: var(--clr-azul-acento);
    --clr-white: #FFFFFF;
    --clr-text-main: #334155;
    --clr-text-muted: #64748b;

    /* Legacy (Para no romper otras dependencias) */
    --primary-blue: var(--clr-azul-oscuro);
    --dark-blue: var(--clr-azul-oscuro);
    --primary-green: var(--clr-success);
    --light-green: #8CC63F;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    /* MANIFIESTO: Tipografía Principal */
    font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
    color: var(--clr-text-main);
    background-color: var(--clr-fondo-app);
    font-size: 13px;
    /* Párrafos/Cuerpo base */
    font-weight: 400;
    line-height: 1.6;
    overflow-x: hidden;
}

/* MANIFIESTO: Jerarquía Tipográfica */
h1,
h2 {
    font-weight: 700;
    color: var(--clr-azul-oscuro);
}

h3,
h4 {
    font-weight: 600;
    color: #64748b;
}

/* Scrollbar Customization */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-gray);
}

::-webkit-scrollbar-thumb {
    background: var(--clr-azul-oscuro);
    border-radius: 4px;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideIn {
    from {
        transform: translateX(-20px);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* =========================================
   MANIFIESTO: COMPONENTES CORE - BOTONES
   ========================================= */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    /* MANIFIESTO: Radio de borde 4px */
    font-family: 'Inter', 'Segoe UI', sans-serif;
    text-decoration: none;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    letter-spacing: 0.3px;
}

.btn-primary {
    background-color: var(--clr-success);
    color: var(--clr-white);
    font-weight: 600;
}

.btn-primary:hover {
    background-color: #7ab237;
}

.btn-danger {
    background-color: var(--clr-danger);
    color: var(--clr-white);
}

.btn-danger:hover {
    background-color: #991b1b;
}

.btn-secondary {
    background-color: transparent;
    border: 1px solid #cbd5e1;
    color: #334155;
}

.btn-secondary:hover {
    background-color: #f1f5f9;
}

/* Tallas de botones */
.btn-lg {
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
}

.btn-sm {
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 500;
    height: 26px;
}

/* =========================================
   LOGIN LAYOUT REDISEÑADO
   ========================================= */
.login-wrapper {
    display: flex;
    min-height: 100vh;
}

.login-left {
    flex: 0 0 70%;
    position: relative;
    overflow: hidden;
    background-color: var(--clr-azul-oscuro);
}

.login-left-bg {
    position: absolute;
    inset: 0;
    background-image: url('img/login-bg.png');
    background-size: cover;
    background-position: center;
    z-index: 1;
}

.login-left-bg::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(2, 92, 124, 0.98) 0%, rgba(4, 176, 234, 0.65) 100%);
    mix-blend-mode: multiply;
}

@supports not (mix-blend-mode: multiply) {
    .login-left-bg::after {
        background: linear-gradient(to top, rgba(2, 92, 124, 0.95) 10%, rgba(4, 176, 234, 0.7) 100%);
    }
}

@keyframes fadeLeftIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.login-left-content {
    position: relative;
    z-index: 2;
    padding: 10% 12%;
    display: flex;
    flex-direction: column;
    height: 100%;
    color: var(--clr-white);
    animation: fadeLeftIn 1.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.login-text-container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    margin-top: 36vh;
    margin-bottom: 0;
    margin-left: -15%;
    margin-right: -15%;
    padding-left: 15%;
    padding-right: 15%;
    padding-top: 40px;
    padding-bottom: 40px;
    background: rgba(2, 92, 124, 0.5);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.25);
}

.login-text-container h1 {
    font-size: 2.2rem;
    font-weight: 700;
    line-height: 1.25;
    margin-bottom: 0.8rem;
    letter-spacing: -0.5px;
    color: #FFFFFF;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.login-text-container h2.subtitle {
    font-size: 1.2rem;
    font-weight: 600;
    color: #7DD5F3;
    margin-bottom: 1.5rem;
    line-height: 1.4;
    text-shadow: 0 1px 5px rgba(0, 0, 0, 0.5);
}

.login-text-container p {
    font-size: 1rem;
    line-height: 1.6;
    max-width: 600px;
    color: #EEF7FD;
    font-weight: 400;
    text-shadow: 0 1px 5px rgba(0, 0, 0, 0.5);
}

.login-footer-text {
    font-size: 11px;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.6);
    padding-bottom: 2rem;
    padding-left: 12%;
    max-width: 500px;
    color: rgba(255, 255, 255, 0.8);
}

/* Líneas decorativas sobre la imagen del login */
.login-graph {
    position: absolute;
    bottom: 12%;
    left: 0;
    width: 100%;
    height: auto;
    max-height: 300px;
    pointer-events: none;
    display: flex;
    align-items: flex-end;
    opacity: 0.8;
    z-index: 3;
}

.login-graph img {
    width: 100%;
    height: auto;
}

.login-footer-text {
    margin-top: auto;
    font-size: 12px;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.6);
    padding-bottom: 2rem;
}

.login-right {
    flex: 0 0 30%;
    background-color: var(--clr-white);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    position: relative;
    z-index: 10;
    box-shadow: -15px 0 40px rgba(0, 0, 0, 0.12);
}

.login-form-container {
    width: 100%;
    max-width: 380px;
}

.logo-form {
    max-width: 240px;
    height: auto;
    display: block;
    margin: 0 auto 2.5rem auto;
}

.login-form-heading {
    margin-bottom: 3.5rem;
}

.login-form-heading h2 {
    font-size: 1.8rem;
    color: var(--clr-azul-oscuro);
    font-weight: 700;
    margin-bottom: 0.5rem;
    letter-spacing: -0.5px;
}

.login-form-heading p {
    font-size: 0.9rem;
    color: var(--clr-text-muted);
    line-height: 1.5;
}

.form-group {
    margin-bottom: 1.75rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 13px;
    font-weight: 600;
    color: var(--clr-text-main);
}

.form-control {
    width: 100%;
    height: 38px;
    padding: 0 14px;
    border: 1px solid #D1D5DB;
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: var(--clr-white);
    color: var(--clr-text-main);
    outline: none;
    box-shadow: none;
}

.form-control::placeholder {
    color: #9CA3AF;
}

.form-control:hover {
    border-color: #9CA3AF;
}

.form-control:focus {
    outline: none;
    border-color: var(--clr-azul-acento);
    box-shadow: 0 0 0 4px rgba(0, 180, 216, 0.15);
}

.login-form-container .btn-primary {
    width: 100%;
    margin-top: 2rem;
    margin-bottom: 1.5rem;
    height: 38px;
    background-color: #8BCD43;
    border: none;
    box-shadow: 0 4px 14px rgba(139, 205, 67, 0.35);
    font-weight: 600;
    font-size: 13px;
    letter-spacing: 0.3px;
    color: #FFFFFF;
}

.login-form-container .btn-primary:hover {
    background-color: #79BA35;
    box-shadow: 0 6px 20px rgba(139, 205, 67, 0.45);
    transform: translateY(-2px);
}

.forgot-password-container {
    text-align: center;
    margin-top: 1.5rem;
}

.forgot-password {
    color: var(--clr-azul-acento);
    font-size: 13.5px;
    text-decoration: none;
    font-weight: 500;
}

.forgot-password:hover {
    text-decoration: underline;
}

.form-options {
    margin: 12px 0 18px 0;
    display: flex;
    align-items: center;
}

/* Wrapper del input con ojo */
.input-eye-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-eye-wrapper .form-control {
    padding-right: 42px;
}

.eye-btn {
    position: absolute;
    right: 12px;
    background: none;
    border: none;
    cursor: pointer;
    color: #9CA3AF;
    display: flex;
    align-items: center;
    padding: 0;
    transition: color 0.2s;
}

.eye-btn:hover {
    color: #04B0EA;
}

.checkbox-container {
    display: flex;
    align-items: center;
    position: relative;
    padding-left: 28px;
    cursor: pointer;
    font-size: 13px;
    color: var(--clr-text-muted);
    user-select: none;
}

.checkbox-container input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.checkmark {
    position: absolute;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
    height: 18px;
    width: 18px;
    background-color: #f1f5f9;
    border-radius: 4px;
    border: 1px solid #cbd5e1;
    transition: var(--transition);
}

.checkbox-container:hover input~.checkmark {
    background-color: #e2e8f0;
}

.checkbox-container input:checked~.checkmark {
    background-color: var(--clr-azul-oscuro);
    border-color: var(--clr-azul-oscuro);
}

.checkmark:after {
    content: "";
    position: absolute;
    display: none;
}

.checkbox-container input:checked~.checkmark:after {
    display: block;
}

.checkbox-container .checkmark:after {
    left: 5px;
    top: 1px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* =========================================
   MANIFIESTO: ESTRUCTURA MAESTRA DE PÁGINA
   ========================================= */
.app-shell {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background-color: var(--clr-azul-oscuro);
    /* MANIFIESTO */
    color: var(--clr-white);
    display: flex;
    flex-direction: column;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}

.sidebar.collapsed {
    width: 0;
}

.sidebar-toggle {
    background: none;
    border: none;
    color: var(--clr-azul-oscuro);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    border-radius: 4px;
    transition: var(--transition);
    margin-right: 15px;
}

.sidebar-toggle:hover {
    background-color: #f1f5f9;
}

.sidebar-header {
    padding: 30px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-logo {
    height: 40px;
    filter: brightness(0) invert(1);
}

.sidebar-category {
    padding: 20px 24px 10px 24px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: #72aebf;
    /* o acento claro */
    letter-spacing: 0.5px;
}

.nav-links {
    flex: 1;
    padding: 10px 0;
    display: flex;
    flex-direction: column;
}

.nav-logout-container {
    margin-top: auto;
    padding: 20px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 10px 16px 10px 12px;
    margin: 4px 16px;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    transition: all 0.3s ease;
    font-size: 13px;
    border-radius: 6px;
    border-left: 4px solid transparent;
}

.nav-item:hover {
    background-color: rgba(4, 176, 234, 0.1);
    color: var(--clr-white);
}

.nav-item.active {
    background: linear-gradient(90deg, rgba(0, 229, 255, 0.15) 0%, rgba(0, 229, 255, 0.05) 100%);
    border-left: 4px solid #00E5FF;
    box-shadow: -2px 0 12px rgba(0, 229, 255, 0.4), inset 5px 0 10px rgba(0, 229, 255, 0.1);
    color: #00E5FF;
    font-weight: 600;
}

.nav-text {
    margin-left: 10px;
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: var(--clr-fondo-app);
    overflow: hidden;
}

/* Header */
header {
    height: 60px;
    /* MANIFIESTO: Altura fija 60px */
    background-color: var(--clr-white);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    /* MANIFIESTO */
    z-index: 5;
}

.header-title h2 {
    font-size: 16px;
    color: var(--clr-azul-oscuro);
    font-weight: 700;
    /* MANIFIESTO */
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
}

.avatar {
    width: 36px;
    height: 36px;
    background-color: #f1f5f9;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: var(--clr-azul-oscuro);
}

.dashboard-container {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
}

.card {
    background: var(--bg-white);
    border-radius: 12px;
    box-shadow: var(--shadow-soft);
    padding: 24px;
    margin-bottom: 24px;
    border: 1px solid var(--border-color);
}

.dashboard-iframe-container {
    height: calc(100vh - 160px);
    width: 100%;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-medium);
    border: 1px solid var(--border-color);
    position: relative;
    display: flex;
    flex-direction: column;
}

.iframe-wrapper {
    flex: 1;
    width: 100%;
    position: relative;
    overflow: hidden;
}

.iframe-wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: calc(100% + 40px);
    border: none;
}

.footer-mask {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 42px;
    background: var(--bg-white);
    z-index: 10;
    border-top: 1px solid var(--border-color);
}

.iframe-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: #94a3b8;
    margin-top: 50px;
}

.loading-dots {
    display: flex;
    gap: 5px;
    margin-top: 10px;
}

.dot {
    width: 8px;
    height: 8px;
    background: var(--clr-azul-oscuro);
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}

.dot:nth-child(1) {
    animation-delay: -0.32s;
}

.dot:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes bounce {

    0%,
    80%,
    100% {
        transform: scale(0);
    }

    40% {
        transform: scale(1.0);
    }
}

/* Footer */
.app-footer {
    padding: 10px 30px;
    background-color: var(--clr-white);
    color: #64748b;
    font-size: 12px;
    z-index: 5;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    bottom: 0;
    border-top: 1px solid var(--border-color);
}

.footer-left {
    display: flex;
    align-items: center;
}

.footer-right {
    color: #64748b;
}

/* =========================================
   MANIFIESTO: TABLAS Y DATAVIZ
   ========================================= */
table {
    width: 100%;
    border-collapse: collapse;
}

th {
    background-color: #f1f5f9;
    /* Gris claro */
    text-transform: uppercase;
    font-size: 11px;
    font-weight: 700;
    padding: 12px 16px;
    text-align: left;
    color: var(--clr-text-main);
}

td {
    padding: 12px 16px;
    border-bottom: 1px solid #e2e8f0;
    /* Borde inferior ligero */
    font-size: 13px;
}

tr:nth-child(even) td {
    background-color: #f8fafb;
    /* Zebra stripe */
}

/* Tabular nums */
.tabular-data {
    font-variant-numeric: tabular-nums;
    text-align: right;
}

/* =========================================
   MANIFIESTO: TOASTS DE NOTIFICACIÓN
   ========================================= */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    min-width: 300px;
    padding: 16px;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    font-weight: 500;
    transform: translateX(120%);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast.show {
    transform: translateX(0);
}

.toast-success {
    background-color: #f0fdf4;
    /* Fondo éxito */
    border-left: 4px solid #22c55e;
    /* Borde izquierdo éxito */
    color: #15803d;
    /* Texto éxito */
}

.toast-error {
    background-color: #fef2f2;
    /* Fondo error */
    border-left: 4px solid #ef4444;
    /* Borde izquierdo error */
    color: #991b1b;
    /* Texto error oscuro */
}

/* Responsive */
@media (max-width: 900px) {
    .login-left {
        display: none;
    }

    .login-right {
        flex: 0 0 100%;
        padding: 2rem;
    }

    .sidebar {
        width: 80px;
    }

    .nav-text {
        display: none;
    }

    .sidebar-category {
        display: none;
    }

    .sidebar-logo {
        width: 30px;
        height: auto;
    }
}