/* ==========================================================================
   RESET GENERAL Y FUENTES
   ========================================================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif; /* Forzamos a usar la fuente de Google */
}

:root {
    --bg-principal: #fcfcfd;
    --bg-tarjetas: #ffffff;
    --borde: #f1f3f5;
    --texto-muted: #868e96;
    --texto-dark: #1a1d20;
}

body {
    background-color: var(--bg-principal);
    color: var(--texto-dark);
    height: 100vh;
    overflow: hidden;
    -webkit-font-smoothing: antialiased; /* Suaviza la fuente en Mac/Chrome */
    -moz-osx-font-smoothing: grayscale;
}

/* ==========================================================================
   ESTRUCTURA DE PANTALLA (LAYOUT)
   ========================================================================== */
.layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    width: 100vw;
    height: 100vh;
}

/* BARRA LATERAL (SIDEBAR) */
.sidebar {
    background-color: #ffffff;
    border-right: 1px solid var(--borde);
    padding: 24px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

/* ==========================================================================
   CABECERA DEL LOGO (BRAND)
   ========================================================================== */
.brand {
    display: flex;
    align-items: center;
    width: 100%;
    margin-bottom: 30px;
    padding: 0 4px;
}

.brand-logo-link {
    display: block;
    width: 100%;
}

.brand-img {
    display: block;
    max-width: 100%;
    max-height: 45px;
    height: auto;
    width: auto;
    object-fit: contain;
}

/* ==========================================================================
   MENÚS Y NUEVOS SUBMENÚS (DETAILS / SUMMARY)
   ========================================================================== */
.menu-section {
    margin-bottom: 24px;
}

.menu-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: #adb5bd;
    font-weight: 700;
    margin-bottom: 12px;
    padding-left: 8px;
}

.menu-list {
    list-style: none;
}

/* Enlaces base del menú */
.menu-item a {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #495057;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    padding: 10px 12px;
    border-radius: 8px;
    margin-bottom: 4px;
    transition: all 0.2s ease;
}

/* Quita estilos de links cuando se meten adentro de un details */
.menu-item details a {
    margin-bottom: 0;
}

.menu-item a.active, 
.menu-item a:hover {
    background-color: #f1f3f5;
    color: #000000;
    font-weight: 600;
}

/* Elemento interactivo superior del Submenú */
details {
    width: 100%;
}

summary {
    list-style: none; /* Oculta flecha nativa */
    outline: none;
    cursor: pointer;
}

summary::-webkit-details-marker {
    display: none; /* Oculta flecha nativa en Safari */
}

/* Contenedor interno del summary para alinear el texto y la flecha */
.dropdown-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #495057;
    font-size: 14px;
    font-weight: 500;
    padding: 10px 12px;
    border-radius: 8px;
    transition: background 0.2s;
}

.dropdown-wrapper:hover {
    background-color: #f1f3f5;
    color: #000000;
}

/* Rotación del icono de flecha cuando <details> está abierto */
details[open] .bi-chevron-right {
    transform: rotate(90deg);
}

.bi-chevron-right {
    font-size: 11px;
    transition: transform 0.2s ease;
    color: var(--texto-muted);
}

/* Lista interna desplegada */
.submenu-list {
    list-style: none;
    padding-left: 24px; /* Sangría hacia la derecha */
    margin-top: 4px;
}

.submenu-item a {
    font-size: 13px !important;
    color: #6c757d !important;
    font-weight: 400 !important;
    padding: 8px 12px !important;
    background: none !important;
}

.submenu-item a:hover {
    color: #000000 !important;
    font-weight: 500 !important;
}

/* ==========================================================================
   USUARIO LOGUEADO (FOOTER SIDEBAR)
   ========================================================================== */
.user-footer {
    border-top: 1px solid var(--borde);
    padding-top: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.avatar {
    width: 38px;
    height: 38px;
    background-color: var(--texto-dark);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
}

/* ==========================================================================
   CONTENIDO CENTRAL Y TOPBAR
   ========================================================================== */
.main {
    padding: 40px;
    overflow-y: auto;
    height: 100vh;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
}

.search-box {
    position: relative;
    width: 340px;
}

.search-box i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--texto-muted);
}

.search-box input {
    width: 100%;
    padding: 10px 10px 10px 40px;
    border: none;
    background-color: #f1f3f5;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 20px;
}

.btn-order {
    background-color: var(--texto-dark);
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 8px;
    font-weight: 500;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
}

.icon-btn {
    color: #495057;
    font-size: 18px;
    cursor: pointer;
}

.welcome-header {
    margin-bottom: 30px;
}

.welcome-header h2 {
    font-size: 26px;
    font-weight: 700;
    margin-bottom: 4px;
    letter-spacing: -0.5px;
}

.welcome-header p {
    color: var(--texto-muted);
    font-size: 15px;
}

/* ==========================================================================
   TARJETAS DE MÉTRICAS (GRID 4 COLUMNAS)
   ========================================================================== */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
    margin-bottom: 30px;
}

.card {
    background-color: var(--bg-tarjetas);
    border: 1px solid var(--borde);
    border-radius: 14px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.card-header-box {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.card-title {
    color: var(--texto-muted);
    font-size: 13px;
    font-weight: 500;
}

.card-value {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.5px;
    margin-top: 4px;
}

.card-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.ic-orange { background-color: #fff3ea; color: #ff8a48; }
.ic-teal { background-color: #e6f9f5; color: #00bfa5; }
.ic-blue { background-color: #eef5ff; color: #3b82f6; }
.ic-yellow { background-color: #fffde6; color: #eab308; }

.trend {
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
}
.up { color: #2b8a3e; }
.down { color: #c92a2a; }
.trend span { color: var(--texto-muted); font-weight: 400; }

/* ==========================================================================
   SECCIÓN INFERIOR (GRÁFICOS)
   ========================================================================== */
.charts-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
}

.chart-box {
    background-color: var(--bg-tarjetas);
    border: 1px solid var(--borde);
    border-radius: 14px;
    padding: 24px;
    min-height: 340px;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chart-header h3 { font-size: 16px; font-weight: 700; }
.chart-header p { font-size: 12px; color: var(--texto-muted); }

.toggle-buttons {
    display: flex;
    background-color: #f1f3f5;
    padding: 4px;
    border-radius: 8px;
    gap: 4px;
}

.toggle-btn {
    background: none;
    border: none;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
}

.toggle-btn.active {
    background-color: white;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.placeholder-text {
    text-align: center;
    color: var(--texto-muted);
    font-size: 13px;
    margin-top: 80px;
}

.header-divider {
    border: 0;
    height: 1px;
    background-color: var(--borde); /* Usa el mismo color gris tenue que ya creamos */
    margin-top: 10px;
    margin-bottom: 35px; /* Le da aire a las tarjetas que vienen abajo */
}