/* Rachunki: ciepły, przyjazny wygląd (wariant C). Mobile-first, tryb ciemny automatycznie. */

/* ---------- Fonty (lokalnie, z polskimi znakami) ---------- */
@font-face { font-family: Nunito; font-weight: 400; font-display: swap; src: url(/fonts/nunito-latin-400.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: Nunito; font-weight: 400; font-display: swap; src: url(/fonts/nunito-latin-ext-400.woff2) format("woff2"); unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: Nunito; font-weight: 700; font-display: swap; src: url(/fonts/nunito-latin-700.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: Nunito; font-weight: 700; font-display: swap; src: url(/fonts/nunito-latin-ext-700.woff2) format("woff2"); unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: Nunito; font-weight: 800; font-display: swap; src: url(/fonts/nunito-latin-800.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: Nunito; font-weight: 800; font-display: swap; src: url(/fonts/nunito-latin-ext-800.woff2) format("woff2"); unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: Fraunces; font-weight: 600; font-display: swap; src: url(/fonts/fraunces-latin-600.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: Fraunces; font-weight: 600; font-display: swap; src: url(/fonts/fraunces-latin-ext-600.woff2) format("woff2"); unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }

/* ---------- Kolory ---------- */
:root {
    --bg: #f7f3ec;
    --surface: #fffdf9;
    --surface-2: #f2ebe0;
    --text: #2b2620;
    --muted: #7a6f63;
    --border: #ebe3d6;
    --accent: #c2562d;
    --accent-soft: #f6e3d8;
    --accent-line: #efcdb9;
    --ink: #2b2620;
    --ink-text: #fffdf9;
    --pos: #3f7d4e;
    --neg: #b4441f;
    --late-bg: #f6d4cf; --late-tx: #a2321f;
    --warn-bg: #fbefc4; --warn-tx: #7a5200;
    --ok-bg: #dbead9; --ok-tx: #2f6b3e;
    --tone-terra-bg: #fbdcc8; --tone-terra: #b4441f;
    --tone-sage-bg: #dbead9; --tone-sage: #3f7d4e;
    --tone-ochre-bg: #fbefc4; --tone-ochre: #946200;
    --tone-slate-bg: #dbe9ee; --tone-slate: #2f6278;
    --tone-plum-bg: #eadff0; --tone-plum: #6d3f86;
    --tone-sand-bg: #efe5d6; --tone-sand: #7a6f63;
    --chart-1: #c2562d; --chart-2: #3f7d4e; --chart-3: #d9a21b; --chart-4: #2f6278; --chart-5: #8e5aa8; --chart-6: #b9a58c;
    --radius: 22px;
    --shadow: 0 1px 0 rgba(60, 40, 20, .03);
    --pop-shadow: 0 12px 32px rgba(60, 40, 20, .14);
    --serif: Fraunces, Georgia, serif;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #1c1915;
        --surface: #26221d;
        --surface-2: #2f2a24;
        --text: #f1ebe2;
        --muted: #b3a797;
        --border: #3a342d;
        --accent: #e07a4f;
        --accent-soft: #3a2a21;
        --accent-line: #5a3b2c;
        --ink: #f1ebe2;
        --ink-text: #1c1915;
        --pos: #7fbf8c;
        --neg: #ef8a65;
        --late-bg: #4a2620; --late-tx: #f4a48d;
        --warn-bg: #44391a; --warn-tx: #f0cf73;
        --ok-bg: #233a29; --ok-tx: #9bd3a7;
        --tone-terra-bg: #4a2a1e; --tone-terra: #f2a07c;
        --tone-sage-bg: #233a29; --tone-sage: #9bd3a7;
        --tone-ochre-bg: #44391a; --tone-ochre: #f0cf73;
        --tone-slate-bg: #1f3540; --tone-slate: #94c3d6;
        --tone-plum-bg: #3a2a44; --tone-plum: #cfa8e3;
        --tone-sand-bg: #38322a; --tone-sand: #c9bba8;
        --chart-1: #e07a4f; --chart-2: #7fbf8c; --chart-3: #f0cf73; --chart-4: #94c3d6; --chart-5: #cfa8e3; --chart-6: #8a7d6b;
        --pop-shadow: 0 12px 32px rgba(0, 0, 0, .45);
    }
}

/* ---------- Podstawy ---------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 15.5px/1.5 Nunito, system-ui, -apple-system, "Segoe UI", sans-serif;
}
a { color: var(--accent); text-decoration: none; font-weight: 700; }
a:hover { text-decoration: underline; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; letter-spacing: -.01em; }
h1 { font-size: 1.9rem; line-height: 1.15; margin: 0; }
h2 { font-size: 1.2rem; margin: 1.6rem 0 .7rem; }
h3 { font-size: 1.02rem; margin: 1.1rem 0 .5rem; }
.ic { width: 18px; height: 18px; flex: none; }
.ic.xs { width: 13px; height: 13px; }

/* ---------- Nagłówek ---------- */
.top {
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: .8rem 1rem;
    padding: 1rem 1.25rem;
    flex-wrap: wrap;
}
.brand { font-family: var(--serif); font-size: 1.55rem; font-weight: 600; color: var(--text); }
.brand em { color: var(--accent); font-style: normal; }
.brand:hover { text-decoration: none; }
.prop {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: .4rem .9rem;
    font-weight: 800;
    color: var(--text);
    max-width: 16rem;
}
.prop span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prop:hover { text-decoration: none; }

.nav {
    margin-left: auto;
    display: flex;
    gap: .2rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: .25rem;
}
.nav a {
    display: flex;
    align-items: center;
    gap: .4rem;
    padding: .45rem .85rem;
    border-radius: 999px;
    color: var(--muted);
    font-weight: 800;
    font-size: .9rem;
    white-space: nowrap;
    position: relative;
}
.nav a:hover { text-decoration: none; color: var(--text); }
.nav a.on { background: var(--ink); color: var(--ink-text); }
.badge {
    display: inline-grid;
    place-items: center;
    min-width: 1.25rem;
    height: 1.25rem;
    padding: 0 .3rem;
    border-radius: 999px;
    background: var(--accent);
    color: #fff;
    font-size: .72rem;
    font-weight: 800;
}
.user-menu:only-of-type, .top > .user-menu { margin-left: auto; }
.nav + .user-menu { margin-left: 0; }

/* Menu rozwijane: przełącznik nieruchomości i menu użytkownika */
.dropdown { position: relative; }
.dropdown > summary { list-style: none; cursor: pointer; user-select: none; }
.dropdown > summary::-webkit-details-marker { display: none; }
.dropdown .pop {
    position: absolute;
    top: calc(100% + .45rem);
    z-index: 30;
    min-width: 15rem;
    max-width: calc(100vw - 2rem);
    margin: 0;
    padding: .4rem;
    list-style: none;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: var(--pop-shadow);
}
.dropdown.left .pop { left: 0; }
.dropdown.right .pop { right: 0; }
.pop a, .pop button {
    display: flex;
    align-items: center;
    gap: .6rem;
    width: 100%;
    padding: .55rem .75rem;
    border-radius: 10px;
    color: var(--text);
    font-weight: 700;
    background: none;
    border: none;
    min-height: 0;
    font-size: .95rem;
    text-align: left;
    cursor: pointer;
}
.pop button { justify-content: flex-start; }
.pop a:hover, .pop button:hover { background: var(--surface-2); text-decoration: none; filter: none; }
.pop a.on { color: var(--accent); }
.pop .sep { border-top: 1px dashed var(--border); margin: .35rem .2rem; }
.pop .ic { color: var(--muted); }
.pop form { margin: 0; }
.pop .who { padding: .45rem .75rem .6rem; color: var(--muted); font-size: .85rem; }
.pop .who b { display: block; color: var(--text); font-size: .95rem; }
.prop .chev { transition: transform .15s; }
.dropdown[open] .prop .chev { transform: rotate(180deg); }

/* ---------- Treść ---------- */
main { max-width: 1100px; margin: 0 auto; padding: .4rem 1.25rem 3rem; }
.page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: .75rem 1rem;
    flex-wrap: wrap;
    margin: .6rem 0 1.25rem;
}
.page-head h2 { margin: 0; }
.lead { color: var(--muted); margin: .3rem 0 0; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; }

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.35rem;
    box-shadow: var(--shadow);
    margin-bottom: 1.1rem;
    min-width: 0;
}
.card > h2:first-child, .card > h3:first-child, .card > .page-head:first-child { margin-top: 0; }
/* Nagłówek karty z przyciskiem obok (np. szukanie na liście). */
.card-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .7rem; }
.card-head h2 { margin: 0; }
.card-head button { padding: .3rem .6rem; }
.list-filter { width: 100%; margin-bottom: .5rem; }
.list-filter[hidden], .list li[hidden] { display: none; }
.card.accent { background: var(--accent-soft); border-color: var(--accent-line); }

