:root {
    color-scheme: light;
    --bg: #f5f7fb;
    --panel: #ffffff;
    --line: #dde4ee;
    --line-strong: #c7d2df;
    --text: #17202a;
    --muted: #66758a;
    --accent: #126a70;
    --accent-dark: #0b4f55;
    --ok: #11743c;
    --bad: #a73434;
    --warn: #996a00;
    --shadow: 0 14px 34px rgba(30, 45, 70, .08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 14px;
}

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

a:hover {
    text-decoration: underline;
}

.login-body {
    display: grid;
    place-items: center;
    padding: 24px;
    background: linear-gradient(135deg, #eef5f4 0%, #f8fafc 45%, #f4f2e8 100%);
}

.login-box {
    width: min(420px, 100%);
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 28px;
    box-shadow: var(--shadow);
}

.login-box h1 {
    margin: 0 0 6px;
    font-size: 24px;
}

.login-box p {
    margin: 0 0 24px;
    color: var(--muted);
}

.shell {
    min-height: 100vh;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 22px;
    background: rgba(255, 255, 255, .95);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(10px);
}

.brand {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.brand strong {
    font-size: 16px;
}

.brand span,
.muted {
    color: var(--muted);
}

.nav {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.nav a,
.button,
button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    padding: 8px 12px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: #fff;
    color: var(--text);
    font: inherit;
    cursor: pointer;
}

.nav a.active,
.button.primary,
button.primary {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.nav a:hover,
.button:hover,
button:hover {
    border-color: var(--line-strong);
    text-decoration: none;
}

.content {
    width: min(1440px, 100%);
    margin: 0 auto;
    padding: 22px;
}

.page-title {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.page-title h1 {
    margin: 0;
    font-size: 26px;
}

.page-title p {
    margin: 5px 0 0;
    color: var(--muted);
}

.grid {
    display: grid;
    gap: 14px;
}

.grid.kpis {
    grid-template-columns: repeat(5, minmax(150px, 1fr));
}

.grid.two {
    grid-template-columns: minmax(0, 1.15fr) minmax(320px, .85fr);
}

.card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 16px;
    box-shadow: var(--shadow);
}

.kpi .label {
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.kpi .value {
    margin-top: 8px;
    font-size: 25px;
    font-weight: 760;
}

.kpi .sub {
    margin-top: 4px;
    color: var(--muted);
    font-size: 12px;
}

.filters {
    display: grid;
    grid-template-columns: repeat(6, minmax(120px, 1fr));
    gap: 10px;
    align-items: end;
    margin-bottom: 16px;
}

.filters .wide {
    grid-column: span 2;
}

label {
    display: grid;
    gap: 6px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 650;
}

input,
select {
    min-height: 38px;
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--line-strong);
    border-radius: 7px;
    background: #fff;
    color: var(--text);
    font: inherit;
}

.table-wrap {
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

table {
    width: 100%;
    min-width: 980px;
    border-collapse: collapse;
}

th,
td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
    white-space: nowrap;
}

th {
    background: #f8fafc;
    color: #46566b;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .04em;
}

tr:last-child td {
    border-bottom: 0;
}

.num {
    text-align: right;
}

.pill {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    background: #edf2f7;
    color: #3b4a5f;
}

.pill.ok {
    background: #e7f5ec;
    color: var(--ok);
}

.pill.bad {
    background: #faecec;
    color: var(--bad);
}

.pill.warn {
    background: #fff5dc;
    color: var(--warn);
}

.bars {
    display: grid;
    gap: 10px;
}

.bar-row {
    display: grid;
    grid-template-columns: 92px 1fr 86px;
    gap: 10px;
    align-items: center;
}

.bar-track {
    height: 10px;
    border-radius: 999px;
    background: #e8eef5;
    overflow: hidden;
}

.bar {
    height: 100%;
    min-width: 2px;
    background: var(--accent);
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(260px, 1fr));
    gap: 14px;
}

.kv {
    display: grid;
    grid-template-columns: 130px 1fr;
    gap: 8px;
    padding: 7px 0;
    border-bottom: 1px solid var(--line);
}

.kv:last-child {
    border-bottom: 0;
}

.kv span:first-child {
    color: var(--muted);
}

.error,
.notice {
    padding: 10px 12px;
    border-radius: 7px;
    margin-bottom: 14px;
}

.error {
    border: 1px solid #efb9b9;
    background: #fff0f0;
    color: #8f2424;
}

.notice {
    border: 1px solid #b9d7ef;
    background: #eef7ff;
    color: #224f75;
}

.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
}

.nowrap {
    white-space: nowrap;
}

.mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
    font-size: 12px;
}

@media (max-width: 1100px) {
    .grid.kpis,
    .grid.two,
    .detail-grid {
        grid-template-columns: 1fr 1fr;
    }

    .filters {
        grid-template-columns: repeat(3, minmax(120px, 1fr));
    }
}

@media (max-width: 720px) {
    .topbar,
    .page-title {
        align-items: stretch;
        flex-direction: column;
    }

    .content {
        padding: 16px;
    }

    .grid.kpis,
    .grid.two,
    .detail-grid,
    .filters {
        grid-template-columns: 1fr;
    }

    .filters .wide {
        grid-column: span 1;
    }

    .bar-row {
        grid-template-columns: 78px 1fr 62px;
    }
}
