/* Rozliczenia – motyw (nadpisuje Bootstrap 5.3) */
:root,
[data-bs-theme="light"] {
  --page: #f6f6f3;
  --surface: #ffffff;
  --surface-2: #fafaf8;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #898781;
  --hair: #e8e7e1;
  --grid: #ecebe5;
  --axis: #c3c2b7;
  --accent: #2a78d6;
  --accent-wash: rgba(42, 120, 214, .08);
  --good: #006300;
  --warn-wash: #fff6e0;
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --series-3: #1baf7a;
  --band: rgba(11, 11, 11, .035);
  --shadow: 0 1px 2px rgba(11, 11, 11, .04), 0 4px 16px rgba(11, 11, 11, .04);

  --bs-body-bg: var(--page);
  --bs-body-color: var(--ink);
  --bs-secondary-color: var(--ink-2);
  --bs-tertiary-bg: var(--surface-2);
  --bs-border-color: var(--hair);
  --bs-primary: #2a78d6;
  --bs-primary-rgb: 42, 120, 214;
  --bs-link-color: #1c5cab;
  --bs-link-color-rgb: 28, 92, 171;
  --bs-link-hover-color: #104281;
  --bs-border-radius: .625rem;
  --bs-border-radius-lg: .875rem;
  --bs-body-font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --bs-body-font-size: .9375rem;
}

[data-bs-theme="dark"] {
  --page: #0f0f0e;
  --surface: #1a1a19;
  --surface-2: #20201f;
  --ink: #f0efec;
  --ink-2: #c3c2b7;
  --muted: #898781;
  --hair: #2c2c2a;
  --grid: #2a2a28;
  --axis: #383835;
  --accent: #3987e5;
  --accent-wash: rgba(57, 135, 229, .12);
  --good: #0ca30c;
  --warn-wash: #2b2412;
  --series-1: #3987e5;
  --series-2: #d95926;
  --series-3: #199e70;
  --band: rgba(255, 255, 255, .04);
  --shadow: none;

  --bs-body-bg: var(--page);
  --bs-body-color: var(--ink);
  --bs-secondary-color: var(--ink-2);
  --bs-tertiary-bg: var(--surface-2);
  --bs-border-color: var(--hair);
  --bs-primary: #3987e5;
  --bs-primary-rgb: 57, 135, 229;
  --bs-link-color: #86b6ef;
  --bs-link-color-rgb: 134, 182, 239;
  --bs-link-hover-color: #b7d3f6;
}

body { background: var(--page); color: var(--ink); -webkit-font-smoothing: antialiased; }
a { text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
.text-muted, .text-body-secondary { color: var(--ink-2) !important; }
.num { font-variant-numeric: tabular-nums; }

/* Nawigacja */
.app-nav { background: var(--surface); border-bottom: 1px solid var(--hair); position: sticky; top: 0; z-index: 1020;
  --bs-navbar-color: var(--ink-2); --bs-navbar-hover-color: var(--ink); --bs-navbar-active-color: var(--ink); --bs-navbar-brand-color: var(--ink); --bs-navbar-brand-hover-color: var(--ink); }
.app-nav .navbar-brand { display: flex; align-items: center; gap: .55rem; font-weight: 650; letter-spacing: -.01em; color: var(--ink); }
.brand-mark { width: 28px; height: 28px; border-radius: 8px; background: var(--ink); color: var(--surface); display: grid; place-items: center; font-size: .85rem; font-weight: 700; }
.app-nav .nav-link { color: var(--ink-2); padding: .4rem .75rem !important; border-radius: 999px; font-weight: 500; }
.app-nav .nav-link:hover { color: var(--ink); background: var(--band); text-decoration: none; }
.app-nav .nav-link.active { color: var(--ink) !important; background: var(--band); font-weight: 600; }
[data-bs-theme="dark"] .app-nav .nav-link.active { background: rgba(255,255,255,.08); }
[data-bs-theme="dark"] .navbar-toggler-icon { filter: invert(1); }

/* Karty */
.card { background: var(--surface); border: 1px solid var(--hair); border-radius: var(--bs-border-radius-lg); box-shadow: var(--shadow); }
.card-header { background: transparent; border-bottom: 1px solid var(--hair); padding: .9rem 1.1rem; font-weight: 600; }
.card-body { padding: 1.1rem; }
.section-title { font-size: .8125rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 .75rem; }

/* Nagłówek strony */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.page-head h1 { font-size: 1.6rem; font-weight: 650; letter-spacing: -.02em; margin: 0; }
.page-head .sub { color: var(--ink-2); font-size: .9rem; }
.month-switch { display: inline-flex; align-items: center; background: var(--surface); border: 1px solid var(--hair); border-radius: 999px; padding: 3px; box-shadow: var(--shadow); }
.month-switch a, .month-switch span { padding: .3rem .75rem; border-radius: 999px; color: var(--ink-2); font-weight: 500; }
.month-switch a:hover { background: var(--band); color: var(--ink); text-decoration: none; }
.month-switch .current { color: var(--ink); font-weight: 600; text-transform: capitalize; min-width: 9.5rem; text-align: center; }
.month-pick { position: relative; display: inline-grid; place-items: center; width: 2.1rem; height: 1.9rem; border-radius: 999px; color: var(--ink-2); border-left: 1px solid var(--hair); margin-left: 2px; }
.month-pick:hover { background: var(--band); color: var(--ink); }
.month-pick input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; border: 0; }
.month-pick input::-webkit-calendar-picker-indicator { position: absolute; inset: 0; width: 100%; height: 100%; cursor: pointer; }

