/* =========================================================
   SECTION KLIENCI — FINAL CLEAN
   ========================================================= */

/* =========================
   ROOT / HELPERS
========================= */
.section-klienci{
  --kl-card-bg: rgba(10,12,18,.86);
  --kl-soft-bg: rgba(255,255,255,.03);
  --kl-soft-bg-2: rgba(255,255,255,.05);
  --kl-border: rgba(255,255,255,.10);
  --kl-border-soft: rgba(255,255,255,.08);
  --kl-text: #f3f5fb;
  --kl-text-soft: rgba(243,245,251,.68);
  --kl-chip: rgba(255,255,255,.06);
  --kl-chip-active: rgba(255,255,255,.12);
  --kl-input: rgba(255,255,255,.04);
  --kl-shadow: 0 14px 36px rgba(0,0,0,.28);
  --kl-radius-xl: 24px;
  --kl-radius-lg: 18px;
  --kl-radius-md: 14px;
  --kl-row-gap: 12px;

  width:100%;
  display:flex;
  flex-direction:column;
  min-height:0;

  background: var(--kl-card-bg);
  border:1px solid var(--stroke2, var(--kl-border));
  border-radius:24px;
  padding:18px;
  box-sizing:border-box;
}

/* =========================
   CLEANUP
========================= */
.checkbox,
.bulkBar,
.toolbar .bulkLeft,
.toolbar .bulkRight{
  display:none !important;
}

/* jeśli toolbar ma pierwszy rząd z bulk akcjami */
.toolbarRow:first-child:has(.bulkLeft),
.toolbarRow:first-child:has(.bulkRight){
  display:none !important;
}

/* =========================
   HEADER SECTION
========================= */
.card__header{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:16px;
  margin-bottom:12px;
}

.card__title{
  margin:0;
  color:var(--kl-text);
}

.card__subtitle{
  color:var(--kl-text-soft);
}

/* =========================
   TOOLBAR
========================= */
.toolbar{
  display:flex;
  flex-direction:column;
  gap:14px;
  margin-bottom:12px;
}

.toolbarRow{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:14px;
  flex-wrap:wrap;
}

/* układ top row: search po lewej, KPI po prawej */
.toolbarRow--top{
  display:grid;
  grid-template-columns:minmax(360px, 720px) 1fr;
  gap:16px;
  align-items:center;
}

@media (max-width: 1200px){
  .toolbarRow--top{
    grid-template-columns:1fr;
  }
}

/* =========================
   SEARCH
========================= */
.searchBox{
  position:relative;
  width:100%;
  max-width:720px;
}

.searchBox input{
  width:100%;
  height:46px;
  padding:0 44px 0 42px;
  border-radius:14px;
  border:1px solid var(--stroke2, var(--kl-border-soft));
  background:var(--kl-input);
  color:var(--kl-text);
  font-size:14px;
  outline:none;
  box-sizing:border-box;
}

.searchBox input::placeholder{
  color:var(--muted, var(--kl-text-soft));
}

.searchBox input:focus{
  border-color:rgba(255,255,255,.18);
  background:rgba(255,255,255,.05);
}

.searchIcon{
  position:absolute;
  left:14px;
  top:50%;
  transform:translateY(-50%);
  opacity:.72;
  pointer-events:none;
  color:var(--kl-text-soft);
}

.searchClear{
  position:absolute;
  right:10px;
  top:50%;
  transform:translateY(-50%);
  width:28px;
  height:28px;
  border-radius:10px;
  border:1px solid rgba(255,255,255,.12);
  background:rgba(255,255,255,.05);
  color:var(--kl-text-soft);
  cursor:pointer;
}

.searchClear:hover{
  background:rgba(255,255,255,.08);
  color:var(--kl-text);
}

/* =========================
   KPI / CHIPS
========================= */
.chips{
  display:flex;
  justify-content:flex-end;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
}

