.historico-header {
    width: 100%;
    background: linear-gradient(135deg, #0f0f0f 0%, #1a1a1a 100%);
    padding: 3rem 2rem;
    border-bottom: 1px solid #333;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1400px;
    margin: 0 auto;
}

.historico-header h1 {
    color: #e0e0e0;
    font-size: 2.5rem;
    font-weight: 700;
    margin: 0 0 0.5rem 0;
}

.historico-header .subtitle {
    color: #30a14e;
    font-size: 1rem;
    margin: 0;
}

.header-buttons {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.btn-action {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: #30a14e;
    color: #fff;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
}

.btn-action:hover {
    background: #28a745;
    transform: translateY(-2px);
}

.btn-action.btn-danger {
    background: #dc3545;
}

.btn-action.btn-danger:hover {
    background: #c82333;
}

.dropdown {
    position: relative;
    display: inline-block;
}

.btn-add-chart {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: #30a14e;
    color: #fff;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
}

.btn-add-chart:hover {
    background: #28a745;
    transform: translateY(-2px);
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 8px;
    min-width: 250px;
    max-height: 400px;
    overflow-y: auto;
    z-index: 1000;
    margin-top: 0.5rem;
    box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}

.dropdown-menu.active {
    display: block;
}

@media (max-width: 768px) {
    .dropdown-menu {
        min-width: 200px;
        max-width: calc(100vw - 2rem);
        right: auto;
        left: 0;
    }
}

.dropdown-menu-item {
    padding: 0.75rem 1rem;
    color: #e0e0e0;
    cursor: pointer;
    border-bottom: 1px solid #333;
    transition: background 0.2s;
}

.dropdown-menu-item:hover {
    background: rgba(48,161,78,0.2);
    color: #30a14e;
}

.dropdown-menu-item:last-child {
    border-bottom: none;
}

#charts-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
    padding: 2rem;
    width: 100%;
    max-width: 100%;
    background: #0f0f0f;
    min-height: calc(100vh - 300px);
    box-sizing: border-box;
}

#charts-container.empty {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
}

#charts-container.empty::before {
    content: "Selecciona una gráfica para comenzar";
    color: #888;
    font-size: 1.2rem;
    text-align: center;
}

/* Tablet: 1 gráfica por fila */
@media (max-width: 1024px) {
    #charts-container {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        padding: 1.5rem;
    }
}

/* Mobile: 1 gráfica por fila */
@media (max-width: 768px) {
    #charts-container {
        grid-template-columns: 1fr;
        gap: 1rem;
        padding: 1rem;
    }
    
    .header-content {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }
}

html, body {
    width: 100%;
    overflow-x: hidden;
}

.chart-container {
    background: #1a1a1a;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
    padding: 2rem;
    border: 1px solid #333;
    min-height: 450px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
}

.chart-container:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(48,161,78,0.2);
}

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

.chart-title {
    color: #e0e0e0;
    font-size: 1.3rem;
    font-weight: 700;
    text-align: center;
    letter-spacing: 0.5px;
    flex-grow: 1;
}

.btn-remove-chart {
    background: #dc3545;
    color: #fff;
    border: none;
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.2s;
    flex-shrink: 0;
}

.btn-remove-chart:hover {
    background: #c82333;
}

.chart-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: rgba(48,161,78,0.05);
    border-radius: 8px;
    border-left: 3px solid #30a14e;
}

.stat-item {
    text-align: center;
}

.stat-label {
    font-size: 0.75rem;
    color: #888;
    margin-bottom: 0.4rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    color: #30a14e;
    font-weight: 700;
    font-size: 1.2rem;
}

canvas {
    max-width: 100% !important;
    height: auto !important;
    flex-grow: 1;
}

.chart-wrapper {
    position: relative;
    flex-grow: 1;
    display: flex;
    align-items: center;
}

/* Botón flotante scroll to top */
.btn-scroll-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 50px;
    height: 50px;
    background: #30a14e;
    color: #fff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(48, 161, 78, 0.3);
    transition: background 0.3s, transform 0.3s, box-shadow 0.3s;
    z-index: 999;
}

.btn-scroll-top:hover {
    background: #28843d;
    transform: translateY(-3px);
    box-shadow: 0 6px 16px rgba(48, 161, 78, 0.4);
}

.btn-scroll-top.visible {
    display: flex;
}

/* Media queries para dispositivos móviles */
@media (max-width: 768px) {
    .btn-scroll-top {
        bottom: 1rem;
        right: 1rem;
        width: 45px;
        height: 45px;
    }
}