* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    background: #f4f6f8;
    color: #222;
}

.topbar {
    height: 80px;
    background: #1f2937;
    color: white;
    display: flex;
    align-items: center;
    padding: 0 24px;
}

.brand {
    font-size: 22px;
    font-weight: bold;
}

.layout {
    display: flex;
    min-height: calc(100vh - 60px);
}

.sidebar {
    width: 220px;
    background: #111827;
    padding: 20px;
}

.sidebar nav {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sidebar a {
    color: white;
    text-decoration: none;
    padding: 10px 12px;
    border-radius: 4px;
}

.sidebar a:hover {
    background: #374151;
}

.content {
    flex: 1;
    padding: 24px;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.page-header h1 {
    margin: 0;
}

.btn {
    display: inline-block;
    padding: 8px 14px;
    text-decoration: none;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.btn-primary {
    background: #2563eb;
    color: white;
}

.btn-danger {
    background: #dc2626;
    color: white;
}

.btn-success {
    background: #16a34a;
    color: white;
}

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

th,
td {
    padding: 10px;
    border-bottom: 1px solid #ddd;
    text-align: left;
}

th {
    background: #e5e7eb;
}

tr:hover {
    background: #f9fafb;
}
.form-card {
    max-width: 800px;
    background: white;
    padding: 24px;
    border-radius: 6px;
}

.form-group {
    display: flex;
    flex-direction: column;
    margin-bottom: 18px;
}

.form-group label {
    font-weight: bold;
    margin-bottom: 6px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    font-size: 12px;
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #2563eb;
}

.form-group input[readonly] {
    background: #f1f5f9;
    color: #64748b;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-help {
    margin-top: 5px;
    color: #64748b;
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.alert {
    max-width: 800px;
    padding: 12px 16px;
    margin-bottom: 16px;
    border-radius: 4px;
}

.alert-error {
    background: #fee2e2;
    border: 1px solid #dc2626;
    color: #991b1b;
}

@media (max-width: 700px) {
    .form-row {
        grid-template-columns: 1fr;
    }

    .sidebar {
        width: 160px;
    }

    .content {
        padding: 16px;
    }
}

.filter-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: 12px;

    margin: 16px 0 24px 0;
    padding: 14px;

    background: #ffffff;
    border: 1px solid #e1e5ea;
    border-radius: 8px;
}

.filter-bar > input[type="text"] {
    min-width: 260px;
    flex: 1 1 280px;
}

.filter-bar > select {
    min-width: 180px;
}

.filter-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.filter-field label {
    font-size: 12px;
    font-weight: 600;
}

.filter-field input[type="date"] {
    min-width: 150px;
    min-height: 36px;
}
/* =========================================================
   BADGES
   ========================================================= */

.badge {
    display: inline-block;
    padding: 5px 9px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: bold;
    white-space: nowrap;
}

.badge-active {
    background: #dcfce7;
    color: #166534;
}

.badge-inactive {
    background: #e5e7eb;
    color: #4b5563;
}


/* Status do ativo */

.status-disponivel {
    background: #dcfce7;
    color: #166534;
}

.status-em_operacao {
    background: #dbeafe;
    color: #1e40af;
}

.status-em_busca {
    background: #fef3c7;
    color: #92400e;
}

.status-localizado {
    background: #e0e7ff;
    color: #3730a3;
}

.status-manutencao {
    background: #ffedd5;
    color: #9a3412;
}

.status-inativo {
    background: #e5e7eb;
    color: #4b5563;
}

/* =========================================================
   PERFIS DE USUÁRIO
   ========================================================= */

.role-admin {
    background: #fee2e2;
    color: #991b1b;
}

.role-supervisor {
    background: #dbeafe;
    color: #1e40af;
}

.role-operador {
    background: #dcfce7;
    color: #166534;
}

.role-auditor {
    background: #f3e8ff;
    color: #6b21a8;
}

/* =========================================================
   LOGIN
   ========================================================= */

.login-body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f1f5f9;
}

.login-container {
    width: 100%;
    max-width: 420px;
    padding: 20px;
}

.login-card {
    background: white;
    padding: 32px;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.10);
}

.login-brand {
    font-size: 28px;
    font-weight: bold;
    text-align: center;
    color: #1f2937;
}

.login-subtitle {
    text-align: center;
    color: #64748b;
    margin-top: 6px;
    margin-bottom: 28px;
}

.login-button {
    width: 100%;
    padding: 11px;
    font-size: 14px;
}

/* =========================================================
   Linha do tempo das missões
   ========================================================= */

.mission-timeline {
    position: relative;
    margin-top: 20px;
    padding-left: 30px;
}

.mission-timeline::before {
    content: "";
    position: absolute;
    left: 8px;
    top: 5px;
    bottom: 5px;
    width: 2px;
    background: #d6dbe1;
}

.timeline-item {
    position: relative;
    margin-bottom: 20px;
}

.timeline-marker {
    position: absolute;
    left: -28px;
    top: 7px;

    width: 14px;
    height: 14px;

    border-radius: 50%;

    background: #2f6fed;
    border: 3px solid #ffffff;

    box-shadow:
        0 0 0 2px #2f6fed;
}

.timeline-content {
    background: #ffffff;

    border: 1px solid #e1e5ea;
    border-radius: 8px;

    padding: 14px 16px;
}

.timeline-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

.timeline-header strong {
    font-size: 15px;
}

.timeline-date {
    color: #6b7280;
    font-size: 13px;
    white-space: nowrap;
}

.timeline-details {
    margin-top: 8px;
}

.timeline-position {
    margin-top: 8px;
    font-size: 13px;
    color: #374151;
}

.timeline-code {
    margin-top: 8px;

    font-size: 11px;
    color: #9ca3af;

    font-family: monospace;
}

.filter-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.filter-field label {
    font-size: 12px;
    font-weight: 600;
}

.filter-field input[type="date"] {
    min-height: 36px;
}
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 12px;

    margin: 16px 0 24px;
    padding: 16px;

    background: #ffffff;
    border: 1px solid #e1e5ea;
    border-radius: 8px;
}

