:root {
    --bg: #f3f5f8;
    --panel: #ffffff;
    --text: #17202a;
    --muted: #667085;
    --border: #dfe4ea;
    --primary: #1f5eff;
    --primary-dark: #1748c5;
    --positive: #067647;
    --positive-bg: #ecfdf3;
    --negative: #b42318;
    --negative-bg: #fef3f2;
    --shadow: 0 8px 24px rgba(16, 24, 40, 0.07);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: Inter, Arial, Helvetica, sans-serif;
    font-size: 14px;
    line-height: 1.5;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 22px max(20px, calc((100vw - 1480px) / 2));
    background: #101828;
    color: #fff;
}

.topbar h1 { margin: 0 0 2px; font-size: 24px; }
.topbar p { margin: 0; color: #cbd5e1; }

.container {
    width: min(1480px, calc(100% - 32px));
    margin: 22px auto 48px;
}

.panel,
.summary-card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.panel { padding: 18px; margin-bottom: 18px; }
.panel h2 { margin: 0 0 14px; font-size: 18px; }

.filter-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(150px, 1fr)) auto;
    gap: 14px;
    align-items: end;
}

.field { min-width: 0; }
.field label {
    display: block;
    margin-bottom: 6px;
    color: #344054;
    font-weight: 700;
}

input,
select,
button,
.button {
    min-height: 42px;
    border-radius: 8px;
    font: inherit;
}

input,
select {
    width: 100%;
    padding: 8px 10px;
    color: var(--text);
    background: #fff;
    border: 1px solid #cfd6df;
}

input:focus,
select:focus {
    outline: 2px solid rgba(31, 94, 255, .18);
    border-color: var(--primary);
}

button,
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 9px 15px;
    border: 1px solid var(--primary);
    background: var(--primary);
    color: #fff;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
}

button:hover,
.button:hover { background: var(--primary-dark); }

button.secondary,
.button.secondary {
    color: #344054;
    background: #fff;
    border-color: #cfd6df;
}

button.secondary:hover,
.button.secondary:hover { background: #f8fafc; }

.actions-field button { width: 100%; white-space: nowrap; }

.report-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.report-meta > div:not(.toolbar) {
    display: flex;
    flex-direction: column;
}

.report-meta span { color: var(--muted); }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; }

.summary-cards {
    display: grid;
    grid-template-columns: repeat(4, minmax(180px, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.summary-card { padding: 18px; }
.summary-card span { display: block; color: var(--muted); margin-bottom: 8px; }
.summary-card strong { display: block; font-size: 23px; letter-spacing: -.3px; }
.summary-card.positive { background: var(--positive-bg); border-color: #abefc6; }
.summary-card.negative { background: var(--negative-bg); border-color: #fecdca; }

.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: 9px;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
}

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

th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: #f8fafc;
    color: #344054;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .035em;
}

tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #fafcff; }
.number { text-align: right; font-variant-numeric: tabular-nums; }
.positive-text { color: var(--positive); }
.negative-text { color: var(--negative); }
.detail-table td:nth-child(6) { white-space: normal; min-width: 240px; }
.empty { padding: 28px; text-align: center; color: var(--muted); }

.section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.section-heading h2 { margin: 0; }
.section-heading span,
.note { color: var(--muted); }
.note { margin: 4px 2px 0; }

.alert {
    padding: 12px 14px;
    margin-bottom: 16px;
    border-radius: 8px;
    border: 1px solid;
}

.alert.error {
    color: #912018;
    background: var(--negative-bg);
    border-color: #fecdca;
}

.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 20px;
}

.login-card {
    width: min(420px, 100%);
    padding: 26px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: var(--shadow);
}

.login-card h1 { margin-top: 0; }
.login-card input { margin-bottom: 14px; }
.login-card button { width: 100%; }

@media (max-width: 1100px) {
    .filter-grid { grid-template-columns: repeat(3, minmax(170px, 1fr)); }
    .summary-cards { grid-template-columns: repeat(2, minmax(180px, 1fr)); }
    .report-meta { align-items: flex-start; flex-wrap: wrap; }
}

@media (max-width: 680px) {
    .topbar { align-items: flex-start; padding: 18px 16px; }
    .topbar h1 { font-size: 20px; }
    .container { width: min(100% - 20px, 1480px); margin-top: 12px; }
    .panel { padding: 13px; }
    .filter-grid,
    .summary-cards { grid-template-columns: 1fr; }
    .toolbar { width: 100%; }
    .toolbar button { flex: 1; }
}

@media print {
    @page { size: A4 landscape; margin: 10mm; }
    body { background: #fff; font-size: 10px; }
    .topbar { background: #fff; color: #000; padding: 0 0 10px; }
    .topbar p { color: #555; }
    .container { width: 100%; margin: 0; }
    .filter-panel,
    .no-print,
    .note { display: none !important; }
    .panel,
    .summary-card { box-shadow: none; break-inside: avoid; }
    .summary-card strong { font-size: 16px; }
    th { position: static; }
    .table-wrap { overflow: visible; }
    table { font-size: 8px; }
    th, td { padding: 4px; white-space: normal; }
}