.chip{
  display:inline-flex;
  align-items:center;
  gap:8px;
  min-height:38px;
  padding:0 14px;
  border-radius:999px;
  background:var(--kl-chip);
  border:1px solid rgba(255,255,255,.10);
  color:#d6ddf4;
  font-weight:700;
  cursor:pointer;
  box-sizing:border-box;
  transition:background .18s ease, border-color .18s ease, color .18s ease, transform .18s ease;
}

.chip:hover{
  background:rgba(255,255,255,.08);
  border-color:rgba(255,255,255,.16);
  color:#eef2ff;
}

.chip.is-active{
  background:rgba(255,255,255,.12);
  border-color:rgba(255,255,255,.18);
  color:#ffffff;
}

.kbd{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-width:22px;
  height:22px;
  padding:0 6px;
  border-radius:999px;
  background:rgba(0,0,0,.28);
  border:1px solid rgba(255,255,255,.08);
  color:#fff;
  font-size:12px;
  line-height:1;
}

/* =========================
   SCROLL WRAPPER
========================= */
.table-wrapper,
.dashScroll{
  min-height:0;
  overflow:auto;
  padding-right:2px;
  border-radius:18px;
}

.table-wrapper::-webkit-scrollbar,
.dashScroll::-webkit-scrollbar{
  width:10px;
  height:10px;
}

.table-wrapper::-webkit-scrollbar-track,
.dashScroll::-webkit-scrollbar-track{
  background:transparent;
}

.table-wrapper::-webkit-scrollbar-thumb,
.dashScroll::-webkit-scrollbar-thumb{
  background:linear-gradient(180deg, #2a2f45, #1c2135);
  border-radius:8px;
  border:2px solid transparent;
  background-clip:padding-box;
}

.table-wrapper::-webkit-scrollbar-thumb:hover,
.dashScroll::-webkit-scrollbar-thumb:hover{
  background:linear-gradient(180deg, #3a4060, #2a2f45);
  background-clip:padding-box;
}

/* =========================
   TABLE CORE
========================= */
.table{
  width:100%;
  border-collapse:separate;
  border-spacing:0 var(--kl-row-gap);
  table-layout:fixed;
}

/* klucz: identyczny układ dla thead i tbody */
.table thead tr,
.table tbody tr{
  display:grid;
  grid-template-columns:
    minmax(190px, 1.45fr)   /* klient */
    minmax(120px, .85fr)    /* tel */
    minmax(240px, 1.55fr)   /* email */
    minmax(120px, .95fr)    /* tagi */
    minmax(96px,  .70fr)    /* raport */
    minmax(110px, .80fr)    /* status */
    minmax(150px, 1.00fr)   /* płatność */
    minmax(180px, 1.05fr);  /* akcje */
  align-items:center;
  column-gap:0;
}

@media (max-width: 1500px){
  .table thead tr,
  .table tbody tr{
    grid-template-columns:
      minmax(170px, 1.35fr)
      minmax(110px, .78fr)
      minmax(220px, 1.45fr)
      minmax(110px, .88fr)
      minmax(90px, .66fr)
      minmax(100px, .74fr)
      minmax(135px, .94fr)
      minmax(165px, .98fr);
  }
}

/* =========================
   HEADER
========================= */
.stickyHead thead{
  position:sticky;
  top:0;
  z-index:3;
}

.stickyHead thead tr{
  position:relative;
}

.stickyHead thead tr::before{
  content:"";
  position:absolute;
  inset:0;
  border-radius:18px;
  background:rgba(255,255,255,.03);
  border:1px solid var(--stroke2, var(--kl-border-soft));
  pointer-events:none;
}

.stickyHead th{
  position:relative;
  z-index:1;
  padding:16px 14px;
  color:rgba(243,245,251,.62);
  font-size:12px;
  font-weight:800;
  text-transform:uppercase;
  letter-spacing:.02em;
  text-align:left;
  box-sizing:border-box;
  white-space:nowrap;
}

/* header alignment */
.stickyHead th:nth-child(5),
.stickyHead th:nth-child(6),
.stickyHead th:nth-child(7){
  text-align:center;
}

.stickyHead th:nth-child(8){
  text-align:right;
}

/* =========================
   ROW CARD
========================= */
.rowCard{
  position:relative;
}

.rowCard::before{
  content:"";
  position:absolute;
  inset:0;
  border-radius:20px;
  background:rgba(255,255,255,.02);
  border:1px solid var(--stroke2, var(--kl-border-soft));
  box-shadow:none;
  pointer-events:none;
}

.rowCard td{
  position:relative;
  z-index:1;
  padding:16px 14px;
  color:var(--kl-text);
  box-sizing:border-box;
  min-width:0;
}

.rowCard:hover::before{
  background:rgba(255,255,255,.035);
  border-color:rgba(255,255,255,.18);
}

/* =========================
   BODY ALIGNMENT
========================= */
.table td:nth-child(5),
.table td:nth-child(6),
.table td:nth-child(7){
  text-align:center;
}

.table td:nth-child(8){
  text-align:right;
}

/* =========================
   NAME / META
========================= */
.table td:nth-child(1){
  min-width:0;
}

.table td:nth-child(1) > div:first-child,
.table td[data-name-cell] > div:first-child{
  font-weight:900;
  color:#fff;
  font-size:15px;
  line-height:1.15;
  word-break:break-word;
}

.small{
  display:block;
  margin-top:4px;
  color:var(--muted, var(--kl-text-soft));
  font-size:12px;
  line-height:1.2;
}

/* =========================
   EMAIL / TAGS OVERFLOW
========================= */
.table td:nth-child(3),
.table td:nth-child(4){
  overflow:hidden;
}

.table td:nth-child(3){
  white-space:nowrap;
  text-overflow:ellipsis;
}

.table td:nth-child(4) .client-tags{
  display:grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)); /* 🔥 zawsze 3 w rzędzie */
  gap:6px;

  align-items:center;
}