/* Hero */
.hero .label { color: var(--ink-2); font-weight: 500; }
.hero .figure { font-size: 3.25rem; font-weight: 650; letter-spacing: -.03em; line-height: 1.05; margin: .25rem 0 1rem; }
.hero .figure small { font-size: 1.5rem; font-weight: 500; color: var(--ink-2); margin-left: .25rem; }
.due-list { list-style: none; padding: 0; margin: 0; }
.due-list li { display: flex; align-items: center; gap: .65rem; padding: .6rem 0; border-top: 1px solid var(--hair); }
.due-list .key { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.due-list .name { flex: 1; }
.due-list .when { color: var(--muted); font-size: .8125rem; min-width: 6.5rem; text-align: right; }
.due-list .amt { font-weight: 600; min-width: 7.5rem; text-align: right; font-variant-numeric: tabular-nums; }
.hero .note { color: var(--muted); font-size: .8125rem; margin-top: .75rem; }

/* Kafelki */
.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; background: var(--hair); border-radius: var(--bs-border-radius-lg); overflow: hidden; border: 1px solid var(--hair); box-shadow: var(--shadow); height: 100%; }
.tile { background: var(--surface); padding: 1rem 1.1rem; }
.tile .t-label { color: var(--ink-2); font-size: .8125rem; font-weight: 500; }
.tile .t-value { font-size: 1.4rem; font-weight: 650; letter-spacing: -.02em; margin-top: .2rem; white-space: nowrap; }
.tile .t-value small { font-size: .85rem; color: var(--muted); font-weight: 500; margin-left: .15rem; }
.tile .t-note { color: var(--muted); font-size: .78rem; margin-top: .15rem; min-height: 1.1em; }
.tile.emph .t-value { color: var(--ink); }
@media (max-width: 767px) { .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } .hero .figure { font-size: 2.5rem; } }

