/* ============================================================
   assets/css/panel.css — style panelu adsdo.it
   Kolorystyka: #333333 (ciemny) · #FF0000 (czerwień) · #FFFFFF
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Kolory marki */
  --brand-dark:   #333333;
  --brand-darker: #222222;
  --brand-darkest:#1a1a1a;
  --brand-red:    #FF0000;
  --brand-red-dk: #CC0000;
  --brand-red-pale: #fff0f0;

  /* Aliasy używane w kodzie (zachowanie nazw dla kompatybilności) */
  --navy-deep:   #1a1a1a;
  --navy:        #333333;
  --navy-mid:    #2a2a2a;
  --navy-light:  #3d3d3d;
  --gold:        #FF0000;
  --gold-dark:   #CC0000;
  --gold-pale:   #fff0f0;

  /* Szarości UI */
  --slate-50:    #f8f8f8;
  --slate-100:   #f2f2f2;
  --slate-200:   #e0e0e0;
  --slate-400:   #999999;
  --slate-600:   #555555;
  --slate-800:   #222222;

  /* Status */
  --success:     #16a34a;
  --danger:      #dc2626;
  --warning:     #d97706;

  /* Geometria */
  --radius-sm:   6px;
  --radius:      10px;
  --radius-lg:   16px;
  --shadow-sm:   0 1px 3px rgba(0,0,0,.10);
  --shadow:      0 4px 16px rgba(0,0,0,.10);
  --shadow-lg:   0 8px 32px rgba(0,0,0,.15);
  --transition:  .18s ease;
}

body {
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
  background: var(--slate-100);
  color: var(--slate-800);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a { color: var(--brand-red); text-decoration: none; }
a:hover { color: var(--brand-red-dk); text-decoration: underline; }

/* ============================================================
   AUTH PAGES
   ============================================================ */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(150deg, #1a1a1a 0%, #333333 60%, #2a2a2a 100%);
  padding: 24px;
}

.auth-box {
  background: #ffffff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 440px;
  overflow: hidden;
}

.auth-header {
  background: var(--brand-dark);
  padding: 32px 40px 28px;
  text-align: center;
  border-bottom: 3px solid var(--brand-red);
}

.auth-logo-img {
  height: 44px;
  width: auto;
  display: block;
  margin: 0 auto;
  /* białe logo na ciemnym tle */
  filter: brightness(0) invert(1);
}

.auth-subtitle {
  color: #aaaaaa;
  font-size: 12px;
  letter-spacing: .12em;
  text-transform: uppercase;
  margin-top: 10px;
}

/* fallback tekstowy (gdy brak pliku logo) */
.auth-logo {
  font-size: 26px;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -.01em;
}
.auth-logo span { color: var(--brand-red); }

.auth-body { padding: 36px 40px 40px; }

.auth-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--brand-dark);
  margin-bottom: 6px;
}

.auth-desc {
  color: var(--slate-600);
  font-size: 14px;
  margin-bottom: 28px;
}

/* --- Form elements --- */
.form-group { margin-bottom: 20px; }

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--slate-600);
  margin-bottom: 7px;
  letter-spacing: .02em;
}

.form-control {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--slate-200);
  border-radius: var(--radius-sm);
  font-size: 15px;
  color: var(--slate-800);
  background: var(--slate-50);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
  font-family: inherit;
}

.form-control:focus {
  border-color: var(--brand-red);
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(255,0,0,.12);
}

select.form-control { cursor: pointer; }

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
  text-decoration: none;
  line-height: 1;
}

.btn-primary {
  background: var(--brand-red);
  color: #ffffff;
  width: 100%;
}

.btn-primary:hover {
  background: var(--brand-red-dk);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(255,0,0,.25);
  color: #ffffff;
  text-decoration: none;
}

.btn-secondary {
  background: var(--slate-100);
  color: var(--slate-600);
  border: 1.5px solid var(--slate-200);
}

.btn-secondary:hover {
  background: var(--slate-200);
  color: var(--slate-800);
  text-decoration: none;
}

.btn-danger {
  background: #dc2626;
  color: #fff;
}

.btn-danger:hover {
  background: #b91c1c;
  text-decoration: none;
  color: #fff;
}

.btn-sm { padding: 7px 14px; font-size: 13px; }

