:root{
  --brand: #055437;          /* kolor paska u góry */
  --brand-700: #5a43d6;
  --brand-200: #dcd6ff;

  --bg: #f5f6fa;
  --surface: #ffffff;
  --surface-2: #f0f0f5;
  --stroke: #dcdcdc;

  --text: #222;
  --text-muted: #666;

  --card: #ffffff;
  --card-shadow: rgba(0,0,0,.08);

  --radius: 12px;
}

*{ box-sizing: border-box; }
body{
  margin:0;
  color:var(--text);
  background: var(--bg);
  font: 500 16px/1.5 system-ui, sans-serif;
}

/* Pasek górny */
.topbar{
  background: linear-gradient(90deg, var(--brand) 0%, var(--brand-700) 100%);
  color:#fff;
}
.topbar__inner{
  display:flex;
  align-items:center;
  justify-content:space-between;
  height:40px;
  padding: 0 0px;
}
.brand{
  display:flex; align-items:center; gap:12px;
  color:#fff; text-decoration:none; font-weight:700;
}
.topbar__right{ display:flex; align-items:center; gap:16px; }
.btn--ghost{
  background:#fff; color: var(--brand-700);
  border:1px solid var(--brand-200);
}
.btn--ghost:hover{ background:#f5f5f5; }

/* Menu główne */
.mainnav{
  background:#fff;
  border-bottom:1px solid var(--stroke);
}
.mainnav__inner{
  display:flex; align-items:center; gap:20px;
  min-height:40px;
  padding:0 20px;
}
.mainnav__link{
  color: var(--text-muted);
  text-decoration:none;
  padding:10px 6px;
  border-bottom:2px solid transparent;
}
.mainnav__link.is-active{
  color: var(--brand-700);
  border-color: var(--brand-700);
}

.mainnav__spacer { margin-left: auto; }

/* Layout – pełna szerokość */
.layout{
  display:grid;
  grid-template-columns: 240px 1fr;
  gap: 16px;
  padding: 10px;
  max-width: 100%; /* pełna szerokość */
}

.layout2{
  display:grid;
  grid-template-columns: 240px 1fr;
  gap: 16px;
  padding: 10px;
  max-width: 100%; /* pełna szerokość */
}

/* Sidebar */
.sidebar{
  background: var(--surface);
  border:1px solid var(--stroke);
  border-radius: var(--radius);
  padding:14px;
  box-shadow: 0 4px 12px var(--card-shadow);
}
.sidebar__link{
  display:block; padding:10px 12px;
  border-radius: 8px;
  color: var(--text);
  text-decoration:none;
}
.sidebar__link:hover{ background:#f0f0ff; }
.sidebar__link.is-current{
  background: var(--brand-200);
  color: var(--brand-700);
  font-weight:600;
}

/* Treść główna */
.content__header{ margin-bottom:12px; }
.content h1{ margin:0 0 6px; font-size:26px; }
.content__subtitle{ margin:0; color: var(--text-muted); }

/* Karty */
.cards{
  display:grid;
  grid-template-columns: repeat(auto-fit,minmax(200px,1fr));
  gap:16px;
  margin-top:18px;
}
.card{
  background: var(--card);
  border:1px solid var(--stroke);
  border-radius: var(--radius);
  padding:16px;
  box-shadow: 0 6px 16px var(--card-shadow);
}
.card h3{ margin:0 0 8px; font-size:16px; }

/* Panel */
.panel{
  background: var(--surface);
  border:1px solid var(--stroke);
  border-radius: var(--radius);
  padding:18px;
}
.timeline{ list-style:none; padding:0; margin:0; }
.timeline li{ margin:6px 0; }

/* Stopka */
.footer{
  margin-top:2px;
  border-top:1px solid var(--stroke);
  background:#fff;
}
.footer__inner{
  min-height:20px;
  display:flex; align-items:center; justify-content:space-between;
  padding:0 20px;
  font-size:14px;
  color: var(--text-muted);
}

/* Responsywność */
@media (max-width: 860px){
  .layout{ grid-template-columns: 1fr; }
  .sidebar{ order:-1; }
}

.menu-toggle {
  display: none;
}

.logout-button {
	margin-right: 20px;
    background-color: #5a43d6;
    color: #fff;
    border: none;
    padding: 8px 12px;
    border-radius: 16px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    white-space: nowrap;
}

.logout-button:hover {
    background-color: #063d29;
}

.logoff {
    height: 20px;
}

/* FILTRY */
.filters{
  display:flex; flex-wrap:wrap; gap:10px;
  margin: 14px 0 12px;
}
.filters__input{
  padding:10px 12px; border:1px solid #dcdcdc; border-radius:10px;
  background:#fff; color:#222; min-width:220px;
  outline: none;
}
.filters__input:focus{
  border-color:#6750e8; box-shadow: 0 0 0 4px rgba(103,80,232,.12);
}
.btn{ 
  padding:10px 14px; border-radius:10px; border:1px solid transparent;
  cursor:pointer; font-weight:600;
}
.btn--primary{
  background:#6750e8; color:#fff; border-color:#5a43d6;
}
.btn--primary:hover{ filter:brightness(.98); }

/* TABELA – WRAP */
.table-wrap{
  overflow:auto;
  border-radius:14px;
  border:1px solid #e6e6ef;
  background:#fff;
  box-shadow: 0 6px 18px rgba(0,0,0,.06);
}

/* TABELA – BAZA */
.table{
  width:100%;
  border-collapse: collapse;
  font-size:15px;
  color:#222;
}
.table thead th{
  position: sticky; top: 0;
  background: linear-gradient(180deg,#fafaff,#f2f2ff);
  color:#333; text-align:left;
  padding:12px 14px;
  font-weight:700; letter-spacing:.2px;
  border-bottom:1px solid #e5e5f0;
  z-index:1;
}
.table tbody td{
  padding:12px 14px;
  border-bottom:1px solid #f0f0f6;
  vertical-align: middle;  /* wyśrodkowanie wertykalne */
}

.table tbody tr:nth-child(2n){
  background:#fcfcff;
}
.table tbody tr:hover{
  background:#f6f4ff;
}

/* Linki w tabeli */
.table .link{
  color:#4b3be0; text-decoration:none; font-weight:600;
}
.table .link:hover{ text-decoration:underline; }

/* === ZNACZNIKI STANU (kropki + tooltip) === */
.table--clients tbody td:first-child{
  position: relative;
  padding-left: 28px;          
}

/* Kropka bazowa (dla wszystkich) */
.table--clients tbody td:first-child::before{
  content:"";
  position:absolute;
  left:10px;
  top:50%; transform:translateY(-50%);
  width:10px; height:10px;
  border-radius:50%;
  background:#fff;
  border:2px solid #333;
  cursor: help; /* żeby widać było, że można najechać */
}

/* zielona kropka (rozliczone) */
.table--clients tr.state-green td:first-child::before{
  background:#22c55e;
  box-shadow:none !important;  /* bez obramowania/cienia */
  border:1px solid #22c55e;
}



/* TOOLTIP – baza (ukryty) */
.table tbody td:first-child::after{
  position:absolute;
  left:28px; top:50%; transform:translateY(-50%);
  background:#333; color:#fff;
  padding:4px 8px; border-radius:6px;
  font-size:12px; white-space:nowrap;
  opacity:0; pointer-events:none;
  transition:opacity .2s ease;
}

/* Pokazanie tooltipa na hover */
.table tbody td:first-child:hover::after{
  opacity:1;
}

/* Teksty tooltipów wg stanu */
.table tbody tr.state-black td:first-child::after{
  content:"Brak problemów";
}
.table tbody tr.state-yellow td:first-child::after{
  content:"Opóźnienia w spłacie";
}
.table tbody tr.state-red td:first-child::after{
  content:"Windykacja";
}

/* Kolory pełne dla stanów */
.table--clients tbody tr.state-red td:first-child::before{
  background:#ff3b30; border-color:#ff3b30;
}
.table--clients tbody tr.state-yellow td:first-child::before{
  background:#ffcc00; border-color:#ffcc00;
}

/* PUSTO */
.empty{
  margin-top:14px; padding:14px 16px; border:1px dashed #ddd; border-radius:10px;
  color:#666; background:#fff;
}

/* RESPONSYWNOŚĆ */
@media (max-width: 720px){
  .filters__input{ min-width: unset; flex:1; }
  .table thead th, .table tbody td{ padding:10px 12px; }
}

.powiadomienia{ margin:20px 0; }
.powiadomienia h2{
  margin:0 0 10px;
  font-size:18px; font-weight:700; color:#333;
}

/* LISTA: kompakt + przewijanie */
.powiadomienia-list{
  display:flex; flex-direction:column; gap:8px;
}
.powiadomienia-list.is-scrollable{
  max-height: 420px;              /* wysokość widoku */
  overflow-y: auto;
  padding-right: 4px;             /* miejsce na scrollbar */
  border:1px solid #e6e6ef;
  border-radius:12px;
  background:#fff;
  box-shadow: 0 3px 10px rgba(0,0,0,.04) inset;
}

/* Niestandardowy, wąski scrollbar (WebKit) */
.powiadomienia-list.is-scrollable::-webkit-scrollbar{ width: 8px; }
.powiadomienia-list.is-scrollable::-webkit-scrollbar-track{ background: transparent; }
.powiadomienia-list.is-scrollable::-webkit-scrollbar-thumb{
  background: #d7d7e4; border-radius: 10px;
}
.powiadomienia-list.is-scrollable::-webkit-scrollbar-thumb:hover{
  background: #c6c6d6;
}

/* KAFELKI: wersja kompaktowa */
.powiadomienie{
  display:grid;
  grid-template-columns: 1fr auto; /* treść + typ po prawej w wierszu meta */
  row-gap: 4px;
  column-gap: 10px;
  background:#fff;
  border:1px solid #e8e8ef;
  border-left:5px solid var(--accent, #999); /* kolor z PHP */
  border-radius:10px;
  padding:8px 12px;
  box-shadow: 0 1px 4px rgba(0,0,0,.04);
}

/* Górny rządek: data po lewej, typ po prawej */
.powiadomienie .meta{
  grid-column: 1 / 3;
  display:flex; justify-content:space-between; align-items:center;
  font-size:12px; color:#777;
}

/* Opis i firma – ciasna typografia, przycięcie do 2 linii */
.powiadomienie .msg{
  grid-column: 1 / 3;
  font-size:14px; line-height:1.35; color:#222;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; text-overflow: ellipsis;
}
.powiadomienie .firma{
  grid-column: 1 / 3;
  font-size:12px; color:#666;
}

/* Kolorowe paski (stan) */
.powiadomienie.czerwony{ border-left-color:#ff3b30; }
.powiadomienie.zielony{  border-left-color:#34c759; }
.powiadomienie.zolty{    border-left-color:#ffcc00; }
.powiadomienie.neutralne{border-left-color:#999; }

/* Hover – subtelny */
.powiadomienie:hover{ background:#fafaff; }

/* Ultra‑kompaktowy wariant – jeśli chcesz jeszcze ciaśniej */
.powiadomienia-list.is-dense .powiadomienie{
  padding:6px 10px;
}
.powiadomienia-list.is-dense .msg{
  -webkit-line-clamp: 1;          /* 1 linia; zmień na 2 jeśli wolisz */
}

/* Grupa przycisków */
.btn-group{
  display:flex; flex-wrap:wrap; gap:10px;
  margin: 12px 0 16px;
}

/* Bazowy przycisk (także dla <a>) */
.btn{
  display:inline-flex; align-items:center; gap:8px;
  text-decoration:none;           /* usuwa podkreślenie */
  font-weight:600;
  padding:10px 14px;
  border-radius:10px;
  border:1px solid transparent;
  cursor:pointer;
  transition:transform .15s ease, filter .15s ease, box-shadow .15s ease;
  line-height:1;
}

/* Stany wspólne */
.btn:hover{ transform: translateY(-1px); filter:brightness(.98); }
.btn:active{ transform: translateY(0); }
.btn:focus-visible{
  outline: none;
  box-shadow: 0 0 0 3px rgba(103,80,232,.25);
}

/* Wariacje kolorystyczne */
.btn--primary{
  background:#6750e8; color:#fff; border-color:#5a43d6;
}
.btn--primary:hover{ filter:brightness(.97); }

/* obrys (neutralny) */
.btn--secondary{
  background:#fff; color:#2b2b35; border-color:#d6d6e6;
}
.btn--secondary:hover{ background:#f7f7ff; }

/* obrys (neutralny) */
.btn--secondary2{
  background:#4caf50; color:#fff; border-color:#d6d6e6;
}
.btn--secondary2:hover{ background:#388e3c; }

/* niebezpieczny (czerwony obrys) */
.btn--danger{
  background:#fff; color:#b42318; border-color:#f1c0bd;
}
.btn--danger:hover{
  background:#fff5f4; border-color:#e79b96;
}

/* Wersja „ghost” (jeśli kiedyś potrzebujesz linku akcji o niskiej randze) */
.btn--ghost{
  background:transparent; color:#4b3be0; border-color:transparent;
}
.btn--ghost:hover{ background:#f3f2ff; }

/* Responsywność — na wąskich ekranach przyciski pełnej szerokości */
@media (max-width: 520px){
  .btn-group{ gap:8px; }
  .btn{ width:100%; justify-content:center; }
}

/* --- Layout: fixed topbar + fixed sidebar, scroll only in .content --- */
:root{
  /* dopasuj, jeśli masz inne wysokości/szerokości */
  --topbar-h: 64px;
  --mainnav-h: 50px;
  --sidebar-w: 240px;
}

/* 1) Wyłącz scroll całej strony, bo scrollem będzie .content */
html, body { height: 100%; }
body { overflow: hidden; }

/* 2) Pasek górny i menu główne przypinamy */
.topbar{
  position: fixed; top: 0; left: 0; right: 0;
  height: var(--topbar-h);
  z-index: 1000;
}
.topbar .topbar__inner{ min-height: var(--topbar-h); }

.mainnav{
  position: fixed; top: var(--topbar-h); left: 0; right: 0;
  height: var(--mainnav-h);
  z-index: 999;
}
.mainnav .mainnav__inner{ min-height: var(--mainnav-h); }

/* 3) Sidebar przypięty po lewej */
.sidebar{
  position: fixed;
  top: calc(var(--topbar-h) + var(--mainnav-h));
  left: 0;
  bottom: 0;
  width: var(--sidebar-w);
  z-index: 998;
  overflow: auto; /* jeśli chcesz, aby długi sidebar miał własny scroll */
}

/* 4) .layout i .content – tylko środek przewijalny */
.layout{
  /* zastępujemy grid – całą kolumnę „rezerwujemy” paddingiem */
  display: block;
  padding-left: var(--sidebar-w);
  /* odsunięcie w dół spod topbar + mainnav */
  margin-top: calc(var(--topbar-h) + var(--mainnav-h));
}

.layout2{
  /* zastępujemy grid – całą kolumnę „rezerwujemy” paddingiem */
  display: block;
  padding-left: 10px;
  /* odsunięcie w dół spod topbar + mainnav */
  margin-top: calc(var(--topbar-h) + var(--mainnav-h));
}

/* kontener przewijany */
.content{
  height: calc(100vh - var(--topbar-h) - var(--mainnav-h));
  overflow: auto;           /* tu dzieje się scroll */
  padding: 20px;            /* własne odstępy, żeby nic nie podjeżdżało pod krawędzie */
}

/* 5) Opcjonalnie: „container” bez ograniczenia szerokości */
.container{ max-width: 100%; }

/* 6) Mobile: na bardzo wąskich ekranach możesz wyłączyć fixed sidebar (overlay/burger) */
@media (max-width: 860px){
  .sidebar{
    position: fixed;
    width: min(78%, 320px);
    transform: translateX(-110%);
    transition: transform .2s ease;
  }
  /* jeśli używasz checkboxa #menuToggle jako burgera */
  .menu-toggle:checked ~ .layout .sidebar{
    transform: translateX(0);
  }
  /* a środek niech ma mniejszy padding-left na mobile */
  .layout{ padding-left: 0; }
}

/* === KARTA KLIENTA === */
.client-card{
  background:#fff;
  border:1px solid #e6e6ef;
  border-radius:14px;
  box-shadow: 0 8px 20px rgba(0,0,0,.06);
  padding:16px;
  margin: 6px 0 18px;
}

.client-header{
  display:grid;
  grid-template-columns: 1fr auto;
  grid-template-areas:
    "title actions"
    "meta  actions";
  row-gap:8px; column-gap:12px;
  align-items:center;
  margin-bottom: 6px;
}
.client-title{
  grid-area:title;
  font-size:22px; font-weight:800; color:#2b2b35; letter-spacing:.2px;
}
.client-meta{
  grid-area:meta;
  display:flex; flex-wrap:wrap; gap:8px;
}
.client-actions{
  grid-area:actions;
  display:flex; gap:8px; align-items:center; justify-content:flex-end;
}

/* Chipy */
.chip{
  display:inline-flex; align-items:center; gap:6px;
  padding:6px 10px;
  border-radius:999px;
  font-size:12px; font-weight:700;
  background:#f4f4fb; color:#3a3a52; border:1px solid #e6e6f4;
}
.chip--status{ padding:6px 10px; }
.chip--ok{     background:#eefbf3; color:#176b3a; border-color:#d8f1e3; }
.chip--warn{   background:#fff8e1; color:#7a5a00; border-color:#ffe6a3; }
.chip--danger{ background:#fff0f0; color:#a01818; border-color:#f5c2c0; }
.chip--done{   background:#e9f2ff; color:#0c4ea3; border-color:#cfe3ff; }

/* Siatka metadanych */
.meta-grid{
  display:grid;
  grid-template-columns: repeat(2, minmax(240px, 1fr));
  gap:10px 18px;
  margin-top: 6px;
}
.meta-grid--narrow{ grid-template-columns: repeat(2, minmax(180px,1fr)); }
.meta-grid > div{ min-width:0; }
.meta-grid dt{
  font-size:12px; color:#6b6b7a; margin:0 0 4px; font-weight:700; text-transform:uppercase; letter-spacing:.4px;
}
.meta-grid dd{
  margin:0; font-size:15px; color:#222; word-break:break-word;
}
.meta-grid .span-2{ grid-column: 1 / -1; }

.subcard{
  margin-top:14px;
  background:#fafaff; border:1px dashed #e0e0f0; border-radius:12px;
  padding:12px;
}
.subcard h3{
  margin:0 0 8px; font-size:16px; color:#353552;
}

/* Przyciski inline w headerze karty */
.client-actions .btn{ height:34px; padding:8px 12px; }
.inline{ display:inline-block; }

/* Tabela rozliczeń – jeśli używasz już .table, to tylko drobne doszlifowanie */
.table--settlements td, .table--settlements th{ white-space:nowrap; }
.table--settlements td:nth-child(3),
.table--settlements td:nth-child(4),
.table--settlements td:nth-child(5),
.table--settlements td:nth-child(6),
.table--settlements td:nth-child(7),
.table--settlements td:nth-child(9),
.table--settlements td:nth-child(10),
.table--settlements td:nth-child(11),
.table--settlements td:nth-child(12){ text-align:right; }

/* Sekcje poniżej (Pliki / Rozliczenia) – lekki odstęp */
.wplaty h2{ margin: 14px 0 8px; }

/* ===== KOMENTARZE ===== */
.card-comments{
  margin-top: 18px;
  background:#fff;
  border:1px solid #e6e6ef;
  border-radius:14px;
  padding:14px;
  box-shadow: 0 6px 16px rgba(0,0,0,.06);
}
.card-comments > h2{
  margin:0 0 10px;
  font-size:18px; font-weight:800; color:#2b2b35;
}

/* Historia */
.comments-history{
  max-height: 300px;            /* przewijanie gdy dużo treści */
  overflow-y: auto;
  border:1px solid #eee;
  border-radius:12px;
  background:#fafaff;
  padding:10px 12px;
  margin-bottom: 12px;
}

/* Każdy komentarz (na razie jeden blok z całym tekstem) */
.comment{
  position: relative;
  padding-left: 12px;
}
.comment::before{
  content:"";
  position:absolute; left:0; top:10px;
  width:6px; height:6px; border-radius:50%;
  background:#c5c5d9; /* neutralny akcent */
}
.comment-content{
  font-size:14px; line-height:1.5; color:#222;
  white-space: normal;           /* z nl2br działa świetnie */
  word-break: break-word;
}

/* Formularz */
.comments-form{
  display:flex; flex-direction:column; gap:8px;
}
.comments-label{
  font-size:12px; color:#6b6b7a; font-weight:700; text-transform:uppercase; letter-spacing:.4px;
}
.comments-textarea{
  width:100%;
  min-height:90px;
  resize: vertical;
  padding:10px 12px;
  border:1px solid #dcdcdc; border-radius:10px;
  background:#fff; color:#222;
  outline: none;
}
.comments-textarea:focus{
  border-color:#6750e8; box-shadow: 0 0 0 4px rgba(103,80,232,.12);
}
.comments-actions{
  display:flex; justify-content:flex-end; gap:10px;
}

/* Węższe ekrany */
@media (max-width: 720px){
  .comments-history{ max-height: 240px; }
}

/* Karty formularza – spójne z panelami/tabelą */
.form-card{
  background:#fff; border:1px solid var(--stroke); border-radius:14px;
  padding:16px; box-shadow:0 6px 18px rgba(0,0,0,.06); 
}
.subcard + .subcard{ margin-top:16px; }
.subcard h3{ margin:0 0 12px; font-size:18px; }

/* Grid pól */
.form-grid{
  display:grid; grid-template-columns: 220px minmax(0, 1fr);
  gap:12px 16px;
}
.form-grid > label{
  align-self:center; color:#444; font-weight:600;
}

/* Wejścia (spójne z .filters__input) */
.input{
  padding:10px 12px; border:1px solid #dcdcdc; border-radius:10px;
  background:#fff; color:#222; outline:none; min-width:0;
}
.input:focus{ border-color:#6750e8; box-shadow:0 0 0 4px rgba(103,80,232,.12); }

/* Akcje */
.form-actions{
  display:flex; gap:10px; justify-content:flex-end;
  margin-top:16px;
}

/* Alert błędu */
.alert{
  padding:10px 12px; border-radius:10px; margin-bottom:12px; font-weight:600;
}
.alert--error{
  background:#fee; border:1px solid #f7c4c4; color:#b42318;
}

.file-row{
  display:flex; align-items:center; gap:12px;
  margin:6px 0;
}
.file-link{
  text-decoration:none; color: var(--brand-700);
}
.file-link:hover{ text-decoration:underline; }

/* Gdybyś miał globalne style modyfikujące przyciski, przywróć natywne: */
.file-delete-form input[type="submit"]{
  all: revert;           /* systemowy wygląd */
  cursor: pointer;
}

.divbtn {
padding-bottom: 20px;
}
.divbtn2 {
padding-top: 20px;
padding-bottom: 20px;
}

/* Aneks: poprawka wyrównania i szerokości pól kwoty */
.table--aneks td:nth-child(3) {        /* kolumna "Kwota raty" */
  text-align: left;                    /* nie pchaj inputu do prawej */
}
.table--aneks td:nth-child(3) .input { /* sam input kwoty */
  width: 220px;        /* lub np. 240px – jak wolisz */
  max-width: 100%;
}

/* (opcjonalnie) ujednolić wysokość pól w tej tabeli */
.table--aneks .input {
  height: 38px;
}

/* Aneks: poprawka wyrównania i szerokości pól kwoty */
.table--aneks td:nth-child(3){ text-align:left; }
.table--aneks td:nth-child(3) .input{ width:220px; max-width:100%; }
.table--aneks .input{ height:38px; } /* opcjonalnie */

/* form jako „przezroczysty” kontener wewnątrz tr */
.row-form{ display: contents; }
.no-wrap{ white-space: nowrap; }

/* pole hasła inline, domyślnie ukryte */
.pw-inline{ display:none; margin-bottom:8px; }
.pw-inline.is-visible{ display:block; }

.badge{ display:inline-block; padding:4px 8px; border-radius:999px; font-size:12px; }
.badge--success{ background:#e8f8ef; color:#0a7d4f; }
.badge--muted{ background:#eee; color:#555; }

/* Sekcje w panelu emaili */
.grid-2 { display:grid; grid-template-columns: 1fr 1fr; gap:16px; }
@media (max-width: 980px){ .grid-2 { grid-template-columns: 1fr; } }

.form label { display:block; margin:8px 0; }
.form input[type="text"],
.form input[type="number"],
.form textarea,
.form select { width:100%; }

.notice{ margin:10px 0; padding:10px 12px; border-radius:10px; font-weight:600; }
.notice.success{ background:#eefbf3; color:#176b3a; border:1px solid #d8f1e3; }
.notice.error{ background:#fff0f0; color:#a01818; border:1px solid #f5c2c0; }

.badge-pill{ display:inline-block; padding:4px 10px; border-radius:999px;
  background:#f4f4fb; border:1px solid #e6e6f4; font-size:12px; color:#3a3a52; }

.table .actions { white-space:nowrap; }
.table .actions .btn { padding:6px 10px; border-radius:8px; font-weight:700; }


/* === Top menu: mobile swipe === */
@media (max-width: 680px){
  .mainnav__inner{
    overflow-x: auto;
    gap: 12px;
    padding: 0 12px;
    -webkit-overflow-scrolling: touch;
  }
  .mainnav__inner::-webkit-scrollbar{ display:none; }
  .mainnav__link{
    flex: 0 0 auto;
    padding: 10px 8px;
    font-size: 14px;
    white-space: nowrap;
  }
  .mainnav__spacer{ display:none; }
  /* logo + user: zmniejsz, żeby nie zjadało miejsca */
  .topbar .brand__name img{ height:40px !important; }
  .topbar .user{ display:none; } /* na mobile zwykle zbędne */
}

/* === Karta klienta – mobile: jeden słupek + ciaśniejsze chipy === */
@media (max-width: 680px){
  .client-header{
    grid-template-columns: 1fr;
    grid-template-areas:
      "title"
      "meta"
      "actions";
    row-gap: 6px;
  }
  .client-title{ font-size: 20px; }
  .client-actions{ justify-content:flex-start; }
  .chip{ font-size: 11px; padding: 5px 8px; }

  .meta-grid{
    grid-template-columns: 1fr;  /* jedna kolumna */
    gap: 8px 12px;
  }
  .meta-grid dt{ font-size: 11px; }
  .meta-grid dd{ font-size: 14px; }
}

/* przycisk 'Zadzwoń' + checkbox 'płatne' jako jeden wiersz / pod sobą */
@media (max-width: 520px){
  .client-actions .btn{ height:auto; }
  .call-actions{ display:flex; gap:8px; align-items:center; }
  .call-actions .btn{ flex:0 0 auto; }
}

/* === Tabele: lepsze przewijanie i mniejsze czcionki na mobile === */
@media (max-width: 720px){
  .table-wrap{ border-radius: 10px; }
  .table thead th, .table tbody td{
    padding: 10px 10px;
    font-size: 13px;
    white-space: nowrap;   /* zawartość nie łamie się i przewija horyzontalnie */
  }
  .form-card dl.meta-grid dd{ word-break: break-word; }
}

/* Karta z podsumowaniem nad tabelą – lekki „card look” */
.form-card{ border-radius:12px; }


/* === Burger i sidebar overlay === */
.burger{
  display:flex; align-items:center; justify-content:center;
  width:36px; height:36px; margin-left:8px; cursor:pointer;
  border-radius:8px; border:1px solid transparent;
}
.burger span{ display:block; width:18px; height:2px; background:#333; margin:3px 0; }

/* Sidebar nad treścią i pełna wysokość */
.sidebar{
  z-index: 1200;            /* ponad topbar/mainnav */
  background: var(--surface);
  box-shadow: 0 8px 24px rgba(0,0,0,.18);
}

/* półprzezroczyste tło przy otwartym menu (kliknięcie zamknie) */
@media (max-width: 860px){
  .layout::after{
    content:""; position:fixed; inset:0; background:rgba(0,0,0,.25);
    opacity:0; pointer-events:none; transition:opacity .2s ease;
  }
  .menu-toggle:checked ~ .layout::after{ opacity:1; pointer-events:auto; }
}

/* odsuń minimalnie treść od krawędzi ekranu */
@media (max-width: 680px){
  .content{ padding: 14px; }
  .panel{ padding:14px; }
}

/* iOS Safari – upewnij się, że h-scroll działa w top menu */
@supports (-webkit-touch-callout: none) {
  .mainnav__inner{ -webkit-overflow-scrolling: touch; }
}

/* mobilne breakpointy – jeszcze węższe progi dla „dużych” iPhone’ów */
@media (max-width: 430px){
  .topbar .user{ display:none; }
  .mainnav__spacer{ display:none; }
  .mainnav__inner{ overflow-x:auto; gap:12px; }
  .mainnav__link{ white-space:nowrap; padding:10px 8px; font-size:14px; }
  .client-header{ grid-template-columns:1fr; }
  .meta-grid{ grid-template-columns:1fr; }
  .table thead th, .table tbody td{ font-size:13px; white-space:nowrap; }
}

/* Burger: domyślnie ukryty (desktop) */
.burger{ display:none; }

/* Na wszelki wypadek wyłącz obrys/focus */
.burger:focus,
.burger:focus-visible{ outline:none; box-shadow:none; }

/* Pokazuj burgera TYLKO na mobile i nadaj mu wygląd */
@media (max-width: 860px){
  .burger{
    display:flex;
    align-items:center;
    justify-content:center;
    width:36px; height:36px;
    border:1px solid #e6e6ef;
    border-radius:10px;
    background:#fff;
    cursor:pointer;
  }
  .burger span{
    display:block;
    width:18px; height:2px;
    background:#333; margin:3px 0;
  }
}

/* kompakt dla dużych tabel rozliczeń */
.table--compact {
  table-layout: fixed;         /* równe, przewidywalne kolumny */
  font-size: 13px;             /* mniejsza czcionka */
  border-collapse: collapse;
  width: 100%;
}

.table--compact th,
.table--compact td {
  padding: 6px 8px;            /* ciaśniej */
  text-align: center;          /* wyśrodkowanie w całej tabeli */
  vertical-align: middle;
  white-space: nowrap;         /* nie łam nagłówków/kwot */
}

.table--compact thead th {
  font-size: 12px;             /* mniejsze nagłówki */
  line-height: 1.15;
}

.table--compact .btn,
.table--compact input[type="submit"] {
  padding: 2px 6px;
  font-size: 12px;
  line-height: 1.1;
}

.table--compact form.inline {
  display: inline-block;
}

/* jeśli masz sticky nagłówek – opcjonalnie */
.table--settlements thead th {
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 1;
}

/* wąski scroll dolny – już masz .table-wrap; zapewnij overflow-x */
.table-wrap {
  overflow-x: auto;
}

.table--settlements td { vertical-align: top; }
.table--settlements .amount { display:block; margin-bottom:6px; }
.table--settlements .paylog  { font-size:12px; line-height:1.25; color:#555; }
.table--settlements .paylog div { white-space:nowrap;}

/* wyraźniejsze tła wierszy */
tr.paid-full { 
  background:#d8f5d0 !important;;           /* zieleń */
  border-left:4px solid #3fa34d;
}
tr.overdue   { 
  background:#ffe8a3 !important;;           /* żółty */
  border-left:4px solid #f0ad4e;
}

.input[disabled] {
		background:#f3f4f6;
		color:#6b7280;
		cursor:not-allowed;
}


  .table-wrap{overflow:auto; -webkit-overflow-scrolling:touch;}
  .table--settlements{
    width:100%;
    border-collapse:collapse;
    table-layout:fixed;            /* ← stały algorytm */
  }
  .table--settlements th,
  .table--settlements td{
    padding:6px 8px;
    border:1px solid #e6e6f0;
    vertical-align:top;
    white-space:nowrap;            /* ← brak łamań w liczbach */
    font-variant-numeric:tabular-nums; /* wyrównane cyfry */
  }
  .table--settlements th{background:#f5f6ff; font-weight:600;}
  .table--settlements tfoot td{background:#fafaff; font-weight:700;}

  /* wyrównania */
  .tc {text-align:center;}
  .tr {text-align:right;}
  .tl {text-align:left;}

  /* sticky nagłówek przy długich tabelach */
  .table--settlements thead th{
    position:sticky; top:0; z-index:2;
  }

  /* pomocnicze – niech sumy/paid/overdue zostaną jak były */
  .table--settlements tbody tr.paid-full { background:#b4f2a5 !important; }
  .table--settlements tbody tr.overdue   { background:#ffd37f !important; }

.powiadomienie.stale-14d {
  border-left: 4px solid #ff9800;
  background: #fff5e6;
}
.powiadomienie .flag {
  font-size: 13px;
  color: #ff9800;
  margin-left: 6px;
}

.table-ksiegowy {
  width: 60%;
  border-collapse: separate;
  border-spacing: 0 6px;
  font-size: 15px;
  margin-top: 20px;
}

.table-ksiegowy thead tr {
  background: #f0f3f9;
  color: #2b2b2b;
  text-transform: uppercase;
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.5px;
}

.table-ksiegowy th {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 2px solid #dbe3f0;
}

.table-ksiegowy td {
  padding: 12px 16px;
  background: #fff;
  border-top: 1px solid #f2f4f7;
  transition: background 0.2s ease;
}

.table-ksiegowy tr:hover td {
  background: #f9fbff;
}

.table-ksiegowy td.right {
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}

.table-ksiegowy tr.total td {
  background: #f6f8fc !important;
  font-weight: 700;
  border-top: 2px solid #cdd6e4;
}

.table-ksiegowy tr td:first-child {
  border-top-left-radius: 6px;
  border-bottom-left-radius: 6px;
}

.table-ksiegowy tr td:last-child {
  border-top-right-radius: 6px;
  border-bottom-right-radius: 6px;
}

input[type="checkbox"]:focus,
input[type="date"]:focus {
  outline: 2px solid purple;
}

.koszta-tab .form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px 32px;
    align-items: center;
}

.koszta-tab .field {
    display: flex;
    flex-direction: column;
}

.koszta-tab .label {
    font-weight: 600;
    margin-bottom: 6px;
}

.koszta-tab .input {
    width: 100%;
    box-sizing: border-box;
    padding: 8px 10px;
    font-size: 15px;
    border-radius: 6px;
}

.koszta-tab .value {
    font-size: 16px;
    font-weight: bold;
    margin-top: 6px;
}

.koszta-tab .actions {
    grid-column: span 2;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 15px;
}

/* Tabela historii */
.koszta-tab table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

.koszta-tab table th,
.koszta-tab table td {
    padding: 8px;
    border-bottom: 1px solid #ddd;
}

.koszta-tab table th {
    text-align: left;
    font-weight: 600;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .koszta-tab .form-grid {
        grid-template-columns: 1fr;
    }
    .koszta-tab .actions {
        grid-column: span 1;
        justify-content: space-between;
    }
}
