:root {
    --bg: #f3f4f6;
    --card: #ffffff;
    --dark: #111111;
    --muted: #6b7280;
    --border: #d1d5db;
    --primary: #d81616;
    --primary-dark: #a50f0f;
    --success: #0f75ff;
    --warning: #f59e0b;
    --danger: #ef4444;
}
* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    background: var(--bg);
    color: #1f2937;
}
a { text-decoration: none; color: inherit; }
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
    width: 92px;
    background: #0a0a0a;
    color: #fff;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px 12px;
    gap: 18px;
}
.logo {
    font-weight: 700;
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    letter-spacing: 1px;
}
.logo span { color: var(--primary); }
.menu { display: flex; flex-direction: column; gap: 12px; width: 100%; }
.menu-item {
    border: 1px solid #2f2f2f;
    border-radius: 16px;
    padding: 14px 10px;
    text-align: center;
    font-size: 12px;
    line-height: 1.2;
    color: #d1d5db;
}
.menu-item.active, .menu-item:hover {
    border-color: var(--primary);
    color: #fff;
    background: rgba(216, 22, 22, 0.12);
}
.sidebar-footer { margin-top: auto; font-size: 12px; color: #9ca3af; }

.main-content {
    flex: 1;
    padding: 0 !important;
}

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

.topbar-user { display: flex; gap: 10px; align-items: center; }
.page-header { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 0px; margin-left: 2.5%;}
.page-header h1 { margin: 0; font-size: 24px; }
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 20px;
    box-shadow: 0 4px 20px rgba(0,0,0,.04);
    margin-bottom: 20px;
    width: 95%;
    margin-left: 2.5%;
}
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
label { font-size: 13px; color: #374151; display: block; margin-bottom: 6px; font-weight: 700; }
input, select, textarea {
    width: 100%;
    border: 1px solid var(--border);
    background: #fff;
    border-radius: 12px;
    padding: 12px 14px;
    font-size: 14px;
}
textarea { min-height: 110px; resize: vertical; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 16px;
    border-radius: 12px;
    border: 1px solid transparent;
    cursor: pointer;
    font-weight: 700;
    font-size: 14px;
}
.btn-primary { background: #1f2937; color: #fff; }
.btn-primary:hover { background: #111827; }
.btn-danger { background: #fff; border-color: #fca5a5; color: #dc2626; }
.btn-light { background: #fff; border-color: var(--border); color: #111827; }
.btn-red { background: var(--primary); color: #fff; }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; min-width: 960px; }
th, td { padding: 12px 10px; border-bottom: 1px solid #e5e7eb; text-align: left; font-size: 14px; }
th { color: #6b7280; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; }
.badge {
    display: inline-block;
    border-radius: 999px;
    padding: 5px 10px;
    font-size: 12px;
    font-weight: 700;
    color: #fff;
}
.badge-aberto { background: var(--warning); }
.badge-andamento { background: var(--success); }
.badge-finalizado { background: #16a34a; }
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 16px; width: 95%; margin-left: 2.5%;}
.kpi {
    background: linear-gradient(135deg, #111827 0%, #1f2937 100%);
    color: #fff;
    border-radius: 18px;
    padding: 18px;
}
.kpi small { color: #cbd5e1; display: block; margin-bottom: 8px; }
.kpi strong { font-size: 28px; }
.alert {
    padding: 14px 16px;
    border-radius: 12px;
    margin-bottom: 16px;
    border: 1px solid transparent;
}
.alert-success { background: #ecfdf5; color: #166534; border-color: #a7f3d0; }
.alert-error { background: #fef2f2; color: #991b1b; border-color: #fecaca; }
.login-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(rgba(2,6,23,.72), rgba(2,6,23,.72)), url('../img/bg-login.jpg') center/cover no-repeat;
}
.login-card {
    width: 100%;
    max-width: 430px;
    background: rgba(255,255,255,.93);
    border-radius: 8px;
    padding: 28px;
    box-shadow: 0 10px 32px rgba(0,0,0,.25);
}
.login-brand { text-align: center; font-weight: 700; font-size: 42px; margin-bottom: 8px; }
.login-brand span { color: var(--primary); }
.login-sub { text-align: center; margin-bottom: 20px; font-size: 30px; font-weight: 700; }
.muted { color: var(--muted); font-size: 13px; }
.checkbox-list { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 8px; }
.checkbox-item { display: flex; align-items: center; gap: 8px; background: #f9fafb; padding: 10px; border-radius: 12px; border: 1px solid #e5e7eb; }
.checkbox-item input { width: auto; }
.inline-filters { display: grid; grid-template-columns: repeat(5, minmax(0,1fr)); gap: 14px; }
.empty { text-align: center; color: #6b7280; padding: 26px; }
@media (max-width: 1100px) {
    .grid-4, .kpis, .inline-filters { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 800px) {
    .sidebar { display:none; }
    .main-content { padding: 0 !important; }
    .grid-2, .grid-3, .grid-4, .kpis, .inline-filters { grid-template-columns: 1fr; }
    .checkbox-list { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
.field-help {
    display: block;
    margin-top: 6px;
    color: #6b7280;
    font-size: 12px;
}
.timeline {
    display: grid;
    gap: 12px;
}
.timeline-item {
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    padding: 14px;
    background: #fafafa;
}
.timeline-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
    color: #334155;
    font-size: 13px;
}
.timeline-body {
    color: #111827;
    line-height: 1.5;
}