/* --- Alerts --- */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  margin-bottom: 20px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.alert-error   { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.alert-success { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }
.alert-info    { background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; }

.auth-footer-link {
  text-align: center;
  margin-top: 20px;
  font-size: 14px;
  color: var(--slate-400);
}

/* ============================================================
   PANEL LAYOUT
   ============================================================ */
.panel-wrapper {
  display: flex;
  min-height: 100vh;
}

/* --- Sidebar --- */
.sidebar {
  width: 256px;
  min-height: 100vh;
  min-height: 100dvh; /* dokładniejsza wysokość na mobile (uwzględnia pasek przeglądarki) */
  background: var(--brand-dark);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform var(--transition);
  border-right: 3px solid var(--brand-red);
  overflow-y: auto; /* KRYTYCZNE: gdy menu + sekcja użytkownika nie mieszczą się
                        w wysokości ekranu, całość musi dać się przewinąć —
                        inaczej dolne elementy (np. "Wyloguj się") są niedostępne */
  -webkit-overflow-scrolling: touch;
}

.sidebar-logo {
  padding: 18px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,.10);
  overflow: hidden;
}

.sidebar-logo-img {
  height: 28px;
  width: auto;
  max-width: 100%;
  display: block;
  filter: brightness(0) invert(1);
}

/* fallback tekstowy */
.logo-name { font-size: 20px; font-weight: 800; color: #ffffff; }
.logo-name span { color: var(--brand-red); }
.logo-panel {
  font-size: 11px;
  color: #888888;
  letter-spacing: .10em;
  text-transform: uppercase;
  margin-top: 4px;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 0;
  overflow-y: auto;
}

.nav-section-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: #777777;
  padding: 14px 24px 6px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 24px;
  color: #cccccc;
  font-size: 14px;
  font-weight: 500;
  transition: all var(--transition);
  border-left: 3px solid transparent;
  text-decoration: none;
}

.nav-link:hover {
  background: rgba(255,255,255,.07);
  color: #ffffff;
  text-decoration: none;
}

.nav-link.active {
  background: rgba(255,0,0,.12);
  color: #ffffff;
  border-left-color: var(--brand-red);
}

.nav-link svg { flex-shrink: 0; opacity: .75; }
.nav-link.active svg { opacity: 1; }

.sidebar-user {
  padding: 18px 24px calc(18px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid rgba(255,255,255,.10);
  flex-shrink: 0; /* nigdy nie pozwól tej sekcji się skurczyć/zniknąć */
}

.sidebar-user-name {
  font-size: 13px;
  font-weight: 600;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-role {
  font-size: 11px;
  color: var(--brand-red);
  letter-spacing: .04em;
  margin-top: 2px;
}

.sidebar-logout {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  color: #888888;
  font-size: 13px;
  cursor: pointer;
  background: none;
  border: none;
  font-family: inherit;
  padding: 0;
  transition: color var(--transition);
  text-decoration: none;
}

.sidebar-logout:hover { color: var(--brand-red); text-decoration: none; }

/* --- Main content --- */
.main-content {
  margin-left: 256px;
  flex: 1;
  min-width: 0; /* KRYTYCZNE: bez tego jeden zbyt szeroki potomek (tabela,
                   grid-column:span) rozciąga cały układ flex poza ekran */
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  max-width: 100%;
}

.topbar {
  height: 60px;
  background: #ffffff;
  border-bottom: 1px solid var(--slate-200);
  display: flex;
  align-items: center;
  padding: 0 32px;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--brand-dark);
  flex: 1;
}

/* Czerwona linia pod topbarem */
.topbar::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 2px;
  background: var(--brand-red);
  opacity: .15;
}

.page-content {
  padding: 32px;
  flex: 1;
  min-width: 0;
  max-width: 100%;
}

/* Zabezpieczenie globalne: żaden pojedynczy element nie powinien być
   w stanie samodzielnie rozepchnąć układu strony w poziomie. */
img, table, .card, .stats-row, [style*="grid-template-columns"] {
  max-width: 100%;
}
* { min-width: 0; }

/* --- Cards --- */
.card {
  background: #ffffff;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--slate-200);
  overflow: hidden;
  min-width: 0;
  max-width: 100%;
}

.card-header {
  padding: 20px 24px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--brand-dark);
}

.card-body { padding: 20px 24px 24px; }

/* --- Table --- */
.table-wrap { overflow-x: auto; }

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th {
  background: var(--slate-50);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--slate-600);
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--slate-200);
}

.data-table td {
  padding: 14px 16px;
  font-size: 14px;
  color: var(--slate-800);
  border-bottom: 1px solid var(--slate-100);
  vertical-align: middle;
}

.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--slate-50); }

/* --- Badges --- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.badge-admin    { background: rgba(255,0,0,.10);   color: #cc0000; }
.badge-user     { background: rgba(51,51,51,.10);  color: #333333; }
.badge-client   { background: rgba(22,163,74,.12); color: #15803d; }
.badge-active   { background: rgba(22,163,74,.12); color: #15803d; }
.badge-inactive { background: rgba(220,38,38,.12); color: #b91c1c; }

/* --- Modal --- */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.50);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 24px;
}