/* =========================
   TAG / BADGES
========================= */
.tag,
.badge{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-height:28px;
  padding:0 10px;
  border-radius:999px;
  background:rgba(255,255,255,.08);
  border:1px solid rgba(255,255,255,.08);
  font-size:12px;
  line-height:1;
  white-space:nowrap;
  box-sizing:border-box;
}

.tag-muted{
  color:rgba(255,255,255,.55);
}

.tag--ok{
  color:#d7ffe8;
  border-color:rgba(25, 190, 110, .22);
  background:rgba(25, 190, 110, .10);
}

.tag--warn{
  color:#ffe6b3;
  border-color:rgba(255, 183, 0, .20);
  background:rgba(255, 183, 0, .10);
}

.tag--danger{
  color:#ffd0d6;
  border-color:rgba(255, 80, 110, .20);
  background:rgba(255, 80, 110, .10);
}

.tag--teal{
  color:#d7f5ff;
  border-color:rgba(80, 180, 255, .18);
  background:rgba(80, 180, 255, .10);
}

.tag--gold{
  color:#fff0c6;
  border-color:rgba(212,176,106,.24);
  background:rgba(212,176,106,.12);
}

/* =========================
   ACTIONS
========================= */
.actionsCell{
  display:flex;
  justify-content:flex-end;
  align-items:center;
  gap:10px;
  flex-wrap:nowrap;
}

.iconBtn{
  width:36px;
  height:36px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  border-radius:12px;
  border:1px solid var(--stroke2, var(--kl-border-soft));
  background:rgba(0,0,0,.18);
  color:#e8ecf8;
  transition:background .18s ease, border-color .18s ease, transform .18s ease;
}

.iconBtn:hover{
  background:rgba(255,255,255,.06);
  border-color:rgba(255,255,255,.14);
  transform:translateY(-1px);
}

/* =========================
   EMPTY STATE
========================= */
.rowCard td[colspan]{
  text-align:left !important;
  padding:22px 16px;
}