.filter-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.filter-field label {
    font-size: 12px;
    font-weight: 600;
}

.filter-field input,
.filter-field select {
    min-height: 38px;
    box-sizing: border-box;
}

.filter-search {
    flex: 1 1 300px;
}

.filter-search input {
    width: 100%;
}

.filter-field select {
    min-width: 180px;
}

.filter-field input[type="date"] {
    min-width: 155px;
}

.filter-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* =========================================================
   Status das missões
   ========================================================= */

.badge.mission-open {
    background: #e5e7eb;
    color: #374151;
}

.badge.mission-navigating {
    background: #dbeafe;
    color: #1d4ed8;
}

.badge.mission-rf_search {
    background: #fef3c7;
    color: #92400e;
}

.badge.mission-found {
    background: #dcfce7;
    color: #166534;
}

.badge.mission-completed {
    background: #d1fae5;
    color: #065f46;
}

.badge.mission-cancelled {
    background: #fee2e2;
    color: #991b1b;
}

/* =========================================================
   DASHBOARD
   ========================================================= */

.dashboard-cards {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin: 20px 0 24px;
}

.dashboard-card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 120px;
    padding: 20px;
    border: 1px solid #e5e7eb;
    border-left: 5px solid #6b7280;
    border-radius: 12px;
    background: #f3f4f6;
    color: #374151;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.dashboard-card-title {
    font-size: 14px;
    font-weight: 600;
    color: inherit;
    opacity: 0.85;
    margin-bottom: 12px;
}

.dashboard-card-value {
    margin-top: 12px;
    font-size: 34px;
    font-weight: 700;
    line-height: 1.1;
    color: inherit;
}

/* Ativos cadastrados */
.dashboard-card.dashboard-card-neutral {
    background: #f3f4f6;
    border-color: #d1d5db;
    border-left-color: #6b7280;
    color: #374151;
}

/* Missões em andamento */
.dashboard-card.dashboard-card-blue {
    background: #dbeafe;
    border-color: #93c5fd;
    border-left-color: #2563eb;
    color: #1d4ed8;
}

/* Busca por RF */
.dashboard-card.dashboard-card-cyan {
    background: #cffafe;
    border-color: #67e8f9;
    border-left-color: #0891b2;
    color: #0e7490;
}

/* Localizadas */
.dashboard-card.dashboard-card-green {
    background: #dcfce7;
    border-color: #86efac;
    border-left-color: #16a34a;
    color: #15803d;
}

/* Não localizadas */
.dashboard-card.dashboard-card-orange {
    background: #ffedd5;
    border-color: #fdba74;
    border-left-color: #ea580c;
    color: #c2410c;
}

/* Ativos declarados perdidos */
.dashboard-card.dashboard-card-red {
    background: #fee2e2;
    border-color: #fca5a5;
    border-left-color: #dc2626;
    color: #b91c1c;
}

@media (hover: hover) {
    .dashboard-card:hover {
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
    }
}

