:root {
  --tlo: #F4F6F9; --karta: #FFFFFF; --tekst: #111827; --szary: #4B5563; --linia: #E5E7EB; --linia2: #F1F2F4;
  --niebieski: #1D4ED8; --niebieski-jasny: #EEF2FF; --niebieski-ciemny: #1E3A8A; --slupek: #93C5FD;
  --plus: #047857; --plus-tlo: #ECFDF5; --minus: #B91C1C; --minus-tlo: #FEF2F2; --uwaga: #92400E; --uwaga-tlo: #FEF3C7;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--tekst); background: var(--tlo);
  -webkit-text-size-adjust: 100%;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: var(--tlo); }
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.szary { color: var(--szary); }
.male { font-size: 13px; }
.karta { background: var(--karta); border-radius: 14px; }
.blad { color: var(--minus); background: var(--minus-tlo); padding: 10px 12px; border-radius: 10px; font-size: 14px; }
.plus { color: var(--plus); } .minus { color: var(--minus); }
.num { font-variant-numeric: tabular-nums; }

/* ---------- logowanie ---------- */
.logowanie { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.logowanie-karta { width: 100%; max-width: 380px; padding: 28px; display: flex; flex-direction: column; gap: 14px; }
.logowanie-karta h1 { font-size: 24px; }
label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--szary); }
input { min-height: 44px; border: 1px solid #D1D5DB; border-radius: 10px; padding: 0 12px; background: #fff; font-size: 16px; color: var(--tekst); }
input:focus-visible, button:focus-visible { outline: 3px solid #93C5FD; outline-offset: 1px; }
.przycisk-glowny { min-height: 46px; border: 0; border-radius: 10px; background: var(--niebieski); color: #fff; font-weight: 700; font-size: 16px; }
.przycisk-glowny:disabled { opacity: .6; }

/* ---------- układ ---------- */
.aplikacja { display: flex; min-height: 100vh; }
.menu { width: 230px; flex-shrink: 0; background: var(--karta); border-right: 1px solid var(--linia); padding: 24px 14px;
  display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; }
.menu-marka { display: flex; flex-direction: column; gap: 2px; padding: 0 10px 18px; font-size: 18px; }
.menu-marka span { font-size: 12px; }
.menu-poz { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 12px; border: 0; border-radius: 10px;
  background: transparent; color: #374151; font-weight: 600; font-size: 15px; text-align: left; }
.menu-poz[aria-current="page"] { background: var(--niebieski-jasny); color: var(--niebieski-ciemny); }
.menu-wyloguj { margin-top: auto; min-height: 40px; border: 1px solid var(--linia); border-radius: 10px; background: transparent; color: var(--szary); font-weight: 600; }
.tresc { flex: 1; min-width: 0; padding: 28px 28px 40px; max-width: 1280px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
.naglowek { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.naglowek h1 { font-size: 26px; }
.naglowek p { font-size: 14px; margin-top: 4px; }
.przycisk-ikona { width: 44px; height: 44px; border: 1px solid var(--linia); border-radius: 12px; background: var(--karta); display: grid; place-items: center; }
.przycisk-ikona.kreci svg { animation: obrot 1s linear infinite; }
@keyframes obrot { to { transform: rotate(360deg); } }

/* ---------- zakres dat ---------- */
.zakres { padding: 14px 16px; display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 16px; }
.zakres-pola { display: flex; gap: 10px; }
.zakres-pola input { min-width: 150px; }
.zakres p { flex: 1 1 260px; text-align: right; }
.chipy { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { min-height: 38px; padding: 0 14px; border-radius: 999px; border: 1px solid #D1D5DB; background: #fff; font-size: 13px; font-weight: 600; color: var(--tekst); }
.chip[aria-pressed="true"] { background: var(--niebieski); border-color: var(--niebieski); color: #fff; }
.chip.jasny[aria-pressed="true"] { background: var(--niebieski-jasny); border-color: #A5B4FC; color: var(--niebieski-ciemny); }
.chipy.przewijane { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; }
.chipy.przewijane .chip { flex-shrink: 0; }

.komunikat { padding: 10px 14px; border-radius: 10px; background: var(--uwaga-tlo); color: var(--uwaga); font-size: 14px; }

/* ---------- kafelki ---------- */
.widok { display: flex; flex-direction: column; gap: 16px; }
.kafelki { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.kafel { padding: 16px 18px; display: flex; flex-direction: column; gap: 4px; }
.kafel .etykieta { font-size: 13px; color: var(--szary); font-weight: 500; }
.kafel .wartosc { font-size: 24px; font-weight: 700; letter-spacing: -0.01em; }
.kafel .pod { font-size: 12px; color: var(--szary); }
.kafel.duzy { grid-column: span 2; }
.kafel.duzy .wartosc { font-size: 32px; }
.zmiany { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.zmiana { font-size: 12px; font-weight: 700; border-radius: 999px; padding: 3px 9px; }
.zmiana.plus { background: var(--plus-tlo); } .zmiana.minus { background: var(--minus-tlo); }
.zmiana.brak { background: var(--linia2); color: var(--szary); }

/* ---------- tabela (komputer) ---------- */
.sekcja-tytul { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; padding: 16px 16px 8px; }
.sekcja-tytul h2 { font-size: 18px; }
.przewijanie { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { font-size: 12px; font-weight: 600; color: var(--szary); background: #F9FAFB; text-align: right; padding: 10px 12px; white-space: nowrap; }
td { padding: 11px 12px; text-align: right; border-top: 1px solid var(--linia2); white-space: nowrap; font-variant-numeric: tabular-nums; }
th:first-child, td:first-child { text-align: left; }
tbody tr.klik { cursor: pointer; }
tbody tr.klik:hover { background: #F9FAFB; }
tfoot td { font-weight: 700; background: #F9FAFB; border-top: 2px solid var(--linia); }
.link-sklep { border: 0; background: none; padding: 0; font-weight: 600; text-align: left; color: var(--tekst); }
.link-sklep:hover { color: var(--niebieski); }

/* ---------- lista (telefon) ---------- */
.lista { overflow: hidden; }
.wiersz { width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 62px; padding: 10px 16px;
  border: 0; border-bottom: 1px solid var(--linia2); background: #fff; text-align: left; }
.wiersz:last-child { border-bottom: 0; }
.wiersz .lewo, .wiersz .prawo { display: flex; flex-direction: column; gap: 2px; }
.wiersz .prawo { align-items: flex-end; }
.wiersz .nazwa { font-size: 15px; font-weight: 600; }
.wiersz .mniejsze { font-size: 12px; color: var(--szary); }
.nowrap { white-space: nowrap; }
.wiersz .kwota { font-size: 15px; font-weight: 700; }

.status { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--szary); font-weight: 500; }
.status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #9CA3AF; }
.status.ok::before { background: #059669; } .status.opoznienie::before { background: #D97706; } .status.brak::before { background: #DC2626; }

/* ---------- porównanie sklepu ---------- */
.dwie-kolumny { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; }
.dwie-kolumny > .karta { flex: 1 1 640px; min-width: 0; }
.wykres { padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.wykres .sekcja-tytul { padding: 0; }
.slupki { display: grid; grid-template-columns: repeat(14, minmax(0, 1fr)); gap: 5px; align-items: end; height: 170px; }
.slupek { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 4px; }
.slupek .s { width: 100%; border-radius: 4px 4px 2px 2px; background: var(--slupek); min-height: 3px; }
.slupek.dzis .s { background: var(--niebieski); }
.slupek.zamkniete .s { background: #D1D5DB; }
.slupek .w { font-size: 10px; color: var(--szary); }
.osie { display: grid; grid-template-columns: repeat(14, minmax(0, 1fr)); gap: 5px; font-size: 11px; color: var(--szary); text-align: center; }

/* ---------- ranking ---------- */
.rank { width: 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 12px 16px; border: 0; border-bottom: 1px solid var(--linia2); background: #fff; text-align: left; }
.rank .poz { width: 30px; height: 30px; border-radius: 50%; background: var(--niebieski-jasny); color: var(--niebieski-ciemny); font-size: 13px; font-weight: 700; display: grid; place-items: center; flex-shrink: 0; }
.rank .nazwa { flex: 1 1 180px; font-weight: 600; }
.rank .pasek { flex: 2 1 200px; height: 10px; background: var(--linia2); border-radius: 999px; overflow: hidden; }
.rank .pasek span { display: block; height: 100%; background: #3B82F6; border-radius: 999px; }
.rank .pasek span.ujemny { background: #F87171; }
.rank .wart { flex: 0 0 120px; text-align: right; font-weight: 700; }

.tylko-telefon { display: none; }

/* ---------- telefon ---------- */
@media (max-width: 760px) {
  .aplikacja { flex-direction: column; }
  .menu { position: fixed; bottom: 0; left: 0; right: 0; top: auto; width: auto; height: auto; flex-direction: row; justify-content: space-around;
    padding: 6px 8px calc(8px + env(safe-area-inset-bottom)); border-right: 0; border-top: 1px solid var(--linia); z-index: 10; }
  .menu-marka, .menu-wyloguj { display: none; }
  .menu-poz { flex-direction: column; gap: 3px; font-size: 12px; padding: 6px 10px; flex: 1; justify-content: center; }
  .menu-poz[aria-current="page"] { background: transparent; color: var(--niebieski); }
  .tresc { padding: 18px 14px calc(96px + env(safe-area-inset-bottom)); gap: 12px; }
  .naglowek h1 { font-size: 21px; }
  .zakres { padding: 12px 14px; }
  .zakres-pola { width: 100%; }
  .zakres-pola label { flex: 1; }
  .zakres-pola input { min-width: 0; width: 100%; }
  .zakres p { text-align: left; }
  .kafelki { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kafel { padding: 14px; }
  .kafel .wartosc { font-size: 20px; }
  .kafel.duzy { grid-column: 1 / -1; }
  .kafel.duzy .wartosc { font-size: 30px; }
  .tylko-komputer { display: none; }
  .tylko-telefon { display: block; }
  .rank .wart { flex-basis: auto; }
  .rank .pasek { flex-basis: 100%; order: 3; }
}
