/* Notatnik - Rachunki (od 0.12.0, crm/rachunki.js): kafelki z sumami, szybki wpis wydatku, listy opłat, rachunek z
   historią i statystyki. Wykres to zwykły HTML: oś po lewej, kolumny w procentach wysokości, dwie serie (--rc-1
   rachunki, --rc-2 niezaplanowane; para sprawdzona pod kątem ślepoty barw) z 2 px przerwy. Twarde kąty jak w Hegios. */

.rc { --rc-1: #2E64A8; --rc-2: #EB6834; display: flex; flex-direction: column; gap: var(--h-sp-4); max-width: 1120px; }
.rc .is-late:not(.rc-poz) { color: var(--h-error); font-weight: var(--h-fw-sem); }
.rc .is-dzis { color: var(--h-text); font-weight: var(--h-fw-sem); }
.rc .is-mniej { color: var(--h-success); }
.rc-link { background: none; border: none; padding: 4px 0; margin: 0; font-size: var(--h-fs-13); color: var(--h-accent); cursor: pointer; text-align: left; }
.rc-link:hover { text-decoration: underline; }
.rc-link:focus-visible, .rc-rach:focus-visible, .rc-kolumna:focus-visible { outline: 2px solid var(--h-accent); outline-offset: 1px; }
.rc-pod { margin: 0; font-size: var(--h-fs-13); color: var(--h-text-muted); }

.rc-gora { display: flex; align-items: center; justify-content: space-between; gap: var(--h-sp-3); flex-wrap: wrap; }
.rc-gora .tz-seg button { padding: 8px 16px; }
.rc-nowy { min-height: 40px; }
.rc-mies { display: flex; align-items: center; gap: var(--h-sp-1); }
.rc-mies .h-icon-btn { width: 40px; height: 40px; color: var(--h-text); }
.rc-mies h2 { margin: 0; min-width: 168px; text-align: center; font-size: var(--h-fs-20); font-weight: var(--h-fw-sem); }
.rc-mies h2::first-letter { text-transform: uppercase; }
.rc-mies .h-btn { margin-left: var(--h-sp-2); }

/* -- kafelki -- */
.rc-kafle { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--h-sp-3); }
.rc-kafle-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.rc-kaf { background: var(--h-surface); border: 1px solid var(--h-border); padding: var(--h-sp-3) var(--h-sp-4); min-width: 0; }
.rc-kaf-l { font-size: var(--h-fs-13); color: var(--h-text-muted); }
.rc-kaf-w { font-size: var(--h-fs-22); font-weight: var(--h-fw-sem); line-height: 1.35; overflow-wrap: anywhere; }
.rc-kaf-w small { font-size: var(--h-fs-13); font-weight: var(--h-fw-reg); color: var(--h-text-muted); }
.rc-kaf-p { font-size: var(--h-fs-13); color: var(--h-text-muted); }
.rc-brak-d { font-size: var(--h-fs-15); font-weight: var(--h-fw-reg); color: var(--h-text-muted); }
.rc-mier { height: 6px; background: var(--h-accent-bg); margin: 6px 0 2px; }
.rc-mier i { display: block; height: 100%; background: var(--rc-1); }
.rc-mier.is-blisko i { background: var(--rc-2); }
.rc-mier.is-za i { background: var(--h-warning); }

/* -- szybki wpis -- */
.rc-szybki-p { display: grid; grid-template-columns: 120px minmax(160px, 1fr) minmax(150px, 200px) 150px auto; gap: var(--h-sp-3); align-items: end; padding: var(--h-sp-3) var(--h-sp-4) var(--h-sp-4); }
.rc-szybki .h-field > span { font-size: var(--h-fs-13); color: var(--h-text-muted); }
.rc-szybki .h-input, .rc-szybki .h-select { width: 100%; min-width: 0; height: 44px; }
.rc-szybki #rc-s-kwota { text-align: right; font-family: var(--h-font-mono); }
.rc-szybki .h-btn { height: 44px; }

