:root {
    --cgt-primario:   #2D3A82;
    --cgt-secundario: #40D3B9;
    --cgt-fondo:      #F9F6F2;
    --cgt-sidebar-w:  220px;
    --cgt-topbar-h:   56px;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; }

body {
    background-color: var(--cgt-fondo);
    margin: 0;
    font-family: Arial, sans-serif;
}

/* ── Layout principal ── */
.cgt-wrapper {
    display: flex;
    min-height: 100vh;
}

.cgt-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    margin-left: var(--cgt-sidebar-w);
    min-height: 100vh;
}

/* ── Sidebar ── */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--cgt-sidebar-w);
    height: 100vh;
    background-color: var(--cgt-primario);
    overflow-y: auto;
    z-index: 100;
    padding-bottom: 1rem;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px 16px 16px;
}

.sidebar-logo-icon {
    width: 36px;
    height: 36px;
    background-color: #3D4E9A;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sidebar-logo-text {
    color: #fff;
    font-weight: 700;
    font-size: 14px;
}

.sidebar-logo-accent {
    color: var(--cgt-secundario);
    font-weight: 700;
    font-size: 14px;
}

.sidebar-divider {
    border-color: rgba(255,255,255,0.15);
    margin: 0 16px 8px;
}

/* ── Menú items ── */
.sidebar-menu {
    padding: 0 8px;
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 6px;
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    border-left: 4px solid transparent;
    margin-bottom: 2px;
}

.sidebar-item:hover {
    background-color: rgba(255,255,255,0.08);
    color: #fff;
    text-decoration: none;
}

.sidebar-item.active {
    background-color: rgba(64,211,185,0.2);
    color: var(--cgt-secundario);
    border-left-color: var(--cgt-secundario);
    font-weight: 700;
}

.sidebar-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.sidebar-chevron {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    transition: transform 0.2s;
}

.sidebar-toggle[aria-expanded="true"] .sidebar-chevron {
    transform: rotate(180deg);
}

/* ── Submenú ── */
.sidebar-submenu {
    padding: 2px 0 4px 36px;
}

.sidebar-subitem {
    display: block;
    padding: 7px 12px;
    border-radius: 4px;
    color: rgba(255,255,255,0.6);
    text-decoration: none;
    font-size: 12px;
    transition: color 0.15s, background 0.15s;
    margin-bottom: 1px;
}

.sidebar-subitem:hover {
    color: #fff;
    background-color: rgba(255,255,255,0.06);
    text-decoration: none;
}

.sidebar-subitem.active {
    color: var(--cgt-secundario);
    font-weight: 600;
}

/* ── Usuario sidebar ── */
.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
}

.sidebar-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: rgba(64,211,185,0.3);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
    flex-shrink: 0;
}

.sidebar-user-info {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar-user-name {
    color: rgba(255,255,255,0.85);
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-email {
    color: rgba(255,255,255,0.45);
    font-size: 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Topbar ── */
.cgt-topbar {
    height: var(--cgt-topbar-h);
    background-color: #fff;
    border-bottom: 1px solid #EBEBEB;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.cgt-topbar-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--cgt-primario);
    line-height: 1.2;
}

.cgt-topbar-subtitle {
    font-size: 12px;
    color: #888;
}

.cgt-topbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.cgt-topbar-date {
    font-size: 12px;
    color: #aaa;
}

.cgt-topbar-bell {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    background-color: #F0F0F0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #888;
    cursor: pointer;
}

.cgt-topbar-bell:hover {
    background-color: #E5E5E5;
    color: var(--cgt-primario);
}

/* ── Área de contenido ── */
.cgt-content {
    flex: 1;
    padding: 28px;
}

/* ── Tarjetas ── */
.cgt-card {
    background: #fff;
    border: 1px solid #E8E8E8;
    border-radius: 8px;
    padding: 20px;
}

.cgt-card-label {
    font-size: 12px;
    color: #888;
    margin-bottom: 4px;
}

.cgt-card-value {
    font-size: 26px;
    font-weight: 700;
    color: var(--cgt-primario);
    line-height: 1.2;
}

.cgt-card-trend {
    font-size: 11px;
    margin-top: 4px;
}
.cgt-card-trend.positive { color: var(--cgt-secundario); }
.cgt-card-trend.neutral  { color: #888; }

.cgt-card-section-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--cgt-primario);
}

/* ── Gráfico de barras ── */
.cgt-chart {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    height: 140px;
    padding-bottom: 24px;
    position: relative;
}

.cgt-bar-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    height: 100%;
    justify-content: flex-end;
}

.cgt-bar {
    width: 100%;
    background-color: rgba(45,58,130,0.35);
    border-radius: 4px 4px 0 0;
    transition: background 0.2s;
}

.cgt-bar.active {
    background-color: var(--cgt-secundario);
}

.cgt-bar-label {
    font-size: 10px;
    color: #888;
    margin-top: 4px;
}

.cgt-bar-label.active {
    color: var(--cgt-secundario);
    font-weight: 700;
}

/* ── Movimientos recientes ── */
.cgt-movement-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid #F0F0F0;
}
.cgt-movement-item:last-child { border-bottom: none; }

