/* ============================================================
   JusFinance - Estilos Principais
   ============================================================ */

:root {
    --primary:   #1a3c5e;
    --accent:    #2980b9;
    --teal:      #00b894;
    --teal-light:#e8faf5;
    --sidebar-w: 240px;
    --navbar-h:  90px;
    --bg:        #f5f6fa;
    --card-shadow: 0 2px 12px rgba(0,0,0,.07);
}

*, *::before, *::after { box-sizing: border-box; }

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: #2d3436;
    margin: 0;
}

/* ---- NAVBAR TOPO ---- */
.top-navbar {
    background: linear-gradient(135deg, #0d2137 0%, #1a3c5e 100%);
    height: var(--navbar-h);
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 12px rgba(0,0,0,.25);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255,255,255,.08);
}
.top-navbar .nav-brand {
    font-size: 1.1rem;
    font-weight: 700;
    color: #fff;
    display: flex;
    align-items: center;
    gap: .75rem;
    text-decoration: none;
}
.top-navbar .nav-brand i { color: var(--teal); font-size: 1.5rem; }
.top-navbar .nav-brand .navbar-logo {
    height: 78px;
    max-width: 260px;
    object-fit: contain;
}
.navbar-nome-escritorio {
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 260px;
}

.sidebar-logo {
    display: block;
    width: 90%;
    max-width: 160px;
    height: auto;
    object-fit: contain;
    margin: 0 auto;
    opacity: .85;
}
.top-navbar .nav-right { display: flex; align-items: center; gap: 1rem; }
.nav-bell {
    position: relative;
    background: none;
    border: none;
    font-size: 1.3rem;
    color: rgba(255,255,255,.75);
    cursor: pointer;
    padding: .3rem;
    line-height: 1;
}
.nav-bell:hover { color: #fff; }
.nav-bell .badge-dot {
    position: absolute; top: 0; right: 0;
    background: #e17055;
    color: #fff;
    font-size: .6rem;
    font-weight: 700;
    width: 16px; height: 16px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    border: 2px solid rgba(255,255,255,.3);
}
.nav-user {
    display: flex; align-items: center; gap: .6rem;
    font-size: .88rem; color: rgba(255,255,255,.8);
}
.nav-avatar {
    width: 34px; height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--teal), var(--accent));
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: .8rem; font-weight: 700;
}
.nav-logout {
    font-size: .82rem;
    color: rgba(255,255,255,.55);
    text-decoration: none;
    padding: .25rem .6rem;
    border-radius: 6px;
    transition: color .15s, background .15s;
}
.nav-logout:hover { color: #ff7675; background: rgba(255,255,255,.08); }

/* ---- SIDEBAR ---- */
.sidebar {
    width: var(--sidebar-w);
    min-height: calc(100vh - var(--navbar-h));
    background: var(--primary);
    border-right: none;
    position: sticky;
    top: var(--navbar-h);
    height: calc(100vh - var(--navbar-h));
    overflow-y: auto;
    padding: 1rem .75rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}
.sidebar-footer {
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: rgba(255,255,255,.35);
    text-align: center;
    padding: .85rem .5rem .5rem;
    border-top: 1px solid rgba(255,255,255,.1);
    margin-top: auto;
}
.sidebar-footer-brand {
    font-size: .62rem;
    font-weight: 800;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: rgba(255,255,255,.2);
    margin-top: .4rem;
}

.sidebar-link {
    color: rgba(255,255,255,.75);
    border-radius: 8px;
    padding: .55rem .85rem;
    font-size: .9rem;
    display: flex;
    align-items: center;
    transition: background .15s, color .15s;
    text-decoration: none;
}
.sidebar-link i { font-size: 1rem; }
.sidebar-link:hover { background: rgba(255,255,255,.12); color: #fff; }
.sidebar-link.active {
    background: rgba(255,255,255,.18);
    color: #fff !important;
    font-weight: 600;
}
.sidebar-section {
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    color: rgba(255,255,255,.35);
    padding: 1rem .85rem .3rem;
}

/* ---- CONTEÚDO PRINCIPAL ---- */
.main-content {
    min-height: calc(100vh - var(--navbar-h));
    padding: 1.75rem 2rem;
    flex: 1;
    min-width: 0;
}

/* ---- CARDS GENÉRICOS ---- */
.card {
    border: 1px solid #edf2f7;
    border-radius: 14px;
    box-shadow: var(--card-shadow);
    background: #fff;
    overflow: hidden;
}
.card-header {
    background: #fff;
    border-bottom: 1px solid #edf2f7;
    padding: 1rem 1.25rem;
    font-size: .95rem;
    font-weight: 600;
}

/* ---- STAT CARDS (dashboard) ---- */
.stat-card {
    background: #fff;
    border-radius: 16px;
    border: 1px solid #edf2f7;
    box-shadow: var(--card-shadow);
    padding: 1.4rem 1.5rem 1.2rem;
    position: relative;
    overflow: hidden;
}
.stat-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: .75rem;
}
.stat-icon-wrap {
    width: 48px; height: 48px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.3rem;
}
.stat-icon-teal   { background: #e8faf5; color: #00b894; }
.stat-icon-blue   { background: #ebf4ff; color: #2980b9; }
.stat-icon-orange { background: #fff5eb; color: #e67e22; }
.stat-icon-green  { background: #f0fff4; color: #27ae60; }

.stat-change {
    font-size: .8rem;
    font-weight: 600;
    padding: .2rem .55rem;
    border-radius: 20px;
}
.stat-change.up   { background: #e8faf5; color: #00b894; }
.stat-change.down { background: #fff0f0; color: #e17055; }
.stat-change.neutral { background: #f5f6fa; color: #b2bec3; }

.stat-label { font-size: .85rem; color: #636e72; margin-bottom: .2rem; }
.stat-value { font-size: 1.65rem; font-weight: 700; color: #2d3436; line-height: 1.1; }

/* ---- CHART TOGGLE ---- */
.chart-toggle .btn { font-size: .8rem; padding: .25rem .8rem; border-radius: 8px; }
.chart-toggle .btn.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

/* ---- ATIVIDADES ---- */
.atividade-item {
    display: flex;
    align-items: flex-start;
    gap: .85rem;
    padding: .85rem 0;
    border-bottom: 1px solid #f5f6fa;
}
.atividade-item:last-child { border-bottom: none; }
.ativ-icon {
    width: 38px; height: 38px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}
.ativ-icon.cliente   { background: #ebf4ff; color: #2980b9; }
.ativ-icon.processo  { background: #fff5eb; color: #e67e22; }
.ativ-icon.financeiro{ background: #e8faf5; color: #00b894; }
.ativ-icon.contrato  { background: #f5eeff; color: #8e44ad; }
.ativ-body { flex: 1; min-width: 0; }
.ativ-title { font-size: .82rem; color: #636e72; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ativ-sub   { font-size: .9rem; font-weight: 600; color: #2d3436; }
.ativ-time  { font-size: .75rem; color: #b2bec3; margin-top: .15rem; }

/* ---- TABELAS ---- */
.table thead th {
    font-size: .8rem;
    font-weight: 600;
    letter-spacing: .4px;
    text-transform: uppercase;
    padding: .75rem 1rem;
    border-bottom: 1px solid #edf2f7;
    color: #636e72;
    background: #f7fafc;
}
.table tbody td { padding: .7rem 1rem; vertical-align: middle; font-size: .9rem; }
.table-hover tbody tr:hover { background: #f0faf7; }

/* ---- BOTÕES ---- */
.btn-primary     { background: var(--teal); border-color: var(--teal); }
.btn-primary:hover{ background: #00a381; border-color: #00a381; }

/* ---- FORMULÁRIOS ---- */
.form-control:focus, .form-select:focus {
    border-color: var(--teal);
    box-shadow: 0 0 0 .2rem rgba(0,184,148,.15);
}
.form-label { font-size: .88rem; margin-bottom: .35rem; color: #636e72; }

/* ---- LOGIN PAGE ---- */
.login-page  { background: linear-gradient(135deg, #1a3c5e 0%, #2980b9 100%); }
.login-card  { border: none; border-radius: 16px; }
.login-logo-header {
    background: linear-gradient(135deg, #0d2137 0%, #1a3c5e 100%);
    padding: 28px 24px 20px;
}
.login-logo  {
    width: 70px; height: 70px; border-radius: 50%;
    background: var(--primary);
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 2rem; color: #fff;
}

/* ---- BADGES ---- */
.badge { font-weight: 500; font-size: .78rem; padding: .35em .65em; border-radius: 6px; }

/* ---- PAGE HEADER ---- */
.page-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 1.5rem;
}
.page-header h4 { font-size: 1.25rem; font-weight: 700; margin: 0; color: #2d3436; }

/* ---- RESPONSIVO ---- */
/* Overlay sidebar mobile */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 998;
}
.sidebar-overlay.active { display: block; }

/* Botão hamburguer */
.hamburger-btn {
    background: none;
    border: none;
    color: #fff;
    font-size: 1.6rem;
    line-height: 1;
    padding: .25rem .5rem;
    margin-right: .5rem;
    cursor: pointer;
    border-radius: 6px;
    transition: background .15s;
}
.hamburger-btn:hover { background: rgba(255,255,255,.12); }

@media (max-width: 992px) {
    :root { --sidebar-w: 0px; }
    .main-content { padding: 1rem; }
    .sidebar {
        position: fixed;
        left: -260px;
        top: 0;
        height: 100vh;
        z-index: 999;
        transition: left .3s ease;
        width: 240px;
    }
    .sidebar.open { left: 0; }
}

@media (min-width: 993px) {
    .hamburger-btn { display: none !important; }
}
