/* Mary Gestão - identidade visual (lilás / roxo) */
:root {
    --mary-900: #4A1D57;
    --mary-800: #5E2670;
    --mary-700: #6B2D7B;
    --mary-600: #8E4FA8;
    --mary-500: #9B6BB5;
    --mary-400: #B58BCB;
    --mary-300: #C9A8DC;
    --mary-200: #E2D0EC;
    --mary-100: #F1E8F6;
    --mary-50: #FAF6FC;
    --mary-text: #3B2645;
    --mary-muted: #8A7795;

    --bs-primary: var(--mary-700);
    --bs-primary-rgb: 107, 45, 123;
    --bs-link-color: var(--mary-700);
    --bs-link-color-rgb: 107, 45, 123;
    --bs-link-hover-color: var(--mary-900);
    --bs-body-font-family: 'Poppins', system-ui, sans-serif;
    --bs-body-color: var(--mary-text);
    --bs-body-bg: var(--mary-50);
    --bs-border-color: var(--mary-200);
    --bs-focus-ring-color: rgba(142, 79, 168, .25);
}

body { background: var(--mary-50); font-size: .925rem; }
.text-mary { color: var(--mary-700) !important; }
.text-muted { color: var(--mary-muted) !important; }
.bg-mary-soft { background: var(--mary-100) !important; }

/* Botões */
.btn-primary {
    --bs-btn-bg: var(--mary-700); --bs-btn-border-color: var(--mary-700);
    --bs-btn-hover-bg: var(--mary-800); --bs-btn-hover-border-color: var(--mary-800);
    --bs-btn-active-bg: var(--mary-900); --bs-btn-active-border-color: var(--mary-900);
    --bs-btn-disabled-bg: var(--mary-400); --bs-btn-disabled-border-color: var(--mary-400);
}
.btn-outline-primary {
    --bs-btn-color: var(--mary-700); --bs-btn-border-color: var(--mary-400);
    --bs-btn-hover-bg: var(--mary-700); --bs-btn-hover-border-color: var(--mary-700);
    --bs-btn-active-bg: var(--mary-800); --bs-btn-active-border-color: var(--mary-800);
}
.btn-soft {
    background: var(--mary-100); color: var(--mary-700); border: 1px solid var(--mary-200);
}
.btn-soft:hover { background: var(--mary-200); color: var(--mary-900); }
.form-control:focus, .form-select:focus { border-color: var(--mary-400); box-shadow: 0 0 0 .2rem rgba(142, 79, 168, .18); }
.form-check-input:checked { background-color: var(--mary-600); border-color: var(--mary-600); }
.form-label { font-weight: 500; font-size: .85rem; color: var(--mary-800); margin-bottom: .3rem; }