@media (max-width: 900px) {
    .dashboard-cards {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 600px) {
    .dashboard-cards {
        grid-template-columns: 1fr;
    }
}
.dashboard-card-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

.dashboard-card-link .dashboard-card {
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.dashboard-card-link:hover .dashboard-card {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}
.loss-action {
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid #d1d5db;
}

.loss-action h3 {
    margin-top: 0;
    margin-bottom: 12px;
    color: #991b1b;
}

.loss-action .form-help {
    margin-bottom: 20px;
}

.loss-action textarea {
    width: 100%;
    box-sizing: border-box;
}

.btn-danger {
    background: #b91c1c;
    color: #ffffff;
    border: 1px solid #b91c1c;
}

.btn-danger:hover {
    background: #991b1b;
}

.audit-history {
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid #d1d5db;
}

.audit-history h3 {
    margin-top: 0;
    margin-bottom: 16px;
}

.audit-history table {
    width: 100%;
    border-collapse: collapse;
}

.audit-history th,
.audit-history td {
    padding: 10px;
    text-align: left;
    vertical-align: top;
    border-bottom: 1px solid #e5e7eb;
}
/* Logout com aparência dos links da barra lateral */
.sidebar nav form {
    margin: 0;
    padding: 0;
    width: 100%;
}

.sidebar nav form button.nav-link {
    display: block;
    width: 100%;
    padding: 12px 16px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: #e5e7eb;
    font-family: inherit;
    font-size: 17px;
    font-weight: 500;
    line-height: 1.5;
    text-align: left;
    cursor: pointer;
}

.sidebar nav form button.nav-link:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
}

.page-header.mission-live-header {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 100%;
    text-align: center;
    gap: 4px;
    margin-bottom: 16px;
}

.page-header.mission-live-header h1 {
    margin: 0;
    text-align: center;
}

.page-header.mission-live-header p {
    margin: 0;
    text-align: center;
}

.page-header.mapa-live-header {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 100%;
    text-align: center;
    gap: 4px;
    margin-bottom: 16px;
}



/* Destaque da fase da operação */
.map-live-phase {
    padding: 10px 12px;
    border-radius: 8px;
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    font-weight: 600;
}

/* Espaço antes do mapa */
.map-live-info {
    margin-bottom: 12px;
}

@media (max-width: 700px) {

    .live-info-row,
    .map-live-info-row {
        grid-template-columns: 1fr;
        gap: 3px;
    }

    .live-info-row strong,
    .map-live-info-row strong {
        text-align: left;
    }
}

/* =========================================================
   TABELAS - ACOMPANHAMENTO DA MISSÃO
   ========================================================= */

.live-table {
    width: 100%;
    border-collapse: collapse;
    background: #ffffff;
    margin-bottom: 20px;
}

.live-table th {
    width: 32%;
    padding: 10px;
    text-align: left;
    vertical-align: middle;
    background: #e5e7eb;
    font-weight: 600;
}

.live-table td {
    padding: 10px;
    text-align: left;
    vertical-align: middle;
    background: #ffffff;
}

.live-table th,
.live-table td {
    border-bottom: 1px solid #d1d5db;
}

.live-table tr[hidden] {
    display: none;
}

.map-live-table {
    margin-bottom: 16px;
}

/* =========================================================
   BOTÃO ROTA ATÉ O ALVO
   ========================================================= */

.route-target-container {
    display: flex;
    justify-content: center;
    margin: 14px 0 18px;
}

.route-target-button {
    min-width: 280px;
    padding: 12px 24px;

    border: 0;
    border-radius: 8px;

    background: #2563eb;
    color: #ffffff;

    font-family: inherit;
    font-size: 15px;
    font-weight: 700;

    cursor: pointer;

    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);

    transition:
        background 0.15s ease,
        transform 0.15s ease,
        box-shadow 0.15s ease;
}

.route-target-button:hover {
    background: #1d4ed8;
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.20);
}

.route-target-button:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.16);
}

.route-target-icon {
    display: inline-block;
    margin-right: 8px;
    font-size: 18px;
    vertical-align: -1px;
}


/* =========================================================
   OPERAÇÕES EM TEMPO REAL
   ========================================================= */

.page-header.operations-live-header {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 100%;
    text-align: center;
    gap: 4px;
    margin-bottom: 18px;
}

.operations-live-header h1,
.operations-live-header p {
    margin: 0;
}

.operations-summary {
    margin-bottom: 16px;
    font-size: 16px;
}

.operations-live-table {
    width: 100%;
    border-collapse: collapse;
}

.operations-live-table th,
.operations-live-table td {
    padding: 10px;
    text-align: left;
    vertical-align: middle;
    border-bottom: 1px solid #d1d5db;
}

.operations-live-table th {
    background: #e5e7eb;
    font-weight: 600;
}

.operations-empty {
    text-align: center !important;
    padding: 24px !important;
}

.position-online {
    color: #15803d;
    font-weight: 700;
}

.position-warning {
    color: #b45309;
    font-weight: 700;
}

.position-offline {
    color: #b91c1c;
    font-weight: 700;
}

.operations-map-card {
    margin-top: 20px;
}

.page-header.operations-map-header {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    text-align: center;
    margin-bottom: 14px;
}

.operations-map-header h2 {
    margin: 0;
}

