/* ============================================================
   Zlecenia Online — Portal Pracownika
   Design system "Premium" — refined enterprise UI
   ============================================================ */

:root {
  /* Surfaces */
  --bg:            #F5F6F8;
  --surface:       #FFFFFF;
  --surface-2:     #FAFAFB;
  --surface-3:     #F4F5F7;

  /* Borders */
  --border:        #E9EAEE;
  --border-strong: #DCDEE4;
  --hairline:      #EEF0F3;

  /* Text */
  --text:          #16181D;
  --text-2:        #565A66;
  --text-muted:    #8A8F9C;
  --text-faint:    #AEB2BD;

  /* Brand — BISAR (granat + czerwień z logo) */
  --primary:       #17244C;
  --primary-600:   #17244C;
  --primary-700:   #101A38;
  --primary-50:    #ECEEF4;
  --primary-100:   #D5DAE6;
  --primary-tint:  #F2F4F8;
  --accent:        #EE3033;
  --accent-hover:  #D81E22;

  /* Semantic */
  --success:       #047857;
  --success-bg:    #ECFDF4;
  --success-bd:    #A7F3D0;
  --warning:       #B45309;
  --warning-bg:    #FFFBEB;
  --warning-bd:    #FDE9B8;
  --danger:        #BE123C;
  --danger-bg:     #FFF1F3;
  --danger-bd:     #FECDD6;
  --info:          #1D4ED8;
  --info-bg:       #EFF4FF;
  --info-bd:       #C7D7FE;

  /* Sidebar (deep, neutral, premium dark) */
  --sb-bg:         #17244C;
  --sb-bg-2:       #101A38;
  --sb-item:       rgba(255,255,255,.60);
  --sb-item-hover: rgba(255,255,255,.04);
  --sb-item-active:rgba(255,255,255,.07);
  --sb-divider:    rgba(255,255,255,.07);

  /* Radii */
  --r-sm: 8px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 18px;

  /* Shadows — layered, soft */
  --shadow-xs: 0 1px 2px rgba(20,22,33,.04);
  --shadow-sm: 0 1px 2px rgba(20,22,33,.05), 0 1px 1px rgba(20,22,33,.03);
  --shadow-md: 0 2px 4px rgba(20,22,33,.04), 0 6px 16px rgba(20,22,33,.06);
  --shadow-lg: 0 10px 30px rgba(20,22,33,.10), 0 3px 8px rgba(20,22,33,.05);
  --shadow-primary: 0 1px 2px rgba(23,36,76,.30), 0 4px 12px rgba(23,36,76,.22);
}

*,*::before,*::after { box-sizing: border-box; }
html,body { margin: 0; padding: 0; }
body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'cv02','cv03','cv04','cv11';
  letter-spacing: -0.006em;
}

/* ---- Layout shell ---- */
.app-shell { min-height: 100vh; display: flex; }