/* -- listy -- */
.rc-kol { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--h-sp-4); align-items: start; }
.rc-kol-l, .rc-kol-p { display: flex; flex-direction: column; gap: var(--h-sp-4); min-width: 0; }
.rc h3.pd-card-h { margin: 0; }
.rc-kart-s { margin-left: auto; font-size: var(--h-fs-14); font-weight: var(--h-fw-med); white-space: nowrap; }
.rc-karta.is-zal { border-left: 4px solid var(--h-warning); }
.rc-poz { display: flex; align-items: center; gap: var(--h-sp-3); min-height: 56px; padding: 8px var(--h-sp-2) 8px var(--h-sp-4); border-top: 1px solid var(--h-border); color: var(--h-text); text-decoration: none; }
h3 + .rc-poz { border-top: none; }
.rc-poz-t { flex: 1 1 auto; min-width: 0; }
.rc-poz-t strong { display: block; font-size: var(--h-fs-15); font-weight: var(--h-fw-med); overflow-wrap: anywhere; line-height: var(--h-lh-tight); }
.rc-poz-m { display: block; font-size: var(--h-fs-13); color: var(--h-text-muted); overflow-wrap: anywhere; line-height: var(--h-lh-tight); }
.rc-kw { flex-shrink: 0; text-align: right; font-size: var(--h-fs-14); white-space: nowrap; }
.rc-kw small { display: block; font-family: var(--h-font-ui); font-size: var(--h-fs-12); color: var(--h-text-muted); }
.rc-zaplac { flex-shrink: 0; min-height: 36px; width: 88px; padding-left: 0; padding-right: 0; }
.rc-samo { flex-shrink: 0; width: 88px; text-align: center; font-size: var(--h-fs-12); line-height: 1.3; color: var(--h-text-muted); }
.rc-znak { flex-shrink: 0; width: 24px; color: var(--h-success); text-align: center; }
.rc-wiecej { flex-shrink: 0; width: 36px; height: 36px; }
.rc-wiecej .ik { stroke-width: 3; }
.rc-poz.is-skipped strong, .rc-poz.is-skipped .rc-kw { color: var(--h-text-muted); }
a.rc-rach { padding-right: var(--h-sp-3); }
a.rc-rach:hover { background: var(--h-bg); }
.rc-rach > .ik { flex-shrink: 0; color: var(--h-text-muted); }
.rc-term { flex-shrink: 0; width: 130px; font-size: var(--h-fs-13); color: var(--h-text-muted); }
.rc-rach .rc-kw { min-width: 120px; }
.rc-start p { margin: 0 0 var(--h-sp-3); }
.rc-typowe { display: flex; flex-wrap: wrap; gap: var(--h-sp-2); }
.rc-typowe-p { display: flex; align-items: center; flex-wrap: wrap; gap: var(--h-sp-2); font-size: var(--h-fs-13); color: var(--h-text-muted); }
#rc-blad .h-btn { margin-top: var(--h-sp-3); }

/* -- rachunek -- */
.rc-wroc { display: inline-flex; align-items: center; gap: 4px; align-self: flex-start; min-height: 32px; font-size: var(--h-fs-14); text-decoration: none; }
.rc-glowa { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--h-sp-3); flex-wrap: wrap; }
.rc-glowa > div:first-child { flex: 1 1 260px; min-width: 0; }
.rc-glowa h2 { margin: 0; font-size: var(--h-fs-22); overflow-wrap: anywhere; }
.rc-glowa p { margin: 2px 0 0; font-size: var(--h-fs-14); color: var(--h-text-muted); }
.rc-glowa .rc-uwagi { color: var(--h-text); white-space: pre-wrap; overflow-wrap: anywhere; }
.rc-akcje { display: flex; gap: var(--h-sp-2); flex-wrap: wrap; }