.grid { display: grid; gap: 1.1rem; margin-bottom: 1.1rem; }
.grid > .card, .grid > div > .card:last-child { margin-bottom: 0; }
@media (min-width: 760px) {
    .grid.two { grid-template-columns: 1fr 1fr; }
    .grid.three { grid-template-columns: repeat(3, 1fr); }
    .grid.dash { grid-template-columns: 2fr 1fr; }
}

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .8rem; margin-bottom: 1.1rem; }
.stat {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: .9rem 1rem;
    min-width: 0;
}
.stat .k { color: var(--muted); font-size: .85rem; font-weight: 700; }
.stat .v { font-family: var(--serif); font-size: 1.45rem; font-weight: 600; font-variant-numeric: tabular-nums; overflow-wrap: break-word; }
.stat .v.small { font-family: inherit; font-size: 1rem; font-weight: 800; }

/* Saldo na pulpicie */
.hero { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; }
.hero h2 { margin: 0; }
.hero .big { font-family: var(--serif); font-size: clamp(2.2rem, 7vw, 3rem); font-weight: 600; line-height: 1.05; margin: .35rem 0; font-variant-numeric: tabular-nums; }
.hero .big.neg { color: var(--neg); }
.hero .big.pos { color: var(--pos); }
.quick { display: grid; gap: .6rem; align-content: start; }
.quick .btn { justify-content: flex-start; }

