/* Identidade visual do medreader-dashboard (paleta, sidebar, cards); só o que o cockpit usa, mais os
   componentes próprios (barra de filtros, cards-tabela, avisos). */
:root {
    --azul-institucional: #3E6FDB;
    --azul-profundo: #2F56B3;
    --azul-suave: #6F93F2;
    --verde-menta: #49C2A1;
    --verde-medico: #2E9E83;
    --verde-suave: #7FE0C7;
    --azul-background: #EAF1FF;
    --verde-background: #E6F7F3;
    --cinza-light: #F4F6F9;
    --cinza-medio-claro: #D9DEE7;
    --texto-secundario: #4A5568;
    --texto-principal: #2D3748;
    --alto-contraste: #1A202C;
    --azul-cta: #2D8CFF;
    --verde-cta: #1BC58D;
    --ciano-destaque: #00B5D8;
    --ambar-aviso: #B7791F;
    --ambar-fundo: #FFF8E6;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, var(--azul-background) 0%, var(--verde-background) 100%);
    min-height: 100vh;
    color: var(--texto-principal);
}

.app-container {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    background: linear-gradient(180deg, var(--azul-institucional) 0%, var(--azul-profundo) 100%);
    color: white;
    display: flex;
    flex-direction: column;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    position: fixed;
    height: 100vh;
    z-index: 1000;
}

.sidebar-header {
    padding: 2rem 1.5rem;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-logo {
    max-width: 120px;
    height: auto;
    filter: brightness(0) invert(1);
    margin-bottom: 0.5rem;
}

.sidebar-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
}

.sidebar-nav {
    flex: 1;
    padding: 1rem 0;
    overflow-y: auto;
}

.sidebar-nav .nav-link {
    color: rgba(255, 255, 255, 0.8);
    padding: 0.75rem 1.5rem;
    border-radius: 0;
    transition: all 0.2s;
    text-decoration: none;
    border-left: 3px solid transparent;
}

.sidebar-nav .nav-link:hover {
    color: white;
    background: rgba(255, 255, 255, 0.1);
    border-left-color: var(--verde-menta);
}

.sidebar-nav .nav-link.active {
    color: white;
    background: rgba(255, 255, 255, 0.15);
    border-left-color: var(--verde-menta);
}

.sidebar-footer {
    padding: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.user-info {
    background: rgba(255, 255, 255, 0.1);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    color: white;
    font-size: 0.85rem;
    margin-bottom: 1rem;
    text-align: center;
    word-break: break-all;
}

.main-content {
    flex: 1;
    margin-left: 260px;
    min-height: 100vh;
}

.card {
    border: none;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.07);
    background: white;
}

.filter-card {
    border-left: 4px solid var(--azul-institucional);
}

.form-label {
    font-weight: 500;
    color: var(--texto-secundario);
    font-size: 0.9rem;
}