/* -- wykres słupkowy -- */
.rc-leg { display: flex; gap: var(--h-sp-4); margin-bottom: var(--h-sp-3); font-size: var(--h-fs-13); color: var(--h-text); }
.rc-leg span { display: inline-flex; align-items: center; gap: 6px; }
.rc-leg i { width: 12px; height: 12px; }
.rc-c1 { background: var(--rc-1); }
.rc-c2 { background: var(--rc-2); }
.rc-wyk { display: flex; gap: var(--h-sp-2); padding-top: 8px; margin-bottom: var(--h-sp-2); }
.rc-os { position: relative; width: 48px; height: 200px; flex-shrink: 0; }
.rc-os span { position: absolute; right: 0; transform: translateY(50%); font-size: var(--h-fs-12); color: var(--h-text-muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.rc-pole { position: relative; flex: 1 1 auto; min-width: 0; }
.rc-linie { position: absolute; left: 0; right: 0; top: 0; height: 200px; }
.rc-linie i { position: absolute; left: 0; right: 0; height: 1px; background: #E3E7ED; }
.rc-kolumny { position: relative; display: flex; }
.rc-kolumna { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; background: none; border: none; padding: 0; margin: 0; color: var(--h-text-muted); cursor: default; }
button.rc-kolumna { cursor: pointer; }
.rc-slup { display: flex; flex-direction: column; justify-content: flex-end; gap: 2px; width: min(24px, 64%); height: 200px; flex-shrink: 0; }
.rc-slup i { display: block; flex-shrink: 0; min-height: 2px; }
.rc-slup i:first-child { border-radius: 4px 4px 0 0; }
.rc-kolumna:hover .rc-slup i { filter: brightness(1.12); }
.rc-et { height: 26px; line-height: 26px; font-size: var(--h-fs-12); white-space: nowrap; }
.rc-kolumna.is-on { background: var(--h-accent-bg); }
.rc-kolumna.is-on .rc-et { color: var(--h-text); font-weight: var(--h-fw-sem); }
.rc-tab-o { overflow-x: auto; margin-top: var(--h-sp-2); }
.rc-tab { width: 100%; border-collapse: collapse; font-size: var(--h-fs-13); }
.rc-tab th, .rc-tab td { padding: 7px 8px; border-top: 1px solid var(--h-border); text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.rc-tab th { border-top: none; color: var(--h-text-muted); font-weight: var(--h-fw-med); }
.rc-tab th:first-child, .rc-tab td:first-child { text-align: left; padding-left: 0; }

/* -- kategorie, zmiany -- */
.rc-kat { padding: 8px 0 6px; }
.rc-kat-g { display: flex; justify-content: space-between; gap: var(--h-sp-3); font-size: var(--h-fs-14); }
.rc-kat-g small { display: inline-block; width: 44px; text-align: right; color: var(--h-text-muted); font-size: var(--h-fs-12); }
.rc-kat-b { height: 8px; margin-top: 4px; }
.rc-kat-b i { display: block; height: 100%; background: var(--rc-1); border-radius: 0 4px 4px 0; }
.rc .pd-card-b .rc-zm { padding: 6px 0; min-height: 48px; }
.rc-zm > span:first-child { min-width: 0; overflow-wrap: anywhere; }
.rc-zm small { display: block; font-size: var(--h-fs-13); color: var(--h-text-muted); }
.rc-zm .h-num { white-space: nowrap; font-size: var(--h-fs-13); }

@media (min-width: 1000px) {
    .rc-kol { grid-template-columns: minmax(0, 3fr) minmax(300px, 2fr); }
}
@media (max-width: 999px) {
    .rc-kafle { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .rc-kafle-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .rc-szybki-p { grid-template-columns: 110px minmax(0, 1fr) minmax(0, 1fr); }
    .rc-f-dzien { grid-column: 1 / 3; }
}
@media (hover: none) and (pointer: coarse) {
    .rc-zaplac { min-height: 44px; }
    .rc-wiecej { width: 44px; height: 44px; }
    .rc-link { min-height: 36px; }
}
@media (max-width: 599px) {
    .rc { gap: var(--h-sp-3); }
    .rc-gora { gap: var(--h-sp-2); }
    .rc-gora { flex-wrap: nowrap; }
    .rc-gora .tz-seg { flex: 1 1 auto; }
    .rc-gora .tz-seg button { flex: 1 1 auto; justify-content: center; padding: 8px 6px; }
    .rc-nowy { width: 44px; padding: 0; flex-shrink: 0; align-self: stretch; }
    .rc-nowy span { display: none; }
    .rc-mies { justify-content: space-between; flex-wrap: wrap; }
    .rc-mies .h-btn { flex: 1 1 100%; margin: 0; }
    .rc-kafle, .rc-kafle-3 { gap: var(--h-sp-2); grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .rc-kaf { padding: 10px 12px; }
    .rc-kaf-w { font-size: var(--h-fs-16); }
    .rc-kaf-p { font-size: var(--h-fs-12); }
    .rc-kafle-3 .rc-kaf:first-child { grid-column: 1 / 3; }
    .rc-szybki-p { grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); }
    .rc-f-dzien { grid-column: auto; }
    .rc-szybki .h-btn { grid-column: 1 / 3; }
    .rc-poz { gap: var(--h-sp-2); padding-left: var(--h-sp-3); padding-right: 4px; }
    .rc-poz.is-open, .rc-poz.is-today, .rc-poz.is-late { flex-wrap: wrap; }
    .rc-poz.is-open .rc-poz-t, .rc-poz.is-today .rc-poz-t, .rc-poz.is-late .rc-poz-t { flex: 1 1 100%; }
    .rc-poz.is-open .rc-kw, .rc-poz.is-today .rc-kw, .rc-poz.is-late .rc-kw { flex: 1 1 auto; text-align: left; font-size: var(--h-fs-16); }
    .rc-term { width: auto; text-align: right; }
    a.rc-rach { flex-wrap: wrap; position: relative; padding-right: 32px; }
    a.rc-rach .rc-poz-t { flex: 1 1 100%; }
    a.rc-rach .rc-term { flex: 1 1 auto; text-align: left; }
    a.rc-rach > .ik { position: absolute; right: 10px; top: calc(50% - 9px); }
    .rc-akcje .h-btn { flex: 1 1 auto; }
    .rc-os { width: 40px; }
}