/* Listy wpisów */
.list { list-style: none; margin: 0; padding: 0; }
.list li {
    display: flex;
    align-items: center;
    gap: .8rem;
    padding: .7rem 0;
    border-bottom: 1px dashed var(--border);
}
.list li:last-child { border-bottom: none; }
.list .main { flex: 1 1 0; min-width: 0; overflow-wrap: break-word; }
.list .main > a, .list .main > b { font-weight: 800; }
.list .main > a { color: var(--text); }
.list .sub { color: var(--muted); font-size: .86rem; display: flex; flex-wrap: wrap; align-items: center; gap: .15rem .5rem; }
.list .side { display: flex; align-items: center; gap: .5rem; flex: none; }
/* Przelewy w wąskiej kolumnie: przyciski schodzą pod nazwiska zamiast ściskać je do jednej litery. */
.list.transfers li { flex-wrap: wrap; }
.list.transfers .main { min-width: 9rem; }
.list.transfers .side { margin-left: auto; }
@media (max-width: 560px) {
    /* Na telefonie kwota nad przyciskiem, żeby tytuł miał miejsce. */
    .list .side { flex-direction: column; align-items: flex-end; gap: .3rem; }
    .list li { align-items: flex-start; }
    .list li > .cat, .list li > .av { margin-top: .1rem; }
}

.cat {
    width: 38px; height: 38px;
    border-radius: 12px;
    display: grid; place-items: center;
    flex: none;
}
.tone-terra { background: var(--tone-terra-bg); color: var(--tone-terra); }
.tone-sage { background: var(--tone-sage-bg); color: var(--tone-sage); }
.tone-ochre { background: var(--tone-ochre-bg); color: var(--tone-ochre); }
.tone-slate { background: var(--tone-slate-bg); color: var(--tone-slate); }
.tone-plum { background: var(--tone-plum-bg); color: var(--tone-plum); }
.tone-sand { background: var(--tone-sand-bg); color: var(--tone-sand); }

.av {
    width: 36px; height: 36px;
    border-radius: 12px;
    color: #fff;
    display: inline-grid; place-items: center;
    font-weight: 800;
    font-size: .9rem;
    flex: none;
}
.av.sm { width: 30px; height: 30px; border-radius: 10px; font-size: .8rem; }

.muted { color: var(--muted); }
.small { font-size: .86rem; }
.pos { color: var(--pos); }
.neg { color: var(--neg); }
.amount { font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }

.pill {
    display: inline-flex;
    align-items: center;
    padding: .1rem .6rem;
    border-radius: 999px;
    font-size: .76rem;
    font-weight: 800;
    background: var(--surface-2);
    color: var(--muted);
    white-space: nowrap;
}
.pill.late { background: var(--late-bg); color: var(--late-tx); }
.pill.warn { background: var(--warn-bg); color: var(--warn-tx); }
.pill.ok { background: var(--ok-bg); color: var(--ok-tx); }

