/* ── Reset e variáveis ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg-main:    #0d0f14;
    --bg-card:    #1e2535;
    --bg-row-alt: #161b24;
    --border:     #2a3347;
    --accent:     #f5a623;
    --accent-dim: #b87a10;
    --text:       #e8eaf0;
    --text-muted: #8a90a0;
    --ok:         #1e4d2b;
    --ok-text:    #4caf72;
    --warn:       #4d3a00;
    --warn-text:  #f5c842;
    --crit:       #4d0f0f;
    --crit-text:  #e05252;
    --info:       #0d2b4d;
    --info-text:  #5ab0f5;
    --radius:     8px;
    --shadow:     0 4px 24px rgba(0,0,0,0.5);
}

body {
    background: var(--bg-main);
    color: var(--text);
    font-family: 'Segoe UI', system-ui, sans-serif;
    font-size: 14px;
    min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Navbar ─────────────────────────────────────────────────────── */
.navbar {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 0 24px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
}

.navbar-brand {
    font-size: 16px;
    font-weight: 700;
    color: var(--accent);
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.navbar-nav {
    display: flex;
    align-items: center;
    gap: 16px;
    list-style: none;
}

.navbar-nav a {
    color: var(--text-muted);
    font-size: 13px;
    padding: 4px 8px;
    border-radius: var(--radius);
    transition: color 0.15s, background 0.15s;
}

.navbar-nav a:hover {
    color: var(--text);
    background: rgba(255,255,255,0.05);
    text-decoration: none;
}

.navbar-nav a.active {
    color: var(--accent);
}

/* ── Container / Layout ─────────────────────────────────────────── */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px 16px;
}

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

.page-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
}

.page-title span {
    color: var(--accent);
}

/* ── Cards / Estatísticas ───────────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    text-align: center;
}

.stat-card .stat-value {
    font-size: 36px;
    font-weight: 800;
    color: var(--accent);
    line-height: 1;
}

.stat-card .stat-label {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ── Tabelas ────────────────────────────────────────────────────── */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

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

thead th {
    background: #131722;
    color: var(--accent);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

tbody tr {
    border-bottom: 1px solid var(--border);
    transition: background 0.1s;
}

tbody tr:nth-child(even) { background: var(--bg-row-alt); }
tbody tr:hover { background: rgba(245, 166, 35, 0.05); }

tbody td {
    padding: 12px 16px;
    vertical-align: middle;
}

/* ── Badges / Status ────────────────────────────────────────────── */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.badge-ok      { background: var(--ok);   color: var(--ok-text); }
.badge-warn    { background: var(--warn); color: var(--warn-text); }
.badge-crit    { background: var(--crit); color: var(--crit-text); }
.badge-info    { background: var(--info); color: var(--info-text); }
.badge-muted   { background: var(--border); color: var(--text-muted); }

/* ── Botões ─────────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: opacity 0.15s, transform 0.1s;
    text-decoration: none;
}

.btn:hover { opacity: 0.85; text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary  { background: var(--accent);     color: #000; }
.btn-danger   { background: var(--crit-text);  color: #fff; }
.btn-secondary{ background: var(--border);     color: var(--text); }
.btn-sm       { padding: 5px 10px; font-size: 12px; }

/* ── Formulários ────────────────────────────────────────────────── */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.form-control {
    width: 100%;
    background: var(--bg-main);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 10px 14px;
    border-radius: var(--radius);
    font-size: 14px;
    outline: none;
    transition: border-color 0.15s;
}

.form-control:focus {
    border-color: var(--accent);
}

/* ── Login ──────────────────────────────────────────────────────── */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

/* Camada de fundo com blur */
.login-bg {
    position: absolute;
    inset: 0;
    background: url('../static/bg.jpg') center / cover no-repeat;
    filter: blur(8px);
    transform: scale(1.08); /* evita bordas brancas do blur */
    z-index: 0;
}

/* Overlay escuro sobre a imagem */
.login-bg::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
}

.login-card {
    position: relative;
    z-index: 1;
    background: rgba(30, 37, 53, 0.85);
    backdrop-filter: blur(4px);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 40px 36px;
    width: 100%;
    max-width: 380px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.7);
}

.login-logo {
    text-align: center;
    margin-bottom: 28px;
}

.login-logo h1 {
    font-size: 22px;
    color: var(--accent);
    font-weight: 800;
}

.login-logo p {
    color: var(--text-muted);
    font-size: 12px;
    margin-top: 4px;
}

/* ── Alerts / Flash ─────────────────────────────────────────────── */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-size: 13px;
}

.alert-success { background: var(--ok);   color: var(--ok-text);   border: 1px solid #2d6b3d; }
.alert-danger  { background: var(--crit); color: var(--crit-text); border: 1px solid #6b1f1f; }
.alert-warning { background: var(--warn); color: var(--warn-text); border: 1px solid #6b5200; }
.alert-info    { background: var(--info); color: var(--info-text); border: 1px solid #1a4f7a; }

/* ── Detalhe da preventiva ──────────────────────────────────────── */
.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 24px;
}

@media (max-width: 640px) {
    .detail-grid { grid-template-columns: 1fr; }
}

.detail-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
}

.detail-item .label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.detail-item .value {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
}

/* ── Accordion (elementos) ──────────────────────────────────────── */
.accordion-btn {
    width: 100%;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 12px 16px;
    text-align: left;
    cursor: pointer;
    border-radius: var(--radius);
    margin-bottom: 4px;
    font-size: 14px;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.accordion-btn:hover { background: rgba(245,166,35,0.07); }
.accordion-body { display: none; margin-bottom: 8px; }
.accordion-body.open { display: block; }

/* ── Utilities ──────────────────────────────────────────────────── */
.text-muted   { color: var(--text-muted); }
.text-accent  { color: var(--accent); }
.text-sm      { font-size: 12px; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 16px; }
.mb-4 { margin-bottom: 24px; }
.flex { display: flex; }
.items-center { align-items: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 16px; }
.justify-between { justify-content: space-between; }
.w-full { width: 100%; }

/* ── Confirm dialog ─────────────────────────────────────────────── */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    z-index: 200;
    align-items: center;
    justify-content: center;
}
.modal-overlay.active { display: flex; }
.modal-box {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 28px 32px;
    max-width: 400px;
    width: 90%;
    text-align: center;
}
.modal-box h3 { margin-bottom: 10px; }
.modal-box p  { color: var(--text-muted); font-size: 13px; margin-bottom: 20px; }
.modal-actions { display: flex; gap: 12px; justify-content: center; }
