/* ============================================================
   SG Sistemas - Embaixadores | Design System (base: indica_plus_dashboard.html)
   Paleta remapeada para a marca SG (#0033CC)
   ============================================================ */
:root {
    /* Marca SG */
    --sg-blue: #0033CC;
    --sg-blue-dark: #002080;
    --purple: #6b4df6;
    /* Estrutura do mock */
    --navy: #051636;
    --navy2: #08265c;
    --bg: #f5f7fb;
    --card: #ffffff;
    --text: #172033;
    --muted: #758099;
    --border: #e7eaf1;
    --green: #18a66b;
    --orange: #e89b22;
    --red: #e34d59;
    /* Legado (compatibilidade paginas antigas) */
    --sg-primary: var(--sg-blue);
    --sg-primary-dark: var(--sg-blue-dark);
    --sg-primary-light: #e9efff;
    --sg-accent: #00b4d8;
    --sg-success: var(--green);
    --sg-warning: var(--orange);
    --sg-danger: var(--red);
    --sg-text: var(--text);
    --sg-text-muted: var(--muted);
    --sg-border: var(--border);
}

* { font-family: 'Inter', 'Segoe UI', Arial, sans-serif; }

body.sg-app {
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}

/* ===================== SIDEBAR ===================== */
.sidebar {
    width: 245px;
    background: linear-gradient(180deg, var(--navy), var(--navy2));
    color: #fff;
    padding: 20px 14px;
    position: fixed;
    top: 0; bottom: 0; left: 0;
    z-index: 1040;
    display: flex;
    flex-direction: column;
    transition: transform .25s ease;
}
.sg-logo {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: center;
    padding: 8px 10px 24px;
}
.sg-logo img {
    height: 52px;
    width: auto;
    max-width: 100%;
    object-fit: contain;
}
.menu-title {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: #7890b3;
    padding: 15px 13px 8px;
}
.nav-sg { display: block; }
.nav-sg a {
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 12px 13px;
    margin: 3px 0;
    border-radius: 8px;
    color: #cbd6e8;
    text-decoration: none;
    font-size: 14px;
    transition: background .15s;
}
.nav-sg a:hover, .nav-sg a.active { background: var(--sg-blue); color: #fff; }
.nav-sg .icon { width: 20px; text-align: center; }
.userbox {
    margin-top: auto;
    border-top: 1px solid #234064;
    padding: 16px 8px 0;
    display: flex;
    align-items: center;
    gap: 10px;
}
.avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--sg-blue), var(--purple));
    display: grid;
    place-items: center;
    color: #fff;
    font-weight: 700;
    font-size: 13px;
    flex-shrink: 0;
}
.userbox strong { font-size: 12px; display: block; line-height: 1.3; }
.userbox small { color: #90a5c3; font-size: 11px; }

/* ===================== MAIN / TOPBAR ===================== */
.main { margin-left: 245px; width: calc(100% - 245px); min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
    height: 66px;
    background: #fff;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    position: sticky;
    top: 0;
    z-index: 1030;
}
.breadcrumb-sg { font-size: 13px; color: var(--muted); }
.breadcrumb-sg b { color: var(--text); font-weight: 600; }
.top-actions { display: flex; align-items: center; gap: 14px; }
.profile-chip { display: flex; align-items: center; gap: 9px; }
.profile-chip .avatar { width: 34px; height: 34px; font-size: 12px; }
.profile-chip span { font-size: 13px; font-weight: 600; }
.btn-hamburger {
    display: none;
    border: 1px solid var(--border);
    background: #fff;
    border-radius: 8px;
    width: 40px; height: 40px;
    font-size: 18px;
    color: var(--text);
}

/* ===================== CONTENT ===================== */
.content { padding: 26px 30px 30px; max-width: 1500px; margin: auto; width: 100%; }
.content.content-wide { max-width: none; }
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-bottom: 22px; flex-wrap: wrap; }
.page-title {
    font-size: 24px !important;
    font-weight: 700;
    margin: 0 0 5px !important;
    color: var(--text) !important;
}
.page-title i { color: var(--sg-blue); margin-right: 6px; }
.subtitle { font-size: 13px; color: var(--muted); }

/* ===================== CARDS ===================== */
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 11px;
    box-shadow: 0 2px 10px rgba(17,33,68,.025);
    transition: box-shadow .2s;
}
.card:hover { box-shadow: 0 4px 16px rgba(17,33,68,.06); }