.modal-overlay.open { display: flex; }

.modal {
  background: #ffffff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 480px;
  overflow: hidden;
  animation: modalIn .2s ease;
}

@keyframes modalIn {
  from { opacity:0; transform: scale(.96) translateY(8px); }
  to   { opacity:1; transform: scale(1)  translateY(0);    }
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 2px solid var(--brand-red);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--brand-dark);
}

.modal-title { font-size: 16px; font-weight: 700; color: #ffffff; }

.modal-close {
  background: none; border: none; cursor: pointer;
  color: #888888; padding: 4px; border-radius: 4px;
  transition: color var(--transition);
}

.modal-close:hover { color: #ffffff; }

.modal-body    { padding: 24px; }
.modal-footer  {
  padding: 16px 24px;
  border-top: 1px solid var(--slate-200);
  display: flex; gap: 10px; justify-content: flex-end;
}

/* --- Utilities --- */
.flex         { display: flex; }
.items-center { align-items: center; }
.gap-2        { gap: 8px; }
.gap-3        { gap: 12px; }
.mt-1         { margin-top: 4px; }
.mt-2         { margin-top: 8px; }
.mt-4         { margin-top: 16px; }
.mb-4         { margin-bottom: 16px; }
.mb-6         { margin-bottom: 24px; }
.text-sm      { font-size: 13px; }
.text-muted   { color: var(--slate-400); }
.text-right   { text-align: right; }
.w-full       { width: 100%; }

/* --- Stat cards --- */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

.stat-card {
  background: #ffffff;
  border-radius: var(--radius);
  padding: 22px 24px;
  border: 1px solid var(--slate-200);
  box-shadow: var(--shadow-sm);
  border-top: 3px solid var(--brand-red);
}

.stat-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--slate-400);
  margin-bottom: 8px;
}

.stat-value {
  font-size: 30px;
  font-weight: 800;
  color: var(--brand-dark);
  line-height: 1;
}

.stat-accent { color: var(--brand-red); }

/* ============================================================
   RESPONSIVE / RWD — optymalizacja mobilna (Pixel 8 ~412px)
   ============================================================ */

/* --- Tablety i mniejsze (≤ 1024px) --- */
@media (max-width: 1024px) {
  .page-content { padding: 24px; }
}

/* --- Mobile: sidebar jako wysuwane menu (≤ 768px) --- */

/* Pozycje strony: macierz fraza x dzień na CSS Grid (nie <table>) — jawne
   grid-template-columns w PHP daje jednoznaczną, gwarantowaną szerokość
   kolumn niezależnie od przeglądarki, bez żadnych niuansów algorytmu
   szerokości tabel HTML. Zawsze przewijalna w bok; kolumny na telefonie
   są wąskie, żeby ok. 7 dni mieściło się od razu bez przewijania. */
.positions-table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x proximity;
}
.positions-grid {
  display: grid;
  font-size: 13px;
  width: max-content;
}
.pg-cell {
  padding: 9px 4px;
  text-align: center;
  border-bottom: 1px solid var(--slate-100);
  display: flex;
  align-items: center;
  justify-content: center;
  scroll-snap-align: start;
}
.pg-head {
  font-weight: 600;
  color: var(--slate-600);
  background: var(--slate-50);
  border-bottom: 2px solid var(--slate-200);
  padding: 10px 4px;
}
.pg-kw-cell {
  justify-content: flex-start;
  text-align: left;
  padding: 9px 14px;
  white-space: normal;       /* pozwól frazie zawijać się na kilka linii */
  word-break: break-word;
  overflow-wrap: anywhere;
  line-height: 1.35;
}
.pg-cat-row {
  padding: 8px 14px;
  background: var(--brand-dark);
  color: #fff;
  font-weight: 700;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .03em;
  position: sticky;
  left: 0;
}
.pg-cat-label {
  position: sticky;
  left: 14px; /* zostaje w tym samym miejscu, gdy przewijamy w bok */
  display: inline-block;
}