.form-control, .form-select {
    border: 1px solid var(--cinza-medio-claro);
    border-radius: 8px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus, .form-select:focus {
    border-color: var(--azul-institucional);
    box-shadow: 0 0 0 0.2rem rgba(62, 111, 219, 0.15);
}

.btn-primary {
    background: linear-gradient(90deg, var(--azul-cta) 0%, var(--ciano-destaque) 100%);
    border: none;
    border-radius: 8px;
    font-weight: 500;
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(45, 140, 255, 0.3);
    background: linear-gradient(90deg, var(--azul-institucional) 0%, var(--azul-cta) 100%);
}

.page-title {
    color: var(--azul-institucional);
    font-weight: 700;
    font-size: 1.5rem;
}

.section-title {
    color: var(--azul-institucional);
    font-weight: 600;
    font-size: 1rem;
    margin: 0;
}

/* Barra de filtros */
.quick-ranges .btn {
    border-radius: 8px;
}

.quick-ranges .btn.active {
    background: var(--azul-institucional);
    border-color: var(--azul-institucional);
    color: white;
}

.tenant-dropdown .dropdown-menu {
    width: 380px;
    max-height: 420px;
    overflow-y: auto;
    padding: 0.5rem 0;
}

.tenant-dropdown .dropdown-header {
    font-weight: 600;
    color: var(--azul-institucional);
}

.tenant-dropdown .form-check {
    padding: 0.2rem 1rem 0.2rem 2.5rem;
}

.filters-dirty {
    color: var(--ambar-aviso);
    font-size: 0.85rem;
}

/* Avisos */
.alert-cockpit {
    background: var(--ambar-fundo);
    border: 1px solid #F6E05E;
    border-radius: 10px;
    color: #744210;
    font-size: 0.9rem;
}

/* Cards de totais */
.stats-card {
    height: 100%;
}

.stats-card .card-body {
    padding: 1.5rem;
}

.stats-card .card-title {
    font-size: 2.2rem;
    font-weight: 700;
    margin: 0;
}

.stats-card .card-subtitle {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.stats-card .split {
    font-size: 0.85rem;
    color: var(--texto-secundario);
}

.stats-icon {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    color: white;
}

.documents-card {
    border-left: 4px solid var(--azul-cta);
}

.documents-card .stats-icon {
    background: linear-gradient(135deg, var(--azul-suave) 0%, var(--azul-cta) 100%);
}

.documents-card .card-title {
    color: var(--azul-institucional);
}

.calls-card {
    border-left: 4px solid var(--ciano-destaque);
}

.calls-card .stats-icon {
    background: linear-gradient(135deg, var(--ciano-destaque) 0%, var(--azul-cta) 100%);
}

.calls-card .card-title {
    color: var(--ciano-destaque);
}

.cost-card {
    border-left: 4px solid var(--verde-medico);
}

.cost-card .stats-icon {
    background: linear-gradient(135deg, var(--verde-menta) 0%, var(--verde-medico) 100%);
}

.cost-card .card-title {
    color: var(--verde-medico);
}

/* Cards-tabela (ranking por tenant/modelo) */
.ranking-card .table-wrap {
    max-height: 320px;
    overflow-y: auto;
}

.ranking-card table {
    font-size: 0.875rem;
    margin: 0;
}

.ranking-card thead th {
    position: sticky;
    top: 0;
    background: white;
    color: var(--texto-secundario);
    font-weight: 600;
}

.ranking-card .share {
    color: var(--texto-secundario);
    width: 4.5rem;
}

/* Gráficos */
.chart-card {
    border-left: 4px solid var(--verde-menta);
}

.chart-container {
    position: relative;
    height: 320px;
}

.empty-state {
    color: var(--texto-secundario);
    text-align: center;
    padding: 2rem 0;
}

/* Login */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--azul-institucional) 0%, var(--verde-menta) 100%);
}

.login-container {
    width: 100%;
    max-width: 450px;
    padding: 2rem;
}

.login-card {
    background: white;
    border-radius: 16px;
    padding: 3rem 2.5rem;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}

.login-logo {
    max-width: 200px;
    height: auto;
}

.login-title {
    color: var(--azul-institucional);
    font-weight: 700;
    font-size: 1.75rem;
}

.btn-google {
    background: white;
    border: 1px solid var(--cinza-medio-claro);
    border-radius: 8px;
    color: var(--texto-principal);
    font-weight: 500;
    padding: 0.7rem 1rem;
}

.btn-google:hover {
    background: var(--cinza-light);
    border-color: var(--azul-suave);
}

.text-muted {
    color: var(--texto-secundario) !important;
}

@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        position: relative;
        height: auto;
    }

    .main-content {
        margin-left: 0;
    }

    .app-container {
        flex-direction: column;
    }

    .tenant-dropdown .dropdown-menu {
        width: 100%;
    }

    .stats-card .card-title {
        font-size: 1.75rem;
    }

    .chart-container {
        height: 260px;
    }
}
