:root {
    --bg-dark: #1E1E1E;
    --bg-light: #EDF2F4;
    --accent: #D90429;
    --dark-hover: #292929;
    --white: #FFFFFF;
    --text-main: #1E1E1E;
    --text-muted: #666666;
    --border-color: #E2E8F0;
    --font-family: 'Outfit', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--font-family);
}

body {
    background-color: var(--bg-light);
    color: var(--text-main);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
}

a {
    text-decoration: none;
    color: inherit;
}

/* Buttons */
.btn-primary {
    background-color: var(--accent);
    color: var(--white);
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: background-color 0.2s;
    font-size: 1rem;
}

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

.w-100 {
    width: 100%;
    justify-content: center;
}

.icon-btn {
    background: none;
    border: none;
    color: inherit;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Top Bar (Mobile) */
.top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    background-color: var(--bg-dark);
    color: var(--white);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.logo-mobile {
    font-weight: 700;
    font-size: 1.2rem;
    letter-spacing: 0.5px;
}

.user-profile img {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid var(--white);
}

/* Sidebar */
.sidebar {
    background-color: var(--bg-dark);
    color: var(--white);
    width: 280px;
    height: 100vh;
    position: fixed;
    top: 0;
    left: -280px; /* Hidden on mobile by default */
    z-index: 200;
    transition: left 0.3s ease;
    display: flex;
    flex-direction: column;
}

.sidebar.open {
    left: 0;
}

.sidebar-header {
    padding: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--dark-hover);
    height: 72px; /* match header heights if needed */
}

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

.nav-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
    color: var(--white);
    transition: background-color 0.2s, color 0.2s;
    font-weight: 400;
}

.nav-item:hover, .nav-item.active {
    background-color: var(--dark-hover);
    border-left: 4px solid var(--accent);
    padding-left: calc(1.5rem - 4px);
}

.nav-item i {
    font-size: 1.5rem;
}

.sidebar-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--dark-hover);
}

.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0,0,0,0.5);
    z-index: 150;
    display: none;
    backdrop-filter: blur(2px);
}

.sidebar-overlay.open {
    display: block;
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 85px 1rem 2rem 1rem; /* Space for top bar */
    width: 100%;
}

/* Sub Header / Page Header */
.page-header {
    background-color: var(--white);
    padding: 1.5rem;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 2rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    border: 1px solid var(--border-color); /* Minimalist outline */
}

.page-title {
    font-size: 1.5rem;
    color: var(--text-main);
}

/* Dashboard Grid */
.app-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem 1rem;
    justify-items: center;
}

.app-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    max-width: 110px;
    text-align: center;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 12px;
    transition: background-color 0.2s;
}

.app-item:hover {
    background-color: rgba(0,0,0,0.03);
}

.app-icon {
    width: 64px;
    height: 64px;
    background-color: var(--white);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.25rem;
    color: var(--text-main);
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
    border: 1px solid var(--border-color); /* Clean lines */
}

.app-item:hover .app-icon {
    transform: translateY(-3px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.1);
    border-color: var(--text-main);
    color: var(--accent);
}

.app-name {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-main);
    line-height: 1.2;
}

/* Responsive Styles */
@media (max-width: 360px) {
    .app-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 768px) {
    .top-bar {
        display: none; /* Hide mobile top bar */
    }

    .sidebar {
        left: 0; /* Always show sidebar */
    }

    .close-btn {
        display: none; /* Hide close button on desktop */
    }

    .main-content {
        margin-left: 280px; /* Space for sidebar */
        padding: 2rem;
    }

    .page-header {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }

    .app-grid {
        grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
        gap: 2.5rem;
        justify-content: start;
        justify-items: start;
    }
    
    .app-icon {
        width: 80px;
        height: 80px;
        font-size: 2.8rem;
    }
    
    .app-name {
        font-size: 0.95rem;
    }
}

/* -------------------------------------
   NUEVO DASHBOARD ESCRITORIO (SIN SIDEBAR)
   ------------------------------------- */

.desktop-area {
    flex: 1;
    padding: 3rem;
    display: flex;
    justify-content: flex-start;
    align-items: flex-start;
}

.apps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 3rem 2.5rem;
    width: 100%;
}

.access-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    text-decoration: none;
    width: 100px;
    margin: 0 auto; /* Centra el item en su celda */
}

.access-logo-box {
    width: 90px;
    height: 90px;
    background-color: var(--white);
    border-radius: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid transparent; /* Solo el borde */
    transition: border-color 0.2s; /* Solo transicion del color de borde */
    overflow: hidden; /* Importante para que el svg/imagen no se desborde */
}

.access-card:hover .access-logo-box {
    border-color: var(--accent);
}

.access-logo-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.access-name {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-main);
    text-align: center;
    line-height: 1.2;
}

@media (max-width: 768px) {
    .desktop-area {
        padding: 2rem 1rem;
    }
    .apps-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 1.5rem 1rem;
    }
    .access-logo-box {
        width: 80px;
        height: 80px;
        padding: 0;
        border-radius: 18px;
    }
    .access-name {
        font-size: 0.85rem;
    }
}
