/* RESET BÁSICO */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: Arial, Helvetica, sans-serif;
}



/* CONTENEDOR PRINCIPAL */
.main {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* TOPBAR */
.topbar {
    height: 60px;
    background: #fff;
    border-bottom: 1px solid #e9e9e9;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
}

.topbar .accesos button {
    margin-right: 8px;
    padding: 8px 12px;
    border: none;
    border-radius: 4px;
    background: #f0f0f0;
    cursor: pointer;
}

.topbar .accesos button:hover {
    background: #e0e0e0;
}

.topbar .usuario {
    display: flex;
    align-items: center;
    position: relative;
}

.user-dropdown {
    position: relative;
}

.user-dropdown-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid #e9e9e9;
    background: #fff;
    color: #333;
    border-radius: 999px;
    padding: 4px 10px 4px 4px;
    cursor: pointer;
}

.user-dropdown-toggle:hover {
    background: #f7f7f7;
}

.user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #c90000;
    color: #fff;
    font-weight: 700;
    font-size: 12px;
}

.user-name {
    font-size: 12px;
    max-width: 160px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-name-icon {
    color: #666;
    font-size: 12px;
}

.user-chevron {
    font-size: 11px;
    color: #666;
    transition: transform .2s ease;
}

.user-dropdown.open .user-chevron {
    transform: rotate(180deg);
}

.user-dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    min-width: 200px;
    background: #fff;
    border: 1px solid #e9e9e9;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .12);
    z-index: 30;
    padding: 6px;
}

.user-dropdown-item {
    width: 100%;
    border: none;
    background: transparent;
    display: flex;
    align-items: center;
    gap: 8px;
    text-align: left;
    padding: 8px 10px;
    border-radius: 6px;
    color: #333;
}

.user-dropdown-item:hover {
    background: #f4f4f4;
}

.user-dropdown-item.danger {
    color: #b10000;
}

@media (max-width: 768px) {
    .user-name {
        display: none;
    }

    .user-dropdown-toggle {
        padding-right: 8px;
    }
}

/* CONTENIDO CENTRAL */
.content {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 15px;
    overflow: hidden;
}

/* HEADER DEL CONTENIDO */
.content-header {
    display: flex;
    justify-content: space-between;
    align-items: center; /* para escritorio, botones arriba */
    background: #fff;
    padding: 12px 15px;
    border-radius: 6px;
    margin-bottom: 10px;
    border: 1px solid #e9e9e9;
    flex-wrap: nowrap; /* permite que los elementos bajen en móviles */
}

.content-header h2 {
    font-size: 18px;
    margin-bottom: 0;
    color: #5f6368;
}

.content-header .acciones {
    display: flex;
    flex-wrap: wrap;
    gap: 6px; /* espacio entre botones */
    /*flex-shrink: 0;*/
}

.content-header .acciones button {
    /*margin-left: 6px;*/
    padding: 6px 10px;
    border: 1px solid #ccc;
    background: #fafafa;
    border-radius: 4px;
    cursor: pointer;
}

.content-header .acciones button:hover {
    background: #eee;
}

/* MEDIA QUERY PARA MÓVIL */
@media (max-width: 768px) {
    .content-header {
        flex-direction: column; /* título arriba, botones abajo */
        align-items: stretch;   /* ocupan todo el ancho */
    }

    .content-header h2 {
        margin-bottom: 10px;
    }

    .content-header .acciones {
        justify-content: center; /* centra los botones debajo */
    }
}

/* CUERPO DINÁMICO */
.content-body {
    flex: 1;
    background: #fff;
    border-radius: 6px;
    border: 1px solid #e9e9e9;
    padding: 15px;
    overflow: auto;
}

/* FOOTER */
.footer {
    height: 32px;
    background: #fff;
    border-top: 1px solid #e9e9e9;
    display: flex;
    align-items: center;
    padding: 0 15px;
    font-size: 12px;
    color: #555;
}

.dashboard-home {
    min-height: 100%;
    color: #5f6368;
}

.dashboard-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.dashboard-toolbar h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
}

.dashboard-toolbar span {
    color: #697586;
    font-size: 13px;
}

.dashboard-refresh {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    border: 1px solid #e5e7eb;
    background: #fff;
    color: #27364a;
    border-radius: 6px;
    padding: 8px 12px;
}