/* KPIs legados (dashboard atual ate Fase 3) */
.kpi-card { border-radius: 11px; overflow: hidden; }
.kpi-card:hover { transform: translateY(-3px); box-shadow: 0 8px 25px rgba(17,33,68,.1); }
.kpi-card .kpi-icon { width: 46px; height: 46px; border-radius: 10px; display: grid; place-items: center; font-size: 1.3rem; background: #eef2ff; color: var(--sg-blue); }
.kpi-card .kpi-value { font-size: 1.7rem; font-weight: 800; line-height: 1; color: var(--text); }
.kpi-card .kpi-label { font-size: .74rem; font-weight: 500; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); }
.kpi-success .kpi-icon, .kpi-warning .kpi-icon, .kpi-danger .kpi-icon, .kpi-info .kpi-icon { background: #f1f4fa; color: inherit; }

/* ===================== BOTOES ===================== */
.btn-sg, .btn.sg-primary {
    background: linear-gradient(135deg, var(--sg-blue), var(--purple));
    border: 0;
    color: #fff;
    font-weight: 600;
    border-radius: 8px;
    padding: .55rem 1.1rem;
    transition: filter .15s, transform .15s;
}
.btn-sg:hover, .btn.sg-primary:hover {
    color: #fff;
    filter: brightness(1.08);
    transform: translateY(-1px);
}
.btn-outline-sg {
    border: 1px solid var(--sg-blue);
    color: var(--sg-blue);
    font-weight: 600;
    border-radius: 8px;
    padding: .45rem 1.05rem;
    background: transparent;
}
.btn-outline-sg:hover { background: var(--sg-blue); color: #fff; }

/* ===================== FORMULARIOS ===================== */
.form-control, .form-select {
    border-radius: 8px;
    border-color: var(--border);
    padding: .55rem .85rem;
    font-size: .92rem;
    color: #536079;
}
.form-control:focus, .form-select:focus {
    border-color: var(--sg-blue);
    box-shadow: 0 0 0 3px rgba(0,51,204,.12);
}
.form-label { font-weight: 500; font-size: .85rem; }
.input-group { border-radius: 8px; overflow: hidden; }
.form-select-ano { min-width: 85px; }
.select-par { width: 126px !important; flex: 0 0 auto; }
.sel-status-filtro { width: 200px !important; flex: 0 0 auto; }

/* ===================== TABELAS ===================== */
.table { font-size: 13px; border-collapse: collapse; }
.table th {
    text-align: left;
    color: var(--muted);
    font-weight: 600;
    background: #fafbfe;
    border-bottom: 1px solid var(--border) !important;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .4px;
    padding: 12px !important;
    white-space: nowrap;
}
.table td { padding: 12px !important; border-bottom: 1px solid #edf0f5; vertical-align: middle; }
.table-hover tbody tr:hover td { background: #f7f9fd; }
.table-dark { --bs-table-bg: #fafbfe; --bs-table-color: var(--muted); --bs-table-border-color: var(--border); }
.table-dark th { text-transform: uppercase; }
.table-responsive { border-radius: 11px; }

/* Tabela densa: mais colunas visiveis sem rolagem */
.table-compact th, .table-compact td { padding: 8px 10px !important; }
.table-compact { font-size: 12.5px; }
.table-compact .badge { padding: .32em .65em; font-size: .68rem; }
.table-compact .btn-sm { padding: .25rem .55rem; font-size: .78rem; }
.cell-main { font-weight: 500; color: var(--text); }
.cell-sub { display: block; font-size: 11px; color: var(--muted); margin-top: 1px; }
.table-compact td .input-group { width: 132px; }

/* ===================== BADGES ===================== */
.badge { font-weight: 600; padding: .42em .8em; border-radius: 20px; font-size: .72rem; letter-spacing: .2px; }
.badge.bg-success { background: #e5f8ef !important; color: #168b5c !important; }
.badge.bg-warning { background: #fff3dc !important; color: #b47710 !important; }
.badge.bg-danger  { background: #ffe8ea !important; color: #c33d4a !important; }
.badge.bg-primary, .badge.bg-info { background: #e9efff !important; color: #3658c9 !important; }
.badge.bg-secondary { background: #eceff5 !important; color: #536079 !important; }

/* ===================== ALERTS / MODAIS ===================== */
.alert { border-radius: 10px; border: 0; font-size: .9rem; }
.modal-content { border-radius: 14px; border: 0; box-shadow: 0 18px 60px rgba(5,22,54,.25); }
.btn-status { min-width: 150px; }

/* ===================== DASHBOARD (mock Indica+) ===================== */
.cards-grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 15px; }
.cards-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 15px; align-items: stretch; }
.metric { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.metric label { font-size: 12px; color: var(--muted); display: block; }
.metric strong { display: block; font-size: 24px; margin-top: 7px; font-weight: 800; }
.delta { font-size: 11px; color: var(--green); margin-top: 6px; }
.metric-icon {
    width: 38px; height: 38px;
    border-radius: 10px;
    background: #eef2ff;
    display: grid;
    place-items: center;
    color: var(--sg-blue);
    font-size: 17px;
    flex-shrink: 0;
}

.grid2 { display: grid; grid-template-columns: 1.65fr 1fr; gap: 15px; margin-top: 15px; }
.bottom-grid { display: grid; grid-template-columns: 1.2fr 1fr 1fr; gap: 15px; margin-top: 15px; }

.card-title { font-weight: 700; font-size: 14px; margin-bottom: 15px; color: var(--text); }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }

.chart { height: 230px; position: relative; padding: 15px 8px 8px 34px; }
.gridline { position: absolute; left: 34px; right: 10px; border-top: 1px dashed #e5e8ef; }
.g1 { top: 40px; } .g2 { top: 85px; } .g3 { top: 130px; } .g4 { top: 175px; } .g5 { top: 220px; }
.chart svg { width: auto; height: calc(100% - 26px); position: absolute; left: 32px; right: 10px; top: 16px; }
.legend { display: flex; gap: 18px; font-size: 11px; color: var(--muted); margin-top: 8px; padding-left: 26px; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--sg-blue); margin-right: 5px; }
.dot.green { background: var(--green); }

.donut-wrap { display: flex; align-items: center; justify-content: center; gap: 25px; min-height: 205px; padding: 8px 0; }
.donut-box { position: relative; width: 150px; height: 150px; flex-shrink: 0; }
.donut { width: 100%; height: 100%; border-radius: 50%; }
.donut::after { content: ""; position: absolute; inset: 25px; background: #fff; border-radius: 50%; }
.donut-text { position: absolute; inset: 0; display: grid; place-items: center; font-size: 25px; font-weight: 800; z-index: 1; }
.stats { font-size: 12px; line-height: 2; color: var(--muted); }
.stats b { color: var(--text); }

.mini-row { display: flex; justify-content: space-between; padding: 11px 0; border-bottom: 1px solid #f0f1f5; font-size: 12.5px; }
.mini-row:last-of-type { border-bottom: 0; }
.link-more { display: inline-block; margin-top: 10px; color: var(--sg-blue); font-size: 12px; font-weight: 700; text-decoration: none; }
.link-more:hover { text-decoration: underline; color: var(--sg-blue-dark); }

.reward { display: flex; gap: 12px; align-items: center; margin: 6px 0 12px; }
.gift { width: 48px; height: 48px; border-radius: 10px; background: #fff1e5; display: grid; place-items: center; font-size: 24px; flex-shrink: 0; }

.card.cta { background: linear-gradient(135deg, #eef2ff, #f7f4ff); border-color: #dfe4ff; box-shadow: none; }
.card.cta h3 { margin: 0 0 8px; font-size: 16px; font-weight: 700; }
.card.cta p { font-size: 12px; color: var(--muted); line-height: 1.55; }

.table-card { margin-top: 15px; }
.table-tools { display: flex; gap: 8px; flex-wrap: wrap; }
.search {
    border: 1px solid var(--border);
    background: #fff;
    border-radius: 8px;
    padding: 9px 13px;
    color: #536079;
    font-size: 13px;
    min-width: 200px;
}
.search:focus { outline: none; border-color: var(--sg-blue); box-shadow: 0 0 0 3px rgba(0,51,204,.12); }

/* Badges de status das indicações */
.b-aguardando   { background: #eceff5 !important; color: #536079 !important; }
.b-em_contato   { background: #e9efff !important; color: #3658c9 !important; }
.b-negociacao   { background: #fff3dc !important; color: #b47710 !important; }
.b-agendou_demo { background: #e0f7fa !important; color: #0891b2 !important; }
.b-ganho        { background: #e5f8ef !important; color: #168b5c !important; }
.b-perdido      { background: #ffe8ea !important; color: #c33d4a !important; }

/* ===================== FOOTER ===================== */
footer.footer-sg {
    background: transparent;
    color: #a0a8b9;
    text-align: center;
    font-size: 11px;
    padding: 22px;
    margin-top: auto;
}

/* ===================== LAYOUT AUTH ===================== */
.auth-body {
    background: linear-gradient(135deg, var(--navy) 0%, var(--navy2) 45%, var(--sg-blue-dark) 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
}
.auth-container { width: 100%; max-width: 480px; }
.auth-brand { text-align: center; margin-bottom: 22px; }
.auth-brand img { height: 52px; margin-bottom: 10px; }
.auth-brand h4 { color: #fff; font-weight: 700; margin: 0; font-size: 1.15rem; }
.auth-brand p { color: #90a5c3; font-size: .82rem; margin: 4px 0 0; }

/* ===================== OVERLAY MOBILE ===================== */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(5,22,54,.55);
    z-index: 1035;
}
.sidebar-overlay.show { display: block; }

/* ===================== RESPONSIVO (mock) ===================== */
@media (max-width: 1100px) {
    .cards-grid-4 { grid-template-columns: repeat(2, 1fr) !important; }
    .cards-grid-3 { grid-template-columns: repeat(2, 1fr) !important; }
    .grid2, .bottom-grid { grid-template-columns: 1fr; }
}
@media (max-width: 992px) {
    .sidebar { transform: translateX(-260px); box-shadow: 0 0 40px rgba(0,0,0,.35); }
    .sidebar.open { transform: translateX(0); }
    .main { margin-left: 0; width: 100%; }
    .btn-hamburger { display: inline-flex; align-items: center; justify-content: center; }
    .profile-chip span { display: none; }
    .content { padding: 20px 18px 28px; }
    .topbar { padding: 0 18px; }
}
@media (max-width: 700px) {
    .page-title { font-size: 1.25rem !important; }
    .cards-grid-4 { grid-template-columns: 1fr !important; }
    .cards-grid-3 { grid-template-columns: 1fr !important; }
}