.flash, .alert, .note { padding: .8rem 1.1rem; border-radius: 16px; margin-bottom: 1.1rem; font-weight: 700; }
.flash { background: var(--ok-bg); color: var(--ok-tx); }
.alert { background: var(--late-bg); color: var(--late-tx); }
.note { background: var(--warn-bg); color: var(--warn-tx); font-weight: 600; }
/* Stały komunikat u góry strony (niepotwierdzony e-mail, nieruchomość w archiwum). */
.banner {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .6rem;
    padding: .7rem 1.1rem; border-radius: 16px; margin-bottom: 1.1rem;
    background: var(--warn-bg); color: var(--warn-tx); font-weight: 600;
}
.banner form.inline { margin: 0; }
.banner .actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
/* Link do skopiowania (zaproszenie). */
input.copy-link { width: 100%; font-family: ui-monospace, monospace; font-size: .85rem; margin-top: .4rem; }
/* Lista pierwszych kroków na pulpicie. */
.checklist { list-style: none; padding: 0; margin: .4rem 0 .8rem; display: grid; gap: .45rem; }
.checklist li { display: flex; align-items: center; gap: .6rem; }
.checklist li.done { color: var(--muted); text-decoration: line-through; }
.checklist .tick { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--border); display: grid; place-items: center; flex: none; }
.checklist li.done .tick { background: var(--ok-bg); border-color: var(--ok-tx); color: var(--ok-tx); }
/* Szybkie dodawanie rachunku z kategorii. */
.chips { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .6rem; }
/* Miniatury załączników. */
.attachments { list-style: none; padding: 0; margin: .4rem 0; display: grid; gap: .5rem; }
.attachments li { display: flex; align-items: center; gap: .7rem; }
.attachments img { width: 56px; height: 56px; object-fit: cover; border-radius: 10px; border: 1px solid var(--border); }
.attachments .main { flex: 1; min-width: 0; overflow-wrap: anywhere; }

.empty { text-align: center; padding: 1.2rem .5rem; color: var(--muted); }
.empty .cat { margin: 0 auto .6rem; width: 46px; height: 46px; }

/* Tabele */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .95rem; }
th, td { text-align: left; padding: .6rem .45rem; border-bottom: 1px dashed var(--border); vertical-align: top; }
th { color: var(--muted); font-weight: 800; font-size: .76rem; text-transform: uppercase; letter-spacing: .05em; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tr:last-child td { border-bottom: none; }
tfoot td { font-weight: 800; border-top: 2px solid var(--border); border-bottom: none; }

/* Wykres słupkowy w CSS (pulpit) */
.bars { display: flex; align-items: flex-end; gap: .55rem; height: 150px; }
.bars .b { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: .35rem; min-width: 0; }
.bars .b i { width: 100%; min-height: 4px; border-radius: 10px; background: var(--surface-2); }
.bars .b.on i { background: var(--accent); }
.bars .b span { font-size: .75rem; color: var(--muted); font-weight: 800; }
/* Kategorie wydatków na pulpicie (jedna osoba): poziomy pasek względem największej kategorii. */
.meter { height: 8px; border-radius: 999px; background: var(--surface-2); margin-top: .35rem; overflow: hidden; }
.meter i { display: block; height: 100%; border-radius: 999px; background: var(--accent); }

/* ---------- Formularze ---------- */
form.stack, .form-grid { display: grid; gap: .9rem; }
@media (min-width: 760px) {
    .form-grid { grid-template-columns: 1fr 1fr; }
    .form-grid .wide { grid-column: 1 / -1; }
}
.field { display: grid; gap: .3rem; align-content: start; }
.field .lbl { font-size: .86rem; color: var(--muted); font-weight: 800; }
.hint { color: var(--muted); font-size: .82rem; }
.err { color: var(--neg); font-weight: 700; font-size: .85rem; }

input, select, textarea, button { font: inherit; }
input, select, textarea {
    width: 100%;
    padding: .6rem .8rem;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
    color: var(--text);
    min-height: 2.75rem;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
input[type=checkbox], input[type=radio] { width: 1.1rem; height: 1.1rem; min-height: 0; accent-color: var(--accent); }

.check { display: flex; align-items: center; gap: .55rem; font-weight: 700; }
.choices { display: flex; flex-wrap: wrap; gap: .5rem 1.2rem; }
fieldset { border: 1px solid var(--border); border-radius: 18px; padding: 1rem; margin: 0; background: var(--bg); }
legend { padding: 0 .4rem; color: var(--muted); font-size: .86rem; font-weight: 800; }
.split-row { display: grid; grid-template-columns: 1fr 6.5rem; gap: .5rem; align-items: center; }

.btn, button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    padding: .6rem 1.15rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-weight: 800;
    cursor: pointer;
    min-height: 2.6rem;
    text-decoration: none;
    white-space: nowrap;
}
.btn:hover, button:hover { text-decoration: none; filter: brightness(.97); }
.btn.primary, button.primary { background: var(--ink); color: var(--ink-text); border-color: var(--ink); }
.btn.accent, button.accent { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn.danger, button.danger { color: var(--neg); }
.btn.small, button.small { padding: .3rem .8rem; min-height: 2.1rem; font-size: .86rem; }
button.link { background: none; border: none; padding: 0; min-height: 0; color: var(--accent); }
.form-actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
form.inline { display: inline; }

.row-form { display: flex; flex-wrap: wrap; gap: .55rem; align-items: end; }
.row-form .field { flex: 1 1 9rem; }
.list .row-form { flex-wrap: nowrap; align-items: center; }
.list .row-form input, .list .row-form select { width: auto; flex: 1 1 auto; min-width: 0; }

/* Osoby w ustawieniach: nazwa (z polem do zmiany) zajmuje całą wolną szerokość, rola i dezaktywacja obok,
   a na węższym ekranie pod nią – zamiast ściskać pole nazwy do jednej litery. */
.list.members li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: start; gap: .4rem .8rem; }
.list.members li > .av { margin-top: .3rem; }
.list.members .main { display: grid; grid-template-columns: minmax(0, 1fr); gap: .3rem; }
/* Pole nazwy bierze resztę miejsca obok przycisku (bez domyślnej szerokości 20 znaków, która rozpychała wiersz). */
.list.members .main .row-form input { flex: 1 1 0; width: 0; min-width: 0; }
.member-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: .5rem; }
.member-actions .row-form select { flex: none; }
@media (max-width: 760px) {
    .list.members li { grid-template-columns: auto minmax(0, 1fr); }
    .member-actions { grid-column: 2; justify-content: flex-start; }
}
/* Zaproszenia: gdy adres nie mieści się obok przycisku, przycisk schodzi pod spód (adres zostaje w jednym kawałku). */
.list.invites li { flex-wrap: wrap; }
.list.invites .main { min-width: min(100%, 15rem); }
.list.invites li > form { margin-left: auto; }
.list .address { display: block; overflow-wrap: anywhere; }

