/* AdScreen - własny, samodzielny arkusz CSS.
   Wcześniej panel ładował Tailwind z cdnjs.cloudflare.com - jeśli komputer
   otwierający panel nie miał w danym momencie internetu (albo coś
   blokowało ten adres), CAŁE stylowanie znikało i widać było gołe HTML.
   To jest realne ryzyko nie tylko w testach lokalnych, ale i u klientów -
   sieć w ich lokalu nie musi mieć dostępu do zewnętrznych CDN. Poniżej
   ręcznie odwzorowane WYŁĄCZNIE te klasy Tailwind, które panel faktycznie
   używa - zero zapytań do internetu, panel wygląda tak samo zawsze. */

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Segoe UI', system-ui, sans-serif; }

/* layout */
.flex { display: flex; }
.grid { display: grid; }
.flex-1 { flex: 1 1 0%; }
.flex-shrink-0 { flex-shrink: 0; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 768px) { .md\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } .md\:col-span-4 { grid-column: span 4 / span 4; } }
.col-span-2 { grid-column: span 2 / span 2; }
.col-span-4 { grid-column: span 4 / span 4; }
.min-h-screen { min-height: 100vh; }
.mx-auto { margin-left: auto; margin-right: auto; }
.max-w-6xl { max-width: 72rem; }
.max-w-sm { max-width: 24rem; }
.w-full { width: 100%; }
.w-5 { width: 1.25rem; } .w-12 { width: 3rem; } .w-16 { width: 4rem; } .w-32 { width: 8rem; } .w-72 { width: 18rem; }
.h-12 { height: 3rem; }

/* odstępy */
.gap-1 { gap: 0.25rem; } .gap-2 { gap: 0.5rem; } .gap-3 { gap: 0.75rem; }
.space-y-1 > * + * { margin-top: 0.25rem; }
.space-y-2 > * + * { margin-top: 0.5rem; }
.space-y-3 > * + * { margin-top: 0.75rem; }
.space-y-4 > * + * { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.25rem; } .mb-2 { margin-bottom: 0.5rem; } .mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; } .mb-6 { margin-bottom: 1.5rem; }
.mt-1 { margin-top: 0.25rem; } .mt-24 { margin-top: 6rem; }
.ml-2 { margin-left: 0.5rem; }
.p-1\.5 { padding: 0.375rem; } .p-2 { padding: 0.5rem; } .p-3 { padding: 0.75rem; } .p-4 { padding: 1rem; } .p-6 { padding: 1.5rem; }
.px-1\.5 { padding-left: 0.375rem; padding-right: 0.375rem; }
.px-2 { padding-left: 0.5rem; padding-right: 0.5rem; }
.px-3 { padding-left: 0.75rem; padding-right: 0.75rem; }
.px-4 { padding-left: 1rem; padding-right: 1rem; }
.py-0\.5 { padding-top: 0.125rem; padding-bottom: 0.125rem; }
.py-1 { padding-top: 0.25rem; padding-bottom: 0.25rem; }
.py-1\.5 { padding-top: 0.375rem; padding-bottom: 0.375rem; }
.py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.py-3 { padding-top: 0.75rem; padding-bottom: 0.75rem; }