.sidebar {
  width: 248px;
  background: linear-gradient(180deg, var(--sb-bg) 0%, var(--sb-bg-2) 100%);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 40;
  transition: transform .26s cubic-bezier(.4,0,.2,1);
  border-right: 1px solid rgba(255,255,255,.04);
}
.sidebar-brand {
  height: 60px;                 /* równo z .topbar (60px) — dolne krawędzie linii poziomych na tej samej wysokości */
  box-sizing: border-box;
  padding: 0 20px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;      /* logo i podtytuł równo przy lewej (bez tego img rozciąga się i SVG centruje się w prawo) */
  justify-content: center;
  gap: 2px;
  border-bottom: 1px solid var(--sb-divider);
}
.sidebar-brand .sub { font-size: 10px; font-weight: 500; letter-spacing: .04em; color: rgba(255,255,255,.55); }
.sidebar-brand-icon {
  width: 38px; height: 38px;
  background: linear-gradient(135deg, var(--accent) 0%, #FF5A5C 100%);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(238,48,51,.35);
}
.sidebar-brand-text { font-weight: 700; font-size: 14px; line-height: 1.15; letter-spacing: .01em; }
.sidebar-brand-text .sub { font-weight: 500; font-size: 10px; opacity: .5; letter-spacing: .14em; }

.sidebar-nav { flex: 1; padding: 16px 12px; overflow-y: auto; }
.sidebar-nav-label {
  font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .09em;
  color: rgba(255,255,255,.34); padding: 10px 12px 8px;
}
.sidebar-nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 12px; border-radius: var(--r-md);
  color: var(--sb-item); font-size: 13.5px; font-weight: 500;
  cursor: pointer; text-decoration: none;
  transition: background .15s, color .15s, box-shadow .15s;
  margin-bottom: 2px;
  position: relative;
}
.sidebar-nav-item:hover { background: var(--sb-item-hover); color: rgba(255,255,255,.92); }
.sidebar-nav-item.active {
  background: var(--sb-item-active); color: #fff;
  box-shadow: inset 3px 0 0 var(--accent), inset 0 0 0 1px rgba(255,255,255,.04);
}
.sidebar-nav-item.active svg { color: #FFFFFF; }
.sidebar-nav-item svg { width: 18px; height: 18px; flex-shrink: 0; opacity: .9; }
.sidebar-nav-item .badge {
  margin-left: auto;
  background: var(--primary); color: #fff; font-size: 10px; font-weight: 700;
  padding: 2px 6px; border-radius: 20px;
}

.sidebar-footer { padding: 12px; border-top: 1px solid var(--sb-divider); }

.main {
  flex: 1;
  min-width: 0; /* pozwala flex-childowi kurczyć się poniżej min-content treści (anty poziome przepełnienie na mobile) */
  margin-left: 248px;
  min-height: 100vh;
  display: flex; flex-direction: column;
  transition: margin-left .26s cubic-bezier(.4,0,.2,1);
}
/* Zwinięte menu (desktop) — hamburger chowa sidebar i rozszerza treść */
.app-shell.nav-collapsed .sidebar { transform: translateX(-100%); }
.app-shell.nav-collapsed .main { margin-left: 0; }

.topbar {
  background: var(--surface);
  height: 60px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px;
  position: sticky; top: 0; z-index: 30;
}
.topbar-burger { display: inline-flex; background: none; border: none; cursor: pointer; padding: 8px; margin-right: 4px; }
.topbar-burger svg { width: 22px; height: 22px; color: var(--text); }
.topbar-user { display: flex; align-items: center; gap: 10px; padding: 5px 8px 5px 6px; border-radius: var(--r-md); cursor: pointer; transition: background .15s; }
.topbar-user:hover { background: var(--surface-3); }
.topbar-user-avatar {
  width: 32px; height: 32px;
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 12.5px;
}

.content { flex: 1; padding: 28px; max-width: 1240px; width: 100%; margin: 0 auto; }

/* Menu użytkownika (rozwijane spod avatara w prawym górnym rogu) */
.topbar-user { background: none; border: none; font-family: inherit; }
.user-menu {
  display: none; position: absolute; right: 0; top: calc(100% + 6px);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md); box-shadow: 0 10px 30px rgba(20,22,33,.16);
  min-width: 190px; padding: 6px; z-index: 50;
}
.user-menu.open { display: block; }
.user-menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 9px 11px; border: none; background: none; cursor: pointer;
  border-radius: 8px; font-size: 13.5px; font-weight: 500; color: var(--text);
  text-align: left; font-family: inherit;
}
.user-menu-item:hover { background: var(--surface-3); }
.user-menu-item svg { width: 16px; height: 16px; color: #8A8F9C; flex-shrink: 0; }

/* ---- Typography helpers ---- */
h1,h2,h3 { letter-spacing: -0.02em; }

/* ---- Card ---- */
.card {
  background: var(--surface);
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  padding: 22px;
  box-shadow: var(--shadow-sm);
}
.card-header { display: flex; align-items: start; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.card-title { font-size: 16.5px; font-weight: 650; color: var(--text); margin: 0; letter-spacing: -0.02em; }
.card-subtitle { font-size: 13px; color: var(--text-2); margin-top: 3px; }

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 16px; border-radius: var(--r-sm);
  font-weight: 600; font-size: 13.5px; letter-spacing: -0.01em;
  cursor: pointer; border: 1px solid transparent;
  transition: all .15s cubic-bezier(.4,0,.2,1);
  text-decoration: none; white-space: nowrap;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn svg { width: 16px; height: 16px; }
.btn-primary {
  background: linear-gradient(180deg, #243660 0%, var(--primary) 100%);
  color: #fff; box-shadow: var(--shadow-primary);
}
.btn-primary:hover:not(:disabled) { background: linear-gradient(180deg, #1B2A52 0%, var(--primary-700) 100%); transform: translateY(-1px); }
.btn-primary:active:not(:disabled) { transform: translateY(0); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); box-shadow: var(--shadow-xs); }
.btn-secondary:hover:not(:disabled) { background: var(--surface-2); border-color: #CBD0D9; }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-3); color: var(--text); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #9F1239; }
.btn-sm { padding: 6px 11px; font-size: 12.5px; border-radius: 7px; }
.btn-sm svg { width: 14px; height: 14px; }
.btn-lg { padding: 11px 22px; font-size: 14.5px; }
.btn-block { width: 100%; }

/* ---- Input ---- */
.input, .select, .textarea {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  padding: 10px 12px;
  font-size: 13.5px; color: var(--text);
  font-family: inherit;
  transition: border-color .15s, box-shadow .15s;
}
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3.5px var(--primary-50);
}
.input::placeholder { color: var(--text-faint); }
.textarea { resize: vertical; min-height: 80px; line-height: 1.5; }
.label { display: block; font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.label-hint { font-weight: 400; color: var(--text-muted); font-size: 12px; }
.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%238A8F9C' stroke-width='2' viewBox='0 0 24 24'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px;
}

/* ---- Calendar ---- */
.calendar { background: var(--surface); }
.cal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.cal-title { font-size: 19px; font-weight: 700; color: var(--text); letter-spacing: -0.02em; }
.cal-nav-btn {
  width: 36px; height: 36px;
  border: 1px solid var(--border-strong); background: var(--surface);
  border-radius: var(--r-sm); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-2);
  transition: all .15s; box-shadow: var(--shadow-xs);
}
.cal-nav-btn:hover { background: var(--surface-2); border-color: #CBD0D9; color: var(--text); }
.cal-nav-btn svg { width: 16px; height: 16px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 7px; }
.cal-day-label {
  text-align: center;
  /* --text-2 zamiast --text-muted: 3.2:1 → 6.9:1 (WCAG 1.4.3) — jedyna wskazówka,
     która kolumna to sobota/niedziela (audyt mobilny v7). */
  font-size: 11px; font-weight: 600; color: var(--text-2);
  padding: 6px 0 8px;
  text-transform: uppercase; letter-spacing: .05em;
}
.cal-cell {
  aspect-ratio: 1.25;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 14px; color: var(--text);
  cursor: pointer;
  transition: all .13s cubic-bezier(.4,0,.2,1);
  user-select: none;
  position: relative;
  /* dotyk: bez opóźnienia 300ms i bez double-tap-zoom przy seryjnym zaznaczaniu dni */
  touch-action: manipulation;
}
/* :hover tylko dla realnych kursorów — na dotyku emulowany hover „przykleja się"
   po tapnięciu i wygląda jak trzeci stan zaznaczenia (audyt mobilny v7). */
@media (hover: hover) and (pointer: fine) {
  .cal-cell:hover:not(.outside):not(.disabled):not(.ro) {
    background: var(--primary-tint); border-color: var(--primary);
    transform: translateY(-1px); box-shadow: var(--shadow-sm);
  }
  /* Swoistość MUSI przebić regułę wyżej: `.cal-cell.unavailable:hover` to (0,3,0), a generyczny
     hover z dwoma :not() to (0,4,0) — więc wygrywał i zaznaczony dzień pod kursorem dostawał
     JASNE tło, zachowując `color:#fff` z .unavailable → biała cyfra na białym tle, nieczytelna
     (zgłoszenie 2026-07-20). Dorównanie :not()-ami daje (0,5,0) i przywraca ciemną czerwień. */
  .cal-cell.unavailable:hover:not(.outside):not(.disabled):not(.ro) {
    background: #C01A1E; border-color: #C01A1E; color: #fff;
  }
}
/* Podgląd bez edycji (kadry, miesiąc zamknięty): renderCal nie podpina nasłuchów, więc komórka
   nie może udawać klikalnej — bez „rączki" i bez reakcji na kursor. */
.cal-cell.ro { cursor: default; }

/* Strzałki przewijania miesięcy — wyraźnie większe od zwykłego btn-sm; to główna nawigacja
   w karcie osoby, a nie akcja poboczna. Kwadratowe, żeby znak ‹ › był optycznie wyśrodkowany. */
.cal-nav {
  width: 46px; height: 46px; padding: 0;
  font-size: 26px; line-height: 1; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.cal-cell:active:not(.outside):not(.disabled) { transform: scale(.96); }
.cal-cell.outside { background: var(--surface-3); color: var(--text-faint); cursor: default; border-color: transparent; }
.cal-cell.unavailable {
  /* --accent-hover (#D81E22) zamiast --accent: biały tekst 4.1:1 → 5.1:1 (WCAG AA)
     na najważniejszych komórkach siatki (zaznaczone dni). */
  background: var(--accent-hover); border-color: #C01A1E; color: #fff; font-weight: 700;
  box-shadow: 0 1px 4px rgba(238,48,51,.35);
}
.cal-cell.today { box-shadow: 0 0 0 2px var(--primary), 0 2px 6px rgba(79,70,229,.25); }
.cal-cell.disabled { cursor: not-allowed; opacity: .55; }
.cal-cell.coord-edited::after {
  content: ''; position: absolute; top: 5px; right: 5px;
  width: 7px; height: 7px; background: var(--warning); border-radius: 50%;
  border: 1.5px solid var(--surface);
}

/* ---- Kalendarze obok siebie + wariant kompaktowy (TYLKO panel obsługi) ----
   Karta osoby pokazuje kilka miesięcy naraz; na szerokim ekranie mają stać obok siebie,
   a nie jeden pod drugim. auto-fit + minmax sam zwija do jednej kolumny na wąskim ekranie.

   UWAGA: .cal-cell jest WSPÓŁDZIELONE z portalem zleceniobiorcy (ten sam styles.css), gdzie
   obowiązują cele dotykowe 44-45 px (audyt mobilny v7, ~3,7 tys. osób na telefonach). Dlatego
   zmniejszenie komórek jest zamknięte w osobnej klasie .cal-compact ORAZ progu min-width:900px —
   poniżej niego (także dla koordynatora edytującego z telefonu) komórki wracają do pełnego rozmiaru. */
/* minmax(280px, 380px), a NIE 1fr: przy dwóch miesiącach `1fr` rozciągnąłby każdy kalendarz na pół
   ekranu i komórki zrobiłyby się WIĘKSZE, nie mniejsze. Górny limit trzyma je zwarte i zostawia
   miejsce na trzeci miesiąc, gdyby availability_months_ahead urosło. */
.cal-multi { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 380px)); gap: 14px; margin-bottom: 16px; justify-content: start; }
@media (min-width: 900px) {
  .cal-compact .cal-header { margin-bottom: 10px; }
  .cal-compact .cal-title { font-size: 15px; }
  .cal-compact .cal-grid { gap: 4px; }
  .cal-compact .cal-day-label { font-size: 10px; padding: 3px 0 5px; letter-spacing: .03em; }
  .cal-compact .cal-cell { aspect-ratio: 1; font-size: 12px; border-radius: 7px; }
}

/* ---- Legend ---- */
.legend-item { display: flex; align-items: start; gap: 11px; }
.legend-swatch {
  width: 26px; height: 26px; border-radius: 7px; flex-shrink: 0;
  border: 1px solid var(--border-strong);
}
.legend-swatch.available { background: var(--surface); }
.legend-swatch.unavailable { background: var(--accent-hover); border-color: #C01A1E; } /* = kolor komórek */
.legend-swatch.outside { background: var(--surface-3); border-color: transparent; }

/* ---- Badges ---- */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2.5px 9px; border-radius: 6px;
  font-size: 11.5px; font-weight: 600; letter-spacing: -0.01em;
  white-space: nowrap; border: 1px solid transparent;
}
.badge-success { background: var(--success-bg); color: var(--success); border-color: var(--success-bd); }
.badge-warning { background: var(--warning-bg); color: var(--warning); border-color: var(--warning-bd); }
.badge-danger  { background: var(--danger-bg); color: var(--danger); border-color: var(--danger-bd); }
.badge-info    { background: var(--info-bg); color: var(--info); border-color: var(--info-bd); }
.badge-gray    { background: var(--surface-3); color: var(--text-2); border-color: var(--border); }

/* ---- Stat tile ---- */
.stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 20px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .2s, transform .2s;
}
.stat:hover { box-shadow: var(--shadow-md); }
.stat-label { font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .045em; }
.stat-value { font-size: 27px; font-weight: 700; color: var(--text); margin-top: 8px; letter-spacing: -0.03em; line-height: 1.1; }
.stat-trend { display: flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; margin-top: 8px; }
.stat-trend.up { color: var(--success); }
.stat-trend.down { color: var(--danger); }

/* ---- Table ---- */
.tbl { width: 100%; border-collapse: collapse; }
.tbl thead th {
  text-align: left;
  font-size: 11px; font-weight: 600; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .05em;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.tbl tbody td { padding: 13px 16px; border-bottom: 1px solid var(--hairline); font-size: 13.5px; vertical-align: middle; }
/* Badge w komórce tabeli: przytnij wielokropkiem zamiast wyjść na sąsiednią kolumnę.
   .badge ma white-space:nowrap i nie miał max-width, a tabela „Zleceniobiorcy" jest
   table-layout:fixed (Projekt 17%) — długie nazwy spółek („TRUVANT EUROPE SPÓŁKA Z OGRANICZONĄ
   ODPOWIEDZIALNOŚCIĄ") nachodziły na kolumnę Kontakt. Pełna nazwa zostaje w title= (tooltip). */
.tbl tbody td .badge { max-width: 100%; overflow: hidden; text-overflow: ellipsis; display: inline-block; }
.tbl tbody tr { transition: background .12s; }
.tbl tbody tr:hover { background: var(--surface-2); }
.tbl tbody tr:last-child td { border-bottom: none; }
.tbl-actions { display: flex; gap: 6px; justify-content: flex-end; }

/* ---- Avatar ---- */
.avatar {
  width: 36px; height: 36px;
  border-radius: 9px;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 13px; color: #fff;
  flex-shrink: 0;
}
.avatar-sm { width: 30px; height: 30px; border-radius: 8px; font-size: 11px; }
.avatar-lg { width: 54px; height: 54px; border-radius: 12px; font-size: 18px; }

/* ---- Banner ---- */
.banner {
  display: flex; align-items: start; gap: 12px;
  padding: 14px 16px; border-radius: var(--r-md);
  font-size: 13.5px; line-height: 1.5;
}
.banner-info    { background: var(--info-bg); color: #1E3A8A; border: 1px solid var(--info-bd); }
.banner-warning { background: var(--warning-bg); color: #78350F; border: 1px solid var(--warning-bd); }
.banner-danger  { background: var(--danger-bg); color: #881337; border: 1px solid var(--danger-bd); }
.banner-success { background: var(--success-bg); color: #064E3B; border: 1px solid var(--success-bd); }
.banner svg { flex-shrink: 0; width: 19px; height: 19px; margin-top: 1px; }

/* ---- Toast ---- */
.toast {
  pointer-events: auto;
  min-width: 290px; max-width: 380px;
  background: var(--surface);
  border-radius: var(--r-md);
  padding: 13px 15px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  display: flex; align-items: start; gap: 11px;
  animation: slideInRight .26s cubic-bezier(.4,0,.2,1);
  position: relative; overflow: hidden;
}
.toast::before { content:''; position:absolute; left:0; top:0; bottom:0; width:3px; background: var(--primary); }
.toast.success::before { background: var(--success); }
.toast.error::before   { background: var(--danger); }
.toast.warning::before { background: var(--warning); }
@keyframes slideInRight { from{transform:translateX(24px); opacity:0} to{transform:translateX(0); opacity:1} }

/* ---- Modal ---- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(20,22,33,.50);
  display: flex; align-items: center; justify-content: center;
  z-index: 50; padding: 20px;
  animation: fadeIn .2s ease-out;
}
.modal {
  background: var(--surface); border-radius: var(--r-xl);
  max-width: 480px; width: 100%;
  max-height: 90vh; overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: slideUp .26s cubic-bezier(.4,0,.2,1);
  border: 1px solid var(--border);
}
.modal-header { padding: 22px 24px 16px; border-bottom: 1px solid var(--hairline); }
.modal-body { padding: 20px 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--hairline); display: flex; gap: 8px; justify-content: flex-end; }

@keyframes fadeIn { from{opacity:0} to{opacity:1} }
@keyframes slideUp { from{opacity:0; transform:translateY(12px) scale(.99)} to{opacity:1; transform:translateY(0) scale(1)} }

/* ---- Tabs ---- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 22px; }
.tab {
  padding: 10px 16px;
  font-size: 13.5px; font-weight: 600; color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all .15s;
  background: none; border-top: none; border-left: none; border-right: none;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ---- Progress ---- */
.progress { height: 7px; background: var(--surface-3); border-radius: 20px; overflow: hidden; }
.progress-bar { height: 100%; background: var(--primary); border-radius: 20px; transition: width .4s cubic-bezier(.4,0,.2,1); }
.progress-bar.success { background: var(--success); }
.progress-bar.warning { background: #D97706; }
.progress-bar.danger { background: var(--danger); }

/* ---- Empty state ---- */
.empty { padding: 52px 20px; text-align: center; }
.empty-icon {
  width: 52px; height: 52px; margin: 0 auto 16px;
  border-radius: 14px; background: var(--surface-3);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-faint);
}
.empty-icon svg { width: 26px; height: 26px; }
.empty-title { font-size: 15px; font-weight: 600; color: var(--text-2); margin-bottom: 4px; }
.empty-text { font-size: 13px; color: var(--text-muted); }

/* ---- Section heading (page) ---- */
.page-title { font-size: 22px; font-weight: 700; margin: 0; color: var(--text); letter-spacing: -0.025em; }
.page-subtitle { margin: 5px 0 0; color: var(--text-2); font-size: 14px; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
  .sidebar { transform: translateX(-100%); box-shadow: 4px 0 24px rgba(0,0,0,.22); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-backdrop { position: fixed; inset: 0; background: rgba(20,22,33,.45); z-index: 35; display: none; }
  .sidebar-backdrop.show { display: block; }
  .main { margin-left: 0; }
  .topbar-burger { display: inline-flex; }
}

@media (max-width: 640px) {
  .content { padding: 16px; }
  .card { padding: 16px; border-radius: 12px; }
  .topbar { height: 56px; padding: 0 16px; }

  .cal-grid { gap: 5px; }
  .cal-cell { font-size: 13px; border-radius: 8px; aspect-ratio: 1; min-height: 44px; }
  .cal-day-label { font-size: 11px; padding: 4px 0; }
  .cal-title { font-size: 17px; }

  /* Toast: nie przybijaj do prawej — na 320px długi komunikat wychodził 36px poza lewą
     krawędź (position:fixed = nie do doscrollowania). Audyt mobilny v7. */
  .toast { min-width: 0; max-width: calc(100vw - 32px); margin-left: auto; }

  .stat { padding: 16px; }
  .stat-value { font-size: 23px; }

  .modal { border-radius: 18px 18px 0 0; max-width: 100%; align-self: flex-end; }
  .modal-backdrop { padding: 0; align-items: flex-end; }

  .tbl thead { display: none; }
  .tbl, .tbl tbody, .tbl tr, .tbl td { display: block; width: 100%; }
  .tbl tbody tr { border: 1px solid var(--border); border-radius: 12px; margin-bottom: 10px; padding: 14px; box-shadow: var(--shadow-xs); }
  .tbl tbody td { border: none; padding: 5px 0; overflow-wrap: break-word; }
  .tbl tbody td[data-label]::before {
    content: attr(data-label); display: block;
    font-weight: 600; color: var(--text-muted); font-size: 11px;
    text-transform: uppercase; letter-spacing: .04em; margin-bottom: 2px;
  }
  /* Puste etykiety (kolumna checkboxa/akcji) — nie renderuj pustego wiersza nagłówka w trybie kart. */
  .tbl tbody td[data-label=""]::before { display: none; }
  .tbl-actions { justify-content: flex-start; margin-top: 10px; }
  /* Touch targety ≥ ~44px na telefonie */
  .btn-sm { min-height: 42px; padding-top: 8px; padding-bottom: 8px; }
  .tbl tbody td[style*="max-width"] { max-width: 100% !important; }
}

/* Ciasne ekrany ≤420px: odzyskaj szerokość dla komórek kalendarza (cel dotykowy w osi X
   32-40px → ~42-46px) — mniejsze paddingi strony/karty + gap (audyt mobilny v7). */
@media (max-width: 420px) {
  .wk-wrap { padding-left: 8px !important; padding-right: 8px !important; }
  .wk-card { padding-left: 10px !important; padding-right: 10px !important; }
  .cal-grid { gap: 4px; }
}

/* ---- Helpers ---- */
.hidden { display: none !important; }
.flex-1 { flex: 1; }
.text-truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.divider { height: 1px; background: var(--border); margin: 16px 0; }

/* ---- Login ---- */
.login-bg {
  min-height: 100vh;
  background:
    radial-gradient(1100px 520px at 78% -8%, rgba(238,48,51,.16), transparent 60%),
    radial-gradient(900px 480px at 12% 108%, rgba(23,36,76,.55), transparent 55%),
    linear-gradient(165deg, #17244C 0%, #1B2C5C 45%, #101A38 100%);
  /* column: karta + stopka jedno pod drugim (stopka jest RODZEŃSTWEM karty, nie jej częścią —
     układ jak w suw.bisar.pl). Bez `flex-direction: column` stanęłyby obok siebie. */
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 20px;
}
.login-card {
  background: var(--surface); border-radius: var(--r-xl);
  width: 100%; max-width: 432px;
  padding: 36px 32px;
  box-shadow: 0 24px 70px rgba(8,9,20,.5), 0 4px 12px rgba(8,9,20,.3);
  border: 1px solid rgba(255,255,255,.08);
}
@media (max-width: 480px) { .login-card { padding: 26px 20px; } }

/* Stopka ekranu logowania (układ jak w suw.bisar.pl): POZA kartą, na ciemnym tle .login-bg.
   Dlatego kolory są jasne z przezroczystością, a nie zmienne motywu (te są pod jasną kartę).
   Rok generuje panel.js z zegara — bez ręcznej edycji co roku. */
.login-footer {
  margin-top: 22px; padding: 0 16px;
  text-align: center; max-width: 432px; width: 100%;
}
.login-security { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }
.login-security-item {
  font-size: 11.5px; line-height: 1.55; color: rgba(255,255,255,.72);
  /* Emoji z fontu systemowego — Inter ich nie ma, a bez tego Windows rysuje puste prostokąty. */
  font-family: 'Inter', 'Segoe UI Emoji', 'Apple Color Emoji', 'Noto Color Emoji', system-ui, sans-serif;
}
.login-copy {
  font-size: 11px; color: rgba(255,255,255,.5); letter-spacing: .01em;
  padding-top: 10px; border-top: 1px solid rgba(255,255,255,.12);
}
@media (max-width: 480px) { .login-security-item { font-size: 10.5px; } }

/* PIN input */
.pin-input { letter-spacing: .7em; text-align: center; font-size: 19px; font-weight: 700; }

/* Lang switcher */
.lang-btn { transition: all .15s; }
.lang-btn:hover { border-color: #CBD0D9 !important; background: var(--surface-2) !important; }
.lang-menu button:hover { background: var(--surface-2) !important; }

/* Checkbox accent */
input[type="checkbox"] { accent-color: var(--primary); width: 16px; height: 16px; cursor: pointer; }

/* Scrollbar (webkit) */
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: #D5D8DF; border-radius: 8px; border: 2px solid var(--bg); }
*::-webkit-scrollbar-thumb:hover { background: #C2C6CF; }

/* ---- Print ---- */
@media print {
  .sidebar, .topbar { display: none; }
  .main { margin-left: 0; }
  .card { border: 1px solid #ccc; box-shadow: none; }
}