/* Zaproszenie: pola w kolumnach wyrównanych do góry (podpowiedzi mają różną wysokość), przycisk w osobnym wierszu. */
.invite-form { display: grid; gap: .9rem; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); align-items: start; margin-bottom: .6rem; }
.invite-form > button { grid-column: 1 / -1; justify-self: start; }

details > summary { cursor: pointer; color: var(--accent); font-weight: 800; }
details[open] > summary { margin-bottom: .6rem; }

.period-nav { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin-bottom: 1.1rem; }
.period-nav .label { font-family: var(--serif); font-size: 1.15rem; min-width: 10rem; text-align: center; }

.chart { position: relative; width: 100%; }

.auth { max-width: 400px; margin: 3rem auto; }
.auth .brand { display: block; font-size: 2.2rem; margin-bottom: .2rem; }
/* Zgoda OAuth: więcej treści niż logowanie, więc szersza karta. */
.auth.consent { max-width: 560px; }
.auth.consent fieldset { display: grid; gap: .45rem; }

code.json { font-size: .78rem; white-space: pre-wrap; word-break: break-word; color: var(--muted); }

.htmx-request { opacity: .7; transition: opacity .2s; }

/* Formularz rachunku: pola zapłaty tylko dla „zapłacony”, opcje cykliczności tylko po zaznaczeniu. */
.expense-form .recurring-only { display: none; }
.expense-form:has(input[name=recurring]:checked) .recurring-only { display: grid; }
.expense-form:has(input[name=recurring]:checked) p.recurring-only { display: block; }
.expense-form:has(input[name=recurring]:checked) .not-recurring,
.expense-form:has(input[name=recurring]:checked) .paid-only,
.expense-form:has(input[name=status][value=topay]:checked) .paid-only { display: none; }
/* Rachunek cykliczny płacony automatycznie: wybór osoby tylko po zaznaczeniu. */
.auto-paid .auto-only { display: none; }
.auto-paid:has(input[name=autoPaid]:checked) .auto-only { display: grid; }
.expense-form:not(:has(input[name=autoPaid]:checked)) p.auto-only,
.expense-form:has(input[name=autoPaid]:checked) p.not-auto { display: none !important; }

