/* ── Reset & base ──────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Segoe UI', system-ui, Arial, sans-serif;
  font-size: 13px;
  background: #f0f2f5;
  color: #1a1a2e;
  min-height: 100vh;
}

/* ── Header ────────────────────────────────────────────────────────────── */
header {
  background: linear-gradient(135deg, #1f3864 0%, #2e75b6 100%);
  padding: 14px 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
}

h1 {
  color: #fff;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: .5px;
}

/* ── Tabs bar ───────────────────────────────────────────────────────────── */
.tabs-bar {
  display: flex;
  flex-wrap: nowrap;          /* jeden rząd */
  overflow-x: auto;           /* przewijany poziomo */
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;      /* ukryj scrollbar (Firefox) */
  gap: 3px;
  padding: 10px 12px 0;
  background: #e4eaf2;
  border-bottom: 2px solid #2e75b6;
}
.tabs-bar::-webkit-scrollbar { display: none; } /* ukryj scrollbar (Chrome/Safari) */

.tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 14px;
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  color: #2e4a7a;
  background: #d0dcea;
  border: 1px solid #b0c4de;
  border-bottom: none;
  border-radius: 6px 6px 0 0;
  cursor: pointer;
  transition: background .15s, color .15s;
  white-space: nowrap;
}
.tab-btn:hover  { background: #bdd3ee; color: #1f3864; }
.tab-btn.active {
  background: #fff;
  color: #1f3864;
  font-weight: 700;
  border-color: #2e75b6;
  border-bottom: 2px solid #fff;
  position: relative;
  top: 1px;
  z-index: 2;
}

/* badge – liczba zdjęć */
.ibadge {
  display: inline-block;
  background: #ed7d31;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  border-radius: 9px;
  padding: 0 5px;
  line-height: 16px;
  min-width: 16px;
  text-align: center;
}

/* ── Main content ───────────────────────────────────────────────────────── */
main { padding: 0; }

.tab-pane {
  background: #fff;
  border: 1px solid #2e75b6;
  border-top: none;
}

/* ── Table wrapper ──────────────────────────────────────────────────────── */
.tbl-wrap {
  overflow-x: auto;
  overflow-y: auto;
  max-height: calc(100vh - 110px);
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x pan-y;
}

/* Wiersze z treścią tylko poza ekranem – małe oznaczenie */
tr.offscreen-only td.sc0::after {
  content: '▶';
  font-size: 9px;
  color: #aaa;
  margin-left: 4px;
}

/* ── Table base ─────────────────────────────────────────────────────────── */
table {
  border-collapse: collapse;
  font-size: 12px;
  width: max-content;
}

td, th {
  border: 1px solid #d0d8e4;
  padding: 4px 7px;
  min-width: 26px;
  vertical-align: middle;
  line-height: 1.35;
  white-space: nowrap;
}

/* ── Nagłówki (thead) ────────────────────────────────────────────────────── */
thead th {
  background: #dce6f5;
  font-weight: 600;
  position: sticky;
  top: 0;
  z-index: 3;
  border-bottom: 2px solid #2e75b6;
}

/* ── Wiersz dat ──────────────────────────────────────────────────────────── */
tr.row-dates td,
tr.row-dates th {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .3px;
  border-top: 2px solid #2e75b6;
  border-bottom: 2px solid #2e75b6;
}

/* ── Serwisanci – wiersz z imieniem ─────────────────────────────────────── */
tr.row-techname td {
  background: #1f3864 !important;
  color: #ffffff !important;
  font-weight: 700;
  font-size: 12px;
  border-color: #16305a;
}
/* sticky w wierszu serwisanta – zachowaj ciemny kolor */
tr.row-techname .sc0,
tr.row-techname .sc1 {
  background: #1f3864 !important;
  color: #fff !important;
}

/* ── Wiersz z tablicą rejestracyjną / telefonem ─────────────────────────── */
tr.row-plate td {
  background: #f5f7fb;
  color: #555;
  font-size: 11px;
  font-style: italic;
}
tr.row-plate .sc0,
tr.row-plate .sc1 {
  background: #edf1f8 !important;
}

/* ── Zebra dla zwykłych wierszy danych ──────────────────────────────────── */
tbody tr:not(.row-techname):not(.row-plate):not(.row-dates):nth-child(even) td {
  background-color: #fafbfd;
}

/* ── Hover ───────────────────────────────────────────────────────────────── */
tbody tr:hover td { filter: brightness(.96); }
tbody tr.row-techname:hover td { filter: brightness(1.1); }

/* ── Sticky kolumny (Serwisy) ────────────────────────────────────────────── */
.sc0, .sc1 {
  position: sticky;
  z-index: 2;
  background: #fff;
  /* cień oddzielający od scrollowanej treści */
}
.sc0 {
  left: 0;
  min-width: 120px;
  max-width: 140px;
  border-right: 1px solid #b0c4de;
}
.sc1 {
  left: 130px;
  min-width: 90px;
  max-width: 110px;
  border-right: 2px solid #2e75b6;
  box-shadow: 3px 0 6px -2px rgba(0,0,0,.18);
}

/* sticky w nagłówku – wyższy z-index */
thead th.sc0 { z-index: 5; background: #dce6f5; }
thead th.sc1 { z-index: 5; background: #dce6f5; }

/* ── Podświetlenie dzisiaj ──────────────────────────────────────────────── */
td.today, th.today {
  outline: 2px solid #ed7d31;
  outline-offset: -2px;
}

/* ── Responsywność ──────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  header       { padding: 10px 14px; }
  h1           { font-size: 15px; }
  .tabs-bar    { padding: 8px 8px 0; gap: 2px; }
  .tab-btn     { font-size: 11px; padding: 6px 10px; }
  td, th       { font-size: 11px; padding: 3px 5px; }
  .tbl-wrap    { max-height: calc(100vh - 90px); }
  /* Sticky kolumny – węższe na małym ekranie */
  .sc0         { min-width: 80px; max-width: 100px; }
  .sc1         { left: 90px; min-width: 70px; max-width: 90px; }
}