@media (max-width: 768px) {
  .gains-drops-grid { grid-template-columns: 1fr !important; }

  .positions-tiles-grid { grid-template-columns: 1fr 1fr !important; min-width: 0; }
  .positions-range-select { width: 100%; min-width: 0 !important; }
  .positions-tiles-row { flex-direction: column; }

  /* Nazwa zadania: na telefonie zawija się na kilka linii zamiast być
     ucinana wielokropkiem — na wąskim ekranie i tak nie ma miejsca na
     jedną długą linię obok ikony kalendarza/przycisków. */
  .task-title-row {
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: unset !important;
    align-items: flex-start !important;
  }
  .task-title-text {
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: unset !important;
    word-break: break-word;
  }

  /* Wiersz zadania: na telefonie nazwa (+checkbox) zajmuje pełną szerokość,
     a przyciski akcji (Szczegóły/Edytuj/Usuń) schodzą pod spód, na własny
     pełnoszerokościowy wiersz, zamiast ściskać się obok tytułu. */
  .task-row-main {
    flex-wrap: wrap;
  }
  .task-actions-row {
    width: 100%;
    flex-wrap: wrap;
    margin-top: 12px;
    flex-shrink: 1 !important;
  }
  .task-actions-row .btn {
    flex: 1;
    min-width: 90px;
  }

  .sidebar {
    transform: translateX(-100%);
    width: 280px;
    max-width: 85vw;
    box-shadow: 4px 0 24px rgba(0,0,0,.25);
  }
  .sidebar.open { transform: translateX(0); }

  /* Przyciemnione tło pod otwartym menu */
  .sidebar-backdrop {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 99;
  }
  .sidebar.open ~ .sidebar-backdrop,
  .sidebar-backdrop.show { display: block; }

  .main-content { margin-left: 0; }

  .topbar {
    height: 56px;
    padding: 0 16px;
  }
  .topbar-title { font-size: 15px; }
  /* Email w topbarze ukryty na małych ekranach — za mało miejsca */
  .topbar .text-sm.text-muted { display: none; }

  .page-content { padding: 18px 14px; }

  .auth-body   { padding: 28px 24px 32px; }
  .auth-header { padding: 28px 24px 20px; }

  /* Karty pełnej szerokości z mniejszym paddingiem */
  .card-header { padding: 14px 16px; }
  .card-body   { padding: 16px; }

  /* Nagłówki sekcji trochę mniejsze */
  h2 { font-size: 18px !important; }

  /* Statystyki: jedna kolumna, węższe */
  .stats-row {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 20px;
  }
  .stat-card { padding: 16px; }
  .stat-value { font-size: 24px; }

  /* Modale: pełnoekranowe od dołu (bottom-sheet) */
  .modal-overlay {
    padding: 0;
    align-items: flex-end;
  }
  .modal {
    max-width: 100% !important;
    width: 100%;
    max-height: 94vh;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    display: flex;
    flex-direction: column;
    animation: modalInMobile .25s ease;
  }
  @keyframes modalInMobile {
    from { transform: translateY(100%); }
    to   { transform: translateY(0); }
  }
  .modal-body {
    padding: 18px 16px;
    overflow-y: auto;
    flex: 1;
    -webkit-overflow-scrolling: touch;
  }
  .modal-header { padding: 16px; }
  .modal-footer {
    padding: 14px 16px;
    padding-bottom: max(14px, env(safe-area-inset-bottom));
    position: sticky;
    bottom: 0;
    background: #fff;
  }
  /* Przyciski w stopce modala pełnej szerokości */
  .modal-footer .btn { flex: 1; }

  /* Tabele: przewijanie poziome zamiast łamania.
     Tabele już owinięte w .table-wrap przewijają przez wrapper. */
  .table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
  }
  .table-wrap table { white-space: nowrap; }

  /* Samodzielne tabele (bez wrappera) — przewijalne jako blok */
  table:not(.table-wrap table) {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
    max-width: 100%;
  }

  /* Wszystkie przyciski: większe pole dotyku (min 44px wg WCAG) */
  .btn {
    padding: 12px 18px;
    min-height: 44px;
  }
  .btn-sm {
    padding: 9px 14px;
    min-height: 38px;
    font-size: 13px;
  }

  /* Pola formularzy: font 16px zapobiega auto-zoomowi na iOS/Android */
  .form-control {
    font-size: 16px;
    padding: 12px 14px;
  }

  /* Grid dwukolumnowy → jedna kolumna (formularze, ustawienia) */
  [style*="grid-template-columns:1fr 1fr"],
  [style*="grid-template-columns: 1fr 1fr"],
  [style*="grid-template-columns:280px 1fr"],
  [style*="grid-template-columns: 280px 1fr"],
  [style*="grid-template-columns:1fr 1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }
}

