:root {
    --crs-lateral-fundo: #0b1220;
    --crs-lateral-texto: #9aa7bd;
    --crs-lateral-ativo: #ffffff;
    --crs-lateral-destaque: #e5484d;
    --crs-fundo: #f3f5f9;
    --crs-cartao: #ffffff;
    --crs-borda: #e3e8ef;
    --crs-perigo: #e5484d;
    --crs-alerta: #f5a524;
    --crs-info: #3b82f6;
    --crs-neutro: #64748b;
    --crs-largura-lateral: 240px;
}

[data-bs-theme="dark"] {
    --crs-fundo: #0f1522;
    --crs-cartao: #161e2e;
    --crs-borda: #243049;
}

body {
    background: var(--crs-fundo);
    font-size: .925rem;
}

.fonte-mono {
    font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
}

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

.barra-lateral {
    width: var(--crs-largura-lateral);
    flex-shrink: 0;
    background: var(--crs-lateral-fundo);
    color: var(--crs-lateral-texto);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    z-index: 1040;
}

.marca {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: 1.1rem 1.25rem;
    color: #fff;
    font-weight: 700;
    letter-spacing: .08em;
    font-size: 1.1rem;
    text-decoration: none;
    border-bottom: 1px solid rgba(255, 255, 255, .06);
}

.marca i {
    color: var(--crs-lateral-destaque);
    font-size: 1.4rem;
}

.menu {
    padding: .5rem .75rem;
    overflow-y: auto;
    flex: 1;
}

.menu-grupo {
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    padding: 1rem .75rem .35rem;
    opacity: .6;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: .7rem;
    padding: .5rem .75rem;
    border-radius: .5rem;
    color: var(--crs-lateral-texto);
    text-decoration: none;
    margin-bottom: 2px;
}

.menu-item:hover {
    color: #fff;
    background: rgba(255, 255, 255, .05);
}

.menu-item.active {
    color: var(--crs-lateral-ativo);
    background: rgba(229, 72, 77, .16);
    box-shadow: inset 3px 0 0 var(--crs-lateral-destaque);
}

.rodape-menu {
    font-size: .75rem;
    padding: .75rem 1.25rem;
    opacity: .5;
}

.conteudo {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.topo {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .75rem 1.5rem;
    background: var(--crs-cartao);
    border-bottom: 1px solid var(--crs-borda);
    position: sticky;
    top: 0;
    z-index: 1030;
}

.topo-titulo {
    font-size: 1.15rem;
    font-weight: 600;
    margin: 0;
}

.principal {
    padding: 1.5rem;
}

.cartao {
    background: var(--crs-cartao);
    border: 1px solid var(--crs-borda);
    border-radius: .75rem;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
}

.cartao > .card-header {
    background: transparent;
    font-weight: 600;
    border-bottom: 1px solid var(--crs-borda);
    padding: .8rem 1rem;
}

.cartao .table {
    --bs-table-bg: transparent;
}

.cartao .table > thead th {
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--bs-secondary-color);
    font-weight: 600;
    white-space: nowrap;
}

.kpi .card-body {
    position: relative;
    padding: 1.1rem 1.25rem;
}

.kpi-icone {
    position: absolute;
    right: 1.1rem;
    top: 1rem;
    width: 2.6rem;
    height: 2.6rem;
    border-radius: .6rem;
    display: grid;
    place-items: center;
    font-size: 1.3rem;
}

.kpi-valor {
    font-size: 1.9rem;
    font-weight: 700;
    line-height: 1.1;
}

.kpi-rotulo {
    color: var(--bs-secondary-color);
    font-size: .85rem;
}

.kpi-extra {
    font-size: .75rem;
    color: var(--crs-info);
    margin-top: .2rem;
}

.kpi-perigo .kpi-icone { background: rgba(229, 72, 77, .12); color: var(--crs-perigo); }
.kpi-alerta .kpi-icone { background: rgba(245, 165, 36, .14); color: var(--crs-alerta); }
.kpi-info .kpi-icone { background: rgba(59, 130, 246, .12); color: var(--crs-info); }
.kpi-neutro .kpi-icone { background: rgba(100, 116, 139, .14); color: var(--crs-neutro); }

.grafico {
    position: relative;
    height: 280px;
}

.grafico-baixo {
    height: 240px;
}

.lista-dados {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: .35rem 1rem;
    font-size: .875rem;
}

.lista-dados dt {
    font-weight: 500;
    color: var(--bs-secondary-color);
}

.lista-dados dd {
    margin: 0;
}

.fi {
    border-radius: 2px;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, .08);
}

.bandeira-vazia {
    background: var(--crs-borda);
}

.bandeira-grande .fi {
    font-size: 3rem;
    line-height: 1;
}

.ip-grande {
    font-size: 1.6rem;
    font-weight: 700;
}

.tabela-monitor {
    max-height: calc(100vh - 260px);
    overflow-y: auto;
}

.tabela-monitor thead th {
    background: var(--crs-cartao);
}

.linha-nova {
    animation: destaque 2.5s ease-out;
}

@keyframes destaque {
    from { background: rgba(229, 72, 77, .18); }
    to { background: transparent; }
}

.ponto-vivo {
    display: inline-block;
    width: .6rem;
    height: .6rem;
    border-radius: 50%;
    background: #22c55e;
    margin-right: .35rem;
    animation: pulso 1.6s infinite;
}

.ponto-vivo.pausado {
    background: var(--crs-neutro);
    animation: none;
}

@keyframes pulso {
    0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, .6); }
    70% { box-shadow: 0 0 0 8px rgba(34, 197, 94, 0); }
    100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

.opcao-cartao {
    padding: .9rem;
    display: flex;
    flex-direction: column;
    gap: .2rem;
}

.lista-paises {
    max-height: 520px;
    overflow-y: auto;
    border: 1px solid var(--crs-borda);
    border-radius: .5rem;
}

.item-pais {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .4rem .75rem;
    border-bottom: 1px solid var(--crs-borda);
    cursor: pointer;
    margin: 0;
}

.item-pais:hover {
    background: rgba(59, 130, 246, .06);
}

.item-pais .form-check-input {
    margin: 0;
}

.tela-acesso {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background: radial-gradient(circle at 20% 20%, #1c2640, var(--crs-lateral-fundo) 60%);
    padding: 1rem;
}

.cartao-acesso {
    width: 100%;
    max-width: 420px;
    background: var(--crs-cartao);
    border-radius: 1rem;
    padding: 2rem;
    box-shadow: 0 20px 50px rgba(0, 0, 0, .35);
}

.marca-acesso {
    font-size: 1.6rem;
    font-weight: 800;
    letter-spacing: .1em;
}

.marca-acesso i {
    color: var(--crs-lateral-destaque);
}

@media (max-width: 991.98px) {
    .barra-lateral {
        position: fixed;
        left: calc(-1 * var(--crs-largura-lateral));
        transition: left .2s ease;
    }

    .barra-lateral.aberta {
        left: 0;
        box-shadow: 0 0 40px rgba(0, 0, 0, .4);
    }

    .principal {
        padding: 1rem;
    }

    .topo {
        padding: .6rem 1rem;
    }
}