/* ---------- Telefon ---------- */
@media (max-width: 760px) {
    .top { padding: .8rem 1rem; gap: .6rem; }
    .brand { font-size: 1.3rem; }
    .prop { max-width: 11rem; }
    .top > .user-menu { margin-left: auto; }
    .nav {
        order: 3;
        margin: 0;
        width: 100%;
        justify-content: space-between;
        border-radius: 18px;
    }
    .nav a {
        flex: 1;
        flex-direction: column;
        gap: .1rem;
        padding: .4rem .2rem;
        border-radius: 14px;
        font-size: .68rem;
    }
    .nav a .ic { width: 20px; height: 20px; }
    .nav .badge { position: absolute; top: .1rem; right: calc(50% - 1.35rem); min-width: 1.05rem; height: 1.05rem; font-size: .62rem; }
    main { padding: .2rem 1rem 2.5rem; }
    h1 { font-size: 1.6rem; }
    .card { padding: 1.1rem; border-radius: 18px; }
}

/* ---------- Logowanie przez Google, separator ---------- */
.btn.google { background: #fff; color: #1f1f1f; border-color: #dadce0; }
.divider { display: flex; align-items: center; gap: .75rem; color: var(--muted); font-size: .85rem; }
.divider::before, .divider::after { content: ""; flex: 1; border-top: 1px dashed var(--border); }

/* ---------- Goście, stopka ---------- */
.guest { margin-left: auto; display: flex; align-items: center; gap: .9rem; }
.foot { max-width: 1100px; margin: 0 auto; padding: 1.5rem 1.25rem 2.5rem; display: flex; gap: .6rem; flex-wrap: wrap;
        justify-content: center; color: var(--muted); font-size: .85rem; }

/* ---------- Kreator nowej nieruchomości ---------- */
.setup-steps { list-style: none; padding: 0; margin: 0 0 1rem; display: flex; flex-wrap: wrap; gap: .4rem 1.1rem; }
.setup-steps li { display: flex; align-items: center; gap: .45rem; color: var(--muted); font-weight: 700; font-size: .92rem; }
.setup-steps .tick { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--border); display: grid; place-items: center; flex: none; font-size: .8rem; }
.setup-steps .tick .ic { width: 14px; height: 14px; }
.setup-steps li.on { color: var(--text); }
.setup-steps li.on .tick { background: var(--ink); border-color: var(--ink); color: var(--ink-text); }
.setup-steps li.done .tick { background: var(--ok-bg); border-color: var(--ok-tx); color: var(--ok-tx); }
.card.setup h2 { margin: 0; }
.split-form:not(:has(input[name="splitMode"][value="fixed"]:checked)) .shares { display: none; }
.pct { position: relative; display: block; }
.pct input { width: 100%; padding-right: 2rem; text-align: right; }
.pct > span { position: absolute; right: .8rem; top: 50%; transform: translateY(-50%); color: var(--muted); font-weight: 700; pointer-events: none; }
.purpose-pick { display: grid; gap: .6rem; }
.purpose-pick .pick { display: grid; grid-template-columns: auto 1fr; column-gap: .8rem; row-gap: .15rem; align-items: center;
                      padding: .9rem 1rem; border: 2px solid var(--border); border-radius: 18px; background: var(--bg); cursor: pointer; }
.purpose-pick .pick .cat { grid-row: span 2; }
.purpose-pick .pick input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.purpose-pick .pick:hover { border-color: var(--muted); }
.purpose-pick .pick:has(input:checked) { border-color: var(--ink); background: var(--surface); }
.purpose-pick .pick:has(input:focus-visible) { outline: 3px solid var(--accent); outline-offset: 2px; }
@media (min-width: 760px) {
    .purpose-pick { grid-template-columns: repeat(3, 1fr); }
    .purpose-pick .pick { grid-template-columns: 1fr; align-content: start; }
    .purpose-pick .pick .cat { grid-row: auto; margin-bottom: .4rem; }
}