/* --- Małe telefony (≤ 430px, Pixel 8 = 412px) --- */
@media (max-width: 430px) {
  .page-content { padding: 14px 12px; }

  h2 { font-size: 17px !important; }

  .card-header {
    flex-wrap: wrap;
    gap: 10px;
  }
  /* Przycisk w nagłówku karty na pełną szerokość gdy się zawija */
  .card-header .btn { width: 100%; }

  /* Statystyki: jedna kolumna na bardzo wąskich */
  .stats-row { grid-template-columns: 1fr; }

  /* Siatka projektów: jedna kolumna */
  [style*="grid-template-columns:repeat(auto-fill,minmax(320px"],
  [style*="grid-template-columns: repeat(auto-fill, minmax(320px"] {
    grid-template-columns: 1fr !important;
  }

  /* Grupy przycisków akcji: zawijają się */
  .btn-group-mobile {
    flex-wrap: wrap;
  }
}

/* ============================================================
   DOLNY PASEK NAWIGACJI — charakter natywnej aplikacji mobilnej
   ============================================================ */
.bottom-tab-bar { display: none; }

@media (max-width: 768px) {
  .bottom-tab-bar {
    display: flex;
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 90;
    background: rgba(255,255,255,.96);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-top: 1px solid var(--slate-200);
    box-shadow: 0 -2px 16px rgba(0,0,0,.06);
    padding-bottom: env(safe-area-inset-bottom, 0);
  }

  .bottom-tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 9px 4px 8px;
    background: none;
    border: none;
    font-family: inherit;
    cursor: pointer;
    color: var(--slate-400);
    text-decoration: none;
    min-height: 56px;
  }

  .bottom-tab span { font-size: 11px; font-weight: 600; letter-spacing: .01em; }
  .bottom-tab svg { opacity: .85; }

  .bottom-tab.active { color: var(--brand-red); }
  .bottom-tab.active svg { opacity: 1; }
  .bottom-tab:active { background: var(--slate-50); }

  /* Miejsce na dolny pasek, żeby treść się pod nim nie chowała */
  .page-content { padding-bottom: calc(80px + env(safe-area-inset-bottom, 0)); }

  /* Sidebar nadal dostępny przez "Więcej" — otwiera się jako pełny drawer */
  .main-content { padding-bottom: 0; }
}

/* --- Ułatwienia dotykowe globalne --- */
@media (hover: none) and (pointer: coarse) {
  /* Usuń efekty hover translate na urządzeniach dotykowych */
  .btn-primary:hover { transform: none; box-shadow: none; }
  .card:hover { transform: none; }

  /* Checkbox/radio większe */
  input[type="checkbox"], input[type="radio"] {
    min-width: 20px;
    min-height: 20px;
  }
}

/* ============================================================
   GWARANCJA BRAKU POZIOMEGO PRZESUWANIA — nawet dla tabel
   ============================================================ */
@media (max-width: 640px) {
  html, body { overflow-x: hidden; max-width: 100vw; }

  /* Tabele o wielu kolumnach: zamiast przewijania w bok,
     każdy wiersz staje się osobną, skrolowaną pionowo "kartą".
     Nagłówek kolumny jest odtwarzany jako etykieta przy wartości
     (gdy znacznik ma atrybut data-label — dodawany stopniowo). */
  .table-wrap table,
  table.mobile-stack {
    display: block;
    white-space: normal;
  }
  .table-wrap table thead,
  table.mobile-stack thead { display: none; }
  .table-wrap table tbody,
  table.mobile-stack tbody { display: block; }
  .table-wrap table tr,
  table.mobile-stack tr {
    display: block;
    border: 1px solid var(--slate-200);
    border-radius: var(--radius-sm);
    margin-bottom: 10px;
    padding: 6px 4px;
    background: #fff;
  }
  .table-wrap table td,
  table.mobile-stack td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 10px !important;
    border: none !important;
    text-align: right !important;
    white-space: normal;
    word-break: break-word;
  }
  .table-wrap table td[data-label]::before,
  table.mobile-stack td[data-label]::before {
    content: attr(data-label);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--slate-400);
    text-align: left;
    flex-shrink: 0;
  }
  /* Komórki bez data-label (np. same przyciski akcji) wyśrodkowane */
  .table-wrap table td:not([data-label]),
  table.mobile-stack td:not([data-label]) {
    justify-content: center;
  }
}

/* ============================================================
   DASHBOARD — akcje użytkownika
   ============================================================ */
.dashboard-welcome-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 20px;
}

.dashboard-user-actions {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 22px;
}

.dashboard-user-actions .btn {
  width: auto;
  white-space: nowrap;
}

.dashboard-projects-btn {
  flex: 0 0 auto;
}

.dashboard-order-btn {
  margin-left: auto;
}

.dashboard-user-actions-single {
  justify-content: flex-start;
}

