/* Finanse — wygląd aplikacji (wspólny z Garażem i Oponami). Motyw jasny i ciemny (ustawienie systemu albo wybór w menu: html[data-theme]). */

:root {
    --bg: #f4f6fa;
    --surface: #ffffff;
    --surface-2: #f8fafc;
    --surface-3: #eef2f7;
    --border: #e3e8f0;
    --border-2: #d3dbe7;
    --text: #0f172a;
    --text-2: #475569;
    --text-3: #8592a6;
    --accent: #2457d6;
    --accent-2: #1c46b0;
    --accent-soft: #e9f0ff;
    --accent-text: #ffffff;
    --ok: #15803d;
    --ok-soft: #e6f6ec;
    --soon: #b45309;
    --soon-soft: #fdf2df;
    --bad: #dc2626;
    --bad-soft: #fdeaea;
    --info: #2457d6;
    --info-soft: #e9f0ff;
    --sb-bg: #0b1120;
    --sb-bg-2: #111a2e;
    --sb-text: #c9d3e3;
    --sb-muted: #6b7a93;
    --sb-line: rgba(255, 255, 255, .07);
    --sb-hover: rgba(255, 255, 255, .06);
    --sb-active: rgba(96, 140, 255, .18);
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05);
    --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 6px 20px -6px rgba(15, 23, 42, .08);
    --shadow-lg: 0 24px 60px -12px rgba(15, 23, 42, .35);
    --radius: 14px;
    --radius-sm: 10px;
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI Variable Text", "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
    --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #0c1222;
        --surface: #121a2c;
        --surface-2: #161f34;
        --surface-3: #1b2640;
        --border: #232f48;
        --border-2: #2f3c5a;
        --text: #e7ecf5;
        --text-2: #a6b2c7;
        --text-3: #6d7b95;
        --accent: #5d8dff;
        --accent-2: #7ba3ff;
        --accent-soft: rgba(93, 141, 255, .15);
        --accent-text: #0b1120;
        --ok: #4ade80;
        --ok-soft: rgba(74, 222, 128, .12);
        --soon: #fbbf24;
        --soon-soft: rgba(251, 191, 36, .13);
        --bad: #f87171;
        --bad-soft: rgba(248, 113, 113, .13);
        --info: #7ba3ff;
        --info-soft: rgba(93, 141, 255, .15);
        --sb-bg: #080d19;
        --sb-bg-2: #0e1526;
        --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px -8px rgba(0, 0, 0, .45);
        color-scheme: dark;
    }
}
:root[data-theme="dark"] {
    --bg: #0c1222;
    --surface: #121a2c;
    --surface-2: #161f34;
    --surface-3: #1b2640;
    --border: #232f48;
    --border-2: #2f3c5a;
    --text: #e7ecf5;
    --text-2: #a6b2c7;
    --text-3: #6d7b95;
    --accent: #5d8dff;
    --accent-2: #7ba3ff;
    --accent-soft: rgba(93, 141, 255, .15);
    --accent-text: #0b1120;
    --ok: #4ade80;
    --ok-soft: rgba(74, 222, 128, .12);
    --soon: #fbbf24;
    --soon-soft: rgba(251, 191, 36, .13);
    --bad: #f87171;
    --bad-soft: rgba(248, 113, 113, .13);
    --info: #7ba3ff;
    --info-soft: rgba(93, 141, 255, .15);
    --sb-bg: #080d19;
    --sb-bg-2: #0e1526;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px -8px rgba(0, 0, 0, .45);
    color-scheme: dark;
}