.dashboard-refresh:hover{

    background:#f8fafc;
    border-color:#d1d5db;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 12px;
}

.dashboard-widget {
    grid-column: span 3;
    min-height: 150px;
    background: #fff;
    border: 1px solid #eceff3;
    border-radius: 6px;
    padding: 18px;
    box-shadow: 0 1px 2px rgba(0,0,0,.05), 0 8px 24px rgba(0,0,0,.05);
    transition: transform .2s, box-shadow .2s, border-color .2s;
    border:0px solid transparent;
    position:relative;
    overflow:hidden;
}

.dashboard-widget::before{
    content:"";
    position:absolute;
    left:0;
    top:0;
    width:5px;
    height:100%;
    border-radius:6px 0 0 6px;
}

.dashboard-widget:hover{
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0,0,0,.08);
}

.dashboard-widget:active {
    cursor: grabbing;
}

.dashboard-widget.widget-md {
    grid-column: span 4;
}

.dashboard-widget.widget-lg {
    grid-column: span 6;
}

.widget-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
}

.widget-header div {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.widget-header i{
    width:34px;
    height:34px;
    display:flex;
    align-items:center;
    justify-content:center;
    border-radius:10px;
    font-size:15px;
}

.widget-header strong {
    font-size:14px;
    font-weight:600;
    color:#4b5563; 
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.widget-header button {
    border: none;
    background: transparent;
    color: #8391a2;
    padding: 4px;
}

.widget-kpi {
    font-size:26px;
    font-weight:700;
    letter-spacing:-1px;
    font-weight: 800;
    line-height: 1.15;
    color: #3f4752;
}

.widget-content small,
.widget-note {
    display: block;
    margin-top: 6px;
    color:#6b7280;
    font-size:13px;
}

.widget-note {
    color: #9a6a00;
}

.widget-loading,
.widget-error {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 80px;
    color: #697586;
    font-size: 13px;
}

.widget-loading span {
    width: 16px;
    height: 16px;
    border: 2px solid #dbe2ea;
    border-top-color: #2f80ed;
    border-radius: 50%;
    animation: dashboard-spin .8s linear infinite;
}

.widget-error {
    color: #b42318;
}

.tone-danger .widget-header i {
    color:#d62839;
    background:#fdecec;
}

.tone-primary .widget-header i {
    color:#2563eb;
    background:#eef4ff;
}

.tone-success .widget-header i {
    color:#198754;
    background:#e9f8ef;
}

.tone-info .widget-header i {
    color:#0ea5e9;
    background:#eaf8ff;
}

.tone-warning .widget-header i {
    color:#c27c00;
    background:#fff7e0;
}

.progress-track,
.bar-track {
    height: 8px;
    border-radius: 999px;
    background: #eef2f6;
    overflow: hidden;
}

.progress-track span,
.bar-track span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: #2f80ed;
}

.line-chart {
    width: 100%;
    height: 160px;
    color: #2f80ed;
    background: linear-gradient(#f8fafc, #fff);
    border: 1px solid #eef2f6;
    border-radius: 6px;
}

.chart-axis {
    display: flex;
    justify-content: space-between;
    gap: 4px;
    margin-top: 6px;
    color: #697586;
    font-size: 11px;
}

.ranking-row,
.bar-label,
.seller-goal > div:first-child {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.ranking-row {
    border-bottom: 1px solid #eef2f6;
    padding: 8px 0;
}

.ranking-row span,
.bar-label span,
.seller-goal strong {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 13px;
    color: #4b5563;
}

.ranking-row strong,
.bar-label strong {
    font-size: 12px;
    color: #5f6368;
}

.bar-row,
.seller-goal {
    display: grid;
    gap: 6px;
    margin-bottom: 10px;
}

.seller-goal small {
    margin: 0;
    white-space: nowrap;
}

@keyframes dashboard-spin {
    to {
        transform: rotate(360deg);
    }
}

@media (max-width: 1200px) {
    .dashboard-widget,
    .dashboard-widget.widget-md {
        grid-column: span 6;
    }

    .dashboard-widget.widget-lg {
        grid-column: span 12;
    }
}

@media (max-width: 768px) {
    .dashboard-toolbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .dashboard-widget,
    .dashboard-widget.widget-md,
    .dashboard-widget.widget-lg {
        grid-column: span 12;
    }
}