@media (max-width: 430px) {
  .dashboard-welcome-row {
    margin-bottom: 16px;
  }

  .dashboard-user-actions {
    gap: 8px;
    margin-bottom: 20px;
    width: 100%;
  }

  .dashboard-user-actions .btn {
    min-width: 0;
    padding-left: 11px;
    padding-right: 11px;
    font-size: 13px;
  }

  .dashboard-projects-btn {
    flex: 0 0 35%;
    justify-content: center;
  }

  .dashboard-order-btn {
    flex: 1 1 65%;
    justify-content: center;
    margin-left: 0;
  }

  .dashboard-user-actions-single .dashboard-projects-btn {
    flex: 0 0 auto;
  }
}

/* ============================================================
   DASHBOARD — kafelek pogody
   ============================================================ */
.dashboard-weather-summary {
  display: grid;
  grid-template-columns: auto auto 1fr auto;
  grid-template-areas: "icon main temps precip";
  align-items: center;
  gap: 16px;
  padding: 0 20px 16px;
}

.dashboard-weather-icon {
  grid-area: icon;
  font-size: 44px;
  line-height: 1;
}

.dashboard-weather-main {
  grid-area: main;
  min-width: 0;
}

.dashboard-weather-label {
  font-weight: 700;
  color: var(--navy);
  font-size: 15px;
}

.dashboard-weather-key-hours {
  grid-area: temps;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 18px;
  min-width: 0;
}

.dashboard-weather-key-hours-empty {
  min-height: 1px;
}

.dashboard-weather-key-hour-item {
  text-align: center;
}

.dashboard-weather-key-hour-time {
  font-size: 12px;
  line-height: 1.1;
  color: var(--slate-400);
  font-weight: 600;
}

.dashboard-weather-key-hour-temp {
  margin-top: 3px;
  font-size: 17px;
  line-height: 1.1;
  font-weight: 700;
  color: var(--navy);
}

.dashboard-weather-precip {
  grid-area: precip;
  text-align: right;
}

.dashboard-weather-precip-mm {
  font-size: 13px;
  color: #0ea5e9;
  font-weight: 700;
  white-space: nowrap;
}

.dashboard-weather-precip-prob {
  white-space: nowrap;
}

@media (max-width: 768px) {
  .dashboard-weather-summary {
    grid-template-columns: 56px 1fr auto;
    grid-template-areas:
      "icon main precip"
      "temps temps precip";
    gap: 8px 12px;
    padding: 0 16px 14px;
  }

  .dashboard-weather-icon {
    font-size: 40px;
    align-self: start;
  }

  .dashboard-weather-main {
    align-self: center;
  }

  .dashboard-weather-label {
    font-size: 14px;
  }

  .dashboard-weather-range {
    font-size: 13px;
  }

  .dashboard-weather-key-hours {
    justify-content: flex-start;
    gap: 12px;
  }

  .dashboard-weather-key-hour-time {
    font-size: 10px;
  }

  .dashboard-weather-key-hour-temp {
    font-size: 19px;
    margin-top: 2px;
  }

  .dashboard-weather-precip {
    min-width: 56px;
    align-self: center;
  }

  .dashboard-weather-precip-mm {
    font-size: 14px;
  }

  .dashboard-weather-precip-icon {
    display: none;
  }

  .dashboard-weather-precip-prob {
    font-size: 12px;
  }

  .dashboard-weather-precip-prob-label {
    display: none;
  }
}

@media (max-width: 430px) {
  .dashboard-weather-summary {
    grid-template-columns: 52px 1fr auto;
    gap: 6px 10px;
    padding: 0 14px 14px;
  }

  .dashboard-weather-key-hours {
    gap: 10px;
  }

  .dashboard-weather-key-hour-item {
    min-width: 32px;
  }

  .dashboard-weather-key-hour-time {
    font-size: 9px;
  }

  .dashboard-weather-key-hour-temp {
    font-size: 18px;
  }

  .dashboard-weather-precip {
    min-width: 50px;
  }

  .dashboard-weather-precip-mm {
    font-size: 13px;
  }

  .dashboard-weather-precip-prob {
    font-size: 11px;
  }
}

.dashboard-weather-forecast {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--slate-100);
}

.dashboard-weather-forecast-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 20px;
  margin-bottom: 8px;
}

.dashboard-weather-forecast-title {
  font-weight: 600;
}

.dashboard-weather-forecast-times {
  display: flex;
  gap: 10px;
  padding: 0 10px;
}

.dashboard-weather-forecast-time {
  width: 30px;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--slate-400);
}

