/* ════════════════════════════════════════════════════════════
   SafePress — tema sobre Bootstrap 5.3
   main.css é carregado DEPOIS do Bootstrap (CDN) e sobrescreve
   o necessário. Mantém a paleta original do projeto e centraliza
   os componentes usados pelos templates.
   ════════════════════════════════════════════════════════════ */

/* ── PALETA (paleta original do projeto) ── */
:root {
    --primary: #0f3a7d;
    --primary-light: #1e5ba8;
    --accent: #00d4aa;
    --danger: #e63946;
    --warning: #f77f00;
    --success: #06a77d;
    --bg-light: #f8f9fa;
    --text-primary: #1a1a2e;
    --text-secondary: #666;
    --border: #e0e0e0;
    --shadow: 0 2px 8px rgba(15, 58, 125, 0.1);
    --shadow-lg: 0 8px 24px rgba(15, 58, 125, 0.15);

    /* sidebar/shell */
    --sidebar-bg: #091f45;
    --sidebar-hover: rgba(255, 255, 255, 0.07);
    --sidebar-border: rgba(255, 255, 255, 0.08);

    /* ── Mapeia a paleta nas variáveis do Bootstrap ── */
    --bs-primary: #0f3a7d;
    --bs-primary-rgb: 15, 58, 125;
    --bs-link-color: #0f3a7d;
    --bs-link-color-rgb: 15, 58, 125;
    --bs-link-hover-color: #1e5ba8;
    --bs-success: #06a77d;
    --bs-success-rgb: 6, 167, 125;
    --bs-danger: #e63946;
    --bs-danger-rgb: 230, 57, 70;
    --bs-warning: #f77f00;
    --bs-warning-rgb: 247, 127, 0;
    --bs-body-color: #1a1a2e;
    --bs-body-bg: #f8f9fa;
    --bs-body-font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    --bs-border-color: #e0e0e0;
}

/* botões do Bootstrap com a paleta */
.btn-primary {
    --bs-btn-bg: var(--primary);
    --bs-btn-border-color: var(--primary);
    --bs-btn-hover-bg: var(--primary-light);
    --bs-btn-hover-border-color: var(--primary-light);
    --bs-btn-active-bg: var(--primary-light);
    --bs-btn-active-border-color: var(--primary-light);
    --bs-btn-disabled-bg: var(--primary);
    --bs-btn-disabled-border-color: var(--primary);
}
.btn-success {
    --bs-btn-bg: var(--success);
    --bs-btn-border-color: var(--success);
    --bs-btn-hover-bg: #059873;
    --bs-btn-hover-border-color: #059873;
    --bs-btn-active-bg: #059873;
}
.btn-danger {
    --bs-btn-bg: var(--danger);
    --bs-btn-border-color: var(--danger);
    --bs-btn-hover-bg: #d62828;
    --bs-btn-hover-border-color: #d62828;
}
.btn-warning {
    --bs-btn-bg: var(--warning);
    --bs-btn-border-color: var(--warning);
    --bs-btn-color: #fff;
    --bs-btn-hover-bg: #f05d09;
    --bs-btn-hover-border-color: #f05d09;
    --bs-btn-hover-color: #fff;
}
.btn-outline-primary {
    --bs-btn-color: var(--primary);
    --bs-btn-border-color: var(--primary);
    --bs-btn-hover-bg: var(--primary);
    --bs-btn-hover-border-color: var(--primary);
    --bs-btn-active-bg: var(--primary);
}

/* foco com a cor primária */
.form-control:focus,
.form-select:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 0.2rem rgba(15, 58, 125, 0.15);
}

body {
    font-family: var(--bs-body-font-family);
    color: var(--text-primary);
    background: var(--bg-light);
}

/* ── LAYOUT ── */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

.main-content {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 30px;
    align-items: start;
}

/* ── PAGE HEADER (banner) ── */
.header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white;
    padding: 30px 0;
    margin-bottom: 40px;
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
}

.header::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -10%;
    width: 300px;
    height: 300px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
}