/* Wykresy */
.chart-card .card-body { padding: 1rem 1.1rem .75rem; }
.chart-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; flex-wrap: wrap; margin-bottom: .5rem; }
.chart-head h2 { font-size: 1rem; font-weight: 600; margin: 0; }
.legend { display: flex; gap: 1rem; flex-wrap: wrap; font-size: .8125rem; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: .4rem; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.chart { position: relative; width: 100%; height: 280px; }
.chart svg { display: block; width: 100%; height: 100%; overflow: visible; }
.chart .tick { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .grid { stroke: var(--grid); stroke-width: 1; shape-rendering: crispEdges; }
.chart .base { stroke: var(--axis); stroke-width: 1; shape-rendering: crispEdges; }
.chart .band { fill: transparent; cursor: pointer; }
.chart .band.hover { fill: var(--band); }
.chart .band.sel { fill: var(--accent-wash); }
.chart .xlab { fill: var(--muted); font-size: 11px; }
.chart .xlab.sel { fill: var(--ink); font-weight: 600; }
.chart-tip { position: absolute; pointer-events: none; background: var(--surface); border: 1px solid var(--hair); border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.12); padding: .6rem .75rem; font-size: .8125rem; min-width: 190px; opacity: 0; transition: opacity .08s; z-index: 5; }
.chart-tip.on { opacity: 1; }
.chart-tip .tt { font-weight: 600; margin-bottom: .35rem; text-transform: capitalize; }
.chart-tip .row-i { display: flex; align-items: center; gap: .5rem; padding: .1rem 0; }
.chart-tip .row-i i { width: 9px; height: 9px; border-radius: 2px; }
.chart-tip .row-i .v { margin-left: auto; font-weight: 600; font-variant-numeric: tabular-nums; padding-left: 1rem; }
.chart-tip .row-i.sum { border-top: 1px solid var(--hair); margin-top: .3rem; padding-top: .35rem; color: var(--ink-2); }

/* Tabele */
.table { --bs-table-bg: transparent; --bs-table-hover-bg: var(--band); margin-bottom: 0; }
.table > :not(caption) > * > * { padding: .55rem .75rem; border-bottom-color: var(--hair); }
.table thead th { color: var(--muted); font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; border-bottom-color: var(--hair); white-space: nowrap; }
.table td { font-variant-numeric: tabular-nums; }
.table tr.sel > * { background: var(--accent-wash) !important; }
.table tfoot td { font-weight: 600; border-bottom: 0; }
.table-warning > * { --bs-table-bg: var(--warn-wash) !important; }

/* Drobne */
.badge { font-weight: 600; letter-spacing: .01em; border-radius: 6px; }
.badge.text-bg-light { background: var(--band) !important; color: var(--ink-2) !important; }
.btn { border-radius: 8px; font-weight: 500; }
.btn-primary { --bs-btn-bg: var(--ink); --bs-btn-border-color: var(--ink); --bs-btn-hover-bg: #2b2b2a; --bs-btn-hover-border-color: #2b2b2a; --bs-btn-color: var(--surface); --bs-btn-hover-color: var(--surface); --bs-btn-active-bg: #2b2b2a; }
[data-bs-theme="dark"] .btn-primary { --bs-btn-hover-bg: #d9d8d3; --bs-btn-hover-border-color: #d9d8d3; --bs-btn-active-bg: #d9d8d3; }
.btn-outline-primary { --bs-btn-color: var(--ink); --bs-btn-border-color: var(--hair); --bs-btn-hover-bg: var(--band); --bs-btn-hover-color: var(--ink); --bs-btn-hover-border-color: var(--hair); background: var(--surface); }
.btn-outline-secondary { --bs-btn-color: var(--ink-2); --bs-btn-border-color: var(--hair); --bs-btn-hover-bg: var(--band); --bs-btn-hover-color: var(--ink); --bs-btn-hover-border-color: var(--hair); }
.form-control, .form-select { border-color: var(--hair); background-color: var(--surface); border-radius: 8px; }
.form-control:focus, .form-select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-wash); }
.alert { border-radius: var(--bs-border-radius-lg); border: 1px solid var(--hair); }
.alert-warning { background: var(--warn-wash); color: var(--ink); }
.status-line { color: var(--muted); font-size: .8125rem; display: flex; gap: 1.25rem; flex-wrap: wrap; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; margin-right: .35rem; vertical-align: middle; }
body.bare { background: var(--page); }
@media (max-width: 575px) {
  .due-list .when { min-width: 0; }
  .due-list .amt { min-width: 0; }
  .tile { padding: .8rem .85rem; }
  .tile .t-value { font-size: 1.1rem; }
  .page-head h1 { font-size: 1.35rem; }
  .chart { height: 230px; }
}
.btn { white-space: nowrap; }
.chip { display: inline-block; padding: .15rem .5rem; border-radius: 6px; font-size: .75rem; font-weight: 600; background: var(--band); color: var(--ink-2); }
.chip-sale { background: rgba(0, 131, 0, .09); color: var(--good); }
.chip-kor { background: var(--warn-wash); color: #8a5a00; }
[data-bs-theme="dark"] .chip-kor { color: #eda100; }
.chip-info { background: var(--accent-wash); color: var(--bs-link-color); }
.card.toolbar { display: flex; flex-direction: row; gap: .5rem; flex-wrap: wrap; align-items: center; padding: .75rem; }
.toolbar .form-control, .toolbar .form-select { width: auto; font-size: .875rem; }