.dashboard-weather-forecast-row {
  display: grid;
  grid-template-columns: 38px 32px minmax(90px, 1fr) auto auto;
  grid-template-areas: "day icon label keyhours meta";
  align-items: center;
  column-gap: 10px;
  row-gap: 6px;
  padding: 8px 20px;
  border-bottom: 1px solid var(--slate-50);
}

.dashboard-weather-forecast-day {
  grid-area: day;
  width: 38px;
  font-weight: 700;
  color: var(--navy);
  font-size: 13px;
}

.dashboard-weather-forecast-icon {
  grid-area: icon;
  font-size: 22px;
  width: 32px;
  text-align: center;
}

.dashboard-weather-forecast-label {
  grid-area: label;
  font-size: 12px;
  color: var(--slate-500);
  min-width: 0;
}

.dashboard-weather-forecast-keyhours {
  grid-area: keyhours;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  min-width: 0;
}

.dashboard-weather-forecast-keyhours-empty {
  min-height: 1px;
}

.dashboard-weather-forecast-keyhour {
  width: 30px;
  text-align: center;
}

.dashboard-weather-forecast-keyhour-icon {
  font-size: 16px;
  line-height: 1;
}

.dashboard-weather-forecast-keyhour-temp {
  font-size: 12px;
  font-weight: 700;
  color: var(--slate-600);
  margin-top: 2px;
}

