:root {
    --sgm-sidebar-width: 260px;
    --sgm-sidebar-width-collapsed: 72px;
    --sgm-header-height: 60px;
}

body {
    background-color: #f4f6f9;
}

.sgm-guest-body {
    background-color: #eef1f6;
}

.sgm-login-card {
    max-width: 400px;
    width: 100%;
}

.sgm-wrapper {
    display: flex;
    min-height: 100vh;
}

.sgm-sidebar {
    width: var(--sgm-sidebar-width);
    flex-shrink: 0;
    background-color: #1e293b;
    color: #e2e8f0;
    transition: width 0.2s ease;
    overflow-x: hidden;
    overflow-y: auto;
}

.sgm-sidebar-brand {
    padding: 1.25rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sgm-sidebar-brand-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #fff;
    white-space: nowrap;
}

.sgm-sidebar-brand-subtitle {
    font-size: 0.75rem;
    color: #94a3b8;
    white-space: nowrap;
}

.sgm-sidebar-group {
    padding: 0.75rem 0;
}

.sgm-sidebar-group-title {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
    padding: 0.25rem 1rem;
    white-space: nowrap;
}

.sgm-sidebar-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.sgm-sidebar-link,
.sgm-sidebar-link-disabled {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 1rem;
    color: #cbd5e1;
    text-decoration: none;
    font-size: 0.9rem;
    white-space: nowrap;
}

.sgm-sidebar-link:hover {
    background-color: rgba(255, 255, 255, 0.06);
    color: #fff;
}

.sgm-sidebar-link.active {
    background-color: #2563eb;
    color: #fff;
}

.sgm-sidebar-link-disabled {
    color: #475569;
    cursor: not-allowed;
}

.sgm-sidebar-link i,
.sgm-sidebar-link-disabled i {
    font-size: 1.1rem;
    width: 1.25rem;
    text-align: center;
}

.sgm-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.sgm-header {
    height: var(--sgm-header-height);
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0 1rem;
    background-color: #fff;
    border-bottom: 1px solid #e2e8f0;
    position: sticky;
    top: 0;
    z-index: 10;
}

.sgm-header-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0;
    flex: 1;
}

.sgm-content {
    flex: 1;
}

.sgm-sidebar-backdrop {
    display: none;
}

/*
 * Desktop e tablet (>= 768px): a sidebar nasce sempre expandida (ícone +
 * nome). O botão manual pode recolhê-la para o modo compacto (só ícones)
 * — preferência armazenada em localStorage, aplicada apenas nesta faixa.
 */
@media (min-width: 768px) {
    .sgm-sidebar-collapsed .sgm-sidebar {
        width: var(--sgm-sidebar-width-collapsed);
    }

    .sgm-sidebar-collapsed .sgm-sidebar-brand-subtitle,
    .sgm-sidebar-collapsed .sgm-sidebar-group-title,
    .sgm-sidebar-collapsed .sgm-sidebar-link-label {
        display: none;
    }
}

/*
 * Telas pequenas (< 768px): a sidebar não compacta para ícones — ela some
 * da tela (off-canvas) e desliza por cima do conteúdo quando aberta pelo
 * botão, sempre com ícone + nome (nunca perde os rótulos permanentemente).
 */
@media (max-width: 767.98px) {
    .sgm-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        z-index: 1040;
        width: var(--sgm-sidebar-width);
        transform: translateX(-100%);
        transition: transform 0.2s ease;
    }

    .sgm-sidebar-mobile-open .sgm-sidebar {
        transform: translateX(0);
    }

    .sgm-sidebar-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(15, 23, 42, 0.5);
        z-index: 1030;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.2s ease;
    }

    .sgm-sidebar-mobile-open .sgm-sidebar-backdrop {
        opacity: 1;
        pointer-events: auto;
    }

    .sgm-main {
        width: 100%;
    }
}
