:root {
  --bg: #f4f4f1;
  --surface: #fcfcfb;
  --surface-2: #efeee9;
  --line: #dddcd5;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --ink-3: #7a7974;
  --accent: #2a78d6;
  --s1: #2a78d6;
  --s2: #eb6834;
  --s3: #1baf7a;
  --s4: #6250d6;
  --good: #0ca30c;
  --seq-100: #cde2fb; --seq-200: #9ec5f4; --seq-300: #6da7ec; --seq-400: #3987e5; --seq-500: #256abf; --seq-600: #184f95; --seq-700: #0d366b;
  --bad: #d03b3b;
  --radius: 10px;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111110; --surface: #1a1a19; --surface-2: #232321; --line: #33332f;
    --ink: #f0efec; --ink-2: #c3c2b7; --ink-3: #8f8e86; --accent: #3987e5;
    --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #9085e9; --good: #2bbf2b; --bad: #e66767;
    --seq-100: #104281; --seq-200: #184f95; --seq-300: #256abf; --seq-400: #2a78d6; --seq-500: #5598e7; --seq-600: #86b6ef; --seq-700: #cde2fb;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font-size: 14px; line-height: 1.45; }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
button {
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 6px 12px; cursor: pointer;
}
button:hover { border-color: var(--ink-3); }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
input, select, textarea { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; }
.num { font-variant-numeric: tabular-nums; text-align: right; }
.muted { color: var(--ink-2); }
.small { font-size: 12px; }
.empty { color: var(--ink-3); font-style: italic; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.card h3 { margin: 0 0 4px; font-size: 15px; }
.card .sub { margin: 0 0 12px; color: var(--ink-2); font-size: 12px; }

/* KPI */
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.kpi .lab { font-size: 12px; color: var(--ink-2); }
.kpi .val { font-size: 26px; font-weight: 650; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.kpi .val small { font-size: 13px; font-weight: 500; color: var(--ink-2); margin-left: 3px; }
.kpi .meta { font-size: 12px; color: var(--ink-3); display: flex; justify-content: space-between; align-items: end; gap: 8px; }
.delta.up { color: var(--good); } .delta.down { color: var(--bad); }
.delta::before { content: ""; }

/* charts */
.chart { position: relative; }
.chart svg { display: block; overflow: visible; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .tick { fill: var(--ink-3); font-size: 11px; }
.chart .dlabel { fill: var(--ink-2); font-size: 11px; }
.chart .cross { stroke: var(--ink-3); stroke-width: 1; stroke-dasharray: 3 3; }
.tip { position: absolute; pointer-events: none; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 6px 9px; font-size: 12px; box-shadow: 0 4px 14px rgb(0 0 0 / .12); min-width: 140px; }
.tip i, .legend i { display: inline-block; width: 10px; height: 3px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--ink-2); margin-top: 6px; }
.tableview { margin-top: 8px; font-size: 12px; }
.tableview summary { cursor: pointer; color: var(--ink-2); }
.tscroll { max-height: 220px; overflow: auto; margin-top: 6px; }

table { border-collapse: collapse; width: 100%; }
th, td { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { font-size: 12px; color: var(--ink-2); font-weight: 600; position: sticky; top: 0; background: var(--surface); }

.chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.chip { font-size: 11px; background: var(--surface-2); border-radius: 999px; padding: 1px 8px; font-variant-numeric: tabular-nums; }
.tag { font-size: 11px; color: var(--ink-2); border: 1px solid var(--line); border-radius: 999px; padding: 0 7px; white-space: nowrap; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
.dot.ok { background: var(--good); } .dot.err { background: var(--bad); } .dot.none { background: var(--ink-3); }

/* ---------- tryb generowania raportu PDF: zawsze jasny motyw, stała szerokość, bez kontrolek ---------- */
html.pdf-mode {
  --bg: #ffffff; --surface: #ffffff; --surface-2: #f1f0ec; --line: #dddcd5;
  --ink: #0b0b0b; --ink-2: #52514e; --ink-3: #7a7974; --accent: #2a78d6;
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #6250d6; --good: #0ca30c; --bad: #d03b3b;
  --seq-100: #cde2fb; --seq-200: #9ec5f4; --seq-300: #6da7ec; --seq-400: #3987e5; --seq-500: #256abf; --seq-600: #184f95; --seq-700: #0d366b;
  color-scheme: light;
}
html.pdf-mode body { background: #ffffff; }
html.pdf-mode main { width: 1100px; max-width: 1100px; margin: 0; }
html.pdf-mode .grid2 { grid-template-columns: 1fr 1fr; }
html.pdf-mode select, html.pdf-mode button, html.pdf-mode input, html.pdf-mode form, html.pdf-mode textarea,
html.pdf-mode details, html.pdf-mode label:has(select), html.pdf-mode label:has(input),
html.pdf-mode [data-pdf="skip"], html.pdf-mode .tip, html.pdf-mode .cross { display: none !important; }
html.pdf-mode .tscroll { max-height: none !important; overflow: visible !important; }
html.pdf-mode th { position: static; }
html.pdf-mode #ecoHot tbody tr:nth-child(n+41), html.pdf-mode #ecoRegions tbody tr:nth-child(n+31),
html.pdf-mode #newsList .news-item:nth-child(n+21), html.pdf-mode #creditNews .news-item:nth-child(n+9) { display: none; }
html.pdf-mode a { color: var(--ink); text-decoration: none; }
.pdf-title { font-size: 20px; font-weight: 700; letter-spacing: -0.01em; margin: 6px 0 2px; color: var(--ink); }
.pdf-cover { background: #fff; padding: 28px 32px; border: 1px solid var(--line); border-radius: var(--radius); }
.pdf-cover h1 { font-size: 30px; margin: 0 0 6px; letter-spacing: -0.02em; }
.pdf-cover .lead { color: var(--ink-2); margin: 0 0 18px; }
.pdf-cover ol { margin: 6px 0 0 18px; padding: 0; color: var(--ink-2); }
.pdf-overlay { position: fixed; inset: 0; z-index: 50; background: rgb(0 0 0 / .45); display: grid; place-items: center; }
.pdf-overlay > div { background: var(--surface); color: var(--ink); border-radius: 12px; padding: 20px 24px; min-width: 320px; box-shadow: 0 10px 40px rgb(0 0 0 / .3); }
.pdf-overlay .progress { height: 8px; background: var(--surface-2); border-radius: 999px; overflow: hidden; margin-top: 10px; }
.pdf-overlay .progress > i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .3s; }
.mir-info { background: var(--surface-2); border-radius: 8px; padding: 10px 12px; }
.mir-info code { font-size: 11.5px; }
.mir-info table td:first-child { white-space: nowrap; color: var(--ink-2); }
html.pdf-mode .mir-info details { display: block !important; }
/* linki do źródeł */
.srcs { margin-top: 10px; padding-top: 8px; border-top: 1px dashed var(--line); font-size: 11.5px; color: var(--ink-3); line-height: 1.7; }
.srcs a { color: var(--accent); text-decoration: none; white-space: nowrap; }
.srcs a:hover { text-decoration: underline; }
.srcs .srcs-lab { font-weight: 600; color: var(--ink-2); margin-right: 2px; }
.kpi-src { text-decoration: none; font-size: 11px; color: var(--accent); margin-left: 2px; }
.kpi-src:hover { text-decoration: underline; }
html.pdf-mode .srcs a, html.pdf-mode .kpi-src { color: var(--accent); }
/* zdolność kredytowa */
.cap-layout { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 18px; align-items: start; }
@media (max-width: 900px) { .cap-layout { grid-template-columns: 1fr; } }
.cap-app { display: grid; grid-template-columns: 22px minmax(0, 1fr) 130px auto auto; gap: 6px 8px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); }
.cap-app select { min-width: 0; }
.cap-app .cap-inc { display: grid; font-size: 11px; color: var(--ink-2); }
.cap-app .cap-inc input { width: 100%; }
.cap-app .cap-note { grid-column: 2 / -1; }
.cap-n { font-weight: 650; color: var(--ink-2); }
@media (max-width: 560px) { .cap-app { grid-template-columns: 22px 1fr; } .cap-app > *:nth-child(n+3) { grid-column: 2; } }
#capAdd { margin-top: 6px; }
.cap-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 560px) { .cap-grid { grid-template-columns: 1fr; } }
.cap-res { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: var(--surface); }
.cap-res.variable { box-shadow: inset 0 3px 0 var(--s1); }
.cap-res.fixed { box-shadow: inset 0 3px 0 var(--s2); }
.cap-amt { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; margin: 2px 0; }
.cap-tbl td { padding: 3px 4px; } .cap-tbl td:first-child { color: var(--ink-2); }
.cap-break { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-top: 10px; color: var(--ink-2); }
.cap-mx td { white-space: nowrap; } .cap-mx td div.muted { font-size: 12px; }
tr.cap-now td { background: rgba(42, 120, 214, 0.10); }
#capBanks tr.mb td { background: rgba(42, 120, 214, 0.12); }
#capBanks tr.mb td:first-child { box-shadow: inset 4px 0 0 var(--accent); }
td.sep, th.sep { border-left: 1px solid var(--line); }
html.pdf-mode .cap-layout { grid-template-columns: 1fr 1.2fr; }
html.pdf-mode #capFactors input { display: inline !important; border: none; background: none; }