/* typografia */
.text-2xl { font-size: 1.5rem; line-height: 2rem; }
.text-xl { font-size: 1.25rem; line-height: 1.75rem; }
.text-lg { font-size: 1.125rem; line-height: 1.75rem; }
.text-sm { font-size: 0.875rem; line-height: 1.25rem; }
.text-xs { font-size: 0.75rem; line-height: 1rem; }
.font-bold { font-weight: 700; }
.font-medium { font-weight: 500; }
.text-center { text-align: center; }
.text-left { text-align: left; }
.leading-none { line-height: 1; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* kolory (paleta "slate"/"sky" ze standardowego Tailwinda) */
.bg-slate-950 { background-color: #020617; }
.bg-slate-900 { background-color: #0f172a; }
.bg-slate-800 { background-color: #1e293b; }
.bg-sky-600 { background-color: #0284c7; }
.bg-red-900 { background-color: #7f1d1d; }
.bg-amber-900 { background-color: #78350f; }
.text-slate-100 { color: #f1f5f9; }
.text-slate-300 { color: #cbd5e1; }
.text-slate-400 { color: #94a3b8; }
.text-slate-500 { color: #64748b; }
.text-slate-600 { color: #475569; }
.text-sky-400 { color: #38bdf8; }
.text-red-400 { color: #f87171; }
.border { border-width: 1px; border-style: solid; border-color: currentColor; }
.border-b { border-bottom-width: 1px; border-bottom-style: solid; }
.border-b-2 { border-bottom-width: 2px; border-bottom-style: solid; }
.border-slate-700 { border-color: #334155; }
.border-slate-800 { border-color: #1e293b; }
.border-sky-400 { border-color: #38bdf8; }
.last\:border-0:last-child { border-width: 0; }
.rounded { border-radius: 0.375rem; }
.object-cover { object-fit: cover; }
.cursor-pointer { cursor: pointer; }

/* hover - JS dopisuje te klasy razem z bg-*, więc trzeba je zdefiniować jako :hover warianty */
.hover\:bg-slate-700:hover { background-color: #334155; }
.hover\:bg-sky-500:hover { background-color: #0ea5e9; }
.hover\:bg-red-800:hover { background-color: #991b1b; }
.hover\:bg-amber-800:hover { background-color: #92400e; }
.hover\:text-white:hover { color: #ffffff; }
.hover\:text-slate-200:hover { color: #e2e8f0; }

/* wygaszony wygląd formularzy w ciemnym motywie (input/select/button bez
   Tailwinda wyglądałyby jak domyślne, jasne kontrolki przeglądarki) */
input, select, button {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  background-color: #1e293b;
  border: 1px solid #334155;
  border-radius: 0.375rem;
  padding: 0.375rem 0.5rem;
}
button { cursor: pointer; }
button:hover { background-color: #334155; }
input[type="checkbox"] { width: auto; padding: 0; }

.status-dot { display:inline-block; width:10px; height:10px; border-radius:50%; margin-right:6px; }

/* Menu "więcej opcji" (⋯) przy ekranie - grupuje rzadziej używane akcje,
   żeby wiersz urządzenia nie zamieniał się w ścianę 10 przycisków przy
   kilku-kilkunastu ekranach. */
.device-menu {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 0.25rem;
  background: #0f172a;
  border: 1px solid #1e293b;
  border-radius: 0.5rem;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
  z-index: 40;
  min-width: 13rem;
  overflow: hidden;
}
.device-menu button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.5rem 0.75rem;
  font-size: 0.75rem;
  background: transparent;
  border: none;
  border-radius: 0;
  color: #e2e8f0;
}
.device-menu button:hover { background: #1e293b; }
.device-menu button.danger { color: #f87171; }
.device-menu button.danger:hover { background: #450a0a; }

/* Raport miesięczny: przyciski "Wróć"/"Drukuj" mają sens tylko na ekranie,
   nie na wydruku/PDF - .no-print znika przy faktycznym drukowaniu. */
@media print {
  .no-print { display: none !important; }
}

/* ════════════════════════════════════════════════════════════════════
   PANEL KLASY PREMIUM - sidebar, karty, wykres. Wszystko nadal 100%
   samodzielne (bez CDN/fontów zewnętrznych) - ta sama zasada co reszta
   pliku: panel musi wyglądać identycznie niezależnie od dostępu do
   internetu.
   ════════════════════════════════════════════════════════════════════ */

body {
  font-family: -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

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

/* ── Sidebar ── */
.sidebar {
  width: 15rem;
  flex-shrink: 0;
  background: #0b1120;
  border-right: 1px solid #1e293b;
  padding: 1.25rem 0.75rem;
  display: flex;
  flex-direction: column;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.5rem 1.5rem;
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.55rem 0.75rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  color: #94a3b8;
  background: transparent;
  border: none;
  text-align: left;
  width: 100%;
  margin-bottom: 0.125rem;
  cursor: pointer;
  transition: background-color 0.12s ease, color 0.12s ease;
}
.nav-item:hover { background: #1e293b; color: #e2e8f0; }
.nav-item.active { background: #0284c7; color: #ffffff; }
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.sidebar-footer {
  margin-top: auto;
  padding: 0.75rem 0.5rem 0;
  border-top: 1px solid #1e293b;
}

.main-area { flex: 1; padding: 2rem 2.5rem; max-width: 82rem; }

/* ── Telefon: sidebar jako wysuwana szuflada, nie stały pasek ──
   Stały pasek 240px zjadałby ponad połowę szerokości typowego telefonu
   (~390px) - poniżej 768px chowamy go poza ekran, otwierany przyciskiem ☰. */
.mobile-menu-toggle { display: none; }

@media (max-width: 767px) {
  .mobile-menu-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    top: 0.75rem;
    left: 0.75rem;
    z-index: 60;
    width: 2.5rem;
    height: 2.5rem;
    background: #0f172a;
    border: 1px solid #1e293b;
    border-radius: 0.5rem;
    font-size: 1.25rem;
  }
  .app-shell { display: block; }
  .sidebar {
    position: fixed;
    inset: 0 25% 0 0;
    z-index: 55;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    width: auto;
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 50;
  }
  .sidebar-backdrop.open { display: block; }
  .main-area { padding: 4rem 1rem 1.5rem; max-width: 100%; }
}

/* ── Karty statystyk pulpitu ── */
.stat-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.stat-card {
  flex: 1 1 180px;
  background: #0f172a;
  border: 1px solid #1e293b;
  border-radius: 0.75rem;
  padding: 1rem 1.125rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
.stat-card .stat-icon {
  width: 2rem; height: 2rem;
  border-radius: 0.5rem;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 0.625rem;
}
.stat-card .stat-icon svg { width: 16px; height: 16px; }
.stat-card .stat-value { font-size: 1.625rem; font-weight: 700; line-height: 1.1; letter-spacing: -0.02em; }
.stat-card .stat-label { font-size: 0.75rem; color: #64748b; margin-top: 0.25rem; }

/* ── Karta generyczna (wykres, tabele) ── */
.panel-card {
  background: #0f172a;
  border: 1px solid #1e293b;
  border-radius: 0.75rem;
  padding: 1.25rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
  margin-bottom: 1.5rem;
}
.panel-card-title { font-size: 0.9375rem; font-weight: 600; margin-bottom: 1rem; }

/* ── Wykres słupkowy (inline SVG, zero zależności) ── */
.chart-bar { fill: #0284c7; transition: fill 0.15s ease; }
.chart-bar:hover { fill: #38bdf8; }
.chart-label { fill: #64748b; font-size: 10px; }
.chart-value { fill: #cbd5e1; font-size: 10px; font-weight: 600; }

/* ── Tabela audytu ── */
.audit-table { width: 100%; border-collapse: collapse; font-size: 0.8125rem; }
.audit-table th { text-align: left; padding: 0.5rem 0.75rem; color: #64748b; font-weight: 500; border-bottom: 1px solid #1e293b; }
.audit-table td { padding: 0.5rem 0.75rem; border-bottom: 1px solid #1e293b; }
.audit-table tr:last-child td { border-bottom: none; }
.badge { display: inline-block; padding: 0.125rem 0.5rem; border-radius: 999px; font-size: 0.6875rem; background: #1e293b; color: #94a3b8; }
