/* --- font (lokalnie: CSP nie wpuszcza zewnętrznych źródeł) --- */
@font-face {
  font-family: "Jakarta"; font-style: normal; font-weight: 200 800; font-display: swap;
  src: url("fonts/jakarta-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329,
    U+1D00-1DBF, 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: "Jakarta"; font-style: normal; font-weight: 200 800; font-display: swap;
  src: url("fonts/jakarta-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* --- motywy ---
   Jasne: szalwia (domyślny), mgla, len. Ciemne: grafit (domyślny ciemny), ametyst, glebia.
   Bez data-theme panel podąża za ustawieniem systemu. */
:root, [data-theme] {
  --radius: 20px;
  --radius-sm: 12px;
  --font: "Jakarta", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

:root, [data-theme="szalwia"] {
  --bg: #eceeec;
  --bg-glow: none;
  --shell: #f7f8f7;
  --surface: #ffffff;
  --surface-2: #f3f5f3;
  --active: #e7ede9;
  --border: #e1e6e2;
  --rule: #edf0ed;
  --border-strong: #cad2cc;
  --text: #101a14;
  --text-2: #55615a;
  --text-3: #66726b;
  --accent: #1d6a43;
  --accent-soft: #e2f1e7;
  --primary: #1a5f3b;
  --primary-hover: #134b2e;
  --on-primary: #ffffff;
  --hero-bg: radial-gradient(120% 120% at 0% 0%, #34a06a 0%, transparent 55%),
    linear-gradient(150deg, #23804f 0%, #17573a 60%, #0f3d27 100%);
  --hero-text: #ffffff;
  --hero-sub: #c5ecd5;
  --hero-chip: rgba(255, 255, 255, .16);
  --shadow: 0 1px 2px rgba(16, 26, 20, .04), 0 8px 24px -12px rgba(16, 26, 20, .10);
  --nav-active: #ffffff;
  color-scheme: light;
}

[data-theme="mgla"] {
  --bg: #e8eaf1;
  --bg-glow: none;
  --shell: #f5f6fa;
  --surface: #ffffff;
  --surface-2: #f2f4f8;
  --active: #e5e9f8;
  --border: #dfe2ec;
  --rule: #eceef4;
  --border-strong: #c7ccdc;
  --text: #141620;
  --text-2: #535a6e;
  --text-3: #646a7e;
  --accent: #2b5bdc;
  --accent-soft: #e6ecfd;
  --primary: #2b5bdc;
  --primary-hover: #2049bb;
  --on-primary: #ffffff;
  --hero-bg: radial-gradient(90% 90% at 100% 0%, #ff9c86 0%, transparent 60%),
    radial-gradient(90% 100% at 0% 100%, #f5a8d6 0%, transparent 60%),
    linear-gradient(160deg, #d8d4ff 0%, #ffe0cf 100%);
  --hero-text: #1a1530;
  --hero-sub: #4a3f66;
  --hero-chip: rgba(255, 255, 255, .55);
  --shadow: 0 1px 2px rgba(20, 22, 40, .04), 0 10px 28px -14px rgba(20, 22, 60, .14);
  --nav-active: #ffffff;
  color-scheme: light;
}

[data-theme="len"] {
  --bg: #efebe4;
  --bg-glow: none;
  --shell: #f8f5f0;
  --surface: #fffdf9;
  --surface-2: #f6f2eb;
  --active: #eee6da;
  --border: #e5ddd0;
  --rule: #eee8de;
  --border-strong: #d2c8b7;
  --text: #1f1a14;
  --text-2: #5f5548;
  --text-3: #6f6557;
  --accent: #ad4f27;
  --accent-soft: #f7e7dc;
  --signed: #2c5f8f;
  --signed-soft: #e4ecf6;
  --primary: #2a241d;
  --primary-hover: #000000;
  --on-primary: #fffdf9;
  --hero-bg: radial-gradient(110% 110% at 100% 0%, #e08a5c 0%, transparent 55%),
    linear-gradient(150deg, #c25f34 0%, #973e1f 100%);
  --hero-text: #ffffff;
  --hero-sub: #ffdcc8;
  --hero-chip: rgba(255, 255, 255, .18);
  --shadow: 0 1px 2px rgba(40, 28, 14, .05), 0 10px 26px -14px rgba(40, 28, 14, .14);
  --nav-active: #fffdf9;
  color-scheme: light;
}

/* statusy dla jasnych motywów */
:root, [data-theme="szalwia"], [data-theme="mgla"], [data-theme="len"] {
  --danger: #b42318;
  --danger-soft: #fdecea;
  --success: #1b7346;
  --success-soft: #e3f3ea;
  --warning: #8a5100;
  --warning-soft: #fcf0d9;
  --info-soft: #e8eef8;
}

[data-theme="grafit"] {
  --bg: #0e100f;
  --bg-glow: radial-gradient(60% 50% at 85% -10%, rgba(62, 207, 134, .07), transparent 70%);
  --shell: #131615;
  --surface: #171a19;
  --surface-2: #1d211f;
  --active: #232826;
  --border: #252a28;
  --rule: #1f2321;
  --border-strong: #37403b;
  --text: #eceeed;
  --text-2: #a6aeaa;
  --text-3: #8d9691;
  --accent: #52d392;
  --accent-soft: #15301f;
  --primary: #3fcf86;
  --primary-hover: #63dc9e;
  --on-primary: #05160c;
  --hero-bg: radial-gradient(120% 120% at 0% 0%, #2c9a62 0%, transparent 55%),
    linear-gradient(150deg, #1d7348 0%, #0f4a2d 60%, #0a2e1c 100%);
  --hero-text: #ffffff;
  --hero-sub: #a6e8c4;
  --hero-chip: rgba(255, 255, 255, .14);
  --nav-active: #232826;
}

[data-theme="ametyst"] {
  --bg: #0a0a0f;
  --bg-glow: radial-gradient(55% 45% at 90% -10%, rgba(140, 110, 255, .12), transparent 70%);
  --shell: #0f0f16;
  --surface: #13131b;
  --surface-2: #1a1a24;
  --active: #22212f;
  --border: #23232e;
  --rule: #1c1c26;
  --border-strong: #363645;
  --text: #ededf4;
  --text-2: #a7a7b9;
  --text-3: #8e8ea2;
  --accent: #b6a7ff;
  --accent-soft: #241f3e;
  --primary: #b9aaff;
  --primary-hover: #cdc2ff;
  --on-primary: #150f2c;
  --hero-bg: radial-gradient(130% 110% at 50% 115%, #7556e0 0%, #2d2163 45%, transparent 80%),
    linear-gradient(180deg, #17142a 0%, #1b1636 100%);
  --hero-text: #f4f1ff;
  --hero-sub: #c8bdff;
  --hero-chip: rgba(255, 255, 255, .10);
  --nav-active: #22212f;
}

[data-theme="glebia"] {
  --bg: #090f1e;
  --bg-glow: radial-gradient(60% 50% at 85% -10%, rgba(78, 168, 255, .10), transparent 70%);
  --shell: #0d1427;
  --surface: #111a2f;
  --surface-2: #16203b;
  --active: #1c2849;
  --border: #1e2946;
  --rule: #18223b;
  --border-strong: #324068;
  --text: #e8edf9;
  --text-2: #a3afcb;
  --text-3: #8995b4;
  --accent: #66b8ff;
  --accent-soft: #142a4c;
  --primary: #4fa9ff;
  --primary-hover: #77bdff;
  --on-primary: #03122a;
  --hero-bg: radial-gradient(120% 120% at 100% 0%, #3aa0ff 0%, transparent 55%),
    linear-gradient(150deg, #1d5fd4 0%, #133b8c 55%, #0d2353 100%);
  --hero-text: #ffffff;
  --hero-sub: #bcd8ff;
  --hero-chip: rgba(255, 255, 255, .14);
  --nav-active: #1c2849;
}

/* wspólne dla ciemnych motywów */
[data-theme="grafit"], [data-theme="ametyst"], [data-theme="glebia"] {
  --danger: #f38a7e;
  --danger-soft: #3a1d1b;
  --success: #6fd29b;
  --success-soft: #15301f;
  --warning: #f1b65c;
  --warning-soft: #352713;
  --info-soft: #1b2333;
  --shadow: inset 0 1px 0 rgba(255, 255, 255, .03);
  color-scheme: dark;
}

/* Bez wybranego motywu: ciemny system = Grafit */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg: #0e100f;
    --bg-glow: radial-gradient(60% 50% at 85% -10%, rgba(62, 207, 134, .07), transparent 70%);
    --shell: #131615;
    --surface: #171a19;
    --surface-2: #1d211f;
    --active: #232826;
    --border: #252a28;
    --rule: #1f2321;
    --border-strong: #37403b;
    --text: #eceeed;
    --text-2: #a6aeaa;
    --text-3: #8d9691;
    --accent: #52d392;
    --accent-soft: #15301f;
    --primary: #3fcf86;
    --primary-hover: #63dc9e;
    --on-primary: #05160c;
    --hero-bg: radial-gradient(120% 120% at 0% 0%, #2c9a62 0%, transparent 55%),
      linear-gradient(150deg, #1d7348 0%, #0f4a2d 60%, #0a2e1c 100%);
    --hero-text: #ffffff;
    --hero-sub: #a6e8c4;
    --hero-chip: rgba(255, 255, 255, .14);
    --nav-active: #232826;
    --danger: #f38a7e;
    --danger-soft: #3a1d1b;
    --success: #6fd29b;
    --success-soft: #15301f;
    --warning: #f1b65c;
    --warning-soft: #352713;
    --info-soft: #1b2333;
    --shadow: inset 0 1px 0 rgba(255, 255, 255, .03);
    color-scheme: dark;
  }
}

/* --- podstawy --- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg-glow), var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font: 15px/1.55 var(--font);
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
  touch-action: manipulation;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
h1, h2, h3 { margin: 0; line-height: 1.2; text-wrap: balance; letter-spacing: -.015em; }
h1 { font-size: 1.85rem; font-weight: 700; letter-spacing: -.025em; }
h2 { font-size: 1.05rem; font-weight: 650; }
h3 { font-size: .95rem; font-weight: 650; }
.muted { color: var(--text-2); }
.small { font-size: .85rem; }
.nowrap { white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; text-align: end; white-space: nowrap; }
/* taste-skill-ignore: numery ksiąg wieczystych i rachunków czyta się znak po znaku */
.mono { font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; }
svg.icon { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round; }
.skip-link { position: absolute; inset-inline-start: 16px; top: -48px; z-index: 10; padding: 8px 14px;
  border-radius: 999px; background: var(--primary); color: var(--on-primary); }
.skip-link:focus { top: 12px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; }

/* --- układ aplikacji --- */
.app { display: grid; grid-template-columns: 252px minmax(0, 1fr); gap: 12px; min-height: 100dvh; padding: 12px; }
.sidebar {
  background: var(--shell); border: 1px solid var(--border); border-radius: 24px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; padding: 20px 14px 14px; position: sticky; top: 12px;
  height: calc(100dvh - 24px); overflow-y: auto; scrollbar-width: thin;
}
.sidebar-top { display: flex; align-items: center; justify-content: space-between; }
.sidebar-body { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.brand { display: flex; align-items: center; gap: 10px; padding: 2px 10px 22px; color: var(--text);
  font-weight: 700; font-size: 1.1rem; letter-spacing: -.02em; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 30px; height: 30px; flex: none; color: var(--accent); }
.sidebar .nav-toggle { display: none; }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav-label { font-size: .72rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
  color: var(--text-3); padding: 18px 12px 8px; }
.nav a, .nav form button {
  position: relative; display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--radius-sm);
  color: var(--text-2); font: inherit; font-weight: 500; background: none; border: 0; cursor: pointer; text-align: start;
  width: 100%; transition: background-color .15s, color .15s;
}
.nav a:hover, .nav form button:hover { background: var(--active); color: var(--text); text-decoration: none; }
.nav a.active { background: var(--nav-active); color: var(--text); font-weight: 650; box-shadow: var(--shadow); }
.nav a.active svg.icon { color: var(--accent); }
.nav a.active::before {
  content: ""; position: absolute; inset-inline-start: -14px; top: 9px; bottom: 9px; width: 4px;
  border-start-end-radius: 4px; border-end-end-radius: 4px; background: var(--accent);
}
.sidebar-footer { margin-top: auto; padding-top: 16px; gap: 4px; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 10px; margin-bottom: 4px;
  border-radius: var(--radius-sm); background: var(--surface-2); font-size: .8rem; color: var(--text-2); min-width: 0; }
.user-chip .avatar { width: 34px; height: 34px; flex: none; border-radius: 50%; display: grid; place-items: center;
  background: var(--hero-bg); color: var(--hero-text); font-weight: 700; font-size: .9rem; }
.user-chip .who { min-width: 0; overflow-wrap: anywhere; line-height: 1.35; }
.user-chip strong { display: block; color: var(--text); font-weight: 650; font-size: .88rem; }
.main { min-width: 0; padding: 24px 28px 48px; width: 100%; max-width: 1480px; margin-inline: auto; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 26px;
  flex-wrap: wrap; }
.page-head .sub { color: var(--text-2); margin-top: 6px; }
.page-head h1 .badge { vertical-align: middle; margin-inline-start: 6px; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.breadcrumb { font-size: .85rem; color: var(--text-2); margin-bottom: 8px; }
.breadcrumb a { color: var(--text-2); }

/* wybór motywu */
.theme-pick { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px 4px; }
.theme-pick .label { font-size: .72rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); }
.swatches { display: flex; gap: 6px; }
.swatch { width: 20px; height: 20px; padding: 0; border-radius: 50%; border: 0; cursor: pointer;
  box-shadow: inset 0 0 0 1px var(--border-strong); transition: transform .15s; }
.swatch:hover { transform: scale(1.12); }
.swatch[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--shell), 0 0 0 4px var(--accent); }
.sw-szalwia { background: linear-gradient(135deg, #eceeec 50%, #1d6a43 50%); }
.sw-mgla { background: linear-gradient(135deg, #e8eaf1 50%, #2b5bdc 50%); }
.sw-len { background: linear-gradient(135deg, #efebe4 50%, #ad4f27 50%); }
.sw-grafit { background: linear-gradient(135deg, #171a19 50%, #3fcf86 50%); }
.sw-ametyst { background: linear-gradient(135deg, #13131b 50%, #b9aaff 50%); }
.sw-glebia { background: linear-gradient(135deg, #111a2f 50%, #4fa9ff 50%); }

@media (max-width: 860px) {
  .app { grid-template-columns: minmax(0, 1fr); align-content: start; padding: 0; gap: 0; }
  .sidebar { position: sticky; top: 0; z-index: 5; height: auto; padding: 0 16px; border: 0;
    border-bottom: 1px solid var(--border); border-radius: 0; }
  .sidebar-top { height: 58px; }
  .brand { padding: 0; }
  .sidebar .nav-toggle { display: inline-flex; }
  .sidebar-body { display: none; padding: 4px 0 14px; }
  .sidebar.is-open .sidebar-body { display: flex; }
  .nav a.active::before { display: none; }
  .nav a, .nav form button { min-height: 44px; }
  .swatch { width: 28px; height: 28px; }
  .main { padding: 22px 16px 40px; }
  h1 { font-size: 1.55rem; }
}

/* --- elementy --- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 18px 22px 10px; }
.card-head h2 { font-size: 1.05rem; }
.card-body { padding: 18px 22px 22px; }
.card-head + .card-body { padding-top: 8px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.page-body { display: flex; flex-direction: column; gap: 16px; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.grid-halves { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
@media (max-width: 1100px) { .grid-2, .grid-halves { grid-template-columns: minmax(0, 1fr); } }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 8px 18px; min-height: 40px; border-radius: 999px; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); font: inherit; font-weight: 600; cursor: pointer;
  text-decoration: none; line-height: 1.3; white-space: nowrap;
  transition: background-color .15s, border-color .15s, transform .15s, box-shadow .15s;
}
.btn:hover { background: var(--surface-2); border-color: var(--text-3); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .6; cursor: progress; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary);
  box-shadow: 0 6px 16px -8px var(--primary); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-primary svg.icon { width: 16px; height: 16px; stroke-width: 2.2; }
.btn-danger { color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); border-color: var(--danger); }
.btn-sm { padding: 5px 12px; min-height: 32px; font-size: .85rem; gap: 6px; }
.btn-block { width: 100%; }
.btn-link { border: 0; background: none; color: var(--accent); padding: 0; cursor: pointer; font: inherit; font-weight: 550; }
.btn-link.danger { color: var(--danger); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { .btn, .swatch, .nav a, .kpi { transition: none; } }

.badge { display: inline-flex; align-items: center; gap: 6px; flex: none; padding: 3px 10px; border-radius: 999px;
  font-size: .76rem; font-weight: 600; letter-spacing: 0; white-space: nowrap; background: var(--surface-2);
  color: var(--text-2); border: 1px solid var(--border); }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-do_podpisu { background: var(--warning-soft); color: var(--warning); border-color: transparent; }
.badge-podpisana { background: var(--signed-soft, var(--accent-soft)); color: var(--signed, var(--accent)); border-color: transparent; }
.badge-zrealizowana { background: var(--success-soft); color: var(--success); border-color: transparent; }
.badge-anulowana { background: var(--danger-soft); color: var(--danger); border-color: transparent; }

.flash { padding: 12px 16px; border-radius: 14px; margin-bottom: 18px; border-inline-start: 4px solid currentColor;
  font-weight: 500; }
.flash-success { background: var(--success-soft); color: var(--success); }
.flash-error { background: var(--danger-soft); color: var(--danger); }
.flash-warning { background: var(--warning-soft); color: var(--warning); }
.flash-info { background: var(--info-soft); color: var(--text); border-inline-start-color: var(--accent); }

/* --- tabele --- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 14px 16px; text-align: start; border-bottom: 1px solid var(--rule); vertical-align: top; }
.table th:first-child, .table td:first-child { padding-inline-start: 22px; }
.table th:last-child, .table td:last-child { padding-inline-end: 22px; }
.table th { font-size: .72rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3);
  background: var(--surface-2); border-bottom: 0; padding-top: 10px; padding-bottom: 10px; white-space: nowrap; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background-color .12s; }
.table tbody tr:hover { background: var(--surface-2); }
.table .num { text-align: end; }
.table .sub { display: block; font-size: .82rem; color: var(--text-2); margin-top: 2px; }
.table td.cell-price { font-weight: 650; }
.row-link { color: var(--text); font-weight: 650; }
.col-place { min-width: 220px; }

/* Poniżej 640 px wiersz tabeli to dwie linie: numer i cena, pod nimi reszta pól */
@media (max-width: 640px) {
  .table-stack thead { display: none; }
  .table-stack tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px;
    padding: 14px 18px; border-bottom: 1px solid var(--rule); }
  .table-stack tr:last-child { border-bottom: 0; }
  .table-stack td, .table-stack td:first-child, .table-stack td:last-child { display: block; padding: 0; border: 0; min-width: 0; }
  .table-stack td.cell-id { grid-column: 1; grid-row: 1; }
  .table-stack td.cell-price { grid-column: 2; grid-row: 1; }
  .table-stack td:not(.cell-id):not(.cell-price) { text-align: start; grid-column: 1 / -1; font-size: .87rem; color: var(--text-2); }
}

.filters { display: flex; gap: 10px; flex-wrap: wrap; padding: 16px 22px; }
.filters input[type=search] { flex: 1 1 260px; }
.filters select { flex: 0 1 220px; }
.tabs { display: flex; gap: 4px; width: fit-content; max-width: 100%; margin-bottom: 16px; padding: 4px;
  overflow-x: auto; scrollbar-width: none; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 999px; }
.tabs a { display: inline-flex; align-items: center; padding: 7px 14px; border-radius: 999px; color: var(--text-2);
  font-size: .88rem; font-weight: 550; white-space: nowrap; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.active { background: var(--surface); color: var(--text); font-weight: 650; box-shadow: 0 1px 3px rgba(0, 0, 0, .08); }
.tabs .count { margin-inline-start: 8px; padding: 0 7px; border-radius: 999px; font-size: .75rem;
  background: var(--active); color: var(--text-2); }
.tabs a.active .count { background: var(--accent-soft); color: var(--accent); }
.pagination { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 22px;
  border-top: 1px solid var(--rule); font-size: .9rem; color: var(--text-2); flex-wrap: wrap; }
.empty { padding: 56px 22px; text-align: center; color: var(--text-2); }
.empty h3 { color: var(--text); margin-bottom: 6px; font-size: 1.05rem; }

/* --- formularze --- */
label { display: block; font-weight: 600; font-size: .85rem; margin-bottom: 6px; }
input[type=text], input[type=email], input[type=password], input[type=search], input[type=date],
input[type=number], input[type=tel], select, textarea {
  width: 100%; padding: 9px 14px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); font: inherit; min-height: 42px;
  transition: border-color .15s, box-shadow .15s;
}
input[type=search] { border-radius: 999px; padding-inline-start: 18px; background: var(--surface-2); border-color: var(--border); }
select { border-radius: 999px; padding-inline: 16px; }
textarea { min-height: 88px; resize: vertical; }
input::placeholder, textarea::placeholder { color: var(--text-3); opacity: 1; }
input:hover, select:hover, textarea:hover { border-color: var(--text-3); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft); background: var(--surface); }
.field { min-width: 0; }
.field .hint { font-size: .8rem; color: var(--text-3); margin-top: 5px; }
.field .error-msg { font-size: .8rem; color: var(--danger); margin-top: 5px; font-weight: 550; }
.field.has-error input, .field.has-error select, .field.has-error textarea { border-color: var(--danger); }
.form-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px; }
.col-12 { grid-column: span 12; } .col-8 { grid-column: span 8; } .col-6 { grid-column: span 6; }
.col-5 { grid-column: span 5; } .col-4 { grid-column: span 4; } .col-3 { grid-column: span 3; }
.col-2 { grid-column: span 2; }
/* Tablet: dwie kolumny pól; telefon: jedna */
@media (max-width: 1100px) {
  .col-8 { grid-column: span 12; }
  .col-5, .col-4, .col-3, .col-2 { grid-column: span 6; }
}
@media (max-width: 600px) {
  .col-6, .col-5, .col-4, .col-3, .col-2 { grid-column: span 12; }
}
.form-section + .form-section { margin-top: 16px; }
.form-footer { display: flex; justify-content: flex-end; gap: 12px; margin-top: 22px; flex-wrap: wrap; }
.input-suffix { position: relative; }
.input-suffix input { padding-inline-end: 44px; }
.input-suffix span { position: absolute; inset-inline-end: 14px; top: 50%; transform: translateY(-50%); color: var(--text-3);
  pointer-events: none; }
.radio-cards { display: flex; gap: 12px; flex-wrap: wrap; }
.radio-cards label { flex: 1 1 220px; display: flex; gap: 12px; align-items: flex-start; font-weight: 400;
  border: 1px solid var(--border); border-radius: 16px; padding: 14px 16px; cursor: pointer; margin: 0;
  background: var(--surface); transition: border-color .15s, background-color .15s; }
.radio-cards label:hover { border-color: var(--border-strong); }
.radio-cards label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft);
  box-shadow: 0 0 0 1px var(--accent); }
.radio-cards input { accent-color: var(--accent); margin-top: 3px; }
.radio-cards strong { display: block; }
.file-pick { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.file-pick input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; }
.file-pick input[type=file]:focus-visible + label { outline: 2px solid var(--accent); outline-offset: 2px; }
.file-pick label { margin: 0; font-weight: 600; }
.file-name { font-size: .85rem; color: var(--text-2); overflow-wrap: anywhere; }

.party { border: 1px solid var(--border); border-radius: 16px; padding: 16px; background: var(--surface-2); }
.party + .party { margin-top: 12px; }
.party-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.party-list-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin: 22px 0 12px;
  flex-wrap: wrap; }
.party-list-head:first-child { margin-top: 0; }
.party label input { font-weight: 400; margin-top: 6px; }

/* --- pulpit --- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; }
.kpi {
  position: relative; display: flex; flex-direction: column; justify-content: space-between; gap: 18px; min-height: 148px;
  padding: 20px 22px; color: inherit; min-width: 0; container-type: inline-size;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
  transition: transform .18s, border-color .18s;
}
a.kpi:hover { text-decoration: none; border-color: var(--border-strong); transform: translateY(-2px); }
.kpi .label { color: var(--text-2); font-size: .9rem; font-weight: 600; padding-inline-end: 40px; }
.kpi .value { font-size: 2.6rem; font-weight: 650; line-height: 1; letter-spacing: -.035em;
  font-variant-numeric: tabular-nums; }
.kpi .value.money { font-size: min(1.85rem, 10.5cqi); letter-spacing: -.025em; white-space: nowrap; }
.kpi-arrow { position: absolute; top: 16px; inset-inline-end: 16px; width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center; border: 1px solid var(--border-strong); color: var(--text);
  transition: background-color .18s, color .18s, border-color .18s; }
.kpi-arrow svg.icon { width: 16px; height: 16px; }
a.kpi:hover .kpi-arrow { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.kpi-hero { background: var(--hero-bg); border-color: transparent; color: var(--hero-text); }
.kpi-hero .label { color: var(--hero-sub); }
.kpi-hero .kpi-note { display: inline-flex; align-self: flex-start; padding: 3px 10px; border-radius: 999px;
  background: var(--hero-chip); color: var(--hero-text); font-size: .78rem; font-weight: 600; }
.kpi-hero .value.money { font-size: min(2.2rem, 11.5cqi); }
@media (min-width: 1200px) { .kpis { grid-template-columns: minmax(0, 1.7fr) repeat(4, minmax(0, 1fr)); } }
@media (max-width: 600px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .kpi { min-height: 120px; padding: 16px; }
  .kpi .value { font-size: 2rem; }
  .kpi-arrow { top: 12px; inset-inline-end: 12px; width: 30px; height: 30px; }
  .kpi-hero, .kpi:last-child:nth-child(even) { grid-column: 1 / -1; }
}
.list { list-style: none; margin: 0; padding: 4px 0 8px; }
.list li { display: flex; justify-content: space-between; gap: 16px; padding: 12px 22px; position: relative; }
.list li + li::before { content: ""; position: absolute; top: 0; inset-inline: 22px; border-top: 1px solid var(--rule); }
.list li > div:first-child { min-width: 0; }
.list .main-line { font-weight: 650; color: var(--text); }
.list .side { text-align: end; flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.due-late { color: var(--danger); font-weight: 650; }
.card-foot { padding: 12px 22px; border-top: 1px solid var(--rule); font-size: .88rem; }
.card-head > a.small { font-weight: 600; }

/* --- szczegóły --- */
dl.props { display: grid; grid-template-columns: minmax(150px, max-content) minmax(0, 1fr); gap: 10px 24px; margin: 0; }
dl.props dt { color: var(--text-2); }
dl.props dd { margin: 0; min-width: 0; overflow-wrap: anywhere; font-weight: 550; }
@media (max-width: 560px) { dl.props { grid-template-columns: minmax(0, 1fr); gap: 2px; } dl.props dd { margin-bottom: 10px; } }
.parties-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.party-card { border: 1px solid var(--border); border-radius: 16px; padding: 14px 16px; background: var(--surface-2); }
.party-card .role { font-size: .72rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); }
.party-card .name { font-weight: 650; margin: 4px 0 8px; }
.party-card .meta { font-size: .87rem; color: var(--text-2); overflow-wrap: anywhere; }
.timeline { list-style: none; margin: 0; padding: 4px 0 10px; }
.timeline li { position: relative; padding: 10px 22px 10px 44px; font-size: .9rem; }
.timeline li::before { content: ""; position: absolute; inset-inline-start: 24px; top: 17px; width: 8px; height: 8px;
  border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.timeline li::after { content: ""; position: absolute; inset-inline-start: 27px; top: 29px; bottom: -7px; width: 2px;
  background: var(--rule); }
.timeline li:last-child::after { display: none; }
.timeline .when { color: var(--text-3); font-size: .8rem; }
.timeline .note { background: var(--surface-2); border-radius: 10px; padding: 8px 12px; margin-top: 6px; }
.files li { align-items: center; }
.status-actions { display: flex; flex-direction: column; gap: 8px; }

/* --- wygląd (strona konta) --- */
.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.theme-card { display: block; width: 100%; padding: 0; border: 1px solid var(--border); border-radius: 16px;
  background: var(--surface); color: var(--text); font: inherit; cursor: pointer; text-align: start; overflow: hidden;
  transition: border-color .15s, box-shadow .15s; }
.theme-card:hover { border-color: var(--border-strong); }
.theme-card[aria-pressed="true"] { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.theme-card .preview { display: grid; grid-template-columns: 26% 1fr; gap: 6px; height: 92px; padding: 8px;
  background: var(--bg-glow), var(--bg); }
.theme-card .p-side { border-radius: 8px; background: var(--shell); border: 1px solid var(--border); }
.theme-card .p-main { display: grid; grid-template-rows: 1fr 1fr; grid-template-columns: 1fr 1fr; gap: 6px; }
.theme-card .p-hero { grid-row: span 2; border-radius: 8px; background: var(--hero-bg); }
.theme-card .p-card { border-radius: 8px; background: var(--surface); border: 1px solid var(--border); }
.theme-card .p-card.alt { background: var(--primary); border-color: transparent; }
.theme-card .name { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 12px;
  font-weight: 650; font-size: .88rem; }
.theme-card .name small { color: var(--text-3); font-weight: 500; }
.theme-auto { margin-top: 14px; }

/* --- logowanie --- */
.auth-wrap { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.auth-card { width: 100%; max-width: 420px; border-radius: 28px; }
.auth-card .card-body { padding: 32px; }
.auth-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 26px; font-weight: 700; font-size: 1.1rem; }
.auth-card h1 { font-size: 1.45rem; margin-bottom: 6px; }
.auth-card p.lead { color: var(--text-2); margin: 0 0 22px; }
.auth-card .field + .field { margin-top: 16px; }
.auth-card .btn-block { margin-top: 22px; min-height: 46px; }
.code-input { font-size: 1.4rem !important; letter-spacing: .3em; text-align: center; font-variant-numeric: tabular-nums; }
.qr { background: #fff; border-radius: 16px; padding: 12px; width: 200px; margin: 0 auto 14px; }
.qr svg { display: block; width: 100%; height: auto; }
.secret { text-align: center; font-size: .95rem; background: var(--surface-2); border: 1px dashed var(--border-strong);
  border-radius: 12px; padding: 10px; word-break: break-all; }
.steps { padding-inline-start: 20px; margin: 0 0 18px; color: var(--text-2); }
.steps li + li { margin-top: 4px; }
.codes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 16px 0; }
.codes code { display: block; text-align: center; padding: 8px; border-radius: 10px; background: var(--surface-2);
  border: 1px solid var(--border); font-size: 1rem; }
.auth-foot { text-align: center; margin-top: 16px; font-size: .88rem; }
details summary { cursor: pointer; color: var(--accent); font-weight: 550; }

/* --- odstępy (CSP blokuje atrybuty style=) --- */
.mt-0 { margin-top: 0; } .mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; }
.mb-0 { margin-bottom: 0; }
[hidden] { display: none !important; }

/* --- baza: sprzedawcy, inwestycje --- */
.form-narrow { max-width: 860px; }
.entity-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 360px), 1fr)); gap: 16px;
  align-items: start; }
.entity { display: flex; flex-direction: column; }
.entity.is-default { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), var(--shadow); }
.entity.is-archived { opacity: .7; }
.entity-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; padding: 14px 22px;
  border-top: 1px solid var(--rule); }
.entity-actions form { margin: 0; }
dl.props.compact { grid-template-columns: minmax(110px, max-content) minmax(0, 1fr); gap: 6px 16px; margin-bottom: 14px; }
.row-actions { white-space: nowrap; text-align: end; }
.row-actions form { display: inline; margin-inline-start: 12px; }
.seller-preview { display: flex; flex-direction: column; gap: 2px; height: 100%; justify-content: center;
  padding: 10px 14px; border-radius: var(--radius-sm); background: var(--surface-2); font-size: .85rem; color: var(--text-2); }
@media (max-width: 640px) {
  .table-stack td.row-actions { text-align: start; }
  .row-actions form { margin-inline: 0 16px; }
}
.row-actions > a { font-weight: 550; }
@media (max-width: 640px) { .row-actions > a { margin-inline-end: 16px; } }