/* =========================
   MOBILE / SMALLER WIDTH
========================= */
@media (max-width: 1180px){
  .chips{
    justify-content:flex-start;
  }

  .table thead tr,
  .table tbody tr{
    grid-template-columns:
      minmax(160px, 1.25fr)
      minmax(110px, .75fr)
      minmax(200px, 1.30fr)
      minmax(100px, .80fr)
      minmax(84px,  .62fr)
      minmax(95px,  .68fr)
      minmax(120px, .84fr)
      minmax(150px, .90fr);
  }

  .rowCard td,
  .stickyHead th{
    padding:14px 12px;
  }
}

/* jeśli kiedyś sekcja będzie zbyt wąska */
@media (max-width: 980px){
  .table-wrapper,
  .dashScroll{
    overflow-x:auto;
  }

  .table{
    min-width:1180px;
  }
}
/* =========================
   🔥 WIĘKSZE ODSTĘPY MIĘDZY WIERSZAMI
========================= */
.table{
  border-spacing:0 18px; /* było 12–14 → teraz więcej powietrza */
}

/* opcjonalnie jeszcze bardziej „premium spacing” */
.rowCard td{
  padding-top:20px;
  padding-bottom:20px;
}


/* =========================
   🔥 PŁATNOŚĆ — PRZESUNIĘCIE W LEWO
========================= */

/* kolumna płatność */
.table td:nth-child(7),
.stickyHead th:nth-child(7){
  padding-right:30px; /* 👈 odsuwa od akcji */
}

/* dodatkowy fine-tuning (opcjonalnie) */
.table td:nth-child(7){
  transform:translateX(-6px); /* lekkie optyczne przesunięcie */
}


/* =========================
   🔥 ACTIONS — DELIKATNIE PRAWO
========================= */
.actionsCell{
  padding-left:6px;
}


/* =========================
   🔥 ROW CARD — LEPSZY ODDECH
========================= */
.rowCard::before{
  border-radius:22px;
}
/* =========================
   🔥 REAL GAP MIĘDZY KLIENTAMI (WORKING)
========================= */

/* usuń stare spacingi (bo grid je ignoruje) */
.table{
  border-spacing:0; 
}

/* robimy prawdziwy gap */
.table tbody{
  display:flex;
  flex-direction:column;
  gap:18px; /* 👈 TU kontrolujesz odstęp */
}

/* każdy wiersz jako blok */
.table tbody tr{
  display:grid;
}


/* =========================
   🔥 KARTA — LEPSZE ODDZIELENIE
========================= */

.rowCard::before{
  inset:0;
  border-radius:22px;
  background:rgba(255,255,255,.025);
  border:1px solid rgba(255,255,255,.08);
}

/* hover bardziej wyraźny */
.rowCard:hover::before{
  background:rgba(255,255,255,.04);
  border-color:rgba(255,255,255,.18);
  box-shadow:
    0 18px 50px rgba(0,0,0,.55),
    0 0 0 1px rgba(212,176,106,.15) inset;
}


/* =========================
   🔥 ODDECH W ŚRODKU
========================= */
.rowCard td{
  padding:22px 18px;
}
/* =========================
   🔥 GAP MIĘDZY WIERSZAMI (MNIEJSZY)
========================= */
.table tbody{
  display:flex;
  flex-direction:column;
  gap:12px; /* 👈 było 18 → teraz bardziej elegancko */
}


/* =========================
   🔥 ODSTĘP OD HEADERA
========================= */
.table thead{
  display:block;
  margin-bottom:10px; /* 👈 KLUCZOWE – oddech od nagłówka */
}

.table thead tr{
  margin-bottom:0;
}


/* =========================
   🔥 DELIKATNY BALANS KARTY
========================= */
.rowCard td{
  padding:18px 16px; /* trochę ciaśniej niż 22px */
}


/* =========================
   🔥 MICRO-TUNING (lepszy rytm)
========================= */
.rowCard::before{
  border-radius:20px;
}