:root {
    --sidebar-width: 260px;
    --sidebar-bg: #1a1f2e;
    --sidebar-color: #a0aec0;
    --topbar-height: 60px;
    --primary: #4f46e5;
}

/* LOGIN */
.login-body {
    min-height: 100vh;
    background: linear-gradient(135deg, #1a1f2e 0%, #2d3748 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}
.login-box {
    background: #fff;
    border-radius: 16px;
    padding: 2.5rem;
    width: 100%;
    max-width: 420px;
}

/* BODY */
body.erp-body {
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', sans-serif;
    background: #f0f2f5;
    overflow-x: hidden;
}

/* SIDEBAR */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: transform .3s ease;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,.1);
    border-radius: 4px;
}

.sidebar-brand {
    position: sticky;
    top: 0;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,.08);
    color: #fff;
    font-weight: 700;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: .75rem;
    background: var(--sidebar-bg);
    z-index: 2;
    flex-shrink: 0;
}
.sidebar-brand i {
    font-size: 1.4rem;
    color: var(--primary);
}

.sidebar-menu {
    padding: .75rem 0 2rem;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.sidebar-label {
    padding: .5rem 1.5rem .2rem;
    font-size: .63rem;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: #4a5568;
    margin-top: .25rem;
}

.sidebar-menu a {
    display: flex !important;
    align-items: center;
    gap: .75rem;
    padding: .6rem 1.5rem;
    color: var(--sidebar-color);
    text-decoration: none !important;
    font-size: .88rem;
    transition: all .2s;
    border-left: 3px solid transparent;
    white-space: nowrap;
    cursor: pointer;
}
.sidebar-menu a:hover {
    color: #fff;
    background: rgba(255,255,255,.05);
}
.sidebar-menu a.active {
    color: #fff;
    background: rgba(79,70,229,.2);
    border-left-color: var(--primary);
}
.sidebar-menu a i {
    font-size: .95rem;
    width: 18px;
    text-align: center;
    flex-shrink: 0;
}

/* SUBMENU */
.sidebar-menu a.has-sub { cursor: pointer; }
.sidebar-menu a.has-sub .arrow {
    transition: transform .2s;
    font-size: .72rem;
    margin-left: auto !important;
    width: auto !important;
}
.sidebar-menu a.has-sub[aria-expanded="true"] .arrow,
.sidebar-menu a.has-sub.open .arrow {
    transform: rotate(180deg);
}
.submenu {
    background: rgba(0,0,0,.18);
    border-left: 2px solid rgba(79,70,229,.35);
    margin-left: 1.5rem;
    overflow: hidden;
}
.submenu a {
    padding: .42rem 1rem .42rem 1.1rem !important;
    font-size: .82rem !important;
    border-left: none !important;
    color: #8a9ab5 !important;
    white-space: normal !important;
}
.submenu a:hover {
    color: #fff !important;
    background: rgba(255,255,255,.06) !important;
}
.submenu a.active {
    color: #fff !important;
    background: rgba(79,70,229,.25) !important;
}
.submenu-section {
    padding: .45rem 1rem .1rem;
    font-size: .6rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: #4a5568;
    margin-top: .2rem;
}
.submenu-info {
    display: flex;
    align-items: center;
    gap: .4rem;
    padding: .3rem 1rem .3rem 1.1rem;
    font-size: .75rem;
    color: #718096;
    border-top: 1px solid rgba(255,255,255,.05);
    margin-top: .25rem;
}

/* TOPBAR */
.topbar {
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    right: 0;
    bottom: auto;
    height: var(--topbar-height);
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    z-index: 999;
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
.topbar-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* CONTEÚDO PRINCIPAL */
.main-content {
    margin-left: var(--sidebar-width);
    padding-top: var(--topbar-height);
    min-height: 100vh;
}
.page-content { padding: 1.75rem; }
.page-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: #1a202c;
    margin-bottom: .2rem;
}
.page-subtitle {
    color: #718096;
    font-size: .9rem;
    margin-bottom: 1.5rem;
}

/* CARDS ESTATÍSTICA */
.stat-card {
    background: #fff;
    border-radius: 12px;
    padding: 1.5rem;
    border: 1px solid #e2e8f0;
    transition: box-shadow .2s, transform .2s;
    height: 100%;
}
.stat-card:hover {
    box-shadow: 0 4px 20px rgba(0,0,0,.08);
    transform: translateY(-2px);
}
.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}
.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: #1a202c;
    line-height: 1.2;
}
.stat-label {
    font-size: .83rem;
    color: #718096;
    margin-bottom: .25rem;
}
.stat-change { font-size: .78rem; margin-top: .2rem; }

/* CARDS TABELA */
.table-card {
    background: #fff;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    overflow: hidden;
}
.table-card-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 600;
    font-size: .95rem;
}

/* TABELAS */
.table th {
    font-weight: 600;
    font-size: .83rem;
    color: #4a5568;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.table td { vertical-align: middle; font-size: .9rem; }

/* RESPONSIVO */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .topbar { left: 0; }
    .main-content { margin-left: 0; }
}