:root {
    /* --- TEMA NEUTRO (Geral/Sistema) --- */
    --bg-body: #0f0f0f;
    /* Preto quase absoluto para o fundo neutro */
    --bg-panel: #1e1e1e;

    --text-main: #f5f5f5;
    --text-muted: #a0a0a0;

    /* ⚪ MUDANÇA AQUI: De Dourado para Prata/Cinza */
    --primary-color: #bdc3c7;
    --primary-hover: #95a5a6;

    /* Inputs (Formulários) - Mantive os seus, são ótimos */
    --input-bg: #2b2b2b;
    --input-text: #ffffff;
    --input-border: #444;
    --placeholder-color: #888;

    /* Bordas e Sombras */
    --border-color: #333;
    --shadow-color: rgba(0, 0, 0, 0.5);

    /* Navbar */
    --nav-bg: #1e1e1e;
    --border-radius: 8px;
    --nav-height: 70px;

    /* Cores de Estado */
    --danger: #e74c3c;
    --success: #2ecc71;
}

/* ============================================================
   🎨 ESTILIZAÇÃO DO SELECT (Departamento e Unidade)
   ============================================================ */


.input-group select {
    width: 100%;
    padding: 12px 15px;
    background-color: var(--input-bg);
    color: var(--input-text);
    border: 1px solid var(--input-border);
    border-radius: 6px;
    font-size: 0.95rem;
    outline: none;
    cursor: pointer;
    transition: all 0.3s ease;

    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;

    /* Seta Prata/Cinza (#bdc3c7) */
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23bdc3c7%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
    background-repeat: no-repeat;
    background-position: right 15px center;
    background-size: 12px;
}

/* --- TEMA CLARO (Dia/Deserto) --- */
body.light-mode {
    --bg-body: #e6e0d4;
    /* Cor de Areia Suave */
    --bg-panel: #fdfbf7;
    /* Off-white (quase branco) */
    --text-main: #2c2c2c;
    /* Cinza Escuro (para leitura) */
    --text-muted: #555555;
    --primary-color: #b08d55;
    /* Dourado mais escuro para contraste no claro */
    --primary-hover: #8c6b3a;

    /* Inputs (Formulários) - Fundo claro com texto escuro */
    --input-bg: #ffffff;
    --input-text: #222222;
    --input-border: #ccc;
    --placeholder-color: #666;

    /* Bordas e Sombras */
    --border-color: #d1c7b7;
    --shadow-color: rgba(160, 140, 100, 0.2);

    /* Navbar */
    --nav-bg: #fdfbf7;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #0f0f0f;
    transition: background-image 0.5s ease-in-out;
    color: var(--text-color);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.bg-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
    transition: opacity 0.8s ease-in-out;
    opacity: 0;
}

.bg-layer.active-bg {
    opacity: 1;
}

/* --- Botão de Tema (Sol/Lua) --- */
.theme-toggle {
    background: none;
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
    padding: 5px 10px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    margin-left: 15px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-toggle:hover {
    background-color: var(--primary-color);
    color: var(--bg-panel);
}

/* --- Login Page --- */
.login-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

body.light-mode .login-container {
    background: linear-gradient(rgba(230, 224, 212, 0.8), rgba(230, 224, 212, 0.8)),
        url('https://media.r2rp.com/v1/files/1764609774012-jrgjdt15.png');
}

.login-box {
    background-color: var(--bg-panel);
    padding: 40px;
    border-radius: var(--border-radius);
    border-top: 4px solid var(--primary-color);
    width: 100%;
    max-width: 400px;
    box-shadow: 0 0 20px var(--shadow-color);
    text-align: center;
}

.login-logo {
    width: 120px;
    margin-bottom: 20px;
}

.login-footer {
    margin-top: 25px;
    text-align: center;
}

.login-footer p {
    color: #b0b0b0;
    font-size: 0.95rem;
    margin: 5px 0;
}

.login-footer a {
    color: var(--primary-color);
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
}

.login-footer a:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

.form-group {
    margin-bottom: 20px;
    text-align: left;
}

.form-group label {
    display: block;
    color: var(--primary-color);
    margin-bottom: 5px;
    font-size: 0.9rem;
    font-weight: bold;
}

.form-group input {
    width: 100%;
    padding: 12px;
    background-color: var(--input-bg);
    border: 1px solid var(--input-border);
    color: var(--input-text);
    border-radius: 4px;
    outline: none;
}

::placeholder {
    color: var(--placeholder-color);
    opacity: 1;
}

.form-group input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 5px rgba(212, 180, 131, 0.5);
}