/* Estrutura */
.app { display: flex; min-height: 100vh; }
.sidebar {
    width: 250px; flex-shrink: 0;
    background: linear-gradient(175deg, var(--mary-800) 0%, var(--mary-700) 45%, var(--mary-600) 100%);
    color: #fff; display: flex; flex-direction: column;
}
@media (min-width: 992px) {
    .sidebar { position: sticky; top: 0; height: 100vh; overflow-y: auto; }
}
/* Rolagem do menu discreta (só aparece se a tela for baixa demais) */
.sidebar { scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, .25) transparent; }
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .25); border-radius: 3px; }
.sidebar.offcanvas-lg { --bs-offcanvas-width: 260px; --bs-offcanvas-bg: var(--mary-700); }
.sidebar-brand { display: flex; align-items: center; justify-content: space-between; padding: 1.4rem 1.25rem 1rem; }
.sidebar-brand a { display: flex; align-items: center; gap: .35rem; color: #fff; }
.sidebar-brand img { filter: brightness(0) invert(1); opacity: .9; }
.brand-script { font-family: 'Great Vibes', cursive; font-size: 2.3rem; line-height: 1; }
.brand-sub { font-family: 'Playfair Display', serif; font-size: .8rem; letter-spacing: .25em; text-transform: uppercase; opacity: .85; margin-top: .7rem; }
.sidebar-nav { padding: .5rem .75rem; flex: 1; }
.sidebar-nav a {
    display: flex; align-items: center; gap: .75rem; padding: .62rem .9rem; margin-bottom: .2rem;
    color: rgba(255, 255, 255, .85); text-decoration: none; border-radius: .6rem; font-weight: 400; transition: background .15s;
}
.sidebar-nav a i { font-size: 1.1rem; }
.sidebar-nav a:hover { background: rgba(255, 255, 255, .1); color: #fff; }
.sidebar-nav a.active { background: #fff; color: var(--mary-700); font-weight: 500; box-shadow: 0 4px 14px rgba(0, 0, 0, .12); }
.sidebar-label { font-size: .7rem; text-transform: uppercase; letter-spacing: .12em; opacity: .6; padding: 1rem .9rem .4rem; }
.sidebar-footer { padding: 1rem 1.25rem 1.4rem; font-size: .75rem; opacity: .75; font-style: italic; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
    display: flex; align-items: center; padding: .9rem 1.75rem; background: rgba(255, 255, 255, .85);
    backdrop-filter: blur(6px); border-bottom: 1px solid var(--mary-200); position: sticky; top: 0; z-index: 100;
}
.page-title { font-family: 'Playfair Display', serif; font-size: 1.45rem; margin: 0; color: var(--mary-800); }
.content { padding: 1.5rem 1.75rem 3rem; }
@media (max-width: 575.98px) {
    .content { padding: 1rem; }
    .topbar { padding: .75rem 1rem; }
}
.btn-user { display: flex; align-items: center; gap: .5rem; border: 0; color: var(--mary-800); }
.avatar {
    width: 34px; height: 34px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, var(--mary-400), var(--mary-700)); color: #fff; font-weight: 600;
}

/* Cards */
.card { border: 1px solid var(--mary-200); border-radius: 1rem; box-shadow: 0 2px 12px rgba(107, 45, 123, .05); }
.card-header { background: transparent; border-bottom: 1px solid var(--mary-100); padding: 1rem 1.25rem; }
.card-title { font-family: 'Playfair Display', serif; font-size: 1.05rem; color: var(--mary-800); margin: 0; }
.card-body { padding: 1.25rem; }

.kpi { position: relative; overflow: hidden; height: 100%; }
.kpi .card-body { display: flex; align-items: center; gap: 1rem; }
.kpi-icon {
    width: 48px; height: 48px; flex-shrink: 0; border-radius: 50%; display: flex; align-items: center; justify-content: center;
    background: var(--mary-100); color: var(--mary-700); font-size: 1.3rem;
}
.kpi-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--mary-muted); font-weight: 500; }
.kpi-valor { font-size: 1.35rem; font-weight: 600; color: var(--mary-800); line-height: 1.25; white-space: nowrap; }
.kpi-destaque { background: linear-gradient(135deg, var(--mary-700), var(--mary-500)); border: 0; }
.kpi-destaque .kpi-label { color: rgba(255, 255, 255, .8); }
.kpi-destaque .kpi-valor { color: #fff; }
.kpi-destaque .kpi-icon { background: rgba(255, 255, 255, .2); color: #fff; }

/* Tabelas */
.table { --bs-table-bg: transparent; margin-bottom: 0; }
.table > thead th {
    font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--mary-700);
    background: var(--mary-100); border-bottom: 0; font-weight: 600; white-space: nowrap; padding: .7rem .75rem;
}
.table > tbody td { vertical-align: middle; border-color: var(--mary-100); padding: .65rem .75rem; }
.table-hover > tbody > tr:hover > * { --bs-table-bg-state: var(--mary-50); }
.table tfoot td, .table tfoot th { font-weight: 600; background: var(--mary-50); border-top: 2px solid var(--mary-200); }
.table-responsive { border-radius: 0 0 1rem 1rem; }

.badge-soft { background: var(--mary-100); color: var(--mary-700); font-weight: 500; }
.valor-pos { color: #2E8B57; }
.valor-neg { color: #C0392B; }

/* Filtros */
.filtros { background: #fff; border: 1px solid var(--mary-200); border-radius: 1rem; padding: 1rem 1.25rem; margin-bottom: 1.25rem; }

.nav-pills .nav-link { color: var(--mary-700); border-radius: 2rem; }
.nav-pills .nav-link.active { background: var(--mary-700); }

/* Login */
.login-page {
    min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1.25rem; padding: 1rem;
    background: radial-gradient(circle at 15% 20%, var(--mary-200) 0, transparent 40%),
                radial-gradient(circle at 85% 80%, var(--mary-300) 0, transparent 45%), var(--mary-50);
}
.login-card { width: 100%; max-width: 410px; border-radius: 1.5rem; box-shadow: 0 20px 50px rgba(107, 45, 123, .15); }
.login-logo { text-align: center; color: var(--mary-600); }
.login-logo .brand-script { font-size: 4rem; color: var(--mary-600); }
.login-logo .brand-sub { display: block; margin-top: -.4rem; color: var(--mary-800); }

.empty-state { text-align: center; padding: 3rem 1rem; color: var(--mary-muted); }
.empty-state i { font-size: 2.5rem; color: var(--mary-300); display: block; margin-bottom: .5rem; }
.chart-box { position: relative; height: 300px; }
.chart-box.sm { height: 240px; }
.min-w-0 { min-width: 0; }
.badge-soft { white-space: normal; text-align: left; line-height: 1.3; }
@media (max-width: 575.98px) {
    .kpi .card-body { padding: .9rem 1rem; }
    .kpi-valor { font-size: 1.2rem; }
}

/* Créditos */
.rodape { padding: 0 1.75rem 1.5rem; margin-top: auto; }
.creditos { text-align: center; font-size: .8rem; color: var(--mary-muted); margin: 0; }
.creditos a { color: var(--mary-700); font-weight: 500; text-decoration: none; }
.creditos a:hover { text-decoration: underline; }
.creditos .coracao { color: #D9468B; }

/* Telas baixas (notebooks): menu mais compacto, sem a frase do rodapé */
@media (min-width: 992px) and (max-height: 760px) {
    .sidebar-brand { padding: 1rem 1.25rem .6rem; }
    .sidebar-nav a { padding: .45rem .9rem; margin-bottom: .1rem; }
    .sidebar-label { padding: .6rem .9rem .3rem; }
    .sidebar-footer { display: none; }
}