/* =========================================================
   INFOWINDOW - MAPA DAS OPERAÇÕES
   ========================================================= */

.map-info-window {
    min-width: 230px;
    padding: 4px 2px;
    line-height: 1.6;
    font-size: 14px;
}

.map-info-title {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid #d1d5db;
}

.map-info-action {
    margin-top: 12px;
    text-align: center;
}

.map-info-action .btn {
    display: inline-block;
}

/* Logo SAMU - barra superior */
.topbar img.topbar-samu-logo {
    display: block;
    height: 100px !important;
    width: auto !important;
    max-height: 100px !important;
    max-width: 130px !important;
    object-fit: contain !important;
    flex-shrink: 0;
}

.topbar-institution {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 50px;
}

.topbar-institution-text {
    display: flex;
    flex-direction: column;
    justify-content: center;
    line-height: 1.15;
}

.topbar-institution-text strong {
    font-size: 15px;
}

.topbar-institution-text span {
    font-size: 11px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.topbar-institution {
    margin-left: auto;
}

/* Padronização da página Cadastro de Ativos */

.assets-page .filter-bar input,
.assets-page .filter-bar select,
.assets-page .filter-bar button,
.assets-page .filter-bar .btn,
.assets-page table th,
.assets-page table td,
.assets-page table .btn {
    font-family: inherit;
    font-size: 14px;
}

.assets-page table th {
    font-weight: 600;
}

.assets-page table .badge {
    font-size: 13px;
    font-weight: 600;
}

/* Ações administrativas da edição de ativos */

.asset-admin-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid #e1e5ea;
}

.asset-admin-actions form {
    margin: 0;
}


/* =========================================================
   GEO FENCE - ESTADO E ALERTA OPERACIONAL
   ========================================================= */

.geofence-badge-inside {
    background: #dcfce7;
    color: #166534;
}

.geofence-badge-outside {
    background: #fee2e2;
    color: #991b1b;
}

.geofence-badge-waiting {
    background: #fef3c7;
    color: #92400e;
}

.geofence-badge-disabled,
.geofence-badge-none {
    background: #e5e7eb;
    color: #4b5563;
}

/*
 * Destaque aplicado à linha inteira quando o ativo
 * está atualmente fora da área permitida.
 */
.geofence-alert-row {
    background: #fff7ed;
}

.geofence-alert-row td:first-child {
    border-left: 4px solid #dc2626;
}

.geofence-alert-text {
    display: block;
    margin-top: 4px;
    color: #b91c1c;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
}


/* =========================================================
   GEO FENCE - PAINEL OPERACIONAL DE ALARMES
   ========================================================= */

.geofence-command-panel {
    margin-bottom: 24px;
    padding: 22px;
    border: 2px solid #dc2626;
    border-radius: 10px;
    background: #fff7f7;
}

.geofence-command-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}

.geofence-command-title {
    font-size: 26px;
    font-weight: 800;
    color: #991b1b;
}

.geofence-command-subtitle {
    margin-top: 4px;
    color: #6b7280;
}

.geofence-command-counter {
    padding: 10px 18px;
    border-radius: 8px;
    background: #dc2626;
    color: white;
    font-size: 18px;
    font-weight: 800;
}

.geofence-command-alert {
    display: grid;
    grid-template-columns:
        minmax(180px, 1fr)
        minmax(220px, 1.5fr)
        auto;
    gap: 24px;
    align-items: center;
    padding: 18px;
    margin-top: 12px;
    border-radius: 8px;
}

.geofence-command-alert-open {
    border: 2px solid #dc2626;
    background: #fee2e2;
}

.geofence-command-alert-ack {
    border: 2px solid #f59e0b;
    background: #fef3c7;
}

.geofence-command-asset-number {
    margin-bottom: 6px;
    font-size: 24px;
    font-weight: 800;
}

.geofence-command-event strong {
    display: block;
    margin-bottom: 5px;
    font-size: 20px;
}

.geofence-command-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.geofence-command-actions form {
    margin: 0;
}

.geofence-alert-open {
    background: #fff1f2;
}

.geofence-alert-ack {
    background: #fffbeb;
}

@media (max-width: 900px) {
    .geofence-command-alert {
        grid-template-columns: 1fr;
    }
}


/* =========================================================
   GEO FENCE - MONITORAMENTO EM TEMPO REAL / ÁUDIO
   ========================================================= */

.geofence-monitor-controls {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    flex-wrap: wrap;
}

.geofence-sound-toggle {
    font-weight: 700;
}

.geofence-sound-enabled {
    background: #dcfce7;
    color: #166534;
    border-color: #86efac;
}

.geofence-live-indicator {
    color: #166534;
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
}

@media (max-width: 800px) {
    .geofence-monitor-controls {
        justify-content: flex-start;
    }
}