.dashboard-weather-forecast-meta {
  grid-area: meta;
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.dashboard-weather-forecast-precip {
  font-size: 12px;
  color: #0ea5e9;
  white-space: nowrap;
}

.dashboard-weather-forecast-sun {
  font-size: 12px;
  color: #d97706;
  white-space: nowrap;
}

.dashboard-weather-forecast-range {
  font-size: 13px;
  font-weight: 700;
  color: var(--navy);
  white-space: nowrap;
  min-width: 70px;
  text-align: right;
}

@media (max-width: 768px) {
  .dashboard-weather-forecast-head {
    padding: 0 16px;
    margin-bottom: 10px;
  }

  .dashboard-weather-forecast-times {
    gap: 8px;
    padding: 0;
  }

  .dashboard-weather-forecast-time {
    width: 28px;
    font-size: 11px;
  }

  .dashboard-weather-forecast-row {
    grid-template-columns: 38px 32px 1fr;
    grid-template-areas:
      "day icon label"
      "day keyhours keyhours"
      "day meta meta";
    align-items: start;
    padding: 10px 16px;
  }

  .dashboard-weather-forecast-label {
    font-size: 13px;
    line-height: 1.3;
  }

  .dashboard-weather-forecast-keyhours {
    justify-content: flex-start;
    margin-top: 2px;
  }

  .dashboard-weather-forecast-meta {
    justify-content: flex-start;
    gap: 12px;
  }

  .dashboard-weather-forecast-range {
    min-width: 0;
    text-align: left;
  }
}

@media (max-width: 430px) {
  .dashboard-weather-forecast-head {
    padding: 0 14px;
  }

  .dashboard-weather-forecast-times {
    gap: 6px;
  }

  .dashboard-weather-forecast-time {
    width: 26px;
    font-size: 10px;
  }

  .dashboard-weather-forecast-row {
    padding: 10px 14px;
    column-gap: 8px;
  }

  .dashboard-weather-forecast-day {
    width: 34px;
    font-size: 12px;
  }

  .dashboard-weather-forecast-icon {
    width: 28px;
    font-size: 20px;
  }

  .dashboard-weather-forecast-label {
    font-size: 12px;
  }

  .dashboard-weather-forecast-keyhours {
    gap: 8px;
  }

  .dashboard-weather-forecast-keyhour {
    width: 28px;
  }

  .dashboard-weather-forecast-keyhour-icon {
    font-size: 15px;
  }

  .dashboard-weather-forecast-keyhour-temp,
  .dashboard-weather-forecast-precip,
  .dashboard-weather-forecast-sun,
  .dashboard-weather-forecast-range {
    font-size: 12px;
  }
}

/* ============================================================
   v59 — graficzny profil anchorów na kafelku projektu
   ============================================================ */
.anchor-profile-mini {
  display: block;
  margin: 14px 22px 0;
  padding: 12px 13px;
  border: 1px solid var(--slate-200);
  border-radius: 12px;
  background: linear-gradient(180deg,#fff 0%,var(--slate-50) 100%);
  text-decoration: none;
  color: inherit;
  transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}
.anchor-profile-mini:hover {
  border-color: #c7d2fe;
  box-shadow: 0 5px 16px rgba(15,23,42,.07);
  transform: translateY(-1px);
}
.anchor-profile-mini-head {
  display:flex;align-items:center;justify-content:space-between;gap:8px;
  font-size:11px;color:var(--slate-500);margin-bottom:8px;
}
.anchor-profile-mini-head span:first-child {font-size:12px;font-weight:800;color:var(--navy);}
.anchor-profile-bar {
  display:flex;width:100%;height:9px;border-radius:999px;overflow:hidden;background:var(--slate-200);
  box-shadow:inset 0 1px 2px rgba(15,23,42,.08);
}
.anchor-profile-bar > span {height:100%;display:block;min-width:0;}
.anchor-brand {background:#2563eb;}
.anchor-keyword {background:#7c3aed;}
.anchor-neutral {background:#16a34a;}
.anchor-other {background:#cbd5e1;}
.anchor-profile-values {
  display:flex;align-items:center;justify-content:space-between;gap:8px;
  margin-top:8px;font-size:11px;color:var(--slate-600);white-space:nowrap;
}
.anchor-profile-values span:nth-child(1) b{color:#1d4ed8;}
.anchor-profile-values span:nth-child(2) b{color:#6d28d9;}
.anchor-profile-values span:nth-child(3) b{color:#15803d;}
.anchor-profile-target {margin-top:5px;font-size:10px;color:var(--slate-400);line-height:1.35;}
.anchor-profile-empty {font-size:11px;color:var(--slate-400);padding:3px 0 1px;}

.anchor-profile-hero {
  padding:20px;border:1px solid var(--slate-200);border-radius:14px;background:#fff;
}
.anchor-profile-hero .anchor-profile-bar {height:14px;margin:14px 0 12px;}
.anchor-profile-stat-grid {display:grid;grid-template-columns:repeat(4,1fr);gap:12px;margin-top:14px;}
.anchor-profile-stat {padding:14px;border-radius:12px;background:var(--slate-50);border:1px solid var(--slate-100);}
.anchor-profile-stat .value {font-size:24px;font-weight:800;color:var(--navy);line-height:1.05;}
.anchor-profile-stat .label {font-size:11px;color:var(--slate-500);margin-top:4px;}

@media(max-width:768px){
  .anchor-profile-mini{margin-left:16px;margin-right:16px;}
  .anchor-profile-values{font-size:10px;gap:5px;}
  .anchor-profile-stat-grid{grid-template-columns:1fr 1fr;}
}

/* ============================================================
   v75 — licznik indeksacji IndexCheckr na kafelku projektu
   ============================================================ */
.indexcheckr-mini {
  display:block;
  margin:10px 22px 0;
  padding:12px 13px;
  border:1px solid var(--slate-200);
  border-radius:12px;
  background:linear-gradient(180deg,#fff 0%,var(--slate-50) 100%);
  text-decoration:none;
  color:inherit;
  transition:border-color .15s ease,box-shadow .15s ease,transform .15s ease;
}
.indexcheckr-mini:hover {
  border-color:#bbf7d0;
  box-shadow:0 5px 16px rgba(15,23,42,.07);
  transform:translateY(-1px);
}
.indexcheckr-mini-head {
  display:flex;align-items:center;justify-content:space-between;gap:8px;
  font-size:11px;color:var(--slate-500);margin-bottom:8px;
}
.indexcheckr-mini-head span:first-child {font-size:12px;font-weight:800;color:var(--navy);}
.indexcheckr-bar {
  display:flex;width:100%;height:9px;border-radius:999px;overflow:hidden;background:var(--slate-200);
  box-shadow:inset 0 1px 2px rgba(15,23,42,.08);
}
.indexcheckr-bar > span {height:100%;display:block;min-width:0;}
.indexcheckr-indexed {background:#16a34a;}
.indexcheckr-not-indexed {background:#ef4444;}
.indexcheckr-pending {background:#cbd5e1;}
.indexcheckr-values {
  display:flex;align-items:center;justify-content:space-between;gap:8px;
  margin-top:8px;font-size:11px;color:var(--slate-600);white-space:nowrap;
}
.indexcheckr-values span:first-child b {color:#15803d;}
.indexcheckr-values span:last-child b {color:#dc2626;}
.indexcheckr-note {margin-top:5px;font-size:10px;color:var(--slate-400);line-height:1.35;}
.indexcheckr-note-error {color:#b45309;}
.indexcheckr-empty {font-size:11px;color:var(--slate-400);padding:3px 0 1px;}

@media(max-width:768px){
  .indexcheckr-mini{margin-left:16px;margin-right:16px;}
  .indexcheckr-values{font-size:10px;gap:5px;}
}
