:root {
    --bg: #f5f7fb;
    --panel: #ffffff;
    --text: #182033;
    --muted: #6b7280;
    --line: #e5e7eb;
    --primary: #182033;
    --primary-2: #2f3b52;
    --danger: #b42318;
    --success: #087443;
    --warning: #a16207;
    --shadow: 0 10px 30px rgba(17, 24, 39, .08);
    --radius: 18px;
}

* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--bg);
    color: var(--text);
}
a { color: inherit; text-decoration: none; }
code { background: #eef2f7; padding: 2px 6px; border-radius: 6px; }

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 270px;
    padding: 22px;
    background: #111827;
    color: #fff;
    display: flex;
    flex-direction: column;
    gap: 22px;
}
.sidebar-brand {
    display: flex;
    gap: 12px;
    align-items: center;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255,255,255,.12);
}
.sidebar-brand span, .sidebar-footer small { display:block; color: rgba(255,255,255,.62); font-size: 12px; margin-top: 2px; }
.brand-mark {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    background: #fff;
    color: #111827;
    font-weight: 800;
    letter-spacing: -.04em;
}
.sidebar nav { display: grid; gap: 6px; }
.sidebar nav a {
    padding: 12px 14px;
    border-radius: 12px;
    color: rgba(255,255,255,.78);
    transition: .15s;
}
.sidebar nav a:hover, .sidebar nav a.active { background: rgba(255,255,255,.12); color: #fff; }
.sidebar-footer { margin-top: auto; border-top: 1px solid rgba(255,255,255,.12); padding-top: 16px; display: grid; gap: 2px; }
.sidebar-footer a { margin-top: 10px; color: rgba(255,255,255,.8); font-size: 14px; }

.main { margin-left: 270px; padding: 28px; min-height: 100vh; }
.page-header { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
h1 { margin: 0 0 6px; font-size: 32px; letter-spacing: -.03em; }
h2 { margin: 0 0 12px; font-size: 20px; letter-spacing: -.02em; }
p { line-height: 1.5; }
.page-header p, .muted { color: var(--muted); margin: 0; }
.small, small { font-size: 12px; color: var(--muted); }
.header-actions { display: flex; gap: 10px; align-items: center; }

.grid { display: grid; gap: 18px; margin-bottom: 18px; }
.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)); }
.align-start { align-items: start; }
.card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    margin-bottom: 18px;
}
.card.narrow { max-width: 820px; }
.metric span { display: block; color: var(--muted); font-size: 13px; margin-bottom: 8px; }
.metric strong { display: block; font-size: 28px; letter-spacing: -.03em; margin-bottom: 4px; }
.positive { color: var(--success); }
.negative { color: var(--danger); }

.alert {
    padding: 14px 16px;
    border-radius: 14px;
    margin-bottom: 18px;
    border: 1px solid var(--line);
    background: #fff;
}
.alert-success { border-color: #bbf7d0; color: #166534; background: #f0fdf4; }
.alert-error { border-color: #fecaca; color: #991b1b; background: #fef2f2; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 0;
    cursor: pointer;
    border-radius: 12px;
    padding: 11px 15px;
    font-weight: 700;
    line-height: 1;
    background: #e5e7eb;
    color: #111827;
    white-space: nowrap;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-2); }
.btn-secondary { background: #eef2f7; color: #182033; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-light { background: #f3f4f6; color: #111827; }
.btn-small { padding: 7px 10px; font-size: 12px; }

form.stack, .stack { display: grid; gap: 14px; }
.form-grid, .filters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; align-items: end; }
.filters { grid-template-columns: repeat(5, minmax(0, 1fr)); }
label { display: grid; gap: 7px; font-weight: 700; font-size: 13px; color: #374151; }
input, select, textarea {
    width: 100%;
    padding: 11px 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
    color: var(--text);
    font: inherit;
    outline: none;
}
input:focus, select:focus, textarea:focus { border-color: #94a3b8; box-shadow: 0 0 0 4px rgba(148,163,184,.15); }
textarea { resize: vertical; }
.span-2 { grid-column: span 2; }

.progress-wrap { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 18px; box-shadow: var(--shadow); }
.progress-label { display: flex; justify-content: space-between; margin-bottom: 10px; color: var(--muted); font-size: 13px; }
.progress { width: 100%; height: 10px; background: #e5e7eb; border-radius: 999px; overflow: hidden; }
.progress div { height: 100%; background: #111827; border-radius: 999px; }
.mini-bar { display: inline-block; vertical-align: middle; width: 90px; height: 8px; background: #e5e7eb; border-radius: 99px; margin-right: 8px; overflow: hidden; }
.mini-bar span { display: block; height: 100%; background: #111827; }

.section-head { display:flex; justify-content:space-between; align-items:center; gap: 12px; margin-bottom: 12px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 13px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
td { font-size: 14px; }
tr:hover td { background: #fafafa; }
.empty { text-align: center; color: var(--muted); padding: 26px; }
.small-table th, .small-table td { padding: 9px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.chips span { display: inline-flex; padding: 8px 10px; border-radius: 999px; background: #f3f4f6; color: #374151; font-size: 12px; }
.sector-card .progress { margin-top: 12px; }

.login-body { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 20% 10%, #e5e7eb, #f8fafc 32%, #eef2f7 100%); }
.login-card { width: min(440px, 100%); background: #fff; border: 1px solid var(--line); border-radius: 24px; padding: 30px; box-shadow: var(--shadow); }
.login-card .brand-mark { background: #111827; color: #fff; margin-bottom: 18px; }
.login-card h1 { font-size: 28px; }

@media (max-width: 1100px) {
    .grid-4, .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 800px) {
    .sidebar { position: static; width: auto; }
    .main { margin-left: 0; padding: 18px; }
    .grid-4, .grid-3, .grid-2, .form-grid, .filters { grid-template-columns: 1fr; }
    .span-2 { grid-column: auto; }
    .page-header { align-items: flex-start; flex-direction: column; }
}
