/* Painéis com menu lateral (master e afiliados). */
:root {
    --acc: #7c3aed;
    --acc-texto: #b794ff;
    --acc-escuro: #6425d3;
    --acc-claro: #f1ebff;
    --preto: #151225;
    --preto-claro: #221d38;
    --linha: #2e2848;
    --bs-primary: #7c3aed;
    --bs-primary-rgb: 124, 58, 237;
    --bs-link-color: #6425d3;
    --bs-link-color-rgb: 100, 37, 211;
    --bs-link-hover-color: #4c1d95;
}
body { display: flex; min-height: 100vh; background-color: #f5f4f9; }

/* Menu lateral */
.sidebar { width: 250px; background-color: var(--preto); position: fixed; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; z-index: 1050; }
.sidebar-brand { padding: 1.5rem 1rem; border-bottom: 1px solid var(--linha); text-align: center; }
.sidebar-brand .titulo { color: #fff; font-weight: 700; }
.sidebar-brand .titulo i { color: var(--acc); }
.badge-master { display: inline-block; margin-top: .4rem; background-color: var(--acc); color: #fff; font-size: .68rem; padding: .2rem .6rem; border-radius: 20px; letter-spacing: .05em; font-weight: 600; }
.sidebar-nav { padding: 1rem 0; flex: 1; }
.sidebar-nav .rotulo { color: #6f6a88; font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; padding: .9rem 1.5rem .3rem; }
.sidebar-nav a { display: flex; align-items: center; padding: .7rem 1.5rem; color: #c9c5dc; text-decoration: none; border-left: 4px solid transparent; transition: all .2s ease; }
.sidebar-nav a i { width: 1.6rem; }
.sidebar-nav a:hover { background-color: var(--preto-claro); color: #fff; }
.sidebar-nav a.active { background-color: var(--preto-claro); border-left-color: var(--acc); color: var(--acc-texto); }
.sidebar-nav a .contador { margin-left: auto; background: #dc3545; color: #fff; font-size: .68rem; border-radius: 20px; padding: .1rem .45rem; font-weight: 700; }
.sidebar-footer { padding: 1rem 1.5rem; border-top: 1px solid var(--linha); }
.sidebar-footer a { color: #c9c5dc; text-decoration: none; font-size: .9rem; }
.sidebar-footer a:hover { color: var(--acc-texto); }

/* Conteúdo */
.main-content { flex: 1; margin-left: 250px; padding: 2rem; min-width: 0; }
.topbar { margin-bottom: 1.75rem; padding-bottom: 1rem; border-bottom: 1px solid #e4e2ec; display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; }
.topbar h1 { font-size: 1.6rem; font-weight: 700; color: #1e1b2e; margin: 0; }
.topbar .subtitle { color: #7d7892; font-size: .9rem; }
.card { border: none; border-radius: 12px; box-shadow: 0 2px 10px rgba(21, 18, 37, .06); }
.card-header { background: #fff; border-bottom: 1px solid #efedf5; border-radius: 12px 12px 0 0 !important; padding: 1rem 1.25rem; }
.card-header h2 { font-size: 1.02rem; font-weight: 700; color: #1e1b2e; margin: 0; display: flex; align-items: center; gap: .5rem; }
.card-header h2 i { color: var(--acc); }
.table thead th { border-top: none; color: #7d7892; font-size: .76rem; text-transform: uppercase; letter-spacing: .03em; font-weight: 600; background: #faf9fd; }
.table > :not(caption) > * > * { padding: .75rem 1rem; }

/* Indicadores */
.stat-card { padding: 1rem 1.15rem; display: flex; flex-direction: row; align-items: center; gap: .85rem; height: 100%; text-decoration: none; color: inherit; }
a.stat-card:hover { box-shadow: 0 4px 16px rgba(124, 58, 237, .15); }
.stat-icon { width: 42px; height: 42px; border-radius: 10px; background: var(--acc-claro); color: var(--acc); display: flex; align-items: center; justify-content: center; font-size: 1.15rem; flex-shrink: 0; }
.stat-icon.verde { background: #e7f7ee; color: #1a9c4a; }
.stat-icon.amarelo { background: #fff5dc; color: #b07b00; }
.stat-icon.vermelho { background: #fde8e8; color: #c62828; }
.stat-icon.cinza { background: #efeef3; color: #5f5a74; }
.stat-numero { font-size: 1.35rem; font-weight: 700; color: #1e1b2e; line-height: 1.1; }
.stat-label { color: #7d7892; font-size: .78rem; }
.destaque-card { background: var(--preto); color: #fff; border-radius: 12px; padding: 1.2rem 1.35rem; height: 100%; }
.destaque-card .label { color: #9993b3; font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; }
.destaque-card .valor { font-size: 1.8rem; font-weight: 700; margin-top: .2rem; }
.destaque-card .sub { color: var(--acc-texto); font-size: .85rem; }

/* Filtros em pílula */
.filtros { display: flex; gap: .4rem; flex-wrap: wrap; }
.filtros a { padding: .35rem .85rem; border-radius: 20px; background: #fff; border: 1px solid #e4e2ec; color: #4a4560; text-decoration: none; font-size: .85rem; }
.filtros a.ativo { background: var(--acc); border-color: var(--acc); color: #fff; }
.filtros a .n { opacity: .7; margin-left: .2rem; }

/* Abas da empresa */
.nav-abas { border-bottom: 1px solid #e4e2ec; gap: .25rem; margin-bottom: 1.25rem; }
.nav-abas .nav-link { color: #7d7892; border: 0; border-bottom: 3px solid transparent; border-radius: 0; font-weight: 600; }
.nav-abas .nav-link.active { color: var(--acc); border-bottom-color: var(--acc); background: none; }

.btn-primary { --bs-btn-bg: var(--acc); --bs-btn-border-color: var(--acc); --bs-btn-hover-bg: var(--acc-escuro); --bs-btn-hover-border-color: var(--acc-escuro); --bs-btn-active-bg: #4c1d95; }
.btn-outline-primary { --bs-btn-color: var(--acc); --bs-btn-border-color: var(--acc); --bs-btn-hover-bg: var(--acc); --bs-btn-hover-border-color: var(--acc); --bs-btn-active-bg: var(--acc-escuro); }
.form-control:focus, .form-select:focus { border-color: var(--acc-texto); box-shadow: 0 0 0 .2rem rgba(124, 58, 237, .18); }
.avatar-emp { width: 38px; height: 38px; border-radius: 10px; background: var(--acc-claro); color: var(--acc); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: .85rem; flex-shrink: 0; }
.vazio { text-align: center; color: #9993b3; padding: 2.5rem 1rem; }
.vazio i { font-size: 2.2rem; display: block; margin-bottom: .5rem; }

/* Celular */
.mobile-topbar, .sidebar-overlay { display: none; }
@media (max-width: 991.98px) {
    body { padding-top: 56px; }
    .mobile-topbar { display: flex; align-items: center; gap: .75rem; position: fixed; top: 0; left: 0; right: 0; height: 56px; background-color: var(--preto); padding: 0 1rem; z-index: 1045; }
    .mobile-topbar .btn-menu { background: transparent; border: none; color: #fff; font-size: 1.4rem; padding: .25rem .5rem; line-height: 1; }
    .mobile-topbar .mobile-topbar-title { color: #fff; font-weight: 600; font-size: .95rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .mobile-topbar .badge-master { margin-top: 0; flex-shrink: 0; }
    .sidebar { transform: translateX(-100%); transition: transform .25s ease; top: 0; width: 260px; }
    .sidebar.show { transform: translateX(0); box-shadow: 6px 0 20px rgba(0, 0, 0, .3); }
    .sidebar-overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, .45); z-index: 1040; }
    .sidebar-overlay.show { display: block; }
    .main-content { margin-left: 0; padding: 1.25rem 1rem; width: 100%; }
    .topbar { flex-wrap: wrap; align-items: flex-start; }
}

/* Tema do painel de AFILIADOS: mesma estrutura, em verde. */
body.tema-afiliado {
    --acc: #059669;
    --acc-texto: #6ee7b7;
    --acc-escuro: #047857;
    --acc-claro: #e3f6ee;
    --preto: #0e1d19;
    --preto-claro: #163029;
    --linha: #22423a;
    --bs-primary: #059669;
    --bs-primary-rgb: 5, 150, 105;
    --bs-link-color: #047857;
    --bs-link-color-rgb: 4, 120, 87;
    --bs-link-hover-color: #065f46;
    background-color: #f3f7f5;
}
.tema-afiliado .form-control:focus, .tema-afiliado .form-select:focus { border-color: #6ee7b7; box-shadow: 0 0 0 .2rem rgba(5, 150, 105, .18); }
.tema-afiliado a.stat-card:hover { box-shadow: 0 4px 16px rgba(5, 150, 105, .15); }
.codigo-afiliado { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 1.9rem; font-weight: 800; letter-spacing: .12em; color: var(--acc-escuro); }
.qr-box { background: #fff; border-radius: 12px; padding: 12px; display: inline-block; }
.qr-box canvas, .qr-box img { display: block; }

.cor-bolinha { display: inline-block; width: 22px; height: 22px; border-radius: 50%; margin-right: 4px; border: 2px solid #fff; box-shadow: 0 0 0 1px #e4e2ec; vertical-align: middle; }