/* ------------------------------------------------------------ podstawy */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 15px/1.5 var(--font);
    -webkit-font-smoothing: antialiased;
    font-variant-numeric: tabular-nums;
}
h1, h2, h3 { margin: 0; line-height: 1.25; letter-spacing: -.01em; }
h1 { font-size: 28px; font-weight: 700; letter-spacing: -.02em; }
h2 { font-size: 16px; font-weight: 650; }
h3 { font-size: 15px; font-weight: 650; }
p { margin: 0; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: var(--mono); font-size: .86em; background: var(--surface-3); padding: 1px 6px; border-radius: 6px; color: var(--text-2); white-space: nowrap; }
code:empty { display: none; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.i { width: 18px; height: 18px; flex: none; }
.grow { flex: 1 1 auto; }
.muted { color: var(--text-3); }
.small { font-size: 13px; }
.tiny { font-size: 11.5px; color: var(--text-3); display: block; }
.block { display: block; }
.pad { padding: 16px 20px; }
.pad-x { padding: 0 20px 20px; }
.danger-text { color: var(--bad) !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.eyebrow { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.sub { color: var(--text-2); font-size: 14px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ------------------------------------------------------------ przyciski */

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    height: 38px; padding: 0 15px; border-radius: 10px;
    border: 1px solid var(--border-2); background: var(--surface); color: var(--text);
    font-weight: 600; font-size: 14px; cursor: pointer; white-space: nowrap;
    box-shadow: var(--shadow-sm); transition: background .15s, border-color .15s, transform .05s;
    text-decoration: none !important;
}
.btn:hover { background: var(--surface-2); border-color: var(--text-3); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: default; }
.btn .i { width: 17px; height: 17px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn.primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.danger:hover { filter: brightness(.94); }
.btn.ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-3); color: var(--text); }
.btn.sm { height: 32px; padding: 0 11px; font-size: 13px; border-radius: 9px; }
.btn.wide { width: 100%; height: 44px; }
.btn-icon {
    display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 10px;
    border: 0; background: transparent; color: var(--text-2); cursor: pointer; flex: none;
}
.btn-icon:hover { background: var(--surface-3); color: var(--text); }
.btn-icon.sm { width: 30px; height: 30px; border-radius: 8px; }
.btn-icon.sm .i { width: 16px; height: 16px; }
.link-btn { border: 0; background: none; padding: 0; color: var(--accent); font-size: 12.5px; font-weight: 600; cursor: pointer; }
.link-btn:hover { text-decoration: underline; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.seg { display: inline-flex; align-items: center; gap: 2px; border: 1px solid var(--border); background: var(--surface); border-radius: 11px; padding: 2px; }
.seg .btn-icon { width: 32px; height: 32px; }

/* ------------------------------------------------------------ powłoka */

.shell { display: grid; grid-template-columns: 268px minmax(0, 1fr); min-height: 100vh; min-height: 100dvh; }
.sidebar {
    position: sticky; top: 0; height: 100vh; height: 100dvh; overflow-y: auto;
    background: linear-gradient(180deg, var(--sb-bg-2), var(--sb-bg) 40%);
    color: var(--sb-text); display: flex; flex-direction: column; padding: 18px 14px 14px;
    border-right: 1px solid var(--sb-line);
    padding-top: max(18px, env(safe-area-inset-top));
}
.sb-brand { display: flex; align-items: center; gap: 11px; padding: 2px 8px 18px; }
.sb-brand img { border-radius: 9px; }
.sb-brand strong { display: block; color: #fff; font-size: 17px; letter-spacing: -.01em; }
.sb-brand span { display: block; font-size: 11.5px; color: var(--sb-muted); }
.sb-brand .sb-close { margin-left: auto; color: var(--sb-text); display: none; }
.sb-link {
    display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: 10px;
    color: var(--sb-text); text-decoration: none !important; font-weight: 550; font-size: 14px; position: relative;
}
.sb-link .i { color: var(--sb-muted); }
.sb-link:hover { background: var(--sb-hover); }
.sb-link.active { background: var(--sb-active); color: #fff; }
.sb-link.active .i { color: #8fb0ff; }
.sb-badge { margin-left: auto; min-width: 22px; height: 20px; padding: 0 6px; border-radius: 10px; font-size: 11.5px; font-weight: 700; display: grid; place-items: center; }
.sb-badge.overdue { background: #ef4444; color: #fff; }
.sb-badge.soon { background: #f59e0b; color: #1f1300; }
.sb-title { display: flex; align-items: center; justify-content: space-between; margin: 22px 8px 6px 10px; font-size: 11.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--sb-muted); }
.sb-title .btn-icon { color: var(--sb-text); }
.sb-title .btn-icon:hover { background: var(--sb-hover); color: #fff; }
.sb-empty { color: var(--sb-muted); font-size: 13px; padding: 6px 10px; }
.sb-foot { margin-top: auto; padding-top: 16px; display: flex; flex-direction: column; gap: 2px; }
.sb-link .dot { margin-left: auto; }
.sb-user { display: flex; align-items: center; gap: 10px; padding: 12px 6px 2px 8px; margin-top: 8px; border-top: 1px solid var(--sb-line); }
.sb-user .btn-icon { color: var(--sb-muted); width: 32px; height: 32px; }
.sb-user .btn-icon:hover { background: var(--sb-hover); color: #fff; }
.sb-user-t { min-width: 0; flex: 1; display: flex; flex-direction: column; line-height: 1.25; }
.sb-user-t b { color: #fff; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; }
.sb-user-t small { color: var(--sb-muted); font-size: 12px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; flex: none; font-size: 12.5px; font-weight: 700; color: #fff; background: linear-gradient(135deg, #3b6ef5, #7c3aed); letter-spacing: .02em; }
.avatar.sm { width: 30px; height: 30px; font-size: 11px; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; display: inline-block; background: var(--text-3); }
.dot.ok { background: #22c55e; }
.dot.soon { background: #f59e0b; }
.dot.overdue { background: #ef4444; box-shadow: 0 0 0 3px rgba(239, 68, 68, .2); }
.scrim { display: none; }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: none; }
.page { width: 100%; max-width: 1320px; margin: 0 auto; padding: 30px 34px 60px; outline: none; transition: opacity .15s; }
.page.loading > * { opacity: .55; }

.skeleton-page { display: grid; gap: 18px; }
.sk { height: 110px; border-radius: var(--radius); background: linear-gradient(90deg, var(--surface-3), var(--surface-2), var(--surface-3)); background-size: 200% 100%; animation: sk 1.4s infinite linear; }
.sk.h { height: 54px; width: 46%; }
.sk.big { height: 320px; }
.sk-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
@keyframes sk { to { background-position: -200% 0; } }

/* ------------------------------------------------------------ nagłówki stron, karty, kafelki */

.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px 24px; flex-wrap: wrap; margin-bottom: 24px; }
.page-head h1 { margin-top: 4px; }
.page-head .sub { margin-top: 6px; }
.section-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 14px 24px; flex-wrap: wrap; margin: 4px 0 18px; }
.section-head h2 { font-size: 20px; font-weight: 700; }
.section-head .sub { margin-top: 4px; max-width: 760px; }
.list-title { font-size: 12.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--text-3); margin: 26px 0 10px; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 15px 20px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.card-head h2 { display: flex; align-items: center; gap: 9px; }
.card-head h2 .i { color: var(--text-3); }
.card-head .sub { font-size: 13px; margin-top: 2px; }

.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 20px; }
.tiles.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.tiles.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.tile {
    position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
    padding: 16px 18px 16px; display: flex; flex-direction: column; gap: 2px; color: var(--text); text-decoration: none !important; overflow: hidden; min-width: 0;
}
a.tile:hover { border-color: var(--border-2); transform: translateY(-1px); transition: transform .15s, border-color .15s; }
.tile::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: transparent; }
.tile.overdue::before { background: var(--bad); }
.tile.soon::before { background: var(--soon); }
.tile.ok::before { background: var(--ok); }
.tile-ic { position: absolute; top: 14px; right: 14px; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-3); color: var(--text-2); }
.tile.overdue .tile-ic { background: var(--bad-soft); color: var(--bad); }
.tile.soon .tile-ic { background: var(--soon-soft); color: var(--soon); }
.tile.ok .tile-ic { background: var(--ok-soft); color: var(--ok); }
.tile small { font-size: 12.5px; font-weight: 600; color: var(--text-3); padding-right: 40px; }
.tile b { font-size: 24px; font-weight: 700; letter-spacing: -.02em; line-height: 1.2; margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile > span:last-child, .tile > span:not(.tile-ic) { font-size: 13px; color: var(--text-2); }
.tile.overdue b { color: var(--bad); }

.chip { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px; border-radius: 999px; font-size: 12px; font-weight: 650; white-space: nowrap; background: var(--surface-3); color: var(--text-2); }
.chip .i { width: 13px; height: 13px; }
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.soon { background: var(--soon-soft); color: var(--soon); }
.chip.overdue { background: var(--bad-soft); color: var(--bad); }
.chip.info { background: var(--info-soft); color: var(--info); }
.chip.muted { background: var(--surface-3); color: var(--text-2); }
.tag { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 6px; background: var(--surface-3); color: var(--text-2); white-space: nowrap; }

.empty { text-align: center; padding: 34px 20px; color: var(--text-2); }
.empty-icon { width: 52px; height: 52px; margin: 0 auto 12px; border-radius: 16px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.empty-icon .i { width: 24px; height: 24px; }
.empty h3 { color: var(--text); font-size: 16px; margin-bottom: 4px; }
.empty p { max-width: 460px; margin: 0 auto; font-size: 14px; }
.empty-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 18px; }

.banner { display: flex; gap: 14px; align-items: center; padding: 14px 18px; border-radius: var(--radius); margin-bottom: 18px; background: var(--info-soft); color: var(--info); border: 1px solid transparent; }
.banner .i { width: 26px; height: 26px; }
.banner b { display: block; color: var(--text); }
.banner span { font-size: 13.5px; color: var(--text-2); }
.banner.soon { background: var(--soon-soft); color: var(--soon); }
.banner.overdue { background: var(--bad-soft); color: var(--bad); }


.two-col { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; margin-top: 20px; align-items: start; }
.two-col:first-child { margin-top: 0; }
.tiles + .two-col { margin-top: 0; }
.stack { display: grid; gap: 20px; align-content: start; }
.settings-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 20px; align-items: start; }

.tabs { display: flex; gap: 4px; margin: 20px 0 22px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { display: inline-flex; align-items: center; gap: 8px; padding: 11px 14px; color: var(--text-2); font-weight: 600; font-size: 14px; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; text-decoration: none !important; }
.tab .i { width: 17px; height: 17px; color: var(--text-3); }
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab.active .i { color: var(--accent); }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; font-weight: 650; color: var(--text-3); text-transform: uppercase; letter-spacing: .05em; padding: 10px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; background: var(--surface-2); }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--surface-2); }
.table .num { text-align: right; white-space: nowrap; }
.table td.act { width: 1%; white-space: nowrap; text-align: right; }
.table tfoot td { font-weight: 700; border-top: 1px solid var(--border-2); border-bottom: 0; }
.table .sub-row td { color: var(--text-2); }
.card > .table-wrap:last-child .table tr:last-child td:first-child { border-bottom-left-radius: var(--radius); }

.dl { margin: 0; padding: 8px 20px 16px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 20px; }
.dl > div { padding: 9px 0; border-bottom: 1px dashed var(--border); min-width: 0; }
.dl dt { font-size: 12px; color: var(--text-3); font-weight: 600; }
.dl dd { margin: 0; font-weight: 550; overflow-wrap: anywhere; }
.dl.compact { padding: 0; grid-template-columns: 1fr; }
.dl.compact > div { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; }
.dl.compact dd { text-align: right; font-size: 13.5px; }

/* ------------------------------------------------------------ formularze */

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.form-grid > .wide, .form-grid > .hint { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field.wide { grid-column: 1 / -1; }
.field > label, .field > span { font-size: 13px; font-weight: 600; color: var(--text-2); }
input[type=text], input[type=email], input[type=tel], input[type=url], input[type=search], input[type=password], input[type=date], input[type=time], input[type=number], input:not([type]), select, textarea {
    width: 100%; height: 40px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--border-2); background: var(--surface);
    color: var(--text); font-size: 15px; outline: none; transition: border-color .15s, box-shadow .15s; min-width: 0;
}
textarea { height: auto; padding: 10px 12px; resize: vertical; line-height: 1.45; }
select { appearance: none; padding-right: 32px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238592a6' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; background-size: 16px; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input[readonly] { background: var(--surface-2); color: var(--text-2); }
input[type=date], input[type=time] { min-height: 40px; }
input::placeholder, textarea::placeholder { color: var(--text-3); }
.with-suffix { position: relative; display: flex; align-items: center; }
.with-suffix input { padding-right: 46px; }
.suffix { position: absolute; right: 12px; font-size: 13px; color: var(--text-3); pointer-events: none; }
.hint { font-size: 12.5px; color: var(--text-3); line-height: 1.4; }
.check { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; font-size: 14px; user-select: none; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); margin: 0; flex: none; }
.check.wide { grid-column: 1 / -1; }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px 16px; }
.checks.inline { display: flex; flex-wrap: wrap; gap: 8px; }
.pill-check { padding: 0; }
.pill-check input { position: absolute; opacity: 0; pointer-events: none; }
.pill-check span { display: inline-flex; align-items: center; height: 34px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--border-2); font-size: 13.5px; font-weight: 600; color: var(--text-2); }
.pill-check input:checked + span { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.pill-check input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.row-tools { display: flex; gap: 8px; align-items: center; margin-top: 6px; flex-wrap: wrap; }
.form-actions { display: flex; align-items: center; justify-content: flex-end; gap: 12px; }
.form-actions .form-msg { flex: 1; text-align: left; }
.form-msg { color: var(--bad); font-size: 13.5px; font-weight: 600; min-height: 0; }
.form-msg:empty { display: none; }
.inline { display: flex; gap: 8px; align-items: center; }
.inline input, .inline select { flex: 1; }
.user-cell { display: inline-flex; align-items: center; gap: 10px; }
ul.plain { margin: 6px 0 0; padding-left: 18px; display: grid; gap: 5px; font-size: 14px; }

/* wybór rodzaju wpisu */

/* ------------------------------------------------------------ okna i powiadomienia */

dialog.modal {
    width: min(560px, calc(100vw - 24px)); max-height: calc(100dvh - 40px); padding: 0; border: 1px solid var(--border); border-radius: 18px;
    background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); overflow: hidden;
}
dialog.modal.wide { width: min(780px, calc(100vw - 24px)); }
dialog.modal[open] { animation: pop .18s ease-out; }
dialog.modal::backdrop { background: rgba(8, 13, 25, .55); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.985); } }
dialog.modal form { display: flex; flex-direction: column; max-height: calc(100dvh - 40px); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 16px 14px 22px; border-bottom: 1px solid var(--border); }
.modal-head h2 { font-size: 17px; }
.modal-body { padding: 20px 22px; overflow-y: auto; }
dialog.modal > form > .form-msg { padding: 0 22px 10px; }
.modal-foot { display: flex; gap: 10px; align-items: center; padding: 14px 22px; border-top: 1px solid var(--border); background: var(--surface-2); flex-wrap: wrap; }
.modal-body .hint { margin-top: 12px; display: block; }
.confirm-text { font-size: 15px; color: var(--text-2); }

.toasts { position: fixed; z-index: 100; right: 20px; bottom: 20px; display: grid; gap: 8px; pointer-events: none; }
.toast {
    display: flex; gap: 10px; align-items: center; min-width: 240px; max-width: 420px; padding: 12px 16px; border-radius: 12px;
    background: #0f172a; color: #f1f5f9; box-shadow: var(--shadow-lg); font-size: 14px; font-weight: 550; animation: pop .2s ease-out; transition: opacity .4s, transform .4s;
}
.toast .i { color: #4ade80; }
.toast.error .i { color: #f87171; }
.toast.out { opacity: 0; transform: translateY(6px); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .toast { background: #26324d; border: 1px solid #36456a; } }
:root[data-theme="dark"] .toast { background: #26324d; border: 1px solid #36456a; }


/* ------------------------------------------------------------ logowanie */

.login-page { min-height: 100vh; min-height: 100dvh; background: var(--bg); }
.login { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(380px, 520px); }
.login-art {
    background:
        radial-gradient(80% 60% at 20% 100%, rgba(45, 212, 191, .22), transparent 60%),
        radial-gradient(70% 60% at 90% 10%, rgba(93, 141, 255, .35), transparent 60%),
        linear-gradient(160deg, #0f1a33, #080d19);
    color: #dbe4f3; display: flex; align-items: center; justify-content: center; padding: 60px;
}
.login-art-in { max-width: 460px; }
.login-art img { border-radius: 14px; box-shadow: 0 12px 30px rgba(0, 0, 0, .35); }
.login-art h2 { color: #fff; font-size: 30px; font-weight: 700; letter-spacing: -.02em; margin: 26px 0 20px; line-height: 1.2; }
.login-art ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.login-art li { display: flex; gap: 12px; align-items: center; font-size: 15.5px; }
.login-art li::before { content: ""; width: 20px; height: 20px; flex: none; border-radius: 50%; background: rgba(93, 141, 255, .25) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a8c2ff' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E") center / 12px no-repeat; }
.login-card { align-self: center; justify-self: center; width: 100%; max-width: 400px; padding: 40px 32px; display: flex; flex-direction: column; gap: 14px; }
.login-mark { border-radius: 16px; box-shadow: var(--shadow); }
.login-card h1 { font-size: 30px; margin-top: 6px; }
.login-lead { color: var(--text-2); margin-top: -8px; margin-bottom: 8px; }
.login-card .field span { font-size: 13px; font-weight: 600; color: var(--text-2); }
.login-card input { height: 46px; }
.login-note { font-size: 13px; color: var(--text-3); text-align: center; }
.login-ver { font-size: 12px; color: var(--text-3); text-align: center; }
.login-noscript { text-align: center; color: var(--bad); }
.login-step { display: flex; flex-direction: column; gap: 14px; }
.login-step[hidden] { display: none; }
.login-2fa { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; border-radius: 12px; background: var(--accent-soft); font-size: 14px; color: var(--text-2); }
.login-2fa b { color: var(--text); font-size: 15px; }
.login-card #login-code { font-size: 22px; letter-spacing: .18em; text-align: center; font-variant-numeric: tabular-nums; }
.login-alt { display: flex; justify-content: space-between; gap: 12px; }
.login-alt .link-btn { font-size: 13.5px; }

/* ------------------------------------------------------------ układ responsywny */

@media (max-width: 1200px) {
    .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 1024px) {
    .shell { grid-template-columns: minmax(0, 1fr); }
    .sidebar {
        position: fixed; inset: 0 auto 0 0; width: min(300px, 86vw); z-index: 50; transform: translateX(-102%);
        transition: transform .25s ease; box-shadow: var(--shadow-lg);
    }
    .sb-brand .sb-close { display: inline-grid; }
    body.nav-open .sidebar { transform: none; }
    body.nav-open .scrim { display: block; position: fixed; inset: 0; z-index: 40; background: rgba(8, 13, 25, .5); }
    body.nav-open { overflow: hidden; }
    .topbar {
        display: flex; align-items: center; gap: 8px; position: sticky; top: 0; z-index: 30; height: 56px; padding: 0 10px;
        padding-top: env(safe-area-inset-top); height: calc(56px + env(safe-area-inset-top));
        background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: saturate(160%) blur(12px); -webkit-backdrop-filter: saturate(160%) blur(12px);
        border-bottom: 1px solid var(--border);
    }
    .topbar-brand { display: flex; align-items: center; gap: 9px; color: var(--text); font-size: 16px; text-decoration: none !important; }
    .topbar-brand img { border-radius: 7px; }
    .page { padding: 22px 20px 50px; }
    .two-col, .settings-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 760px) {
    body { font-size: 15px; }
    h1 { font-size: 24px; }
    .page { padding: 18px 16px 44px; }
    .page-head { margin-bottom: 18px; }
    .page-head .actions { width: 100%; }
    .page-head .actions .btn { flex: 1; }
    .tiles, .tiles.three, .tiles.two { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .tile { padding: 13px 14px; }
    .tile b { font-size: 19px; }
    .tile-ic { width: 28px; height: 28px; top: 11px; right: 11px; }
    .tile-ic .i { width: 15px; height: 15px; }
    .tile small { padding-right: 30px; }
    .tiles.three .tile:last-child { grid-column: 1 / -1; }
    .section-head .actions { width: 100%; }
    .section-head .actions .btn { flex: 1; }
    .form-grid { grid-template-columns: minmax(0, 1fr); }
    .dl { grid-template-columns: minmax(0, 1fr); }
    dialog.modal, dialog.modal.wide { width: 100vw; max-width: 100vw; max-height: 94dvh; margin: auto 0 0; border-radius: 18px 18px 0 0; }
    dialog.modal form { max-height: 94dvh; }
    .modal-body { padding: 18px 16px; }
    .modal-head { padding: 14px 10px 12px 16px; }
    .modal-foot { padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); }
    .toasts { left: 12px; right: 12px; bottom: calc(14px + env(safe-area-inset-bottom)); }
    .toast { max-width: none; }
    .login { grid-template-columns: minmax(0, 1fr); }
    .login-art { display: none; }
    .login-card { padding: 32px 20px; }
    .table th, .table td { padding: 9px 10px; }
}


@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}


/* ------------------------------------------------------------ Safari na iPhonie */
/* iOS przybliża stronę po stuknięciu w pole z czcionką mniejszą niż 16 px — i zostaje przybliżona */
@media (max-width: 760px), (pointer: coarse) {
    input[type=text], input[type=email], input[type=tel], input[type=url], input[type=search], input[type=password], input[type=date], input[type=time], input[type=number], input:not([type]), select, textarea { font-size: 16px; }
}
/* pole daty/godziny w Safari na iOS ma własną, sztywną szerokość i wychodzi poza formularz */
@supports (-webkit-touch-callout: none) {
    input[type=date], input[type=time] { -webkit-appearance: none; appearance: none; display: block; min-width: 0; max-width: 100%; text-align: left; line-height: 38px; }
    input[type=date]::-webkit-date-and-time-value, input[type=time]::-webkit-date-and-time-value { text-align: left; margin: 0; }
}
/* schowane menu boczne rzucało cień na lewą krawędź strony — cień tylko przy otwartym menu */
@media (max-width: 1024px) {
    .sidebar { box-shadow: none; }
    body.nav-open .sidebar { box-shadow: var(--shadow-lg); }
}

/* tabele „m-cards” na telefonie (konta): zamiast kolumn — karta na wiersz z podpisami pól */
@media (max-width: 760px) {
    .table.m-cards thead { display: none; }
    .table.m-cards, .table.m-cards tbody { display: block; }
    .table.m-cards tr { display: grid; gap: 8px 14px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
    .table.m-cards tbody tr:last-child { border-bottom: 0; }
    .table.m-cards td { display: block; padding: 0; border: 0; background: none !important; text-align: left; white-space: normal; }
    .table.m-cards td.act { width: auto; align-self: start; }
    .table.m-cards td[data-label]::before { content: attr(data-label); display: block; font-size: 11px; font-weight: 650; color: var(--text-3); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 2px; }
    .table.m-cards .chip { white-space: normal; height: auto; min-height: 24px; padding: 3px 10px; }
}


/* ------------------------------------------------------------ segmenty */
.segs { display: inline-flex; gap: 2px; padding: 3px; border-radius: 11px; background: var(--surface-3); border: 1px solid var(--border); max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.segs::-webkit-scrollbar { display: none; }
.segs button { border: 0; background: transparent; height: 30px; padding: 0 12px; border-radius: 8px; font-size: 13.5px; font-weight: 600; color: var(--text-2); cursor: pointer; white-space: nowrap; }
.segs button:hover { color: var(--text); }
.segs button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

/* ------------------------------------------------------------ konto: bezpieczeństwo, 2FA */
.sec-card { margin-bottom: 20px; }
.sec-rows { display: grid; gap: 4px; }
.sec-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 10px 0; }
.sec-row + .sec-row { border-top: 1px solid var(--border); }
.sec-ic { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-3); color: var(--text-2); }
.sec-ic .i { width: 20px; height: 20px; }
.sec-ic.ok { background: var(--ok-soft); color: var(--ok); }
.sec-ic.warn { background: var(--soon-soft); color: var(--soon); }
.sec-t > b { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 15px; }
.sec-t p { margin-top: 3px; }
.sec-act { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.mfa-setup { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 22px; align-items: start; }
.mfa-qr { background: #fff; border-radius: 12px; padding: 6px; box-shadow: var(--shadow); }
.qr { display: block; width: 100%; height: auto; }
.mfa-steps .steps { margin: 0 0 14px; padding-left: 20px; display: grid; gap: 10px; font-size: 14px; color: var(--text-2); }
.mfa-steps .steps b { color: var(--text); }
.mfa-link { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; }
.mfa-link .i { width: 16px; height: 16px; }
.mfa-key { display: flex; align-items: center; gap: 6px; margin-top: 6px; max-width: 100%; }
.mfa-key code { flex: 1; min-width: 0; white-space: normal; font-size: 14px; letter-spacing: .04em; word-break: break-word; background: var(--surface-3); padding: 6px 8px; border-radius: 8px; }
.mfa-code input { font-size: 22px; letter-spacing: .18em; text-align: center; font-variant-numeric: tabular-nums; }
.rc-list { margin: 14px 0 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; counter-reset: rc; }
.rc-list li { counter-increment: rc; display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; }
.rc-list li::before { content: counter(rc) "."; color: var(--text-3); font-size: 12px; min-width: 18px; }
.rc-list code { font-size: 15px; letter-spacing: .06em; background: none; padding: 0; }
.junk-list { margin: 10px 0 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.junk-list li { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; font-size: 13.5px; }
.junk-list code { font-weight: 600; }
@media (max-width: 760px) {
    .sec-row { grid-template-columns: auto minmax(0, 1fr); align-items: start; }
    .sec-act { grid-column: 1 / -1; justify-content: flex-start; }
    .mfa-setup { grid-template-columns: minmax(0, 1fr); }
    .mfa-qr { width: 200px; justify-self: center; }
}

/* ============================================================ Finanse */

/* paleta wykresów (sprawdzona walidatorem pod kątem daltonizmu, osobno dla jasnego i ciemnego tła).
   Kolejność stała, kolor idzie za rodzajem rachunku: IKE s1, IKZE s2, OKI s3, zwykły/inne s4, PPK s5. */
:root {
    --s1: #257de0; --s2: #f47230; --s3: #00b894; --s4: #f2a600; --s5: #ee7fac;
    --grid: #e6eaf0; --axis: #8592a6; --track: #eef2f7;
    --pos: #15803d; --neg: #dc2626;
}
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --s1: #338ced; --s2: #e76624; --s3: #00a888; --s4: #d28e05; --s5: #e24d8b;
        --grid: #222d44; --axis: #6d7b95; --track: #1b2640;
        --pos: #4ade80; --neg: #f87171;
    }
}
:root[data-theme="dark"] {
    --s1: #338ced; --s2: #e76624; --s3: #00a888; --s4: #d28e05; --s5: #e24d8b;
    --grid: #222d44; --axis: #6d7b95; --track: #1b2640;
    --pos: #4ade80; --neg: #f87171;
}

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.pos { color: var(--pos); }
.neg { color: var(--neg); }
.warn-text { color: var(--soon); font-weight: 600; }
.pre { white-space: pre-wrap; }
.head-tools { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.card + p.small { margin-top: 12px; }
.card + .card, .kpis + .card, .two-col + .card, .card + .two-col, .banner + .kpis { margin-top: 20px; }
.card.narrow { max-width: 720px; }
.card-foot { display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); flex-wrap: wrap; }
.card-foot .form-msg { flex: 1; }
[inert] { opacity: .85; }

/* pasek boczny: gospodarstwo */
.sb-hh { display: flex; align-items: center; gap: 10px; margin: 0 4px 10px; padding: 8px 10px; border-radius: 10px; background: var(--sb-hover); color: var(--sb-text); font-size: 13.5px; }
.sb-hh .i { color: var(--sb-muted); }
.sb-hh b { color: #fff; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-hh select { height: 30px; border: 0; background-color: transparent; color: #fff; padding: 0 26px 0 0; font-size: 13.5px; font-weight: 600; box-shadow: none !important; }
.sb-hh select option { color: #0f172a; }
.sb-badge.count { background: rgba(255, 255, 255, .1); color: var(--sb-text); font-weight: 650; }

/* wybór roku */
.year-nav { display: inline-flex; gap: 2px; padding: 3px; border-radius: 11px; background: var(--surface-3); border: 1px solid var(--border); max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.year-nav::-webkit-scrollbar { display: none; }
.year { height: 30px; padding: 0 12px; border-radius: 8px; display: inline-grid; place-items: center; font-size: 13.5px; font-weight: 650; color: var(--text-2); text-decoration: none !important; }
.year:hover { color: var(--text); }
.year.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

/* kafelki z liczbą (KPI) — liczba najważniejsza, opis pod nią */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.kpi { display: flex; gap: 12px; align-items: flex-start; padding: 16px 18px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 0; position: relative; overflow: hidden; }
.kpi > div { display: flex; flex-direction: column; min-width: 0; }
.kpi-ic { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-3); color: var(--text-2); flex: none; }
.kpi-ic .type-chip { font-size: 10.5px; padding: 0 5px; }
.kpi-l { font-size: 12.5px; font-weight: 600; color: var(--text-3); }
.kpi-v { font-size: 24px; font-weight: 700; letter-spacing: -.02em; line-height: 1.2; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-s { font-size: 12.5px; color: var(--text-2); margin-top: 2px; }
.kpi.accent::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--ok); }
.kpi.accent .kpi-ic { background: var(--ok-soft); color: var(--ok); }
.kpi.warn::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--soon); }
.kpi.warn .kpi-ic { background: var(--soon-soft); color: var(--soon); }

.banner.deadline { background: var(--soon-soft); color: var(--soon); }
.banner + .kpis, .banner + .card { margin-top: 0; }

/* rodzaj rachunku: kolor = seria wykresu */
.type-chip { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 6px; font-size: 11.5px; font-weight: 700; letter-spacing: .02em; white-space: nowrap;
    background: color-mix(in srgb, var(--c, var(--text-3)) 16%, transparent); color: var(--text); box-shadow: inset 3px 0 0 var(--c, var(--text-3)); }
.t-ike { --c: var(--s1); } .t-ikze { --c: var(--s2); } .t-oki { --c: var(--s3); } .t-ppk { --c: var(--s5); }
.t-broker, .t-bonds, .t-deposit, .t-other { --c: var(--s4); }
.acc-cell { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none !important; min-width: 0; }
.acc-cell span { display: flex; flex-direction: column; min-width: 0; }
.acc-cell small { color: var(--text-3); font-size: 12.5px; }
.acc-cell:hover b { color: var(--accent); }
.table tr.closed td { color: var(--text-3); }
.table tr.tot td { font-weight: 700; background: var(--surface-2); border-top: 1px solid var(--border-2); }
.table small.block { font-weight: 400; font-size: 12px; }

/* limity — pasek postępu */
.limits { display: grid; gap: 4px; padding: 6px 20px 16px; }
.lim-person + .lim-person { border-top: 1px solid var(--border); }
.lim-person h3 { font-size: 14px; margin: 12px 0 6px; }
.lim-row { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 6px 0; }
.lim-v { text-align: right; font-size: 13.5px; white-space: nowrap; color: var(--text-2); }
.lim-v b { color: var(--text); }
.lim-v small { display: block; font-size: 12px; color: var(--text-3); }
.meter { display: block; height: 8px; border-radius: 4px; background: var(--track); overflow: hidden; }
.meter i { display: block; height: 100%; border-radius: 4px; background: var(--accent); }
.meter.full i { background: var(--ok); }
.meter.over i { background: var(--bad); }
.lim-mini { font-size: 12.5px; color: var(--text-2); }

/* podpowiedzi optymalizacyjne */
.advice { list-style: none; margin: 0; padding: 6px 0; }
.adv { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; gap: 12px; align-items: center; padding: 12px 20px; }
.adv + .adv { border-top: 1px solid var(--border); }
.adv-ic { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--info-soft); color: var(--info); }
.adv.ok .adv-ic { background: var(--ok-soft); color: var(--ok); }
.adv.soon .adv-ic { background: var(--soon-soft); color: var(--soon); }
.adv.bad .adv-ic { background: var(--bad-soft); color: var(--bad); }
.adv-t > b { display: block; font-size: 14.5px; }
.adv-t p { font-size: 13px; color: var(--text-2); margin-top: 2px; }
.adv-v { font-weight: 700; color: var(--ok); white-space: nowrap; }
.adv.bad .adv-v { color: var(--bad); }

/* PIT rodziny */
.pit-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: 20px; align-items: start; }
.pit-inputs, .pit-results { display: grid; gap: 20px; align-content: start; }
.pit-inputs .card + .card, .pit-results .card + .card { margin-top: 0; }
.pit-results { position: sticky; top: 20px; }
.ikze-paid { flex-direction: row !important; align-items: baseline; gap: 10px !important; flex-wrap: wrap; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); border: 1px dashed var(--border-2); }
.ikze-paid .lbl { font-size: 13px; font-weight: 600; color: var(--text-2); }
.variants { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; padding: 16px 20px 4px; }
.variant { border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; }
.variant.best { border-color: var(--ok); box-shadow: 0 0 0 1px var(--ok) inset; }
.v-t { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 13px; font-weight: 650; color: var(--text-2); }
.v-v { font-size: 22px; font-weight: 700; letter-spacing: -.02em; }
.v-s { font-size: 12.5px; color: var(--text-2); }
.pit-table th[scope=row] { text-transform: none; letter-spacing: 0; font-size: 13.5px; font-weight: 550; color: var(--text-2); background: none; white-space: normal; }
.pit-table th[scope=row] small { text-transform: none; font-size: 11.5px; font-weight: 400; }
.pit-table tr.sub th, .pit-table tr.sub td { font-weight: 700; color: var(--text); background: var(--surface-2); }
.pit-table td.num { width: 1%; }
.ikze-eff { margin: 0; padding-left: 38px; display: grid; gap: 6px; font-size: 14px; }

/* kalkulator */
.calc-layout { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 20px; align-items: start; }
.calc-form { position: sticky; top: 20px; }
.calc-out { display: grid; gap: 20px; min-width: 0; }
.calc-out .card + .card, .calc-out .banner { margin: 0; }
.notes { margin: 0; display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 16px; font-size: 13px; border-top: 1px solid var(--border); }
.notes dt { font-weight: 700; }
.notes dd { margin: 0; color: var(--text-2); }
.lg { display: inline-flex; align-items: center; gap: 7px; }
.lg i { width: 12px; height: 12px; border-radius: 3px; flex: none; }

/* wykresy */
.chart { position: relative; min-height: 120px; }
.chart-svg { display: block; width: 100%; height: auto; overflow: visible; touch-action: pan-y; }
.chart-svg .grid line { stroke: var(--grid); stroke-width: 1; }
.chart-svg .ax { fill: var(--axis); font-size: 11.5px; }
.chart-svg .lbl { fill: var(--text-2); font-size: 12.5px; font-weight: 650; }
.chart-svg .lbl.sm { font-size: 11.5px; fill: var(--text-3); font-weight: 600; }
.chart-svg .hair { stroke: var(--axis); stroke-width: 1; stroke-dasharray: 3 3; }
.chart-svg .bar { cursor: default; }
.chart-svg .bar:hover { filter: brightness(1.08); }
.chart-tip { position: absolute; z-index: 5; pointer-events: none; min-width: 150px; padding: 9px 11px; border-radius: 10px; background: var(--surface); border: 1px solid var(--border-2); box-shadow: var(--shadow-lg); display: grid; gap: 4px; font-size: 12.5px; }
.tip-h { font-size: 12px; color: var(--text-3); font-weight: 650; }
.tip-r { display: grid; grid-template-columns: 10px auto; column-gap: 8px; align-items: center; }
.tip-r i { width: 10px; height: 10px; border-radius: 3px; grid-row: span 2; align-self: start; margin-top: 4px; }
.tip-r b { font-size: 14px; }
.tip-r small { grid-column: 2; color: var(--text-2); font-size: 12px; }
.tip-r.tot { border-top: 1px solid var(--border); padding-top: 4px; grid-template-columns: 1fr; }
.tip-r.tot small { grid-column: 1; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; color: var(--text-2); margin-top: 10px; }

/* rachunek */
.two-col.wide-left { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }
.val-list { list-style: none; margin: 0; padding: 6px 0; }
.val-list li { display: flex; align-items: center; gap: 12px; padding: 9px 20px; font-size: 14px; }
.val-list li + li { border-top: 1px solid var(--border); }
.val-list li > span:first-child { flex: 1; }
.limit-hint .i { width: 15px; height: 15px; vertical-align: -3px; }
.type-desc { margin-top: -4px; }

/* rodzina */
.avatar.child { background: linear-gradient(135deg, #f59e0b, #ec4899); }
.share-list { list-style: none; margin: 0; padding: 6px 0; }
.share-list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 20px; }
.share-list li + li { border-top: 1px solid var(--border); }
.share-list select { width: auto; height: 34px; font-size: 13.5px; }
.danger-zone { border-color: color-mix(in srgb, var(--bad) 35%, var(--border)); }
.rules { margin: 0; padding-left: 38px; display: grid; gap: 8px; font-size: 13.5px; color: var(--text-2); }
.rules b { color: var(--text); }
.settings-grid { margin-top: 20px; }
.page-head + .settings-grid, .sec-card + .settings-grid { margin-top: 0; }

@media (max-width: 1200px) {
    .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .pit-layout, .calc-layout { grid-template-columns: minmax(0, 1fr); }
    .pit-results, .calc-form { position: static; }
}
@media (max-width: 1024px) {
    .two-col.wide-left { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
    .kpis { gap: 10px; }
    .kpi { padding: 13px 14px; flex-direction: column; gap: 8px; }
    .kpi-ic { width: 30px; height: 30px; }
    .kpi-v { font-size: 19px; }
    .head-tools { width: 100%; }
    .head-tools > .btn { flex: 1; }
    .lim-row { grid-template-columns: 50px minmax(0, 1fr); }
    .lim-v { grid-column: 1 / -1; text-align: left; display: flex; gap: 8px; flex-wrap: wrap; align-items: baseline; }
    .lim-v small { display: inline; }
    .limits { padding: 4px 16px 12px; }
    .adv { grid-template-columns: auto minmax(0, 1fr); padding: 12px 16px; }
    .adv-v { grid-column: 2; }
    .adv .btn { grid-column: 2; justify-self: start; }
    .notes { grid-template-columns: minmax(0, 1fr); }
    .notes dd { margin-bottom: 6px; }
    .pit-table th, .pit-table td { padding: 8px 8px; }
    .table.m-cards tr.tot { background: var(--surface-2); }
    .table.m-cards tr { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .table.m-cards td:first-child, .table.m-cards td.act:not(:empty) { grid-column: 1 / -1; }
    .table.m-cards td.act:empty { display: none; }
    .table.m-cards td.act { justify-self: start; }
    .val-list li, .share-list li { padding: 9px 16px; }
}