.btn-login {
    width: 100%;
    padding: 12px;
    background-color: var(--primary-color);
    color: #000;
    font-weight: bold;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.btn-login:hover {
    background-color: var(--primary-hover);
}

.error-msg {
    color: var(--danger);
    font-size: 0.9rem;
    margin-top: 10px;
    display: none;
}

/* --- LAYOUT SIDEBAR + TOPBAR --- */

/* Variáveis de Tamanho */
:root {
    --sidebar-width: 260px;
    --topbar-height: 70px;
}

/* Isso garante que o espaço do menu seja respeitado mesmo antes dele carregar */
#menu-placeholder {
    display: contents;
    /* Faz o container desaparecer e os filhos (aside/header) agirem normalmente */
}

/* Sidebar (Menu Lateral) */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background-color: var(--bg-panel);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: transform 0.3s ease;
}

.sidebar-header {
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    padding: 0 20px;
    border-bottom: 1px solid var(--border-color);
    gap: 15px;
}

.sidebar-header img {
    height: 40px;
}

.sidebar-header h3 {
    font-size: 1.2rem;
    color: var(--primary-color);
    letter-spacing: 1px;
}

.sidebar-menu {
    list-style: none;
    padding: 20px 0;
    flex: 1;
}

.sidebar-menu li a {
    display: flex;
    align-items: center;
    padding: 15px 25px;
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    transition: 0.3s;
    border-left: 3px solid transparent;
}

/* ============================================
   SIDEBAR - CORREÇÃO COMPLETA
   ============================================ */

/* Estilo BASE dos links (todos) */
.sidebar-menu li a {
    display: flex;
    align-items: center;
    padding: 15px 25px;
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
}

/* Hover dos links NORMAIS (exceto admin) */
.sidebar-menu li a:hover {
    background-color: rgba(212, 180, 131, 0.1);
    color: var(--primary-color);
    border-left-color: var(--primary-color);
}

/* Link ATIVO (página atual) */
.sidebar-menu li a.active {
    background-color: rgba(212, 180, 131, 0.2);
    color: var(--primary-color);
    border-left-color: var(--primary-color);
}

/* ============================================
   PAINEL ADMIN - COR AMARELA FIXA
   ============================================ */

/* Cor padrão (sempre amarelo) */
.sidebar-menu .admin-link {
    color: #f1c40f !important;
}

.sidebar-menu .admin-link:hover {
    background-color: rgba(241, 196, 15, 0.15) !important;
    color: #f39c12 !important;
    border-left-color: #f1c40f !important;
}

.sidebar-menu .admin-link.active {
    background-color: rgba(241, 196, 15, 0.2) !important;
    color: #f1c40f !important;
    border-left-color: #f1c40f !important;
}

