/* ============================================================================
   Platforma Spółdzielni Energetycznych 2.0 — Design System
   Styl zaczerpnięty z AstroStore: font Inter, większe czcionki, wysoka czytelność,
   aubergine (#68296A) z gradientem, duże zaokrąglenia, miękkie cienie. Zero emoji.
   ============================================================================ */

:root {
  /* Marka — aubergine z gradientem (AstroStore) */
  --primary: #68296a;
  --primary-hover: #7a3380;
  --primary-400: #9b4dca;
  --primary-soft: #d9b8e4;
  --primary-bg: #f5f0f8;
  --grad-brand: linear-gradient(135deg, #68296a 0%, #9b4dca 100%);
  /* Powierzchnie */
  --bg: #faf8fc;
  --surface: #ffffff;
  --sidebar-bg: #ffffff;
  --sidebar-hover: #f5f0f8;
  --sidebar-active: #efe4f4;
  --border: #ece8f0;
  --border-soft: #f3eff7;
  --border-strong: #ddd5e4;
  /* Teksty — ciemne, kontrastowe */
  --text: #1a1320;
  --text-muted: #574d60;
  --text-soft: #8a8194;
  /* Statusy (AstroStore) */
  --danger: #c0392b;  --danger-bg: #fdecea;
  --success: #1f9d63; --success-bg: #e7f7ee;
  --warning: #b8860b; --warning-bg: #fdf6e3;
  --info: #2f6fb0;    --info-bg: #eaf2fb;
  /* Kształt */
  --shadow-sm: 0 4px 18px -10px rgba(56, 20, 60, .22);
  --shadow: 0 10px 40px -16px rgba(56, 20, 60, .25);
  --shadow-lg: 0 24px 60px -20px rgba(56, 20, 60, .32);
  --radius: 18px;
  --radius-sm: 12px;
  --radius-lg: 28px;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --sidebar-w: 268px;
  --page-bg: none;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 15.5px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: var(--primary-400); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { color: var(--text); font-weight: 700; line-height: 1.25; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: 28px; }
h2 { font-size: 21px; }
h3 { font-size: 17px; }

/* --- Górny pasek: logo (szerokość sidebara) + zakładki workspace do prawej --- */
.topbar {
  height: 64px; display: flex; align-items: stretch;
  background: var(--sidebar-bg);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 50;
}
.topbar-brand {
  width: var(--sidebar-w); flex: 0 0 var(--sidebar-w);
  display: flex; align-items: center; padding: 0 20px;
  border-right: 1px solid var(--border);
}
.topbar-brand img { width: 100%; max-width: 200px; height: auto; display: block; }
.topbar-brand:hover { text-decoration: none; }
/* Prawa strona paska: System → przełącznik obszarów → użytkownik, w jednym ciągu.
   margin-left:auto trzyma tylko pierwszy blok — reszta układa się tuż obok niego. */
.topbar-sys { display: flex; align-items: center; gap: 4px; margin-left: auto; padding-right: 4px; }
.topbar-sys a { display: flex; align-items: center; gap: 7px; padding: 8px 12px; border-radius: 10px;
  color: var(--text-muted); font-size: 13px; font-weight: 600; text-decoration: none;
  border: 1px solid transparent; transition: color .16s ease, border-color .16s ease; }
.topbar-sys a svg { width: 17px; height: 17px; flex: 0 0 auto; }
/* Licznik otwartych spraw — czerwone kółko przy pozycji BOK */
.ts-badge { display: inline-flex; align-items: center; justify-content: center;
  min-width: 19px; height: 19px; padding: 0 5px; border-radius: 999px;
  background: #d92d20; color: #fff; font-size: 11px; font-weight: 800; line-height: 1;
  box-shadow: 0 0 0 2px var(--sidebar-bg, #fff); }
.topbar-sys a:hover { color: var(--text); text-decoration: none; }
.topbar-sys a.active { color: var(--primary); border-color: color-mix(in srgb, var(--primary) 22%, transparent); }
.topbar-sys + .workspace-tabs { margin-left: 0; }

.workspace-tabs { display: flex; gap: 6px; align-items: center; margin-left: auto; padding: 0 6px 0 10px; }
.workspace-tabs a {
  display: flex; flex-direction: column; justify-content: center;
  padding: 8px 16px; border-radius: 12px; color: var(--text-muted);
  font-weight: 700; line-height: 1.2; border: 1px solid transparent;
}
.workspace-tabs a:hover { background: var(--sidebar-hover); text-decoration: none; }
.workspace-tabs a.active { background: var(--sidebar-active); color: var(--primary); border-color: color-mix(in srgb, var(--primary) 25%, transparent); }
.workspace-tabs .ws-name { font-size: 14px; }
.workspace-tabs .ws-sub { font-size: 11px; color: var(--text-soft); font-weight: 600; }
.workspace-tabs a.active .ws-sub { color: var(--primary); opacity: .72; }

/* --- Powłoka: sidebar + content --- */
.app { display: flex; min-height: calc(100vh - 64px); }
.sidebar {
  width: var(--sidebar-w); flex: 0 0 var(--sidebar-w);
  /* Pasek boczny Findera jest ODROBINĘ ciemniejszy od okna obok — to ta różnica, nie kreska,
     mówi oku „to jest nawigacja, tamto treść". Stąd chłodna szarość zamiast bieli. */
  background: #f4f2f7;
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: sticky; top: 64px; height: calc(100vh - 64px);
}
/* Menu ma się mieścić w całości — pasek przewijania przy nawigacji zmusza do szukania pozycji,
   które powinny być widoczne od razu. Przy 16 pozycjach w trzech grupach oznacza to ciasne odstępy:
   wysokość jednej pozycji zeszła z 38 px na 30 px, co daje ~590 px zamiast 803 px i mieści się
   na ekranie 800 px. Poniżej tej wysokości przewijanie zostaje, ale paskiem cienkim i bez strzałek. */
.sidebar nav { flex: 1; overflow-y: auto; padding: 10px 8px 6px; scrollbar-width: thin;
  scrollbar-color: rgba(120,100,150,.28) transparent; }
.sidebar nav::-webkit-scrollbar { width: 6px; }
.sidebar nav::-webkit-scrollbar-track { background: transparent; }
.sidebar nav::-webkit-scrollbar-thumb { background: rgba(120,100,150,.24); border-radius: 3px; }
.sidebar nav:hover::-webkit-scrollbar-thumb { background: rgba(120,100,150,.42); }
/* Wiersz jak w Finderze: niski, tekst zwykłej grubości, zaznaczenie jako wypełniona pigułka
   na całą szerokość paska. Kolor tekstu niesie treść, a nie stan — stan niesie tło.

   Wypełnienie WJEŻDŻA OD LEWEJ, tak jak wcześniej robiła to kreska pod pozycją. Ruch jest
   ten sam, tylko zamiast dorysowywać element pod tekstem — na co przy 28-pikselowym wierszu
   nie ma już miejsca — rozsuwa się samo tło pigułki.

   Zrobione przez background-size na gradiencie, a nie przez osobną warstwę pod spodem:
   tło z definicji rysuje się za treścią, więc ikona i napis nie wymagają układania w warstwy
   (napis jest gołym tekstem, nie da się mu nadać z-index). */
.sidebar nav a {
  position: relative; display: flex; align-items: center; gap: 9px;
  padding: 5px 9px; margin-bottom: 1px; border-radius: 6px;
  color: var(--text); font-weight: 500; font-size: 13px; line-height: 1.4;
  background-image: linear-gradient(rgba(80, 52, 100, .07), rgba(80, 52, 100, .07));
  background-repeat: no-repeat; background-position: left center; background-size: 0% 100%;
  transition: background-size .24s cubic-bezier(.4, 0, .2, 1);
}
.sidebar nav a:last-child { margin-bottom: 0; }
.sidebar nav a:hover { background-size: 100% 100%; text-decoration: none; }
/* Zaznaczenie jest stanem trwałym, nie zdarzeniem — stoi wypełnione od razu, bez wjazdu. */
.sidebar nav a.active {
  background-image: linear-gradient(rgba(80, 52, 100, .11), rgba(80, 52, 100, .11));
  background-size: 100% 100%; font-weight: 600;
}
/* Ikony trzymają kolor marki — w Finderze to one, nie tekst, są kolorowym elementem paska.
   Przy najechaniu drgną o włos w prawo, w tę samą stronę co wypełnienie. */
.sidebar nav a .ico { display: flex; color: var(--primary-400);
  transition: transform .24s cubic-bezier(.4, 0, .2, 1); }
.sidebar nav a:hover .ico { transform: translateX(2px); }
.sidebar nav a.active .ico { transform: none; }
.sidebar nav a .ico, .sidebar nav a .ico svg { width: 16px; height: 16px; flex: 0 0 16px; }
@media (prefers-reduced-motion: reduce) {
  .sidebar nav a, .sidebar nav a .ico { transition: none; }
  .sidebar nav a:hover .ico { transform: none; }
}

.nav-section { padding: 0; margin-bottom: 2px; }
.nav-section:last-child { margin-bottom: 0; }
/* Grupy nie mają ramek ani wypełnień — oddziela je nagłówek i odstęp nad nim, jak w Finderze. */
.nav-section.grouped {
  position: relative;
  padding: 0; margin: 0 0 2px;
  border: 0; border-radius: 0; background: none;
}
/* Nagłówek grupy: mały, szary, PISANY NORMALNIE. Wersaliki z rozstrzeleniem to język paneli
   administracyjnych; Finder pisze „Ulubione" i „Lokalizacje" zwykłym tekstem. */
.nav-section-label {
  font-size: 11px; font-weight: 600; text-transform: none; letter-spacing: 0;
  color: var(--text-soft); padding: 11px 9px 3px;
}

/* Gradienty grup — dwubarwne, po przekątnej; --grp-accent zasila kreskę hover i wstęgę */
/* Barwa grupy zabarwia ikony jej pozycji — jedyny ślad koloru, jaki Finder dopuszcza w pasku. */
.nav-section.grp-green  a .ico { color: #12b886; }
.nav-section.grp-purple a .ico { color: #9b4dca; }
.nav-section.grp-gray   a .ico { color: #5c7cfa; }

/* Mapa — wyblakłe kafelki, żeby granice i terytoria spółdzielni były na pierwszym planie */
.map-faded-tiles { filter: grayscale(0.68) brightness(1.1) opacity(0.5); }

/* Baner podglądu jako partner */
.impersonate-bar { display: flex; align-items: center; justify-content: center; gap: 16px; background: var(--grad-brand); color: #fff; padding: 9px 18px; font-size: 13.5px; font-weight: 600; }
.impersonate-bar button { background: rgba(255,255,255,.2); color: #fff; border: 1px solid rgba(255,255,255,.5); border-radius: 8px; padding: 4px 12px; font-weight: 700; cursor: pointer; font-size: 13px; }
.impersonate-bar button:hover { background: rgba(255,255,255,.32); }
.leaflet-tooltip { font-size: 12.5px; }
.nav-badge { margin-left: auto; background: rgba(80, 52, 100, .14); color: var(--text-muted);
  font-size: 11px; font-weight: 600; padding: 0 6px; border-radius: 999px; }
.sidebar nav a.active .nav-badge { background: rgba(80, 52, 100, .18); color: var(--text); }
.sidebar-foot { border-top: 1px solid var(--border); padding: 10px 12px; }
/* Awatar w stopce dostaje obwódkę w kolorze paska, nie bieli. */
.sidebar-foot .avatar { box-shadow: 0 0 0 2px #f4f2f7; }
.user-chip { display: flex; align-items: center; gap: 11px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--grad-brand); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13.5px; flex: 0 0 34px; }
.user-chip .meta { min-width: 0; flex: 1; }
.user-chip .name { font-weight: 700; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-chip .email { font-size: 11.5px; color: var(--text-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-chip .logout { color: var(--text-soft); padding: 4px; }

.content { flex: 1; min-width: 0; padding: 32px 38px; position: relative; }

/* --- Subtelne tło sekcji (akcent po prawej) --- */
.content::before {
  content: ""; position: fixed; right: 0; bottom: 0;
  width: 72%; height: 100%;
  background-image: var(--page-bg); background-repeat: no-repeat;
  background-position: bottom right; background-size: cover;
  opacity: .30; pointer-events: none; z-index: 0;
  -webkit-mask-image: linear-gradient(to left, #000 0%, #000 22%, transparent 88%);
          mask-image: linear-gradient(to left, #000 0%, #000 22%, transparent 88%);
}
.content > * { position: relative; z-index: 1; }
.sec-pulpit       { --page-bg: url('../img/bg-2.jpg'); }
.sec-spoldzielnie { --page-bg: url('../img/bg-1.jpg'); }
.sec-klienci      { --page-bg: url('../img/bg-3.jpg'); }
.sec-partnerzy    { --page-bg: url('../img/bg-4.jpg'); }
.sec-moderatorzy  { --page-bg: url('../img/bg-4.jpg'); }
.sec-finanse      { --page-bg: url('../img/bg-5.jpg'); }
.sec-mailing      { --page-bg: url('../img/bg-3.jpg'); }
.sec-dokumenty    { --page-bg: url('../img/bg-1.jpg'); }

.page-head { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 26px; }
.page-head .subtitle { color: var(--text-muted); font-size: 15px; margin-top: 5px; }

/* --- Karty --- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 22px 24px; }
.card + .card { margin-top: 18px; }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; gap: 12px; }

/* --- Statystyki --- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 18px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 22px; box-shadow: var(--shadow-sm); }
.stat .label { color: var(--text-muted); font-size: 14px; font-weight: 600; }
.stat .value { font-size: 32px; font-weight: 800; margin-top: 6px; letter-spacing: -.02em; }
.stat .value.accent { color: var(--primary-400); }

/* --- Przyciski --- */
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 11px 20px; border-radius: var(--radius-sm); border: 1px solid transparent; font-family: inherit; font-size: 15px; font-weight: 600; cursor: pointer; transition: filter .12s, background .12s, border-color .12s; line-height: 1.1; }
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--grad-brand); color: #fff; }
.btn-primary:hover { filter: brightness(1.08); color: #fff; }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn-secondary:hover { background: var(--primary-bg); border-color: var(--primary-soft); color: var(--primary); }
.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--border-soft); color: var(--text); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(1.08); color: #fff; }
.btn-sm { padding: 8px 14px; font-size: 14px; }
.btn .ico { width: 18px; height: 18px; display: flex; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* --- Formularze --- */
.field { margin-bottom: 18px; }
.field label { display: block; font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 7px; }
.input, .select, .textarea {
  width: 100%; padding: 12px 15px; font-family: inherit; font-size: 15.5px;
  color: var(--text); background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm); outline: none;
  transition: border-color .12s, box-shadow .12s;
}
.input:focus, .select:focus, .textarea:focus { border-color: var(--primary-400); box-shadow: 0 0 0 4px var(--primary-bg); }
.textarea { resize: vertical; min-height: 100px; }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px; }
.hint { font-size: 13px; color: var(--text-soft); margin-top: 5px; }

/* --- Toolbar --- */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 20px; }
.search { position: relative; flex: 1; min-width: 240px; }
.search .input { padding-left: 42px; }
.search .ico { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--text-soft); }

/* --- Tabele --- */
.table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); }
table.data { width: 100%; border-collapse: collapse; font-size: 15px; }
table.data th { text-align: left; padding: 14px 18px; background: var(--primary-bg); color: var(--text-muted); font-weight: 700; font-size: 12.5px; text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; }
table.data td { padding: 14px 18px; border-top: 1px solid var(--border-soft); vertical-align: middle; }
table.data tbody tr:hover { background: var(--sidebar-hover); }
table.data .num { text-align: right; font-variant-numeric: tabular-nums; }

/* --- Plakietki --- */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; border-radius: 999px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.badge-primary { background: var(--primary-bg); color: var(--primary); }
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-danger  { background: var(--danger-bg); color: var(--danger); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-info    { background: var(--info-bg); color: var(--info); }
.badge-muted   { background: var(--border-soft); color: var(--text-muted); }
.badge .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

/* --- Sekcje szczegółów (wszystkie widoczne, czytelne) --- */
.tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 22px; }
.tabs a, .tabs button { padding: 9px 16px; font-size: 14.5px; font-weight: 600; color: var(--text-muted); border: 1px solid var(--border-strong); background: var(--surface); border-radius: 999px; cursor: pointer; white-space: nowrap; text-decoration: none; }
.tabs a:hover, .tabs button:hover { background: var(--primary-bg); color: var(--primary); text-decoration: none; }
.tabs a.active, .tabs button.active { background: var(--grad-brand); color: #fff; border-color: transparent; }
.section-title { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-soft); font-weight: 700; margin: 24px 2px 12px; }
/* Szczegóły: wszystkie sekcje widoczne naraz, z odstępami */
.detail-sections > [data-panel] { display: block !important; margin-bottom: 18px; }

/* --- Filtry segmentowe --- */
.segments { display: inline-flex; background: var(--border-soft); border-radius: var(--radius-sm); padding: 4px; gap: 3px; }
.segments button, .segments a { border: none; background: none; padding: 9px 16px; font-size: 14.5px; font-weight: 600; color: var(--text-muted); border-radius: 9px; cursor: pointer; text-decoration: none; }
.segments button.active { background: var(--surface); color: var(--primary); box-shadow: var(--shadow-sm); }

/* --- Stepper --- */
.stepper { display: flex; align-items: center; gap: 0; flex-wrap: wrap; }
.stepper .step { display: flex; align-items: center; gap: 9px; color: var(--text-soft); font-size: 14px; font-weight: 600; }
.stepper .step .num { width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--border-soft); color: var(--text-muted); font-weight: 700; font-size: 14px; }
.stepper .step.done .num { background: var(--success-bg); color: var(--success); }
.stepper .step.current .num { background: var(--grad-brand); color: #fff; }
.stepper .sep { width: 30px; height: 2px; background: var(--border-strong); margin: 0 9px; }

/* --- Modal --- */
.modal-overlay { position: fixed; inset: 0; background: rgba(26,19,32,.5); display: flex; align-items: flex-start; justify-content: center; padding: 44px 16px; z-index: 50; }
.modal { background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); width: 100%; max-width: 800px; max-height: 88vh; overflow: auto; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 22px 26px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface); }
.modal-body { padding: 24px 26px; }

/* --- Alerty --- */
.alert { display: flex; gap: 11px; padding: 14px 16px; border-radius: var(--radius-sm); font-size: 15px; margin-bottom: 16px; }
.alert-success { background: var(--success-bg); color: var(--success); }
.alert-danger  { background: var(--danger-bg); color: var(--danger); }
.alert-warning { background: var(--warning-bg); color: var(--warning); }
.alert-info    { background: var(--info-bg); color: var(--info); }

/* --- Pomocnicze --- */
.muted { color: var(--text-muted); }
.soft { color: var(--text-soft); }
.right { text-align: right; }
.flex { display: flex; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-8 { gap: 8px; } .gap-12 { gap: 12px; }
.mt-0 { margin-top: 0; } .mt-16 { margin-top: 18px; } .mt-24 { margin-top: 26px; }
.empty { text-align: center; padding: 52px 20px; color: var(--text-soft); font-size: 15px; }

/* --- Logowanie --- */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; position: relative; overflow: hidden; }
.auth-wrap::before { content: ""; position: absolute; inset: 0; background: url('../img/login.jpg') no-repeat center; background-size: cover; z-index: 0; }
.auth-wrap > * { position: relative; z-index: 2; }
.auth-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: 40px 38px; width: 100%; max-width: 430px; }
.auth-card .brand { text-align: center; font-weight: 800; font-size: 20px; margin-bottom: 4px; }
.auth-card .sub { text-align: center; color: var(--text-muted); font-size: 15px; margin-bottom: 26px; }

/* --- Responsywność --- */
@media (max-width: 900px) {
  .sidebar { position: fixed; left: 0; top: 0; transform: translateX(-100%); transition: transform .2s; z-index: 60; box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: translateX(0); }
  .content { padding: 20px 16px; }
}

/* ── Portal członka + rozmowy BOK ───────────────────────────────────────────── */
.kp-hero { display: flex; gap: 20px; align-items: center; flex-wrap: wrap;
  background: var(--grad-brand); color: #fff; border-radius: 18px; padding: 26px 30px; margin-bottom: 18px;
  box-shadow: 0 10px 30px rgba(104,41,106,.18); }
.kp-hero-txt { flex: 1; min-width: 260px; }
.kp-hello { font-size: 12.5px; text-transform: uppercase; letter-spacing: .08em; opacity: .82; font-weight: 700; }
.kp-hero h1 { margin: 4px 0 8px; font-size: 27px; line-height: 1.15; color: #fff; }
.kp-hero p { margin: 0; font-size: 14px; line-height: 1.6; opacity: .93; max-width: 62ch; }
.kp-hero-kwota { text-align: right; min-width: 150px; }
.kp-hero-kwota .lbl { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; opacity: .8; font-weight: 700; }
.kp-hero-kwota .val { font-size: 34px; font-weight: 800; line-height: 1.1; }
.kp-hero-kwota .sub { font-size: 12px; opacity: .8; }
@media (max-width: 640px) { .kp-hero-kwota { text-align: left; } }

.kp-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 18px; }
.kp-tile { background: var(--surface, #fff); border: 1px solid var(--border, #e6e8ee); border-radius: 14px; padding: 14px 16px;
  box-shadow: 0 1px 2px rgba(16,24,40,.04); }
.kp-tile-lbl { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-soft, #98a2b3); font-weight: 700; }
.kp-tile-val { font-size: 21px; font-weight: 800; margin-top: 4px; color: var(--text, #101828); }
.kp-tile-link { font-size: 12px; font-weight: 600; }

.kp-walne { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.kp-walne-lbl { font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-soft, #98a2b3); font-weight: 700; }
.kp-walne-data { font-size: 16px; font-weight: 700; }

.kp-iban { font-family: ui-monospace, Menlo, Consolas, monospace; font-weight: 700; letter-spacing: .5px; word-break: break-all; }
.kp-iban-lg { font-size: 18px; color: #1b5e20; }
.kp-mono { font-family: ui-monospace, Menlo, Consolas, monospace; }
.kp-platnosc { background: linear-gradient(150deg, rgba(46,125,50,.07), rgba(46,125,50,.02)); border-color: rgba(46,125,50,.28); }
.kp-pay-lbl { font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-soft, #98a2b3); font-weight: 700; margin-bottom: 3px; }
.kp-pay-kwota { font-size: 24px; font-weight: 800; color: #b45309; }
.kp-pay-kwota span { font-size: 13px; font-weight: 600; color: var(--text-muted, #667085); }

/* minmax(min(100%, 300px), 1fr): przy wąskim oknie kolumna nie wypycha kontenera w poziom */
.kp-docs { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 8px; }
.kp-doc { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--surface, #fff);
  border: 1px solid var(--border, #e6e8ee); border-radius: 12px; text-decoration: none; color: inherit;
  min-width: 0; transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease; }
.kp-doc:hover { border-color: var(--primary, #68296a); box-shadow: 0 4px 14px rgba(104,41,106,.10); transform: translateY(-1px); text-decoration: none; }
.kp-doc:hover .kp-doc-dl { background: var(--primary, #68296a); color: #fff; border-color: var(--primary, #68296a); }
.kp-doc-ico { flex: 0 0 auto; width: 34px; height: 34px; border-radius: 10px; display: flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--ic, #68296a) 12%, transparent); color: var(--ic, #68296a); }
.kp-doc-ico svg { width: 18px; height: 18px; }
.kp-doc-ico.sm { width: 30px; height: 30px; border-radius: 9px; }
.kp-doc-ico.sm svg { width: 16px; height: 16px; }
.kp-doc-txt { flex: 1 1 auto; min-width: 0; }
.kp-doc-name { display: block; font-weight: 600; font-size: 13px; line-height: 1.35;
  overflow-wrap: anywhere; word-break: break-word;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.kp-doc-meta { display: block; font-size: 11.5px; color: var(--text-soft, #98a2b3); margin-top: 3px; }
.kp-doc-dl { flex: 0 0 auto; width: 30px; height: 30px; border-radius: 9px; display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border, #e6e8ee); color: var(--text-soft, #98a2b3);
  transition: background .16s ease, color .16s ease, border-color .16s ease; }
.kp-doc-dl svg { width: 15px; height: 15px; }
.kp-walne-ico { width: 40px; height: 40px; border-radius: 12px; display: flex; align-items: center; justify-content: center;
  background: rgba(104,41,106,.10); color: var(--primary, #68296a); flex: 0 0 auto; }
.kp-walne-ico svg { width: 20px; height: 20px; }

.kp-event { display: flex; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--border-soft, #f0f1f4); }
.kp-event:last-child { border-bottom: 0; }
.kp-event-date { flex: 0 0 56px; text-align: center; border-radius: 12px; padding: 8px 4px;
  background: var(--grad-brand); color: #fff; }
.kp-event-date.past { background: var(--surface-2, #f7f8fa); color: var(--text-soft, #98a2b3); }
.kp-event-date .d { display: block; font-size: 20px; font-weight: 800; line-height: 1; }
.kp-event-date .m { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
.kp-event-title { font-weight: 700; font-size: 14.5px; }
.kp-event-more summary { cursor: pointer; font-size: 12px; color: var(--primary, #68296a); margin-top: 5px; }
.kp-event-tresc { font-size: 13px; line-height: 1.6; margin-top: 8px; padding: 10px 12px;
  background: var(--surface-2, #f7f8fa); border-radius: 10px; }

.kp-threads { display: flex; flex-direction: column; gap: 8px; }
.kp-thread { display: flex; align-items: center; gap: 12px; padding: 13px 15px; border-radius: 12px; text-decoration: none;
  color: inherit; border: 1px solid var(--border, #e6e8ee); background: var(--surface, #fff); transition: border-color .16s ease; }
.kp-thread:hover { border-color: var(--primary, #68296a); text-decoration: none; }
.kp-thread.unread { background: linear-gradient(145deg, rgba(104,41,106,.05), transparent); border-color: rgba(104,41,106,.28); }
.kp-thread-main { flex: 1; min-width: 0; }
.kp-thread-temat { display: block; font-weight: 700; font-size: 14px; }
.kp-thread-meta { display: block; font-size: 11.5px; color: var(--text-soft, #98a2b3); margin-top: 2px; }
.kp-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #d92d20; margin-left: 6px; vertical-align: middle; }

.kp-chat { display: flex; flex-direction: column; gap: 10px; }
.kp-msg { max-width: 78%; padding: 12px 15px; border-radius: 14px; background: var(--surface, #fff);
  border: 1px solid var(--border, #e6e8ee); }
.kp-msg.mine { align-self: flex-end; background: linear-gradient(145deg, rgba(104,41,106,.09), rgba(155,77,202,.05));
  border-color: rgba(104,41,106,.22); }
.kp-msg-head { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; margin-bottom: 5px; }
.kp-msg-head strong { font-size: 12.5px; }
.kp-msg-head .soft { font-size: 11px; white-space: nowrap; }
.kp-msg-body { font-size: 13.5px; line-height: 1.6; word-break: break-word; }
@media (max-width: 700px) { .kp-msg { max-width: 92%; } }

/* ── Pulpit ─────────────────────────────────────────────────────────────────── */
.db-hero { display: flex; gap: 24px; align-items: center; flex-wrap: wrap; justify-content: space-between;
  background: var(--grad-brand); color: #fff; border-radius: 18px; padding: 24px 28px; margin-bottom: 18px;
  box-shadow: 0 10px 30px rgba(104,41,106,.18); }
.db-date { font-size: 12px; text-transform: uppercase; letter-spacing: .07em; opacity: .8; font-weight: 700; }
.db-hero h1 { margin: 5px 0 6px; font-size: 26px; color: #fff; line-height: 1.15; }
.db-hero p { margin: 0; font-size: 14px; opacity: .93; }
.db-hero-stats { display: flex; gap: 26px; }
.db-hero-stats div { text-align: right; }
.db-hero-stats .v { display: block; font-size: 24px; font-weight: 800; line-height: 1.1; }
.db-hero-stats .l { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; opacity: .8; }
@media (max-width: 720px) { .db-hero-stats { gap: 18px; } .db-hero-stats div { text-align: left; } }

.db-cols { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
@media (max-width: 1080px) { .db-cols { grid-template-columns: 1fr; } }

.db-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-bottom: 16px; }
.db-kpi { display: block; padding: 16px 18px; border-radius: 14px; background: var(--surface, #fff);
  border: 1px solid var(--border, #e6e8ee); text-decoration: none; color: inherit;
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease; }
.db-kpi:hover { transform: translateY(-2px); box-shadow: 0 8px 22px rgba(16,24,40,.09); border-color: var(--primary, #68296a); text-decoration: none; }
.db-kpi.accent { background: linear-gradient(150deg, rgba(104,41,106,.08), rgba(155,77,202,.03)); border-color: rgba(104,41,106,.22); }
.db-kpi-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.db-kpi-lbl { font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-soft, #98a2b3); font-weight: 700; }
.db-kpi-pct { font-size: 12px; font-weight: 800; color: var(--primary, #68296a); }
.db-kpi-val { font-size: 30px; font-weight: 800; letter-spacing: -.02em; margin: 4px 0 6px; }
.db-kpi-bar { height: 5px; border-radius: 3px; background: var(--surface-2, #f1f2f6); overflow: hidden; margin-bottom: 7px; }
.db-kpi-bar span { display: block; height: 100%; border-radius: 3px; background: var(--grad-brand); }
.db-kpi-sub { font-size: 11.5px; color: var(--text-soft, #98a2b3); }

.db-funnel { display: flex; flex-direction: column; gap: 7px; }
.db-fun-row { display: grid; grid-template-columns: 190px minmax(0, 1fr) 54px; gap: 12px; align-items: center;
  text-decoration: none; color: inherit; padding: 3px 0; }
.db-fun-row:hover { text-decoration: none; }
.db-fun-row:hover .db-fun-fill { filter: brightness(1.06); }
.db-fun-lbl { font-size: 12.5px; font-weight: 600; color: var(--text-muted, #667085);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.db-fun-track { height: 22px; border-radius: 7px; background: var(--surface-2, #f7f8fa); overflow: hidden; }
.db-fun-fill { display: block; height: 100%; border-radius: 7px; background: var(--grad-brand); transition: width .5s cubic-bezier(.4,0,.2,1); }
.db-fun-n { font-size: 13.5px; font-weight: 800; text-align: right; }
@media (max-width: 620px) { .db-fun-row { grid-template-columns: 120px minmax(0,1fr) 44px; } }

/* Wykres „gdzie stoją spółdzielnie w procesie".
   Każdy krok to kolumna o STAŁEJ strukturze: numer → liczba → tor słupka → etykieta.
   Liczba stoi NAD słupkiem, nie w środku — wcześniej była w środku, a przy dwóch spółdzielniach
   słupek miał 6 px wysokości i cyfra wychodziła poza niego, lądując na etykiecie kroku.
   Tor ma stałą wysokość, więc słupki rosną od wspólnej podstawy i nic się nie przesuwa. */
/* Siedem kroków to jedna oś procesu — kolumny kurczą się równomiernie zamiast zawijać,
   bo złamany na dwa rzędy wykres przestaje czytać się jako kolejność etapów. */
.db-steps { display: flex; gap: 8px; align-items: stretch; flex-wrap: nowrap; }
.db-step { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 7px;
  padding: 10px 6px 8px; border-radius: 12px; text-decoration: none; color: inherit;
  border: 1px solid transparent; transition: background .16s ease, border-color .16s ease; }
.db-step:hover { text-decoration: none; background: var(--surface-2, #f7f8fa); border-color: var(--border, #e6e8ee); }
.db-step:hover .db-step-bar { filter: brightness(.96); }

.db-step-n { width: 22px; height: 22px; flex: none; border-radius: 50%; color: #fff;
  font-size: 11px; font-weight: 800; display: flex; align-items: center; justify-content: center; }
.db-step-val { font-size: 17px; font-weight: 800; line-height: 1; }

.db-step-slot { width: 100%; height: 64px; display: flex; align-items: flex-end; }
.db-step-bar { width: 100%; border-radius: 8px 8px 4px 4px; border: 1px solid;
  transition: height .45s cubic-bezier(.4,0,.2,1); }

.db-step-lbl { font-size: 11px; text-align: center; color: var(--text-muted, #667085);
  line-height: 1.3; min-height: 2.6em; display: flex; align-items: flex-start; justify-content: center; }
.db-step.pusty { opacity: .5; }
.db-step.pusty .db-step-val { font-weight: 700; }

/* Na wąskim ekranie oś łamie się na dwa rzędy — lepsze niż nieczytelnie ściśnięte kolumny. */
@media (max-width: 900px) {
  .db-steps { flex-wrap: wrap; }
  .db-step { flex: 1 1 84px; min-width: 84px; }
}

.db-todo-row { display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 11px;
  text-decoration: none; color: inherit; border: 1px solid var(--border, #e6e8ee); margin-bottom: 8px;
  transition: border-color .16s ease, background .16s ease; }
.db-todo-row:last-child { margin-bottom: 0; }
.db-todo-row:hover { border-color: var(--primary, #68296a); background: var(--sidebar-hover, #f5f0f8); text-decoration: none; }
.db-todo-row.pilne { border-color: #fda29b; background: #fffbfa; }
.db-todo-n { flex: 0 0 auto; min-width: 30px; height: 30px; padding: 0 7px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 14px;
  background: var(--surface-2, #f1f2f6); color: var(--text, #101828); }
.db-todo-row.pilne .db-todo-n { background: #fee4e2; color: #b42318; }
.db-todo-txt { font-size: 12.5px; line-height: 1.4; }
.db-clear { display: flex; gap: 12px; align-items: center; padding: 6px 2px; font-size: 13.5px; }
.db-clear-ico { width: 34px; height: 34px; border-radius: 50%; background: #e7f7ee; color: #1f9d63;
  display: flex; align-items: center; justify-content: center; font-size: 17px; font-weight: 800; }

.db-walne { display: flex; gap: 11px; align-items: center; padding: 9px 0; text-decoration: none; color: inherit;
  border-bottom: 1px solid var(--border-soft, #f0f1f4); }
.db-walne:last-child { border-bottom: 0; }
.db-walne:hover { text-decoration: none; }
.db-walne:hover .nm { color: var(--primary, #68296a); }
.db-walne-d { flex: 0 0 42px; text-align: center; border-radius: 10px; padding: 5px 0; background: var(--surface-2, #f7f8fa); }
.db-walne-d b { display: block; font-size: 16px; line-height: 1; }
.db-walne-d span { display: block; font-size: 10px; text-transform: uppercase; color: var(--text-soft, #98a2b3); }
.db-walne-t { min-width: 0; }
.db-walne-t .nm { display: block; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.db-feed { display: flex; flex-direction: column; gap: 10px; }
.db-feed-row { display: flex; gap: 9px; align-items: flex-start; }
.db-feed-dot { flex: 0 0 7px; width: 7px; height: 7px; border-radius: 50%; background: var(--primary, #68296a); margin-top: 5px; opacity: .55; }
.db-feed-txt { font-size: 12.5px; line-height: 1.35; }

/* ── Użytkownik w prawym górnym rogu ────────────────────────────────────────── */
.topbar-user { display: flex; align-items: center; gap: 10px; padding: 0 18px 0 10px; margin-left: 4px;
  position: relative; }
.topbar-user::before { content: ''; position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: 1px; height: 26px; background: var(--border, #e6e8ee); }
.tu-chip { display: flex; align-items: center; gap: 10px; padding: 6px 12px 6px 6px; border-radius: 999px;
  text-decoration: none; color: inherit; border: 1px solid transparent; transition: background .16s ease, border-color .16s ease; }
.tu-chip:hover { background: var(--sidebar-hover, #f5f0f8); border-color: var(--border, #e6e8ee); text-decoration: none; }
.tu-avatar { flex: 0 0 auto; width: 34px; height: 34px; border-radius: 50%; background: var(--grad-brand);
  color: #fff; font-size: 12.5px; font-weight: 800; letter-spacing: .02em;
  display: flex; align-items: center; justify-content: center; box-shadow: 0 2px 8px rgba(104,41,106,.28); }
.tu-meta { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.tu-name { font-size: 13px; font-weight: 700; color: var(--text, #101828);
  max-width: 190px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tu-role { font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-soft, #98a2b3); font-weight: 700; }
.tu-logout { display: flex; align-items: center; gap: 7px; padding: 8px 14px; border-radius: 10px; cursor: pointer;
  font-family: inherit; font-size: 12.5px; font-weight: 700;
  background: var(--surface-2, #f7f8fa); border: 1px solid var(--border, #e6e8ee); color: var(--text-muted, #667085);
  transition: background .16s ease, color .16s ease, border-color .16s ease, transform .16s ease; }
.tu-logout:hover { background: #fef3f2; border-color: #fda29b; color: #b42318; transform: translateY(-1px); }
.tu-logout svg { flex: 0 0 auto; }
@media (max-width: 900px) {
  .topbar-user { padding-right: 12px; gap: 6px; }
  .tu-meta { display: none; }
  .tu-logout span { display: none; }
  .tu-logout { padding: 8px 10px; }
}

/* Akcje w wierszach tabel — przyciski trzymają się razem zamiast rozjeżdżać po komórce */
td .flex.gap-8, td form + form { gap: 4px; }
td.right form { display: inline-block; margin: 0; }
td.right form + form, td.right form + a, td.right a + form { margin-left: 4px; }

@media (max-width: 1240px) {
  .topbar-sys a span:not(.ts-badge) { display: none; }
  .topbar-sys a { padding: 8px 10px; }
  .workspace-tabs .ws-sub { display: none; }
}
@media (max-width: 900px) { .topbar-sys { display: none; } }

/* BOK — informacja o zamkniętej sprawie */
.bok-zamk { margin-top: 12px; padding: 10px 12px; border-radius: 10px; font-size: 12.5px;
  background: var(--surface-2, #f7f8fa); border: 1px solid var(--border, #e6e8ee); }

/* ── Proces zakładania: krok = osobny panel (układ jak w 1.0) ───────────────── */
.stepper .step { cursor: pointer; font: inherit; text-align: left; }

/* Oś procesu jako siatka kafelków — przy zawijaniu rzędy nie nachodzą na siebie,
   a każdy krok ma stałą, klikalną powierzchnię zamiast samego tekstu. */
.stepper-proc { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; align-items: stretch; }
@media (max-width: 1100px) { .stepper-proc { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 700px)  { .stepper-proc { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.stepper-proc .step {
  display: flex; flex-direction: column; align-items: flex-start; gap: 7px;
  padding: 11px 12px; border-radius: 12px; background: var(--surface-2, #f7f8fa);
  border: 1px solid var(--border, #e6e8ee); color: var(--text-muted, #667085);
  font-size: 12.5px; font-weight: 600; line-height: 1.3; min-height: 72px;
  transition: border-color .16s ease, background .16s ease, transform .16s ease;
}
.stepper-proc .step .lbl { display: block; }
.stepper-proc .step:hover { transform: translateY(-1px); border-color: var(--primary, #68296a); }
.stepper-proc .step .num { width: 26px; height: 26px; font-size: 12.5px; flex: 0 0 auto; }
.stepper-proc .step.done { background: #f2fbf6; border-color: #b7e4c7; color: #1f7a4d; }
.stepper-proc .step.done .num { background: #d3f2e0; color: #1f9d63; }
.stepper-proc .step.current { background: linear-gradient(150deg, rgba(104,41,106,.10), rgba(155,77,202,.04));
  border-color: rgba(104,41,106,.42); color: var(--primary, #68296a); box-shadow: 0 2px 10px rgba(104,41,106,.12); }
/* Aktualnie oglądany panel — obwódka, żeby odróżnić „gdzie patrzę" od „gdzie stoi proces". */
.stepper-proc .step.viewing { outline: 2px solid var(--primary, #68296a); outline-offset: 1px; }
.proc-panel { display: none; }
.proc-panel.active { display: block; animation: procIn .22s ease; }
@keyframes procIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.proc-head { display: flex; gap: 12px; align-items: flex-start; margin: 0 0 14px; }
.proc-num { flex: 0 0 auto; width: 30px; height: 30px; border-radius: 50%; background: var(--grad-brand);
  color: #fff; font-size: 13px; font-weight: 800; display: flex; align-items: center; justify-content: center; }
.proc-head h3 { margin: 0 0 2px; font-size: 17px; }
.proc-head p { margin: 0; font-size: 13px; color: var(--text-muted, #667085); line-height: 1.5; max-width: 78ch; }
.proc-sklad { margin-top: 6px; }

/* ── Zarabiaj z nami (portal członka) ───────────────────────────────────────── */
.zz-hero { display: flex; gap: 22px; align-items: center; flex-wrap: wrap; justify-content: space-between;
  background: linear-gradient(135deg, #b45309 0%, #e8a13a 100%); color: #fff;
  border-radius: 18px; padding: 26px 30px; margin-bottom: 18px; box-shadow: 0 10px 30px rgba(180,83,9,.20); }
.zz-hero-txt { flex: 1; min-width: 260px; }
.zz-eyebrow { font-size: 12px; text-transform: uppercase; letter-spacing: .09em; opacity: .85; font-weight: 800; }
.zz-hero h1 { margin: 5px 0 8px; font-size: 26px; color: #fff; line-height: 1.15; }
.zz-hero p { margin: 0; font-size: 14px; line-height: 1.6; opacity: .95; max-width: 62ch; }
.zz-saldo { text-align: right; min-width: 150px; }
.zz-saldo .lbl { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; opacity: .82; font-weight: 700; }
.zz-saldo .val { font-size: 38px; font-weight: 800; line-height: 1.05; }
.zz-saldo .sub { font-size: 12px; opacity: .85; }
.zz-wdrodze { margin-top: 6px; font-size: 11.5px; background: rgba(255,255,255,.22); border-radius: 999px; padding: 3px 10px; display: inline-block; }
@media (max-width: 640px) { .zz-saldo { text-align: left; } }

.zz-oferty { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); gap: 14px; }
.zz-karta { background: var(--surface, #fff); border: 1px solid var(--border, #e6e8ee); border-top: 3px solid var(--zz, #b45309);
  border-radius: 14px; padding: 18px 20px; box-shadow: 0 1px 2px rgba(16,24,40,.05); }
.zz-karta-head { display: flex; gap: 14px; align-items: flex-start; justify-content: space-between; margin-bottom: 14px; }
.zz-karta-head h3 { margin: 0 0 4px; font-size: 16px; }
.zz-karta-head p { margin: 0; font-size: 12.5px; color: var(--text-muted, #667085); line-height: 1.5; }
.zz-nagroda { flex: 0 0 auto; text-align: center; font-size: 22px; font-weight: 800; color: var(--zz, #b45309); line-height: 1.1; }
.zz-nagroda span { display: block; font-size: 9.5px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--text-soft, #98a2b3); font-weight: 700; }
.zz-pola { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 160px), 1fr)); gap: 10px; }
.zz-stopka { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 14px; }
.zz-stopka .soft { font-size: 11.5px; }

.zz-op { display: flex; gap: 11px; align-items: flex-start; padding: 9px 0; border-bottom: 1px solid var(--border-soft, #f0f1f4); }
.zz-op:last-child { border-bottom: 0; }
.zz-op-kwota { flex: 0 0 auto; min-width: 62px; text-align: right; font-weight: 800; font-size: 14px; }
.zz-op-kwota.plus { color: #067647; }
.zz-op-kwota.minus { color: #b42318; }
.zz-op-txt { font-size: 12.5px; line-height: 1.4; }

/* BOK — przełącznik źródeł spraw (członkowie / partnerzy) */
.bok-zrodla { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.bok-zrodlo { display: flex; align-items: center; gap: 9px; padding: 10px 16px; border-radius: 12px;
  text-decoration: none; color: var(--text-muted, #667085); background: var(--surface, #fff);
  border: 1px solid var(--border, #e6e8ee); font-size: 13.5px; font-weight: 700;
  transition: border-color .16s ease, color .16s ease; }
.bok-zrodlo:hover { text-decoration: none; border-color: var(--primary, #68296a); }
.bok-zrodlo.active { color: var(--primary, #68296a); border-color: rgba(104,41,106,.42);
  background: linear-gradient(150deg, rgba(104,41,106,.08), rgba(155,77,202,.03)); }
.bok-zrodlo .cnt { min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--surface-2, #f1f2f6); color: var(--text, #101828); font-size: 11.5px; font-weight: 800; }
.bok-zrodlo.active .cnt { background: rgba(104,41,106,.14); color: var(--primary, #68296a); }

/* ── Archiwum dokumentów — przeglądarka katalogów ───────────────────────────── */
.dk-widoki { display: inline-flex; gap: 2px; padding: 3px; border-radius: 10px;
  background: var(--surface-2, #f1f2f6); border: 1px solid var(--border, #e6e8ee); }
.dk-w { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 8px;
  font-size: 12.5px; font-weight: 600; color: var(--text-muted, #667085); text-decoration: none; }
.dk-w:hover { text-decoration: none; color: var(--text, #101828); }
.dk-w.active { background: var(--surface, #fff); color: var(--primary, #68296a);
  box-shadow: 0 1px 3px rgba(16,24,40,.08); }

.dk-pasek { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px;
  padding: 9px 12px; border-radius: 12px; background: var(--surface-2, #f7f8fa); border: 1px solid var(--border, #e6e8ee); }
.dk-wstecz { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px;
  border-radius: 8px; background: var(--surface, #fff); border: 1px solid var(--border, #e6e8ee);
  color: var(--text-muted, #667085); flex: none; }
.dk-wstecz:hover { color: var(--primary, #68296a); border-color: rgba(104,41,106,.35); text-decoration: none; }
.dk-okruszki { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; min-width: 0; font-size: 13px; }
.dk-okruszki a { color: var(--text-muted, #667085); font-weight: 600; text-decoration: none; }
.dk-okruszki a:hover { color: var(--primary, #68296a); }
.dk-okruszki a.here { color: var(--text, #101828); }
.dk-okruszki .sep { color: var(--text-soft, #c2c7d0); }
.dk-filtr { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.dk-filtr input { width: 220px; max-width: 44vw; padding: 6px 11px; border-radius: 8px; font-size: 12.5px;
  border: 1px solid var(--border, #e6e8ee); background: var(--surface, #fff); }
.dk-filtr input:focus { outline: none; border-color: var(--primary, #68296a); }

.dk-siatka { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 178px), 1fr)); gap: 12px; }
.dk-folder { display: flex; flex-direction: column; align-items: center; gap: 7px; padding: 18px 12px 14px;
  border-radius: 14px; text-align: center; text-decoration: none; color: inherit;
  background: var(--surface, #fff); border: 1px solid var(--border, #e6e8ee);
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease; }
.dk-folder:hover { text-decoration: none; transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--dk, #8b5cf6) 45%, transparent);
  box-shadow: 0 10px 24px rgba(16,24,40,.10); }
.dk-f-ico { display: inline-flex; align-items: center; justify-content: center; width: 58px; height: 58px;
  border-radius: 16px; color: var(--dk, #8b5cf6);
  background: color-mix(in srgb, var(--dk, #8b5cf6) 12%, transparent); }
.dk-f-nazwa { font-size: 13px; font-weight: 700; line-height: 1.3; overflow-wrap: anywhere; }
.dk-f-meta { font-size: 11.5px; color: var(--text-soft, #98a2b3); }

.dk-plik { display: flex; align-items: center; gap: 9px; }
.dk-p-ext { display: inline-flex; align-items: center; justify-content: center; min-width: 38px; padding: 3px 6px;
  border-radius: 6px; font-size: 10px; font-weight: 800; letter-spacing: .04em;
  background: var(--surface-2, #f1f2f6); color: var(--text-muted, #667085); flex: none; }

.dk-strony { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 16px; }

/* ── Karta spółdzielni — zakładka „Dane" ────────────────────────────────────── */
.sp-kom-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: 10px; }
.sp-kom { padding: 11px 14px; border-radius: 10px;
  background: var(--surface-2, #f7f8fa); border: 1px solid var(--border, #e6e8ee); }
.sp-kom-l { font-size: 11px; color: var(--text-soft, #98a2b3); margin-bottom: 3px; }
.sp-kom-v { font-size: 13.5px; font-weight: 600; color: var(--text, #101828); overflow-wrap: anywhere; }

.sp-form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 210px), 1fr)); gap: 12px; }

.sp-zal { display: flex; flex-direction: column; gap: 8px; }
.sp-zal-p { display: flex; align-items: flex-start; gap: 11px; padding: 11px 14px; border-radius: 10px;
  background: var(--surface-2, #f7f8fa); border: 1px solid var(--border, #e6e8ee); }
.sp-zal-n { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; flex: none;
  border-radius: 999px; background: rgba(104,41,106,.12); color: var(--primary, #68296a);
  font-size: 11.5px; font-weight: 800; }
.sp-zal-t { font-size: 13px; line-height: 1.45; overflow-wrap: anywhere; }
.sp-zal-m { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 5px; font-size: 11.5px; }
.sp-zal-p form { margin-left: auto; flex: none; }

/* ── Dziennik zmian i dokumentacja ──────────────────────────────────────────── */
.doc-legenda { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.doc-typ { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px;
  font-size: 11px; font-weight: 700; letter-spacing: .01em;
  color: var(--dt, #667085); background: color-mix(in srgb, var(--dt, #667085) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--dt, #667085) 30%, transparent); }

.doc-miesiac { display: flex; align-items: center; gap: 12px; margin: 26px 0 12px; }
.doc-m-label { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .07em;
  color: var(--text-soft, #98a2b3); }
.doc-m-linia { flex: 1; height: 1px; background: var(--border, #e6e8ee); }
.doc-m-ile { font-size: 11px; font-weight: 700; color: var(--text-soft, #98a2b3);
  background: var(--surface-2, #f1f2f6); border-radius: 999px; padding: 1px 9px; }

.doc-wpis { position: relative; padding: 16px 18px 16px 20px; margin-bottom: 10px; border-radius: 14px;
  background: var(--surface, #fff); border: 1px solid var(--border, #e6e8ee); overflow: hidden; }
.doc-wpis::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--dt, #667085); }
.doc-w-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 7px; }
.doc-w-data { font-size: 11.5px; color: var(--text-soft, #98a2b3); }
.doc-w-tytul { font-size: 15.5px; margin: 0 0 6px; }
.doc-w-opis { font-size: 13.5px; line-height: 1.65; color: var(--text-muted, #667085); margin: 0; }

.doc-detale { margin-top: 10px; }
.doc-detale summary { cursor: pointer; font-size: 12px; font-weight: 600; color: var(--primary, #68296a);
  list-style: none; display: inline-flex; align-items: center; gap: 5px; }
.doc-detale summary::-webkit-details-marker { display: none; }
.doc-detale summary::before { content: '▸'; font-size: 10px; transition: transform .15s ease; }
.doc-detale[open] summary::before { transform: rotate(90deg); }
.doc-detale ul { margin: 8px 0 0; padding-left: 18px; }
.doc-detale li { font-size: 12.5px; line-height: 1.6; color: var(--text-muted, #667085); margin-bottom: 4px; overflow-wrap: anywhere; }

.doc-stan { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 168px), 1fr));
  gap: 10px; margin-bottom: 20px; }
.doc-s { padding: 13px 15px; border-radius: 12px; background: var(--surface, #fff); border: 1px solid var(--border, #e6e8ee); }
.doc-s-v { display: block; font-size: 21px; font-weight: 800; line-height: 1.15; color: var(--primary, #68296a); }
.doc-s-l { display: block; font-size: 11.5px; color: var(--text-soft, #98a2b3); margin-top: 2px; }

.doc-p { font-size: 13.8px; line-height: 1.7; color: var(--text-muted, #667085); margin: 0 0 10px; }
.doc-p:last-child { margin-bottom: 0; }
.doc-ul { margin: 0; padding-left: 20px; }
.doc-ul li { font-size: 13.3px; line-height: 1.65; color: var(--text-muted, #667085); margin-bottom: 7px; }
.doc-ul li strong { color: var(--text, #101828); }
.doc-kroki { margin: 0; padding-left: 20px; counter-reset: k; }
.doc-kroki li { font-size: 13.3px; line-height: 1.65; color: var(--text-muted, #667085); margin-bottom: 9px; }
.doc-kroki li strong { color: var(--text, #101828); }
.doc-lbl { font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-soft, #98a2b3); margin: 16px 0 7px; }

.doc-pre { margin: 0; padding: 14px 16px; border-radius: 12px; overflow-x: auto;
  background: var(--surface-2, #f7f8fa); border: 1px solid var(--border, #e6e8ee);
  font-family: var(--mono, ui-monospace, monospace); font-size: 12px; line-height: 1.7;
  color: var(--text-muted, #667085); white-space: pre; }

.doc-role { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 330px), 1fr)); gap: 14px; }
.doc-rola { padding: 18px 20px; border-radius: 14px; background: var(--surface, #fff);
  border: 1px solid var(--border, #e6e8ee); border-top: 3px solid var(--dr, #68296a); }
.doc-rola h3 { margin: 0 0 8px; font-size: 16px; color: var(--dr, #101828); }

/* ── Przełączniki statusu partnera ──────────────────────────────────────────── */
.flaga { display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px; border-radius: 999px;
  font-family: inherit; font-size: 12px; font-weight: 600; cursor: pointer;
  color: var(--text-muted, #667085); background: var(--surface-2, #f7f8fa);
  border: 1px solid var(--border, #e6e8ee); transition: border-color .15s ease, color .15s ease; }
.flaga:hover { border-color: var(--primary, #68296a); color: var(--text, #101828); }
.flaga .fl-kropka { width: 8px; height: 8px; border-radius: 50%; flex: none;
  background: var(--border-strong, #c2c7d0); transition: background .15s ease; }
.flaga.on { color: #1f7a4d; background: rgba(31,157,99,.09); border-color: rgba(31,157,99,.32); }
.flaga.on .fl-kropka { background: #1f9d63; }

/* ── Podgląd dokumentu ──────────────────────────────────────────────────────── */
.pv-oko { display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 26px; margin-right: 10px; padding: 0; vertical-align: middle;
  border-radius: 7px; cursor: pointer;
  color: var(--primary, #68296a); background: rgba(104,41,106,.08);
  border: 1px solid rgba(104,41,106,.22);
  transition: background .15s ease, border-color .15s ease; }
.pv-oko:hover { background: rgba(104,41,106,.16); border-color: rgba(104,41,106,.45); }

.pv-modal { position: fixed; inset: 0; z-index: 9999; display: flex; flex-direction: column;
  padding: 20px; background: rgba(15,10,20,.74); backdrop-filter: blur(2px); }
.pv-pasek { display: flex; align-items: center; justify-content: space-between; gap: 14px;
  margin-bottom: 10px; color: #fff; }
.pv-nazwa { font-size: 13.5px; font-weight: 600; opacity: .92; overflow-wrap: anywhere;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pv-akcje { display: flex; gap: 8px; flex: none; }
.pv-btn { display: inline-flex; align-items: center; padding: 7px 14px; border-radius: 8px;
  font-size: 12.5px; font-weight: 600; text-decoration: none; cursor: pointer;
  color: #fff; background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.28); }
.pv-btn:hover { background: rgba(255,255,255,.24); text-decoration: none; color: #fff; }
.pv-btn#pvPobierz { background: #fff; color: #1a1320; border-color: #fff; }
.pv-btn#pvPobierz:hover { background: #f1eef4; color: #1a1320; }

.pv-tresc { flex: 1; display: flex; align-items: center; justify-content: center;
  overflow: hidden; border-radius: 12px; background: #fff; color: #667085; font-size: 14px; }
.pv-tresc iframe { width: 100%; height: 100%; border: 0; }
.pv-tresc img { max-width: 100%; max-height: 100%; object-fit: contain; }
.pv-info { padding: 28px; text-align: center; line-height: 1.7; }

/* Przypomnienie o zaległym kroku procesu */
.proc-przypomnienie { padding: 12px 16px; border-radius: 12px;
  background: var(--surface-2, #f7f8fa); border: 1px solid var(--border, #e6e8ee); }
.proc-przypomnienie summary { cursor: pointer; font-size: 13px; font-weight: 600;
  color: var(--primary, #68296a); list-style: none; display: inline-flex; align-items: center; gap: 6px; }
.proc-przypomnienie summary::-webkit-details-marker { display: none; }
.proc-przypomnienie summary::before { content: '▸'; font-size: 10px; transition: transform .15s ease; }
.proc-przypomnienie[open] summary::before { transform: rotate(90deg); }

/* ── Akcje na kartotece — semantyka kolorów przeniesiona z 1.0 ──────────────────
   W 1.0 kolor przycisku niesie znaczenie i osoba pracująca w panelu rozpoznaje akcję
   zanim przeczyta etykietę: fiolet = edycja, zielony = dodaj/potwierdź, pomarańcz = wyślij
   lub oznacz, niebieski = podgląd i dokumenty, czerwony = operacja nieodwracalna.
   Odcienie przeliczone na jasny motyw 2.0 — te z 1.0 są dobrane pod ciemne tło. */
.akcje { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
/* Pasek akcji kartoteki schodzi pod tytuł (przy 7 akcjach i tak by się nie zmieścił obok)
   i jest wyrównany do lewej — tak jak zakładki pod nim, więc wzrok zawsze trafia w to samo miejsce. */
.page-head .akcje { justify-content: flex-start; padding-top: 2px; }
.akcje-sep { width: 1px; height: 22px; background: var(--border-strong, #ddd5e4); margin: 0 3px; }

.btn.btn-edytuj, .btn.btn-dodaj, .btn.btn-wyslij, .btn.btn-dok, .btn.btn-usun {
  display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.btn.btn-edytuj svg, .btn.btn-dodaj svg, .btn.btn-wyslij svg, .btn.btn-dok svg, .btn.btn-usun svg { flex: none; }

.btn.btn-edytuj { color: #7c3aed; background: rgba(124,58,237,.09); border: 1px solid rgba(124,58,237,.28); }
.btn.btn-edytuj:hover { background: rgba(124,58,237,.16); border-color: rgba(124,58,237,.5); color: #6d28d9; }

.btn.btn-dodaj { color: #1f7a4d; background: rgba(31,157,99,.10); border: 1px solid rgba(31,157,99,.30); }
.btn.btn-dodaj:hover { background: rgba(31,157,99,.18); border-color: rgba(31,157,99,.52); color: #17603c; }

.btn.btn-wyslij { color: #b45309; background: rgba(232,89,12,.09); border: 1px solid rgba(232,89,12,.26); }
.btn.btn-wyslij:hover { background: rgba(232,89,12,.16); border-color: rgba(232,89,12,.48); color: #92400e; }

.btn.btn-dok { color: #1c7ed6; background: rgba(28,126,214,.09); border: 1px solid rgba(28,126,214,.26); }
.btn.btn-dok:hover { background: rgba(28,126,214,.16); border-color: rgba(28,126,214,.48); color: #1864ab; }

.btn.btn-usun { color: #c0392b; background: rgba(192,57,43,.07); border: 1px solid rgba(192,57,43,.24); }
.btn.btn-usun:hover { background: rgba(192,57,43,.14); border-color: rgba(192,57,43,.46); color: #a33125; }

/* Tytuł kartoteki ma pierwszeństwo — inaczej imię i nazwisko łamie się na dwie linie,
   bo blok akcji zabiera połowę szerokości nagłówka. */
.page-head { flex-wrap: wrap; }
.page-head > div:first-child { min-width: 0; flex: 2 1 440px; }
.page-head .akcje { flex: 1 1 auto; }
.page-head h1 { overflow-wrap: anywhere; }
.akcje .btn.btn-sm { white-space: nowrap; }

/* Przełącznik w pasku filtrów (np. „tylko partnerzy zewnętrzni") */
.fb-check { display: inline-flex; align-items: center; gap: 7px; padding: 7px 12px; border-radius: 10px;
  font-size: 12.5px; font-weight: 600; color: var(--text-muted, #667085); cursor: pointer;
  background: var(--surface-2, #f7f8fa); border: 1px solid var(--border, #e6e8ee); white-space: nowrap; }
.fb-check:hover { border-color: var(--primary, #68296a); color: var(--text, #101828); }
.fb-check input { accent-color: var(--primary, #68296a); cursor: pointer; }
.fb-check:has(input:checked) { color: var(--primary, #68296a); background: rgba(104,41,106,.08);
  border-color: rgba(104,41,106,.32); }

/* Komunikat pod mapą, gdy nie ma czego pokazać */
.map-uwaga { margin-top: 10px; padding: 10px 14px; border-radius: 10px; font-size: 13px; line-height: 1.5;
  color: #b42318; background: #fffbfa; border: 1px solid #fda29b; }

/* Łańcuch podpisów — komplet dokumentów w stanie „po poprzedniku" */
.podpis-pakiet { margin: 12px 0 16px; border: 1px solid var(--border, #e6e8ee); border-radius: 12px; overflow: hidden; }
.podpis-pakiet-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap;
  padding: 10px 14px; background: var(--surface-2, #f7f8fa); border-bottom: 1px solid var(--border, #e6e8ee);
  font-size: 13px; }
.podpis-pakiet-head .soft { font-size: 12px; }
.podpis-lista { display: flex; flex-direction: column; }
.podpis-plik { display: flex; align-items: center; gap: 12px; padding: 9px 14px;
  border-bottom: 1px solid var(--border-soft, #f3eff7); }
.podpis-plik:last-child { border-bottom: 0; }
.podpis-nazwa { flex: 1; min-width: 0; font-size: 13px; overflow-wrap: anywhere; }
.podpis-plik form, .podpis-plik .btn { flex: none; }
.podpis-runda { flex: none; font-size: 11.5px; font-weight: 700; padding: 3px 10px; border-radius: 999px;
  color: #1f7a4d; background: rgba(31,157,99,.10); border: 1px solid rgba(31,157,99,.28); }
.podpis-runda.pierwotny { color: var(--text-soft, #98a2b3); background: var(--surface-2, #f1f2f6);
  border-color: var(--border, #e6e8ee); }

/* --- Mapa na pełnym ekranie (mapa.js) --------------------------------------------------------- */
/* Wysokości map są wpisane w atrybut style przy kontenerze, stąd !important — inaczej mapa
   zostałaby przy swoich 420/640 px pośrodku pustego ekranu. */
.map-pelny { position: fixed; inset: 0; z-index: 9990; margin: 0; padding: 12px;
  background: var(--surface, #fff); }
.map-pelny.map-wrap { display: flex; gap: 12px; align-items: stretch; flex-wrap: nowrap !important; }
/* height: 100%, a NIE auto. Przy „auto" lista boczna rozciąga się na wszystkie swoje wiersze
   (przy 44 partnerach to ~1740 px), a że wiersz flexa równa się do najwyższego elementu,
   mapa rosła razem z nią i wyjeżdżała poza ekran. Wysokości są w atrybucie style, stąd !important. */
.map-pelny .map-side { flex: 0 0 300px; height: 100% !important; min-height: 0; }
.map-pelny [data-map],
.map-pelny[data-map] { flex: 1 1 auto; height: 100% !important; min-width: 0; min-height: 0; border-radius: 10px; }
.map-pelny[data-map] { padding: 0; border-radius: 0; }
/* Przeglądarka daje elementowi w pełnym ekranie czarne tło — pod półprzezroczystymi kafelkami
   mapa robiła się wtedy ciemna. */
.map-pelny:fullscreen, .map-pelny:-webkit-full-screen { background: var(--surface, #fff); }

.map-fs a { display: flex !important; align-items: center; justify-content: center;
  width: 30px; height: 30px; color: #33303a; cursor: pointer; }
.map-fs a:hover { color: #7048e8; }

@media (max-width: 720px) {
  .map-pelny.map-wrap { flex-direction: column; }
  .map-pelny .map-side { flex: 0 0 34%; }
}

/* --- Kartoteki w oknach (okna.js) ------------------------------------------------------------ */
.okno { position: fixed; z-index: 4000; display: flex; flex-direction: column; overflow: hidden;
  background: var(--surface, #fff); border-radius: 14px;
  border: 1px solid rgba(30,16,40,.14);
  box-shadow: 0 30px 70px -18px rgba(28,12,40,.45), 0 2px 8px rgba(28,12,40,.14);
  opacity: 0; transform: scale(.985) translateY(6px);
  transition: opacity .15s ease-out, transform .15s ease-out; }
.okno-gotowe { opacity: 1; transform: none; }
.okno-znika { opacity: 0; transform: scale(.97); pointer-events: none; }
.okno-aktywne { box-shadow: 0 36px 84px -18px rgba(28,12,40,.5), 0 2px 10px rgba(28,12,40,.18); }
.okno-max { inset: 0 !important; width: auto !important; height: auto !important;
  border-radius: 0; border: 0; }
/* visibility, a nie samo opacity — inaczej zwinięte okno zostaje w układzie strony i da się
   na nie wejść tabulatorem. Zwłoka równa animacji, żeby zwijanie było widoczne. */
.okno-zwiniete { opacity: 0; visibility: hidden; pointer-events: none; transform: scale(.9) translateY(40px);
  transition: opacity .15s ease-in, transform .15s ease-in, visibility 0s .15s; }

/* Pasek tytułu — wysokość i odstępy jak w oknach systemowych, żeby światła były od razu czytelne. */
.okno-pasek { display: flex; align-items: center; gap: 10px; flex: none; height: 40px;
  padding: 0 12px; cursor: grab; user-select: none;
  background: linear-gradient(#fbfafd, #f2eef7); border-bottom: 1px solid var(--border-soft, #f0ecf5); }
.okno-max .okno-pasek { cursor: default; }
.okno-swiatla { display: flex; gap: 8px; flex: none; }
.sw { width: 13px; height: 13px; padding: 0; border-radius: 50%; border: 1px solid rgba(0,0,0,.14);
  cursor: pointer; position: relative; }
.sw-zamknij { background: #ff5f57; }
.sw-zwin    { background: #febc2e; }
.sw-max     { background: #28c840; }
/* Znaki w światłach pojawiają się przy najechaniu na grupę — dokładnie jak w macOS. */
.sw::after { content: ""; position: absolute; inset: 0; display: flex; align-items: center;
  justify-content: center; font-size: 10px; font-weight: 700; line-height: 1; color: rgba(0,0,0,.55);
  opacity: 0; transition: opacity .12s; }
.okno-swiatla:hover .sw::after { opacity: 1; }
.sw-zamknij::after { content: "✕"; font-size: 9px; }
.sw-zwin::after    { content: "−"; font-size: 13px; }
.sw-max::after     { content: "⤢"; font-size: 9px; }
.okno-tytul { flex: 1; min-width: 0; text-align: center; font-size: 12.5px; font-weight: 600;
  color: #4b4257; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.okno-strona { flex: none; display: flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 7px; color: #8b8397; }
.okno-strona:hover { background: rgba(112,72,232,.12); color: #7048e8; }

.okno-tresc { position: relative; flex: 1; min-height: 0; background: var(--surface-2, #f7f6fa); }
.okno-tresc iframe { width: 100%; height: 100%; border: 0; display: block; }
.okno-ladowanie { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  gap: 10px; font-size: 13px; color: var(--text-muted, #574d60); background: var(--surface, #fff); }
.okno-gotowe .okno-ladowanie { display: none; }
.okno-spinner { width: 15px; height: 15px; border: 2px solid #e2d8f5; border-top-color: #7048e8;
  border-radius: 50%; animation: oknoObrot .7s linear infinite; }
@keyframes oknoObrot { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .okno, .okno-spinner { transition: none; animation: none; }
}

.okno-uchwyt { position: absolute; right: 0; bottom: 0; width: 16px; height: 16px; cursor: nwse-resize; }
.okno-uchwyt::after { content: ""; position: absolute; right: 3px; bottom: 3px; width: 7px; height: 7px;
  border-right: 2px solid rgba(60,40,80,.3); border-bottom: 2px solid rgba(60,40,80,.3); border-radius: 0 0 2px 0; }
.okno-max .okno-uchwyt { display: none; }
/* Podczas przeciągania ramka przechwytywałaby kursor i okno „gubiło się" pod myszką. */
.okno-przeciagam iframe { pointer-events: none; }
.okno-przeciagam { cursor: grabbing; user-select: none; }

/* Pasek zwiniętych kartotek */
.okno-dok { position: fixed; left: 50%; bottom: 14px; transform: translateX(-50%); z-index: 3900;
  display: flex; gap: 8px; max-width: calc(100vw - 28px); padding: 7px 9px; overflow-x: auto;
  background: rgba(252,251,254,.92); backdrop-filter: blur(10px);
  border: 1px solid rgba(30,16,40,.1); border-radius: 14px;
  box-shadow: 0 16px 40px -14px rgba(28,12,40,.34); }
.okno-dok-pusty { display: none; }
.dok-kafel { display: flex; align-items: center; gap: 8px; max-width: 240px; padding: 7px 10px;
  font-size: 12.5px; font-weight: 600; color: #4b4257; cursor: pointer;
  background: #fff; border: 1px solid var(--border-soft, #f0ecf5); border-radius: 9px;
  box-shadow: var(--shadow-sm); }
.dok-kafel:hover { border-color: #d9cdf0; color: #1a1320; }
.dok-kropka { width: 7px; height: 7px; flex: none; border-radius: 50%; background: #febc2e; }
.dok-nazwa { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dok-zamknij { flex: none; padding: 0 2px; color: #b0a8bd; font-size: 11px; }
.dok-zamknij:hover { color: #d92d20; }

/* Oko przy wierszu listy — otwiera kartotekę w oknie zamiast wchodzić na stronę. */
.okno-oko { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px;
  margin-right: 8px; padding: 0; vertical-align: middle; cursor: pointer; flex: none;
  color: var(--text-muted, #574d60); background: transparent; border: 1px solid transparent; border-radius: 7px; }
.okno-oko:hover { color: #7048e8; background: #f4f0fb; border-color: #e2d8f5; }

/* Kartoteka renderowana wewnątrz okna — bez tła strony i z ciaśniejszym marginesem. */
.w-oknie .content { padding: 20px 22px 28px; }
.w-oknie .content::before { display: none; }

@media (max-width: 760px) {
  /* Na wąskim ekranie okno zajmuje wszystko — przesuwanie i zmiana rozmiaru nie mają tam sensu. */
  .okno { inset: 0 !important; width: auto !important; height: auto !important; border-radius: 0; border: 0; }
  .okno-uchwyt { display: none; }
  .okno-dok { left: 8px; right: 8px; transform: none; max-width: none; }
}

/* --- Podsumowanie oczekujących nad mapą ------------------------------------------------------- */
.ocz-karta { margin-bottom: 16px; }
.ocz-kafle { display: grid; grid-template-columns: repeat(auto-fit, minmax(122px, 1fr)); gap: 10px; margin-bottom: 12px; }
.ocz-kafel { padding: 12px 10px; text-align: center; cursor: help;
  background: var(--surface-2, #f7f6fa); border: 1px solid var(--border-soft, #f0ecf5); border-radius: var(--radius-sm); }
.ocz-n { font-size: 26px; font-weight: 800; line-height: 1.1; }
.ocz-et { margin-top: 3px; font-size: 11.5px; color: var(--text-muted, #574d60); }

.ocz-czas { font-size: 12.5px; color: var(--text-muted, #574d60); margin-bottom: 14px; }
.ocz-uwaga { color: #b8860b; }

.ocz-kolumny { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; }
.ocz-h { font-size: 13px; font-weight: 700; margin-bottom: 2px; }
.ocz-wiersz { display: flex; align-items: baseline; gap: 10px; padding: 6px 0;
  border-bottom: 1px solid var(--border-soft, #f0ecf5); font-size: 13px; text-decoration: none; color: inherit; }
.ocz-wiersz:last-child { border-bottom: 0; }
.ocz-wiersz:hover { color: #7048e8; text-decoration: none; }
.ocz-nazwa { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.ocz-liczba { flex: none; font-weight: 700; font-variant-numeric: tabular-nums; }
.ocz-dni { font-size: 12px; font-weight: 600; color: #b42318; }

/* Bardzo niskie okno (małe laptopy, okno w połowie ekranu) — ostatni stopień zagęszczenia.
   Etykiety grup znikają, bo grupy i tak rozróżnia kolorowa wstęga i tło karty; to tańsze
   niż zabranie kolejnych pikseli z odstępów, po których pozycje zaczynają się zlewać. */
@media (max-height: 780px) {
  /* Bez nagłówków grupy zostaje sam odstęp — inaczej pozycje z dwóch grup zlałyby się w jedną listę. */
  .nav-section-label { display: none; }
  .nav-section.grouped { margin-top: 7px; }
  .sidebar nav a { padding: 4px 9px; }
  .sidebar nav { padding-top: 7px; }
}