/* ---------- Strona startowa ---------- */
/* Przełącznik odbiorcy bez JS: zaznaczone radio ukrywa sekcje drugiej grupy. */
.aud-wrap { display: grid; gap: 1rem; justify-items: center; text-align: center; padding: 3rem 0 1rem; }
.landing-title { display: grid; gap: .9rem; margin: 0; max-width: 46rem; }
.landing-title .expert { font-size: clamp(2rem, 5vw, 3.125rem); line-height: 1.02; letter-spacing: -.01em; text-wrap: balance; }
.landing-title .expert em { color: var(--accent); font-style: normal; }
.landing-title .sub { font-family: Nunito, system-ui, sans-serif; letter-spacing: 0; font-size: clamp(1.2rem, 2.6vw, 1.5rem); font-weight: 400; line-height: 1.4; color: var(--muted); text-wrap: balance; }
/* Dłuższe logo (Rachunki.expert) i przyciski gościa mieszczą się w jednym wierszu. */
@media (max-width: 480px) {
    .top .brand { font-size: 1.15rem; }
    .guest { gap: .6rem; }
}
.aud-q { margin-top: 1.2rem; font-size: .8rem; font-weight: 800; text-transform: uppercase; letter-spacing: .09em; color: var(--muted); }
.aud { display: inline-flex; flex-wrap: wrap; justify-content: center; gap: .3rem; background: var(--surface); border: 1px solid var(--border); border-radius: 32px; padding: .35rem; }
.aud input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.aud label { display: inline-flex; align-items: center; gap: .55rem; padding: .75rem 1.5rem; border-radius: 999px; font-size: 1.1rem; font-weight: 800; color: var(--muted); cursor: pointer; }
.aud label .ic { width: 21px; height: 21px; }
.aud label:hover { color: var(--text); }
.aud input:checked + label { background: var(--ink); color: var(--ink-text); }
.aud input:focus-visible + label { outline: 3px solid var(--accent); outline-offset: 2px; }
.landing:has(#aud-flat:checked) :is(.for-rent, .for-own),
.landing:has(#aud-rent:checked) :is(.for-flat, .for-own),
.landing:has(#aud-own:checked) :is(.for-flat, .for-rent) { display: none; }

.landing .eyebrow { font-size: .8rem; font-weight: 800; text-transform: uppercase; letter-spacing: .09em; color: var(--accent); }
.landing-hero { display: grid; gap: 2rem; align-items: center; padding: 1.2rem 0 2.5rem; }
.landing-hero .copy { display: grid; gap: 1rem; min-width: 0; }
.landing-hero .slogan { font-size: clamp(1.9rem, 4.2vw, 2.6rem); line-height: 1.08; text-wrap: balance; margin: 0; }
.landing-hero .lead { font-size: 1.1rem; margin: 0; max-width: 36rem; }
.landing-hero .form-actions, .landing-hero p { margin: 0; }
.landing-hero .preview { display: grid; gap: .6rem; margin: 0; }
.landing-hero .preview p { margin: 0; }
.landing-hero .preview .label { font-weight: 800; }
.landing-hero .preview .big { font-family: var(--serif); font-size: 2.4rem; line-height: 1.05; font-variant-numeric: tabular-nums; }
.landing-hero .preview-head { display: flex; justify-content: space-between; align-items: center; gap: .5rem; flex-wrap: wrap; }
.landing-hero .settle { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; padding: .7rem .9rem; border-radius: 16px; background: var(--surface); font-weight: 700; }
.landing-hero .settle .amount { margin-left: auto; font-variant-numeric: tabular-nums; }
@media (min-width: 900px) { .landing-hero { grid-template-columns: 1.15fr 1fr; } }

.landing-sec { display: grid; gap: 1.2rem; padding: 1.5rem 0; }
.landing-sec h2 { font-size: clamp(1.5rem, 3.4vw, 2rem); margin: 0; text-wrap: balance; }
.landing-sec h2 + p { margin: .4rem 0 0; }
.landing-sec > p { margin: 0; }
.landing .steps { counter-reset: step; list-style: none; margin: 0; padding: 0; display: grid; gap: 1.1rem; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.landing .steps li { counter-increment: step; margin: 0; display: grid; gap: .5rem; align-content: start; }
.landing .steps li::before { content: counter(step); font-family: var(--serif); font-size: 1.1rem; width: 2.1rem; height: 2.1rem; border-radius: 50%;
                             display: grid; place-items: center; background: var(--ink); color: var(--ink-text); }
.landing .steps h3 { font-size: 1.15rem; margin: 0; }
.landing .steps p { margin: 0; }
.landing .forget li { align-items: flex-start; }
.landing .forget b { display: block; }
.landing .cmp-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.landing .cmp { border-collapse: collapse; width: 100%; min-width: 560px; }
.landing .cmp th, .landing .cmp td { text-align: left; padding: .85rem 1.1rem; border-top: 1px solid var(--border); vertical-align: top; }
.landing .cmp thead th { border-top: 0; font-size: .8rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.landing .cmp tbody th { font-weight: 400; font-size: inherit; text-transform: none; letter-spacing: normal; color: var(--text); }
.landing .cmp td:nth-child(2) { color: var(--muted); }
.landing .cmp td:nth-child(3) { font-weight: 700; }
/* Telefon: każdy wiersz porównania jako osobny blok z podpisami kolumn. */
@media (max-width: 640px) {
    .landing .cmp { min-width: 0; }
    .landing .cmp thead { display: none; }
    .landing .cmp tr, .landing .cmp th, .landing .cmp td { display: block; }
    .landing .cmp tbody tr { padding: .9rem 1.1rem; border-top: 1px solid var(--border); }
    .landing .cmp tbody tr:first-child { border-top: 0; }
    .landing .cmp tbody th, .landing .cmp td { padding: 0; border: 0; }
    .landing .cmp tbody th { font-weight: 800; margin-bottom: .4rem; }
    .landing .cmp td + td { margin-top: .3rem; }
    .landing .cmp td::before { content: attr(data-label); display: block; font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
}
.features { display: grid; gap: 1.1rem; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.features .card { margin: 0; }
/* Cztery karty: dwie w rzędzie, żeby żadna nie została sama. */
@media (min-width: 760px) { .features.pairs { grid-template-columns: 1fr 1fr; } }
.feature h3 { font-size: 1.15rem; margin: .8rem 0 .4rem; }
.feature p { margin: 0; }
.privacy { display: flex; gap: 1rem; align-items: flex-start; }
.privacy h3 { font-size: 1.15rem; margin: 0 0 .4rem; }
.privacy p { margin: 0 0 .5rem; }
.faq .card { display: grid; gap: 0; padding-top: .4rem; padding-bottom: .4rem; }
.faq details { padding: .85rem 0; border-top: 1px solid var(--border); }
.faq details:first-child { border-top: 0; }
.faq summary { color: var(--text); font-size: 1.05rem; }
.faq summary:hover { color: var(--accent); }
.faq details p { margin: 0; max-width: 46rem; }
.landing-cta { display: grid; gap: .8rem; justify-items: start; padding: 2rem; margin-top: 1rem; }
.landing-cta h2, .landing-cta p { margin: 0; }
.landing-cta h2 { font-size: 1.6rem; }
.landing .demo-link { display: inline-flex; align-items: center; gap: .4rem; justify-self: start; }

/* ---------- Wersja demo ---------- */
.banner.demo { background: var(--accent-soft); color: var(--text); border: 1px solid var(--accent-line); }
.demo-start { display: grid; gap: 1.4rem; padding: 1.2rem 0 1rem; }
.demo-intro { display: grid; gap: .9rem; max-width: 42rem; }
.demo-intro .eyebrow { font-size: .8rem; font-weight: 800; text-transform: uppercase; letter-spacing: .09em; color: var(--accent); }
.demo-intro h1 { font-size: clamp(2rem, 5vw, 3rem); line-height: 1.08; text-wrap: balance; }
.demo-intro .lead { font-size: 1.1rem; margin: 0; }
.demo-choices { display: grid; gap: 1.1rem; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); }
.demo-choice { display: grid; gap: .7rem; align-content: start; margin: 0; }
.demo-choice h2 { font-size: 1.4rem; margin: .2rem 0 0; }
.demo-choice p { margin: 0; }
.demo-choice button { justify-self: start; margin-top: .3rem; }
.demo-start > p { margin: 0; }
.terms h2 { font-size: 1.1rem; margin: 1.4rem 0 .5rem; }
.terms h2:first-child { margin-top: 0; }
.terms ul { padding-left: 1.2rem; }
.terms li { margin-bottom: .4rem; }

/* ---------- Zgłoszenia ---------- */
.list.feedback .reply { margin-top: .4rem; padding: .5rem .7rem; border-radius: 12px; background: var(--bg); font-size: .92rem; white-space: pre-wrap; }
.feedback-item .body { white-space: pre-wrap; overflow-wrap: anywhere; }
.feedback-item code { overflow-wrap: anywhere; }
.btn .badge { margin-left: .35rem; }

/* ---------- Statystyki użycia ---------- */
.funnel { display: grid; gap: .65rem; margin: .4rem 0 1rem; }
.funnel .lbl { display: flex; justify-content: space-between; gap: .5rem; font-size: .92rem; margin-bottom: .2rem; }
.funnel .track { height: 10px; border-radius: 10px; background: var(--surface-2); overflow: hidden; }
.funnel .track i { display: block; height: 100%; border-radius: 10px; background: var(--accent); }
ul.plain { list-style: none; padding: 0; margin: .3rem 0 .8rem; }
ul.plain li { padding: .15rem 0; }
