* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: "Segoe UI", Arial, sans-serif;
    background: linear-gradient(135deg, #0f172a, #1e293b);
    color: #e2e8f0;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

body.page-projetos {
    align-items: flex-start;
    justify-content: flex-start;
    padding: 80px 24px 32px;
}

a { color: inherit; text-decoration: none; }

a:hover { text-decoration: underline; }

.topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(6px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.brand { font-weight: 700; letter-spacing: 0.5px; }

.link { margin-left: 12px; font-weight: 600; }

.card {
    width: 100%;
    max-width: 420px;
    background: #0b1220;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
    margin-top: 60px;
}

h1 { margin-top: 0; font-size: 24px; }

label { display: block; margin: 14px 0 6px; font-weight: 600; }

input[type="text"],
input[type="password"] {
    width: 100%;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.04);
    color: #e2e8f0;
}

button,
.btn {
    display: inline-block;
    width: 100%;
    text-align: center;
    padding: 12px 14px;
    margin-top: 18px;
    border: none;
    border-radius: 10px;
    background: linear-gradient(135deg, #38bdf8, #0ea5e9);
    color: #0b1220;
    font-weight: 700;
    cursor: pointer;
    transition: transform 120ms ease, box-shadow 120ms ease;
}

button:hover,
.btn:hover { transform: translateY(-1px); box-shadow: 0 10px 30px rgba(56, 189, 248, 0.35); text-decoration: none; }

.buttons { display: grid; grid-template-columns: 1fr; gap: 10px; margin-top: 16px; }

.alert {
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 12px;
    font-weight: 600;
}

.alert-error { background: rgba(239, 68, 68, 0.12); border: 1px solid rgba(239, 68, 68, 0.3); color: #fecdd3; }

@media (min-width: 640px) {
    .card { max-width: 520px; }
    .buttons { grid-template-columns: repeat(3, 1fr); }
}

.card-wide {
    max-width: none;
    width: 100%;
    margin-top: 0;
}

.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin: 12px 0 8px;
    align-items: flex-end;
}

.filter-group {
    display: flex;
    flex-direction: column;
    min-width: 220px;
}

.filter-group select,
.filter-group input[type="date"] {
    padding: 10px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.04);
    color: #e2e8f0;
}

.filter-note {
    font-size: 12px;
    color: #cbd5e1;
    padding: 8px 10px;
    border: 1px dashed rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.04);
    margin-right: 8px;
}

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

.filter-actions .btn,
.filter-actions .btn-ghost,
.filter-actions .btn-excel {
    width: auto;
    flex: 1;
}

.btn-ghost {
    background: rgba(255, 255, 255, 0.06);
    color: #e2e8f0;
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.btn-excel {
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: #07240f;
    border: 1px solid rgba(34, 197, 94, 0.5);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: auto;
    padding: 12px 18px;
}

.btn-excel::before {
    content: 'XLS';
    display: inline-block;
    font-weight: 800;
    padding: 4px 8px;
    border-radius: 6px;
    background: rgba(7, 36, 15, 0.12);
    color: inherit;
    border: 1px solid rgba(7, 36, 15, 0.25);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
    margin: 12px 0 16px;
}

.kpi-card {
    padding: 14px 16px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.04);
}

.kpi-alert {
    border-color: rgba(239, 68, 68, 0.25);
    background: rgba(239, 68, 68, 0.08);
}

.kpi-label {
    font-size: 13px;
    color: #cbd5e1;
    margin-bottom: 6px;
}

.kpi-value {
    font-size: 26px;
    font-weight: 800;
}

.chart-card {
    margin: 18px 0;
    padding: 14px 16px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.03);
}

.chart-header h2 {
    margin: 0 0 4px;
    font-size: 18px;
}

.chart-subtitle {
    margin: 0;
    color: #cbd5e1;
    font-size: 13px;
}

.table-responsive {
    overflow: auto;
    margin-top: 16px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    max-height: calc(100vh - 200px);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 960px;
    background: #0b1220;
}

.data-table th,
.data-table td {
    padding: 10px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    text-align: left;
    font-size: 14px;
}

.data-table thead th {
    font-weight: 700;
    background: rgba(255, 255, 255, 0.04);
    position: sticky;
    top: 0;
    z-index: 1;
}

.data-table thead th.sortable {
    cursor: pointer;
}

.data-table thead th.sortable::after {
    content: '⇅';
    font-size: 11px;
    margin-left: 6px;
    opacity: 0.6;
}

.data-table thead th.sortable.asc::after { content: '↑'; }
.data-table thead th.sortable.desc::after { content: '↓'; }

.data-table tbody tr:nth-child(odd) { background: rgba(255, 255, 255, 0.02); }
.data-table tbody tr:hover { background: rgba(56, 189, 248, 0.05); }

.badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 999px;
    font-weight: 700;
    font-size: 12px;
}

.badge-danger { background: rgba(239, 68, 68, 0.15); color: #fecdd3; }
.badge-success { background: rgba(34, 197, 94, 0.15); color: #bbf7d0; }
.badge-muted { background: rgba(255, 255, 255, 0.08); color: #e2e8f0; }

.row-risk { box-shadow: inset 4px 0 0 0 #ef4444; }
.row-budget-alert { background: rgba(239, 68, 68, 0.06); }