.cgt-mov-badge {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    flex-shrink: 0;
}
.cgt-mov-badge.venta  { background: rgba(64,211,185,0.2); color: var(--cgt-secundario); }
.cgt-mov-badge.compra { background: rgba(45,58,130,0.15); color: var(--cgt-primario); }

.cgt-mov-info {
    display: flex;
    flex-direction: column;
    flex: 1;
}
.cgt-mov-name { font-size: 13px; color: #333; }
.cgt-mov-time { font-size: 11px; color: #888; }

.cgt-mov-amount {
    font-size: 13px;
    font-weight: 700;
    color: var(--cgt-primario);
}

/* ── Baja existencia ── */
.cgt-badge-warn {
    background-color: #FFF3CD;
    color: #856404;
    font-weight: 400;
    font-size: 12px;
}

.cgt-link-sm {
    font-size: 12px;
    color: var(--cgt-primario);
    text-decoration: none;
}
.cgt-link-sm:hover { text-decoration: underline; }

/* ── Tablas ── */
.cgt-table { font-size: 13px; margin-bottom: 0; }
.cgt-table th { font-size: 12px; font-weight: 700; padding: 10px 16px; white-space: nowrap; }
.cgt-table td { padding: 10px 16px; vertical-align: middle; }
.cgt-table-header { background-color: var(--cgt-primario); color: #fff; }
.cgt-table-header th { color: #fff; border: none; }
.cgt-row-alt { background-color: #E8FAF7; }

.cgt-link { color: var(--cgt-primario); text-decoration: none; font-weight: 500; }
.cgt-link:hover { text-decoration: underline; color: var(--cgt-primario); }

.cgt-action-btn { color: var(--cgt-primario); cursor: pointer; font-size: 14px; text-decoration: none; }
.cgt-action-btn:hover { opacity: 0.7; }

/* ── Badges existencia ── */
.cgt-badge-stock {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}
.cgt-badge-stock.low  { background: #FFEBEE; color: #A32D2D; }
.cgt-badge-stock.ok   { background: #E8FAF7; color: #085041; }

/* ── Badges movimientos ── */
.cgt-badge-mov {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 11px;
}
.cgt-badge-mov.salida  { background: #FFEBEE; color: #A32D2D; }
.cgt-badge-mov.entrada { background: #E8FAF7; color: #085041; }
.cgt-badge-mov.ajuste  { background: #EEF2FF; color: var(--cgt-primario); }

/* ── Badge activo/inactivo ── */
.cgt-badge-activo   { background: #E8FAF7; color: #085041; font-weight: 400; font-size: 12px; }
.cgt-badge-inactivo { background: #F5F5F5; color: #888; font-weight: 400; font-size: 12px; }

/* ── Paginación ── */
.cgt-page-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    border: 1px solid #DEDEDE;
    color: #888;
}
.cgt-page-btn.active { background: var(--cgt-primario); color: #fff; border-color: var(--cgt-primario); }

/* ── Leyenda ── */
.cgt-legend-dot {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 3px;
}
.cgt-legend-dot.low { background: #FFEBEE; }
.cgt-legend-dot.ok  { background: #E8FAF7; }

/* ── Detalle etiquetas ── */
.cgt-detail-label { font-size: 11px; color: #888; margin-bottom: 2px; }
.cgt-detail-value { font-size: 13px; color: #222; }
.cgt-detail-big   { font-size: 20px; font-weight: 700; color: var(--cgt-primario); }

/* ── Botón outline primario ── */
.cgt-btn-outline-primary {
    border: 1px solid var(--cgt-primario);
    background: #EEF2FF;
    color: var(--cgt-primario);
    border-radius: 6px;
    font-size: 13px;
    padding: 8px 16px;
}
.cgt-btn-outline-primary:hover { background: var(--cgt-primario); color: #fff; }

/* ── Botones tipo ajuste ── */
.cgt-btn-tipo {
    border: 1px solid #DEDEDE;
    background: #FAFAFA;
    color: #888;
    border-radius: 6px;
    font-size: 13px;
    padding: 8px 20px;
}
.cgt-btn-tipo.active {
    background: #FFEBEE;
    border-color: #E24B4A;
    color: #A32D2D;
}

/* ── Dropdown usuario topbar ── */
.cgt-user-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: none;
    border: 1px solid #E8E8E8;
    border-radius: 8px;
    padding: 5px 10px;
    cursor: pointer;
    color: #333;
    font-size: 13px;
    transition: background 0.15s;
}
.cgt-user-btn:hover { background: #F5F5F5; }
.cgt-user-btn::after { margin-left: 4px; }

.cgt-user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background-color: rgba(64,211,185,0.25);
    color: var(--cgt-primario);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
}

.cgt-user-label {
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cgt-dropdown {
    min-width: 200px;
    border: 1px solid #E8E8E8;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
    padding: 4px;
}

.cgt-dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    border-radius: 6px;
    font-size: 13px;
    padding: 8px 12px;
    color: #333;
    background: none;
    border: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
}
.cgt-dropdown-item:hover { background: #F5F5F5; color: #333; }
.cgt-dropdown-item.text-danger:hover { background: #FFF0F0; color: #dc3545; }

/* ── Modales ── */
.cgt-modal {
    border-radius: 12px;
    border: none;
}

.cgt-modal-header {
    border-bottom: 1px solid #F0F0F0;
    padding: 20px 24px 16px;
}

.cgt-modal-header .modal-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--cgt-primario);
}

.cgt-modal .modal-body {
    padding: 20px 24px;
}

.cgt-modal-footer {
    border-top: 1px solid #F0F0F0;
    padding: 16px 24px;
}

.cgt-label {
    font-size: 13px;
    font-weight: 600;
    color: #444;
    margin-bottom: 6px;
    display: block;
}

.cgt-input {
    font-size: 13px;
    border: 1px solid #E0E0E0;
    border-radius: 6px;
    padding: 8px 12px;
}

.cgt-input:focus {
    border-color: var(--cgt-secundario);
    box-shadow: 0 0 0 3px rgba(64,211,185,0.15);
    outline: none;
}

.cgt-input:disabled {
    background-color: #F8F8F8;
    color: #999;
}

.cgt-btn-primary {
    background-color: var(--cgt-primario);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    padding: 8px 20px;
}

.cgt-btn-primary:hover {
    background-color: #232f6e;
    color: #fff;
}

.cgt-btn-secondary {
    background-color: #F0F0F0;
    color: #444;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    padding: 8px 20px;
}

.cgt-btn-secondary:hover {
    background-color: #E5E5E5;
    color: #333;
}

/* ── Foto de perfil ── */
.cgt-foto-preview {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background-color: rgba(64,211,185,0.2);
    color: var(--cgt-primario);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 700;
    margin: 0 auto;
    overflow: hidden;
    border: 2px solid #E8E8E8;
}

.cgt-foto-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cgt-user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}