gout {
    background: transparent;
    border: 1px solid var(--danger);
    color: var(--danger);
    padding: 8px 15px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-logout:hover {
    background-color: rgba(255, 255, 255, 0.05);
    border-color: #ffffff;
    color: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}


.btn-logout[style*="2ecc71"]:hover,
.btn-logout[style*="3498db"]:hover {
    background-color: rgba(46, 204, 113, 0.15) !important;
    transform: scale(1.05);
}

.btn-logout[style*="e74c3c"]:hover {
    background-color: rgba(231, 76, 60, 0.15) !important;
    transform: scale(1.05);
}

.btn-logout[style*="e67e22"]:hover {
    background-color: rgba(230, 126, 34, 0.15) !important;
    transform: scale(1.05);
}

.theme-toggle {
    background: none;
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
    padding: 5px 10px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    margin-left: 15px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.theme-toggle:hover {
    background-color: rgba(212, 180, 131, 0.2);
    border-color: var(--primary-hover);
    transform: rotate(15deg);
}

body.light-mode .sidebar-menu .admin-link {
    color: #b08d55 !important;
}

body.light-mode .sidebar-menu .admin-link:hover {
    color: #8c6b3a !important;
    background-color: rgba(176, 141, 85, 0.1) !important;
}

.sidebar-menu li a:hover,
.sidebar-menu li a.active {
    background-color: rgba(212, 180, 131, 0.1);
    color: var(--primary-color);
    border-left-color: var(--primary-color);
}

.sidebar-menu .icon {
    margin-right: 15px;
    font-size: 1.2rem;
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid var(--border-color);
}

/* Topbar (Barra de Informações) */
.topbar {
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    /* Começa depois da sidebar */
    right: 0;
    height: var(--topbar-height);
    background-color: var(--bg-panel);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 30px;
    z-index: 900;
    transition: left 0.3s ease;
}

.user-info-display {
    display: flex;
    align-items: center;
    gap: 30px;
}

.info-item {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.info-item small {
    font-size: 0.7rem;
    color: var(--text-muted);
    letter-spacing: 1px;
    margin-bottom: 2px;
}

.info-item span {
    font-weight: bold;
    color: var(--text-main);
}

.badge-pill {
    background: var(--primary-color);
    color: #000 !important;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.9rem;
}

.role-pill {
    color: var(--primary-color) !important;
    text-transform: uppercase;
    font-size: 0.9rem;
}

.toggle-btn {
    background: none;
    border: none;
    color: var(--primary-color);
    font-size: 1.5rem;
    cursor: pointer;
    display: none;
    /* Escondido no PC */
}

/* Ajuste do Main Content */
.main-content {
    margin-left: var(--sidebar-width);
    /* Empurra o conteúdo */
    margin-top: var(--topbar-height);
    padding: 30px;
    transition: margin-left 0.3s ease;
}


.badge-number {
    background-color: var(--primary-color);
    color: #000;
    padding: 5px 12px;
    border-radius: 4px;
    font-weight: bold;
    font-size: 0.8rem;
    text-decoration: none;

    white-space: nowrap;
    min-width: fit-content;
    display: inline-block;
}

.btn-logout {
    background: transparent;
    border: 1px solid var(--danger);
    color: var(--danger);
    padding: 5px 15px;
    border-radius: 4px;
    cursor: pointer;
}

.btn-logout:hover {
    background-color: var(--danger);
    color: white;
}

/* --- Main Content --- */
.main-content {
    margin-top: var(--nav-height);
    padding: 40px 20px;
    min-height: calc(100vh - var(--nav-height) - 60px);
}

.content-wrapper {
    max-width: 1200px;
    margin: 0 auto;
}

.page-header {
    margin-bottom: 40px;
    border-left: 5px solid var(--primary-color);
    padding-left: 20px;
}

.page-header h1 {
    font-size: 2.5rem;
    color: var(--primary-color);
}

.page-header p {
    color: var(--text-muted);
}

/* --- Cards & Grid --- */
.dashboard-grid,
.content-grid,
.signals-grid,
.intensity-levels {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.info-box,
.signal-card,
.level-card,
.content-card,
.tactic-card,
.card {
    background-color: var(--bg-panel);
    padding: 25px;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 6px var(--shadow-color);
}

.info-box:hover,
.card:hover {
    border-color: var(--primary-color);
    transform: translateY(-5px);
}

.info-box.alert {
    background-color: rgba(231, 76, 60, 0.1);
    border-color: var(--danger);
}

/* Ajuste para o modo claro no alerta */
body.light-mode .info-box.alert {
    background-color: rgba(231, 76, 60, 0.05);
}

.info-box h3,
.card h3 {
    color: var(--primary-color);
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.stat-number {
    font-size: 3rem;
    font-weight: bold;
    color: var(--text-main);
    margin: 10px 0;
}

/* --- Links nos Cards --- */
.content-grid a {
    text-decoration: none;
    color: var(--text-main) !important;
    display: block;
}

.content-grid a:visited {
    color: var(--text-main) !important;
}

.content-grid a:hover .card {
    border-color: var(--primary-color);
    transform: translateY(-5px);
    box-shadow: 0 8px 15px var(--shadow-color);
}

.content-grid a:hover h3 {
    color: var(--primary-color);
}

/* --- Tables --- */
.table-container {
    overflow-x: auto;
    background-color: var(--bg-panel);
    border-radius: var(--border-radius);
    padding: 20px;
    margin-bottom: 30px;
    border: 1px solid var(--border-color);
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-main);
}

th {
    color: var(--primary-color);
    text-transform: uppercase;
    font-size: 0.85rem;
}

tr:hover {
    background-color: var(--input-bg);
}

/* --- Veiculos & Armas --- */
.vehicle-showcase {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    align-items: center;
}

.vehicle-img {
    width: 100%;
    border-radius: var(--border-radius);
    border: 2px solid var(--primary-color);
    box-shadow: 0 0 20px var(--shadow-color);
}

.spec-list {
    list-style: none;
    margin-top: 20px;
}

.spec-list li {
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    color: var(--text-main);
}

.weapon-img {
    width: 100%;
    height: 180px;
    object-fit: contain;
    border-radius: 4px;
    margin-bottom: 15px;
    background-color: rgba(0, 0, 0, 0.3);
    padding: 10px;
    border: 1px solid var(--border-color);
}


.footer {
    text-align: center;
    padding: 20px;
    background-color: var(--bg-panel);
    color: var(--text-muted);
    font-size: 0.9rem;
    border-top: 1px solid var(--border-color);
    margin-left: var(--sidebar-width);
    transition: margin-left 0.3s ease;
}

/* Selects dentro da tabela do Admin */
.admin-select {
    background-color: var(--bg-body);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    padding: 5px;
    border-radius: 4px;
    width: 100%;
    max-width: 150px;
    font-size: 0.9rem;
}

.admin-select:focus {
    border-color: var(--primary-color);
    outline: none;
}

/* --- Estilos de Advertência --- */
.warning-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: bold;
    font-size: 0.8rem;
    color: #fff;
}

.warn-low {
    background-color: #f1c40f;
    color: #000;
}

/* 1-2 adv */
.warn-high {
    background-color: #e67e22;
}

/* 3 adv */
.warn-critical {
    background-color: #e74c3c;
    animation: pulse 2s infinite;
}

/* Linha Crítica na Tabela (Remoção Imediata) */
tr.critical-row {
    background-color: rgba(231, 76, 60, 0.15) !important;
    border-left: 4px solid #e74c3c;
}

.input-group label {
    color: var(--primary-color);
    font-weight: bold;
}

.input-group select:hover,
.input-group select:focus {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: #e67e22;
    box-shadow: 0 0 0 3px rgba(230, 126, 34, 0.2);
}

.input-group select option {
    background-color: #1e1b18;
    color: #fff;
    padding: 10px;
}

.input-group select:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

@keyframes pulse {
    0% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }

    100% {
        opacity: 1;
    }
}

/* --- Modal de Perfil --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: var(--bg-panel);
    padding: 30px;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    border: 1px solid var(--primary-color);
    position: relative;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
}

.close-btn {
    background: none;
    border: none;
    color: var(--text-main);
    font-size: 1.5rem;
    cursor: pointer;
}

.profile-detail {
    margin-bottom: 10px;
    font-size: 1rem;
    color: var(--text-main);
}

.warn-history-item {
    background: rgba(0, 0, 0, 0.2);
    padding: 8px;
    margin-top: 5px;
    border-left: 3px solid #e74c3c;
    font-size: 0.9rem;
}




#loginLogo {
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 1;
    transform: scale(1) translateY(0);
    filter: drop-shadow(0 0 10px rgba(0, 0, 0, 0.5));
}

.logo-hidden {
    opacity: 0 !important;
    transform: scale(0.8) translateY(10px);
    filter: blur(5px);
}


@media (max-width: 768px) {
    .vehicle-showcase {
        grid-template-columns: 1fr;
    }

    .nav-container {
        flex-direction: column;
        padding: 10px;
        height: auto;
    }

    .nav-menu {
        gap: 10px;
        flex-wrap: wrap;
        justify-content: center;
        margin: 10px 0;
    }

    .sidebar {
        transform: translateX(-100%);
    }

    .main-content {
        margin-left: 0;
        margin-top: 70px;
    }

    .footer {
        margin-left: 0;
    }

    /* Tira a margem no celular */
    .topbar {
        left: 0;
    }
}