:root {
    color-scheme: light dark;
    --bg: #f6f7f9;
    --surface: #ffffff;
    --text: #1b2230;
    --muted: #5b6577;
    --border: #d9dee6;
    --accent: #1f5fbf;
    --accent-text: #ffffff;
    --good: #18794e;
    --good-bg: #e6f4ed;
    --warn: #8a5a00;
    --warn-bg: #fdf3dc;
    --bad: #b3261e;
    --bad-bg: #fce8e6;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #12151b;
        --surface: #1b2029;
        --text: #e7eaf0;
        --muted: #9aa4b5;
        --border: #333b49;
        --accent: #6ea2f2;
        --accent-text: #10141b;
        --good: #63cf9b;
        --good-bg: #16302a;
        --warn: #e8bd6a;
        --warn-bg: #362b14;
        --bad: #f28b82;
        --bad-bg: #3b1d1b;
    }
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

h1:focus { outline: none; }
.loading { padding: 48px; text-align: center; color: var(--muted); }

.page { max-width: 1240px; margin: 0 auto; padding: 24px 16px 64px; }
.page-header { margin-bottom: 20px; }
.page-header h1 { margin: 0 0 4px; font-size: 26px; font-weight: 650; }
.page-header p { margin: 0; color: var(--muted); max-width: 70ch; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 18px; margin-bottom: 16px; }
.card h2 { margin: 0 0 12px; font-size: 16px; font-weight: 620; }
.card h3 { margin: 14px 0 8px; font-size: 13px; font-weight: 620; color: var(--muted); }

.dropzone { position: relative; display: block; border: 2px dashed var(--border); border-radius: 10px; padding: 34px 16px; text-align: center; cursor: pointer; }
.dropzone:hover, .dropzone:focus-within { border-color: var(--accent); }
.dropzone input[type=file] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.dropzone strong { display: block; font-size: 16px; margin-bottom: 4px; }
.dropzone span { color: var(--muted); }
.upload-actions { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; margin-top: 12px; }

.layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.side { position: sticky; top: 16px; }
@media (max-width: 960px) {
    .layout { grid-template-columns: minmax(0, 1fr); }
    .side { position: static; }
}

.fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px 12px; }
.fields .wide { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.field > span { font-size: 12.5px; color: var(--muted); }
.please-check { color: var(--warn); font-weight: 600; }
.header-row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 16px; }
.language-picker select { width: auto; }
.pdf-language { margin-top: 10px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.field.low input, .field.low select { border-color: var(--warn); background: var(--warn-bg); }

input, select, textarea {
    width: 100%;
    min-width: 0;
    padding: 7px 9px;
    font: inherit;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
}
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
}
input[type=checkbox] { width: auto; }

button { font: inherit; cursor: pointer; border-radius: 6px; padding: 7px 12px; border: 1px solid var(--border); background: var(--surface); color: var(--text); }
button:hover:not(:disabled) { border-color: var(--accent); }
button:disabled { opacity: .55; cursor: not-allowed; }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); font-weight: 600; }
button.link { border: 0; background: none; color: var(--accent); padding: 0; text-decoration: underline; }
a { color: var(--accent); }

.lines { display: flex; flex-direction: column; gap: 12px; }
.line { border: 1px solid var(--border); border-radius: 8px; padding: 12px; }
.line-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; color: var(--muted); font-size: 13px; }
.line-net { font-variant-numeric: tabular-nums; color: var(--text); font-weight: 600; }

.tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.tabs button[aria-pressed=true] { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }

.totals { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.totals td { padding: 3px 0; }
.totals td:last-child { text-align: right; white-space: nowrap; padding-left: 12px; }
.totals .grand td { border-top: 1px solid var(--border); font-weight: 680; font-size: 16px; padding-top: 7px; }

.status { display: block; padding: 9px 11px; border-radius: 7px; font-weight: 600; margin-bottom: 10px; }
.status.good { background: var(--good-bg); color: var(--good); }
.status.bad { background: var(--bad-bg); color: var(--bad); }
.status.neutral { background: var(--bg); color: var(--muted); font-weight: 500; }

.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.actions button { flex: 1 1 auto; }

.issues { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.issue { padding: 7px 9px; border-radius: 6px; font-size: 13.5px; overflow-wrap: anywhere; }
.issue.fatal { background: var(--bad-bg); color: var(--bad); }
.issue.warning { background: var(--warn-bg); color: var(--warn); }
.issue.info { background: var(--bg); color: var(--muted); }
.issue code { font-size: 11.5px; opacity: .8; display: block; margin-top: 2px; }

.banner { padding: 12px 14px; border-radius: 8px; margin-bottom: 14px; background: var(--warn-bg); color: var(--warn); }
.banner.error { background: var(--bad-bg); color: var(--bad); }
.banner label { display: flex; gap: 8px; align-items: center; font-weight: 600; margin-top: 8px; }
.inline-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 8px; }
.inline-form select { width: auto; }
.muted { color: var(--muted); font-size: 13px; }

#blazor-error-ui { display: none; position: fixed; bottom: 0; left: 0; right: 0; padding: 10px 16px; background: var(--bad-bg); color: var(--bad); }
#blazor-error-ui .dismiss { float: right; cursor: pointer; }