.header-content {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.logo {
    font-size: 28px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 5px;
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: var(--accent);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: var(--primary);
    flex-shrink: 0;
}

.subtitle {
    font-size: 14px;
    opacity: 0.9;
    font-weight: 400;
}

.header-nav { margin-top: 6px; font-size: 0.85rem; }
.header-nav a { color: rgba(255,255,255,0.85); text-decoration: none; }
.header-nav a:hover { color: white; text-decoration: underline; }

/* ── STATS ── */
.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    padding: 18px;
    border-radius: 8px;
    text-align: center;
    box-shadow: var(--shadow);
}

.stat-number {
    font-size: 30px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 4px;
}

.stat-label {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 600;
}

.stat-card.success .stat-number { color: var(--success); }
.stat-card.warning .stat-number { color: var(--warning); }
.stat-card.danger  .stat-number { color: var(--danger); }
.stat-card.muted   .stat-number { color: #888; }

/* ── FORM ── */
.form-section {
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.form-wrapper { max-width: 900px; margin: 0 auto; }
.page-form { max-width: 860px; margin: 0 auto; padding: 20px; }

.form-title {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 25px;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.form-section-divider {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--primary);
    border-bottom: 2px solid var(--border);
    padding-bottom: 6px;
    margin: 20px 0 15px;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    font-size: 13px;
    color: var(--text-primary);
}

.form-group label .required,
.required-mark {
    color: var(--danger);
    margin-left: 2px;
}

.form-group input,
.form-group select,
.form-group textarea,
textarea {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    transition: all 0.2s ease;
    background: white;
    color: var(--text-primary);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(15, 58, 125, 0.02);
    box-shadow: 0 0 0 3px rgba(15, 58, 125, 0.1);
}

textarea { resize: vertical; }

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

.telefones-hint { font-size: 0.75rem; color: var(--text-secondary); margin-top: 4px; }

/* ── BUTTONS (custom, complementam os do Bootstrap) ── */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: var(--primary);
    color: white;
    width: 100%;
    justify-content: center;
}

.btn-primary:hover {
    background: var(--primary-light);
    color: white;
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-primary:active { transform: translateY(0); }

.btn-small { padding: 8px 12px; font-size: 13px; }

.btn-secondary {
    background: var(--border);
    color: var(--text-primary);
}
.btn-secondary:hover { background: #ccc; color: var(--text-primary); }

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

.btn-warning { background: var(--warning); color: white; }
.btn-warning:hover { background: #f05d09; color: white; }

.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #059873; color: white; }

/* botão "outline" usado em listagens/tabelas */
.btn-editar,
.btn-ver,
.btn-acao,
.btn-download {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 14px;
    background: transparent;
    border: 1.5px solid var(--primary);
    border-radius: 6px;
    color: var(--primary);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s, color 0.2s;
    white-space: nowrap;
}
.btn-editar:hover,
.btn-ver:hover,
.btn-acao:hover,
.btn-download:hover { background: var(--primary); color: white; }

/* ── LIST SECTION ── */
.list-section {
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.list-header {
    background: var(--bg-light);
    padding: 20px 30px;
    border-bottom: 2px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.list-title { font-size: 20px; font-weight: 600; color: var(--primary); }

.user-list { max-height: 620px; overflow-y: auto; }

.user-item {
    padding: 18px 30px;
    border-bottom: 1px solid var(--border);
    transition: all 0.3s ease;
    cursor: pointer;
}
.user-item:hover { background: rgba(15, 58, 125, 0.02); }
.user-item:last-child { border-bottom: none; }

.user-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    gap: 8px;
    flex-wrap: wrap;
}

.user-name { font-size: 16px; font-weight: 600; color: var(--primary); }
.user-meta { display: flex; gap: 8px; align-items: center; }

.user-details {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    font-size: 13px;
    color: var(--text-secondary);
}

/* ── BADGES ── */
.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.badge-count { background: var(--primary); color: white; }
.badge-ativo { background: rgba(6, 167, 125, 0.15); color: var(--success); }
.badge-inativo { background: rgba(230, 57, 70, 0.15); color: var(--danger); }
.badge-perfil { background: rgba(15, 58, 125, 0.12); color: var(--primary); }

.tipo-badge,
.registro-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 700;
    background: rgba(15, 58, 125, 0.1);
    color: var(--primary);
}
.registro-badge { margin-right: 4px; }

/* ── STATUS BADGES (com pontinho) ── */
.status-badge,
.badge-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 600;
    white-space: nowrap;
}

.status-dot,
.badge-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.badge-dot { width: 7px; height: 7px; }

.status-ativo      { background: rgba(6, 167, 125, 0.12); color: var(--success); }
.status-ativo .status-dot, .status-ativo .badge-dot { background: var(--success); }

.status-inativo    { background: rgba(102, 102, 102, 0.12); color: #555; }
.status-inativo .status-dot, .status-inativo .badge-dot { background: #888; }

.status-parado     { background: rgba(102, 102, 102, 0.12); color: #555; }
.status-parado .status-dot { background: #888; }

.status-manutencao { background: rgba(247, 127, 0, 0.12); color: var(--warning); }
.status-manutencao .status-dot, .status-manutencao .badge-dot { background: var(--warning); }

.status-desativado { background: rgba(230, 57, 70, 0.12); color: var(--danger); }
.status-desativado .status-dot, .status-desativado .badge-dot { background: var(--danger); }

.situacao-proxima  { background: rgba(6, 167, 125, 0.12); color: var(--success); }
.situacao-proxima .badge-dot { background: var(--success); }
.situacao-vencida  { background: rgba(230, 57, 70, 0.12); color: var(--danger); }
.situacao-vencida .badge-dot { background: var(--danger); }

.doc-vigente  { background: rgba(6, 167, 125, 0.12); color: var(--success); }
.doc-vigente .badge-dot { background: var(--success); }
.doc-vencido  { background: rgba(230, 57, 70, 0.12); color: var(--danger); }
.doc-vencido .badge-dot { background: var(--danger); }
.doc-pendente { background: rgba(247, 127, 0, 0.12); color: var(--warning); }
.doc-pendente .badge-dot { background: var(--warning); }

/* ── EMPTY STATE ── */
.empty-state {
    padding: 48px 24px;
    text-align: center;
    color: var(--text-secondary);
}
.empty-state .empty-icon,
.empty-state .icon { font-size: 2.5rem; margin-bottom: 12px; }
.empty-text { font-size: 16px; margin-bottom: 10px; }
.empty-subtext { font-size: 14px; color: #999; }
.empty-state p { font-size: 0.9rem; }

/* ── DETAIL LABELS / GRID ── */
.section-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--border);
    padding-bottom: 8px;
    margin: 0 0 24px;
}

.section-divider {
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
    border-bottom: 1.5px solid var(--border);
    padding-bottom: 6px;
    margin: 28px 0 16px;
}
.section-divider:first-child { margin-top: 0; }

.detail-label {
    font-weight: 700;
    color: var(--text-secondary);
    display: block;
    margin-bottom: 2px;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.detail-item { color: var(--text-secondary); }

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 18px 24px;
}

.detail-field { display: flex; flex-direction: column; gap: 4px; }
.detail-value { font-size: 0.95rem; color: var(--text-primary); font-weight: 500; }
.detail-value.empty { color: #bbb; font-style: italic; font-weight: 400; }

.coord-row { display: grid; grid-template-columns: 1fr 1fr; gap: 18px 24px; }

/* ── FILTER BAR ── */
.filter-bar {
    background: white;
    border-radius: 10px;
    box-shadow: var(--shadow);
    padding: 20px 24px;
    margin-bottom: 24px;
    display: flex;
    align-items: flex-end;
    gap: 16px;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 180px;
}

.filter-group label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--text-secondary);
}

.filter-group select {
    padding: 9px 12px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 0.875rem;
    font-family: inherit;
    background: white;
    color: var(--text-primary);
    transition: border-color 0.2s;
}

.filter-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(15, 58, 125, 0.1);
}

.filter-actions {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    margin-left: auto;
    flex-wrap: wrap;
}

/* ── TABLE CARD ── */
.table-card,
.doc-card {
    background: white;
    border-radius: 10px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.table-header {
    padding: 16px 24px;
    background: var(--bg-light);
    border-bottom: 2px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
}

.table-title { font-size: 1rem; font-weight: 700; color: var(--primary); }
.table-count { font-size: 0.8rem; color: var(--text-secondary); }

.table-card table,
.doc-table,
.tipo-table,
.insp-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 0;
}

.table-card thead th,
.doc-table thead th,
.tipo-table th {
    background: var(--primary);
    color: white;
    padding: 12px 16px;
    text-align: left;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    white-space: nowrap;
}

.table-card tbody td,
.doc-table tbody td,
.tipo-table td {
    padding: 13px 16px;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
    vertical-align: middle;
    color: var(--text-primary);
}

.table-card tbody tr:last-child td,
.doc-table tbody tr:last-child td,
.tipo-table tr:last-child td { border-bottom: none; }

.table-card tbody tr:hover td,
.doc-table tbody tr:hover td,
.tipo-table tr:hover td { background: rgba(15, 58, 125, 0.03); }

.td-id { color: var(--text-secondary); font-size: 0.82rem; font-weight: 600; }
.td-tag, .td-nome, .td-equip { font-weight: 700; color: var(--primary); }
.td-secondary, .td-registro { font-size: 0.82rem; color: var(--text-secondary); }
.td-telefones { font-size: 0.82rem; line-height: 1.6; }
.td-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.doc-tipo { font-weight: 600; color: var(--text-primary); }
.doc-desc { color: var(--text-secondary); font-size: 0.82rem; }
.no-arquivo { font-size: 0.8rem; color: #bbb; font-style: italic; }

.doc-table-wrap { border-radius: 8px; overflow: hidden; border: 1.5px solid var(--border); }

/* ── DASHBOARD / KPI ── */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}

.kpi-card {
    background: white;
    border-radius: 10px;
    padding: 20px 24px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.kpi-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--text-secondary);
}

.kpi-value { font-size: 2.2rem; font-weight: 700; color: var(--primary); line-height: 1; }

.tipo-table, .insp-table {
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: var(--shadow);
    margin-bottom: 8px;
}
.tipo-table { margin-bottom: 32px; }
.tipo-qty { font-weight: 700; color: var(--primary); }
.insp-block { margin-bottom: 32px; }
.insp-table th.proximas { background: var(--primary); }
.insp-table th.vencidas  { background: var(--danger); }
.insp-id { color: var(--text-secondary); font-size: 0.8rem; }
.empty-row td { text-align: center; color: var(--text-secondary); padding: 24px; font-style: italic; }
.hint { font-size: 0.78rem; color: var(--text-secondary); margin-bottom: 12px; display: flex; align-items: center; gap: 6px; }

/* ── DETALHE: cabeçalho + abas ── */
.equip-header,
.insp-header,
.page-header {
    background: white;
    border-radius: 10px;
    box-shadow: var(--shadow);
    padding: 20px 24px;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.equip-tag, .insp-id { font-size: 1.6rem; font-weight: 800; color: var(--primary); letter-spacing: -0.5px; }
.insp-id { font-size: 1.4rem; }
.equip-tipo, .insp-equip { font-size: 0.85rem; color: var(--text-secondary); margin-top: 2px; }
.equip-header-actions, .insp-header-actions { margin-left: auto; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

.page-title { font-size: 1.4rem; font-weight: 800; color: var(--primary); }
.page-subtitle { font-size: 0.85rem; color: var(--text-secondary); margin-top: 2px; }

.tab-nav {
    display: flex;
    background: white;
    border-radius: 10px 10px 0 0;
    box-shadow: var(--shadow);
    border-bottom: 2px solid var(--border);
    padding: 0 8px;
    overflow-x: auto;
}

.tab-btn {
    padding: 14px 22px;
    border: none;
    background: none;
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    transition: color 0.2s, border-color 0.2s;
    white-space: nowrap;
}
.tab-btn:hover { color: var(--primary); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }

.tab-panel { display: none; }
.tab-panel.active { display: block; }

.tab-content {
    background: white;
    border-radius: 0 0 10px 10px;
    box-shadow: var(--shadow);
    padding: 28px 24px;
}

.tab-badge {
    margin-left: 6px;
    background: var(--primary);
    color: white;
    border-radius: 10px;
    padding: 1px 7px;
    font-size: 0.72rem;
}

.recomendacoes-box {
    background: var(--bg-light);
    border: 1.5px solid var(--border);
    border-radius: 8px;
    padding: 14px 16px;
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--text-primary);
}

/* ── UPLOAD ── */
.upload-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 10px;
}

.upload-area {
    border: 2px dashed var(--border);
    border-radius: 10px;
    padding: 32px 24px;
    text-align: center;
    color: var(--text-secondary);
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    margin-bottom: 20px;
    display: none;
}
.upload-area.visible { display: block; }
.upload-area:hover, .upload-area.dragover { border-color: var(--primary); background: rgba(15,58,125,.04); }
.upload-area .upload-icon { font-size: 2.5rem; margin-bottom: 8px; }
.upload-area p { font-size: 0.9rem; margin: 0; }
.upload-area input[type=file] { display: none; }

/* Painel de upload: formulário de metadados + área de drop */
.upload-panel { display: none; margin-bottom: 20px; }
.upload-panel.visible { display: block; }
.upload-meta { text-align: left; margin-bottom: 16px; }
.upload-meta .form-group { margin-bottom: 12px; }
.upload-meta-error {
    display: none;
    color: var(--danger);
    font-size: 0.82rem;
    font-weight: 600;
    margin-bottom: 12px;
}
.upload-meta-error.visible { display: block; }
.optional-mark { color: var(--text-secondary); font-weight: 400; margin-left: 4px; font-size: 0.78rem; }

.upload-queue { margin-bottom: 20px; }
.upload-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 8px;
    font-size: 0.875rem;
}
.upload-item-name { flex: 1; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-item-status { font-size: 0.78rem; white-space: nowrap; }
.status-pendente    { color: var(--text-secondary); }
.status-processando { color: var(--warning); }
.status-concluido   { color: var(--success); }
.status-erro        { color: var(--danger); }

.progress-bar-wrap { flex: 1; height: 6px; background: var(--border); border-radius: 4px; overflow: hidden; }
.progress-bar { height: 100%; background: var(--primary); border-radius: 4px; transition: width 0.3s; }

.nr13-notice {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    background: rgba(15,58,125,.06);
    border: 1.5px solid rgba(15,58,125,.2);
    border-radius: 8px;
    padding: 14px 16px;
    margin-bottom: 20px;
    font-size: 0.85rem;
    color: var(--primary);
}
.nr13-notice-icon { font-size: 1.2rem; flex-shrink: 0; margin-top: 1px; }

.historico-placeholder { padding: 60px 24px; text-align: center; color: var(--text-secondary); }
.historico-placeholder .ph-icon { font-size: 3rem; margin-bottom: 12px; }
.historico-placeholder p { font-size: 0.9rem; }

/* ── MODAL (custom, usado por JS via classe .active) ── */
.modal-custom {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1060;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
    padding: 1rem;
}
.modal-custom.active { display: flex; }

.modal-custom .modal-content {
    background: white;
    padding: 36px;
    border-radius: 12px;
    max-width: 700px;
    width: 95%;
    max-height: 85vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
    border: none;
}

.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.modal-title { font-size: 22px; font-weight: 700; color: var(--primary); }
.modal-subtitle { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }
.modal-close { background: none; border: none; font-size: 28px; cursor: pointer; color: var(--text-secondary); transition: color 0.3s; line-height: 1; }
.modal-close:hover { color: var(--primary); }
.modal-section { margin-bottom: 20px; }
.modal-section-title {
    font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px;
    color: var(--primary); border-bottom: 1px solid var(--border); padding-bottom: 6px; margin-bottom: 14px;
}
.modal-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.modal-field .detail-label { font-size: 11px; color: var(--text-secondary); font-weight: 600; }
.modal-field .detail-value { font-size: 15px; color: var(--text-primary); font-weight: 500; }
.modal-field-full { grid-column: 1 / -1; }
.modal-footer { display: flex; gap: 12px; justify-content: flex-end; margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--border); flex-wrap: wrap; }

/* ── SUCCESS MESSAGE ── */
.success-message {
    background: var(--success);
    color: white;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: none;
    animation: slideDown 0.3s ease;
}
.success-message.show { display: block; }

/* ── ERROR MESSAGE ── */
.error-message {
    background: var(--danger);
    color: white;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: none;
    animation: slideDown 0.3s ease;
}
.error-message.show { display: block; }

/* ── ANIMATIONS ── */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes slideDown { from { transform: translateY(-10px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* ════════════════════════════════════════════════════════════
   SHELL (index.html) — sidebar/topbar responsivo
   ════════════════════════════════════════════════════════════ */
.app-shell { display: flex; height: 100vh; overflow: hidden; }

.sidebar {
    width: 240px;
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    height: 100vh;
    flex-shrink: 0;
}

.sidebar-logo { padding: 1.5rem 1rem 1.25rem; border-bottom: 1px solid var(--sidebar-border); text-align: center; }
.sidebar-logo h1 { color: #fff; font-size: 1.35rem; font-weight: 700; letter-spacing: 1px; margin: 0; }
.sidebar-logo h1 span { color: var(--accent); }
.sidebar-logo p { color: rgba(255,255,255,.4); font-size: .65rem; margin: .2rem 0 0; text-transform: uppercase; letter-spacing: .5px; }

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

.nav-toggle {
    display: flex; align-items: center; justify-content: space-between;
    padding: .75rem 1rem; color: rgba(255,255,255,.75); cursor: pointer; user-select: none;
    font-size: .82rem; font-weight: 600; text-transform: uppercase; letter-spacing: .4px;
    transition: background .2s, color .2s;
}
.nav-toggle:hover, .nav-toggle.open { background: var(--sidebar-hover); color: #fff; }
.nav-toggle-label { display: flex; align-items: center; gap: .55rem; }
.nav-toggle-icon { font-size: .55rem; opacity: .6; transition: transform .25s; }
.nav-toggle.open .nav-toggle-icon { transform: rotate(180deg); opacity: 1; }

.nav-submenu { overflow: hidden; max-height: 0; transition: max-height .3s ease; }
.nav-submenu.open { max-height: 500px; }

.nav-subitem {
    display: block; padding: .6rem 1rem .6rem 2.4rem; color: rgba(255,255,255,.55);
    font-size: .82rem; cursor: pointer; transition: background .2s, color .2s; border-left: 2px solid transparent;
}
.nav-subitem:hover { background: rgba(255,255,255,.06); color: rgba(255,255,255,.9); }
.nav-subitem.active { background: rgba(0,212,170,.12); color: var(--accent); border-left-color: var(--accent); font-weight: 600; }

.content { flex: 1; height: 100vh; display: flex; flex-direction: column; background: #f0f2f5; overflow: hidden; }
.content-welcome { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .75rem; color: #888; text-align: center; padding: 1rem; }
.content-welcome .welcome-icon { font-size: 3rem; margin-bottom: .5rem; }
.content-welcome h2 { color: var(--primary); font-size: 1.4rem; font-weight: 600; }
.content-welcome p { font-size: .875rem; }
.content-iframe { flex: 1; width: 100%; border: none; display: none; }

.topbar {
    min-height: 52px; background: #fff; border-bottom: 1px solid #e2e6ea;
    display: flex; align-items: center; justify-content: space-between; gap: .75rem;
    padding: 0 1rem; flex-shrink: 0; box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.topbar-user { display: flex; align-items: center; gap: .75rem; font-size: .875rem; color: #444; margin-left: auto; }
.topbar-user-icon { width: 30px; height: 30px; background: var(--primary); color: #fff; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: .75rem; font-weight: 700; }
.topbar-user-name { font-weight: 600; }
.topbar-user-link { color: var(--primary); text-decoration: none; cursor: pointer; }
.topbar-user-link:hover { text-decoration: underline; }
.btn-logout { padding: .3rem .8rem; background: transparent; border: 1px solid #ccc; border-radius: 6px; color: #666; font-size: .78rem; cursor: pointer; text-decoration: none; transition: background .2s, border-color .2s; }
.btn-logout:hover { background: #f5f5f5; border-color: #aaa; }

/* hamburger só aparece no mobile */
.sidebar-toggle { display: none; background: transparent; border: 1px solid var(--border); border-radius: 6px; padding: .35rem .6rem; font-size: 1.1rem; color: var(--primary); cursor: pointer; }
.sidebar-backdrop { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 1040; }
.sidebar-backdrop.show { display: block; }

/* ── LOGIN ── */
.login-page { background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%); min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1rem; }
.login-card { background: #fff; border-radius: 12px; box-shadow: 0 20px 60px rgba(0,0,0,.3); padding: 2.5rem 2rem; width: 100%; max-width: 380px; }
.login-card .logo { display: block; text-align: center; margin-bottom: 2rem; }
.login-card .logo h1 { color: var(--primary); font-size: 1.8rem; font-weight: 700; letter-spacing: 1px; }
.login-card .logo span { color: var(--accent); }
.login-card .logo p { color: #666; font-size: .8rem; margin-top: .25rem; }

/* ════════════════════════════════════════════════════════════
   RESPONSIVO
   ════════════════════════════════════════════════════════════ */
@media (max-width: 1024px) {
    .main-content { grid-template-columns: 1fr; }
}

@media (max-width: 992px) {
    /* shell vira off-canvas no mobile */
    .sidebar-toggle { display: inline-flex; align-items: center; }
    .app-shell .sidebar {
        position: fixed; top: 0; left: 0; z-index: 1045;
        transform: translateX(-100%); transition: transform .3s ease;
    }
    .app-shell .sidebar.open { transform: translateX(0); }
}

@media (max-width: 768px) {
    .container { padding: 16px; }
    .form-section { padding: 20px; }
    .form-row { grid-template-columns: 1fr; }
    .modal-grid { grid-template-columns: 1fr; }
    .detail-grid { grid-template-columns: 1fr 1fr; }
    .coord-row { grid-template-columns: 1fr; }
    .filter-bar { flex-direction: column; align-items: stretch; }
    .filter-actions { margin-left: 0; }
    .filter-group { min-width: 0; }
    .stats { grid-template-columns: 1fr 1fr; }
    .user-details { grid-template-columns: 1fr 1fr; }
    .equip-header, .insp-header { flex-direction: column; align-items: flex-start; }
    .equip-header-actions, .insp-header-actions { margin-left: 0; }
    .header { padding: 20px 0; margin-bottom: 24px; }
    .logo { font-size: 22px; }
}

@media (max-width: 480px) {
    .detail-grid { grid-template-columns: 1fr; }
    .stats { grid-template-columns: 1fr; }
    .user-details { grid-template-columns: 1fr; }
}

/* ── QR CODE (etiqueta na tela de detalhe) ── */
.qr-print-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 16px;
    background: white;
    border: 1px solid var(--border);
    border-radius: 10px;
}
.qr-print-tag { font-size: 18px; font-weight: 700; color: var(--text-primary); }
.qr-print-img { width: 256px; height: 256px; image-rendering: pixelated; }
.qr-print-code {
    font-family: monospace; font-size: 12px; color: var(--text-secondary);
    letter-spacing: 0.5px; word-break: break-all;
}

/* Impressão: mostra apenas a etiqueta do QR, ocultando o resto da página. */
@media print {
    body.printing-qr * { visibility: hidden; }
    body.printing-qr .qr-print-area,
    body.printing-qr .qr-print-area * { visibility: visible; }
    body.printing-qr .qr-print-area {
        position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
        border: none;
    }
    body.printing-qr #qrModal { background: none; }
}

/* ── SCANNER DE QR CODE (leitura por câmera na listagem) ── */
.qr-scan-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
}
.qr-scan-video {
    width: 100%;
    max-width: 360px;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    background: #000;
    border-radius: 10px;
    border: 2px solid var(--border);
}
.qr-scan-hint { font-size: 13px; color: var(--text-secondary); text-align: center; }
.qr-scan-status { font-size: 14px; font-weight: 600; min-height: 20px; text-align: center; }
.qr-scan-status.erro { color: var(--danger); }
.qr-scan-status.ok { color: var(--success); }
