/* Czcionki Google Fonts ładowane asynchronicznie z preconnect w includes/header.php */

:root {
  /* Kolorystyka z logo i motywu głównego OSP Żyrardów */
  --osp-yellow: #FFD700;
  /* Żółty z napisów "OSP ŻYRARDÓW" */
  --osp-yellow-dim: rgba(255, 215, 0, 0.15);
  --osp-red: #D2141C;
  /* Czerwień z płomieni */
  --osp-red-hover: #a80f15;
  --osp-red-dim: rgba(210, 20, 28, 0.2);
  --osp-bg: #01020a;
  /* Bardzo ciemne tło */
  --panel: #050a14;
  /* Tło paneli, hero, kart i tabel */
  --panel-card: #0b0e14;
  /* Tło wewnętrznych kafelków */
  --line: #222c3c;
  /* Ramki i separatory */
  --line-subtle: #1a2332;

  /* Typografia */
  --text-white: #ffffff;
  --text-grey: #b0b0b0;
  --text-muted: #888888;

  /* Statusy */
  --status-active: #22c55e;
  --status-active-dim: rgba(34, 197, 94, 0.15);
}

*,
*::before,
*::after {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent !important;
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  background-color: var(--osp-bg);
  color: var(--text-white);
  font-family: 'Lato', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body {
  display: flex;
  flex-direction: column;
}

h1,
h2,
h3,
h4,
h5,
.page-title,
.section-header h2 {
  font-family: 'Merriweather Sans', sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

a {
  color: inherit;
  text-decoration: none;
}

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px;
  padding-left: max(16px, env(safe-area-inset-left));
  padding-right: max(16px, env(safe-area-inset-right));
  padding-bottom: max(16px, env(safe-area-inset-bottom));
  flex: 1 0 auto;
}

.app-footer {
  flex-shrink: 0;
  margin-top: auto !important;
  padding-bottom: max(12px, env(safe-area-inset-bottom));
}

/* ── Nawigacja (Navbar) ────────────────────────────────── */
.navbar {
  background-color: #01020a;
  border-bottom: 2px solid var(--osp-red);
  padding: 10px 0;
  padding-top: max(10px, env(safe-area-inset-top));
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

.nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: 'Merriweather Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: 0.5px;
  color: var(--text-white);
  min-height: 38px;
  flex-shrink: 0;
  contain: layout;
}

.brand-badge {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  background: var(--osp-red-dim);
  border: 1px solid var(--osp-red);
  color: var(--osp-yellow);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .75rem;
  font-weight: 900;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--line);
  color: var(--text-white);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 1.1rem;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.chip {
  padding: 6px 16px;
  border-radius: 20px;
  font-size: .82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid var(--line);
  color: var(--text-white);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
}

.chip:hover {
  color: var(--osp-yellow);
  border-color: var(--osp-yellow);
  background: rgba(30, 41, 59, 0.95);
  transform: translateY(-1px);
}

.chip.active {
  background: rgba(255, 215, 0, 0.18);
  border-color: var(--osp-yellow);
  color: var(--osp-yellow);
  box-shadow: 0 0 10px rgba(255, 215, 0, 0.25);
}

.chip.muted {
  color: var(--text-grey);
  background: transparent;
  border-color: transparent;
}

.chip.danger {
  background: var(--osp-red-dim);
  border-color: var(--osp-red);
  color: #ff8b8b;
}

.chip.danger:hover {
  background: var(--osp-red);
  color: var(--text-white);
}

@media (max-width: 780px) {
  .nav-toggle {
    display: inline-flex;
  }

  .nav-right {
    display: none;
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    margin-top: 10px;
    gap: 8px;
  }

  html.nav-open .nav-right {
    display: flex;
  }

  .nav-inner {
    flex-wrap: wrap;
  }
}

/* ── Przyciski i elementy globalne ─────────────────────── */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 22px;
  border-radius: 24px;
  background-color: var(--osp-red);
  color: var(--text-white);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-size: .88rem;
  border: none;
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), background-color 0.2s;
  box-shadow: 0 4px 14px rgba(210, 20, 28, 0.4);
}

.btn-primary:hover {
  background-color: var(--osp-red-hover);
  transform: translateY(-2px);
  color: var(--text-white);
  box-shadow: 0 6px 18px rgba(210, 20, 28, 0.5);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 22px;
  border-radius: 24px;
  background: rgba(30, 41, 59, 0.85);
  border: 1px solid var(--line);
  color: var(--text-white);
  font-weight: 700;
  text-transform: uppercase;
  font-size: .88rem;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.btn-secondary:hover {
  border-color: var(--osp-yellow);
  color: var(--osp-yellow);
  transform: translateY(-1px);
}

.btn-edit {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: .82rem;
  font-weight: 700;
  text-transform: uppercase;
  background: rgba(30, 41, 59, 0.85);
  border: 1px solid rgba(255, 215, 0, 0.6);
  color: var(--osp-yellow);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

.btn-edit:hover {
  background: var(--osp-yellow);
  color: #000;
  border-color: var(--osp-yellow);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(255, 215, 0, 0.35);
}

.alert {
  padding: 12px 16px;
  border-radius: 6px;
  font-size: .88rem;
  margin-bottom: 14px;
}

.alert-error {
  background: var(--osp-red-dim);
  border: 1px solid var(--osp-red);
  color: #ff8b8b;
}

.alert-ok {
  background: var(--status-active-dim);
  border: 1px solid var(--status-active);
  color: var(--status-active);
}

/* ── Widok akcji (Event Hero) ──────────────────────────── */
.ev-hero {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 5px solid var(--osp-red);
  border-radius: 8px;
  padding: 20px 24px;
  margin-bottom: 16px;
}

.ev-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.ev-title-group {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.ev-title {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-white);
  word-break: break-word;
}

.st-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: .7rem;
  font-weight: 900;
  letter-spacing: .08em;
  border: 1px solid #22c55e88;
  background: var(--status-active-dim);
  color: var(--status-active);
}

.st-pill-archived {
  border-color: #555;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-grey);
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--status-active);
  animation: pulse-live 2s infinite;
}

@keyframes pulse-live {
  0% {
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.8), 0 0 6px rgba(34, 197, 94, 0.6);
  }
  60% {
    box-shadow: 0 0 0 7px rgba(34, 197, 94, 0), 0 0 10px rgba(34, 197, 94, 0.8);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0), 0 0 6px rgba(34, 197, 94, 0.6);
  }
}

.ev-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.ev-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 14px;
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  font-size: .82rem;
  color: var(--text-grey);
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

.ev-chip svg {
  color: var(--osp-yellow);
}

.ev-chip b {
  color: var(--text-white);
  font-weight: 700;
}

.ev-desc {
  font-size: .9rem;
  color: #ddd;
  line-height: 1.6;
  padding-top: 12px;
  border-top: 1px solid var(--line-subtle);
  white-space: pre-wrap;
  word-break: break-word;
}

/* ── Kafelki wideo (Streams Grid) ──────────────────────── */
.ev-layout {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  width: 100%;
}

.ev-main {
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
}

.ev-aside {
  width: 380px;
  flex: 0 0 380px;
  box-sizing: border-box;
}

/* Elementy sterowania TV - ukryte w widoku głównym */
.btn-hide-stream-card,
.ev-resizer {
  display: none !important;
}

.streams-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 14px;
  width: 100%;
}

.stream-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
  width: 100%;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.4);
}

.stream-card-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--panel-card);
  border-bottom: 1px solid var(--line);
  font-family: 'Merriweather Sans', sans-serif;
  font-size: .85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-white);
  cursor: default;
  user-select: none;
  -webkit-user-select: none;
  touch-action: pan-y;
}

.stream-card-drag-handle {
  cursor: grab;
  cursor: -webkit-grab;
  font-size: 16px;
  line-height: 1;
  color: var(--text-muted);
  padding: 4px 6px;
  margin-left: -4px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
  transition: all 0.2s ease;
}

.stream-card-drag-handle:hover,
.stream-card-head:hover .stream-card-drag-handle {
  color: var(--osp-yellow);
  background: rgba(255, 215, 0, 0.12);
}

/* Stany przeciągania kafelków (SortableJS + Touch) */
.stream-card.sortable-chosen {
  opacity: 0.98;
  border-color: var(--osp-yellow) !important;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.9), 0 0 26px rgba(255, 215, 0, 0.7), inset 0 0 10px rgba(255, 215, 0, 0.2) !important;
  transform: scale(1.025);
  transition: transform 0.15s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.15s ease;
  z-index: 9999 !important;
  cursor: grabbing !important;
}

.stream-card.sortable-chosen .stream-card-head {
  background: rgba(255, 215, 0, 0.16) !important;
  border-bottom: 1px solid rgba(255, 215, 0, 0.4) !important;
}

.stream-card.sortable-chosen .stream-card-drag-handle {
  color: var(--osp-yellow) !important;
}

.stream-card.sortable-chosen .stream-card-head,
.stream-card.sortable-chosen .stream-card-drag-handle {
  cursor: grabbing !important;
  cursor: -webkit-grabbing !important;
}

.stream-card.sortable-ghost {
  opacity: 0.25 !important;
  border: 2px dashed var(--osp-yellow) !important;
  background: rgba(255, 215, 0, 0.05) !important;
  box-shadow: none !important;
}

.stream-card.sortable-drag {
  opacity: 1 !important;
  cursor: grabbing !important;
}

body.sortable-dragging-active iframe,
.grid-dragging-active iframe {
  pointer-events: none !important;
}

.sdot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
  display: inline-block;
  background: #ef4444 !important;
  box-shadow: 0 0 6px rgba(239, 68, 68, 0.45) !important;
  transition: background 0.3s ease, box-shadow 0.3s ease;
}

.sdot.ok {
  background: #22c55e !important;
  box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.8) !important;
  animation: pulse-live 1.8s infinite !important;
}

.video-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16/9;
  background: #000;
  overflow: hidden;
}

.video-wrap iframe,
.video-wrap video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* Komunikat o braku sygnału */
.no-signal-msg {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--text-grey);
  font-size: .85rem;
  background: #000;
}

.no-signal-msg svg {
  color: var(--osp-yellow);
}

.stream-card:has(.sdot.ok) .no-signal-msg {
  display: none;
}

/* ── Pasek boczny: Mapa i Pogoda ──────────────────────── */
.sidebar-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
}

.sidebar-tabs {
  display: flex;
  background: var(--panel-card);
  border-bottom: 1px solid var(--line);
}

.stab {
  flex: 1;
  padding: 12px;
  font-family: 'Merriweather Sans', sans-serif;
  font-size: .8rem;
  font-weight: 700;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: .06em;
  cursor: pointer;
  color: var(--text-grey);
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  transition: all 0.2s ease;
}

.stab:hover {
  color: var(--osp-yellow);
}

.stab.active {
  color: var(--text-white);
  border-bottom-color: var(--osp-yellow);
  background: var(--panel);
}

.stab-pane {
  display: none;
}

.stab-pane.active {
  display: block;
}

#map {
  width: 100%;
  height: 350px;
}

.windy-frame {
  width: 100%;
  height: 350px;
  border: 0;
  display: block;
}

/* ── Tabele i Formularze ──────────────────────────────── */
.admin-table {
  width: 100%;
  border-collapse: collapse;
  background-color: var(--panel-card);
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
}

.admin-table th {
  background-color: var(--panel);
  color: var(--osp-yellow);
  font-family: 'Merriweather Sans', sans-serif;
  font-weight: 700;
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 12px 14px;
  border-bottom: 2px solid var(--osp-yellow);
}

.admin-table td {
  padding: 12px 14px;
  font-size: .88rem;
  color: #e0e0e0;
  border-bottom: 1px solid var(--line-subtle);
}

.f input,
.f textarea,
.stream-row input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 4px;
  background-color: #111;
  border: 1px solid var(--line);
  color: var(--text-white);
  font-size: .9rem;
}

.f input:focus,
.f textarea:focus,
.stream-row input:focus {
  border-color: var(--osp-yellow);
  outline: none;
  box-shadow: 0 0 0 2px var(--osp-yellow-dim);
}

/* ── Stopka ────────────────────────────────────────────── */
footer {
  background-color: #000000;
  padding: 40px 0 20px;
  font-size: 0.88rem;
  color: var(--text-grey);
  border-top: 1px solid var(--line-subtle);
  margin-top: 40px;
  text-align: center;
}

/* ── Responsywność mobilna ────────────────────────────── */
@media (max-width: 960px) {
  .ev-layout {
    flex-direction: column;
  }

  .ev-aside {
    width: 100%;
    flex: 1 1 auto;
  }
}

@media (max-width: 600px) {
  .container {
    padding: 10px;
  }

  .ev-hero {
    padding: 14px;
  }

  .ev-title {
    font-size: 1.25rem;
  }

  .streams-grid {
    grid-template-columns: 1fr;
  }

  #map,
  .windy-frame {
    height: 280px;
  }
}

/* Domyślnie iframe jest ukryty, więc widać napis "Brak sygnału" */
.stream-card .video-wrap iframe {
  display: none !important;
}

/* Pokazuj iframe TYLKO wtedy, gdy sprawdzarka API doda klasę .ok do kropki statusu */
.stream-card:has(.sdot.ok) .video-wrap iframe {
  display: block !important;
}

/* Kontener akcji w tabeli */
.admin-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: nowrap;
}

/* Uniwersalny mały przycisk tabeli w stylu Tactical Pill */
.btn-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 6px 12px;
  font-size: 0.74rem;
  font-weight: 700;
  font-family: 'Lato', sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  border-radius: 18px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  border: 1px solid var(--line);
  background: rgba(30, 41, 59, 0.85);
  color: var(--text-white);
  line-height: 1.2;
  box-sizing: border-box;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

/* Równomierne, jednakowej szerokości przyciski akcji w tabeli */
.admin-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
}

.admin-actions .btn-action {
  width: 116px;
  min-width: 116px;
  padding: 6px 8px;
  font-size: 0.72rem;
  letter-spacing: 0.3px;
  text-align: center;
  justify-content: center;
  white-space: nowrap;
  flex-shrink: 0;
  box-sizing: border-box;
}

.btn-action svg {
  flex-shrink: 0;
  width: 12px;
  height: 12px;
  transition: color 0.2s ease, stroke 0.2s ease;
}

@media (max-width: 768px) {
  .admin-actions {
    gap: 4px;
    flex-wrap: nowrap;
  }
  .admin-actions .btn-action {
    width: 98px;
    min-width: 98px;
    padding: 5px 6px;
    font-size: 0.67rem;
    letter-spacing: 0.2px;
    gap: 4px;
    border-radius: 14px;
  }
  .admin-actions .btn-action svg {
    width: 11px;
    height: 11px;
  }
}

/* Edytuj - żółty akcent */
.btn-action.btn-edit-sm {
  border-color: var(--osp-yellow);
  color: var(--osp-yellow);
}

.btn-action.btn-edit-sm:hover {
  background: var(--osp-yellow);
  color: #000;
}

/* Archiwizuj - neutralny / stonowany */
.btn-action.btn-archive-sm {
  border-color: var(--line);
  color: var(--text-grey);
}

.btn-action.btn-archive-sm:hover {
  background: #1f2937;
  color: var(--text-white);
  border-color: var(--text-grey);
}

/* Usuń - czerwony OSP */
.btn-action.btn-delete-sm {
  background: var(--osp-red-dim);
  border-color: var(--osp-red);
  color: #ff8b8b;
}

.btn-action.btn-delete-sm:hover {
  background: var(--osp-red);
  color: #fff;
}

/* ── Ekran Logowania ──────────────────────────────────── */
.login-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at center, #0a1120 0%, var(--osp-bg) 80%);
  padding: 20px;
}

.login-box {
  width: 100%;
  max-width: 380px;
  background-color: var(--panel);
  border: 1px solid var(--line);
  border-top: 4px solid var(--osp-red);
  border-radius: 8px;
  padding: 32px 28px;
  text-align: center;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.7);
}

.login-badge {
  width: 58px;
  height: 58px;
  border-radius: 8px;
  margin: 0 auto 16px;
  background: var(--osp-red-dim);
  border: 1px solid var(--osp-red);
  color: var(--osp-yellow);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  font-weight: 900;
  font-family: 'Merriweather Sans', sans-serif;
  box-shadow: 0 0 15px rgba(210, 20, 28, 0.3);
}

.login-title {
  margin: 0 0 4px;
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--osp-yellow);
  /* Zmiana na złoty kolor z motywu OSP */
  font-family: 'Merriweather Sans', sans-serif;
  letter-spacing: 0.5px;
}

.login-sub {
  margin: 0 0 24px;
  color: var(--osp-yellow);
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  text-align: left;
}

.login-form .f {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.login-form .f span {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-grey);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.login-form input {
  width: 100%;
  padding: 11px 13px;
  border-radius: 4px;
  background-color: #000;
  border: 1px solid var(--line);
  color: var(--text-white);
  font-family: 'Lato', sans-serif;
  font-size: 0.95rem;
  transition: all 0.2s ease;
}

.login-form input:focus {
  border-color: var(--osp-yellow);
  outline: none;
  box-shadow: 0 0 0 3px var(--osp-yellow-dim);
}

.login-form .btn-primary {
  margin-top: 8px;
  width: 100%;
  padding: 12px;
  font-size: 0.92rem;
}

/* Logo w pasku menu (navbar) */
.nav-logo {
  width: 38px;
  height: 38px;
  min-width: 38px;
  min-height: 38px;
  flex-shrink: 0;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 6px;
  display: block;
}

/* Logo na ekranie logowania */
.login-logo {
  width: 110px;
  height: auto;
  margin: 0 auto 16px;
  display: block;
  object-fit: contain;
  filter: drop-shadow(0 4px 12px rgba(210, 20, 28, 0.3));
}

/* ── Nowy układ PRO formularza zdarzenia ──────────────── */
.form-wrapper {
  max-width: 860px;
  margin: 0 auto;
  padding: 10px 0 50px;
}

.dbl-click-hint {
  margin-left: auto;
  font-size: .65rem;
  color: var(--text-muted);
  text-transform: none;
  letter-spacing: 0;
  opacity: .8;
}

.btn-fullscreen-card {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--line);
  color: var(--text-white);
  border-radius: 4px;
  padding: 4px 8px;
  cursor: pointer;
  font-size: 0.75rem;
  transition: all 0.15s ease;
  flex-shrink: 0;
  outline: none;
}

/* W trybie pełnoekranowym przycisk jest aktywny */
.btn-fullscreen-card.is-active,
.card-fullscreen .btn-fullscreen-card {
  background: var(--osp-yellow) !important;
  color: #000 !important;
  border-color: var(--osp-yellow) !important;
}

/* Gdy karta NIE jest w trybie pełnoekranowym, natychmiast gaśnie po wyjściu */
.stream-card:not(.card-fullscreen) .btn-fullscreen-card:not(:hover):not(.is-active) {
  background: rgba(255, 255, 255, 0.08) !important;
  color: var(--text-white) !important;
  border-color: var(--line) !important;
}

@media (hover: hover) {
  .btn-fullscreen-card:hover {
    background: var(--osp-yellow) !important;
    color: #000 !important;
    border-color: var(--osp-yellow) !important;
  }
}

.btn-fullscreen-card:focus {
  outline: none;
}

.btn-back-link {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-grey);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  transition: color 0.2s ease;
}

.btn-back-link:hover {
  color: var(--osp-yellow);
}

/* ── Karty sekcji ─────────────────────────────────────── */
.pro-card {
  background-color: #080c14;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.pro-card-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-bottom: 16px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--line-subtle);
}

.pro-card-icon {
  font-size: 1.5rem;
  background: var(--panel-card);
  border: 1px solid var(--line);
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
}

.pro-card-icon svg {
  flex-shrink: 0;
}

.pro-card-header h3 {
  margin: 0 0 2px;
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--osp-yellow);
}

.pro-card-header p {
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-grey);
}

/* ── Siatka pól (Grid 2-kolumnowy) ────────────────────── */
.pro-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px 20px;
}

.pro-grid .span-2 {
  grid-column: span 2;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.label-text {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-grey);
}

.label-text .req {
  color: var(--osp-red);
}

.form-group input,
.form-group textarea,
.stream-field input {
  width: 100%;
  padding: 10px 14px;
  border-radius: 5px;
  background-color: #01020a;
  border: 1px solid var(--line);
  color: #ffffff;
  font-family: 'Lato', sans-serif;
  font-size: 0.92rem;
  transition: all 0.2s ease;
}

.form-group input:focus,
.form-group textarea:focus,
.stream-field input:focus {
  border-color: var(--osp-yellow);
  outline: none;
  box-shadow: 0 0 0 2px var(--osp-yellow-dim);
}

.font-mono {
  font-family: monospace !important;
  color: var(--osp-yellow) !important;
}

/* ── Lista Strumieni ──────────────────────────────────── */
.stream-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
}

.stream-item-row {
  display: flex;
  gap: 14px;
  align-items: flex-end;
  background: #03060c;
  border: 1px solid var(--line-subtle);
  border-left: 4px solid var(--osp-yellow);
  padding: 14px;
  border-radius: 6px;
  transition: border-left 0.25s ease, box-shadow 0.25s ease;
}

.stream-group-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  line-height: 1.4;
  transition: all 0.25s ease;
}

.stream-field {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.field-sublabel {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-grey);
  text-transform: uppercase;
}

.btn-copy-rtmp {
  background: rgba(255, 215, 0, 0.12);
  border: 1px solid rgba(255, 215, 0, 0.4);
  color: var(--osp-yellow);
  border-radius: 20px;
  padding: 2px 10px;
  font-size: 10.5px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  line-height: 1.4;
  transition: all 0.2s ease;
}

.btn-copy-rtmp svg {
  flex-shrink: 0;
}

.btn-copy-rtmp:hover {
  background: var(--osp-yellow);
  color: #000;
  border-color: var(--osp-yellow);
  box-shadow: 0 0 8px rgba(255, 215, 0, 0.4);
}

.btn-del-stream {
  height: 38px;
  padding: 0 14px;
  border-radius: 6px;
  background: rgba(220, 38, 38, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.45);
  color: #fca5a5;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  transition: all 0.2s ease;
  flex-shrink: 0;
  white-space: nowrap;
}

.btn-del-stream svg {
  flex-shrink: 0;
}

.btn-del-stream:hover {
  background: var(--osp-red);
  border-color: var(--osp-red);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 3px 10px rgba(220, 38, 38, 0.35);
}

.btn-del-stream:active {
  transform: translateY(0);
}

.btn-add-stream {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  border-radius: 20px;
  background: rgba(30, 41, 59, 0.6);
  border: 1px dashed var(--osp-yellow);
  color: var(--osp-yellow);
  font-weight: 700;
  font-size: 0.82rem;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-add-stream svg {
  flex-shrink: 0;
}

.btn-add-stream:hover {
  background: var(--osp-yellow-dim);
  transform: translateY(-1px);
}

/* ── Pasek Zapisz / Anuluj ────────────────────────────── */
.form-submit-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
}

.btn-primary-pro {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 30px;
  border-radius: 26px;
  background-color: var(--osp-red);
  color: #ffffff;
  font-family: 'Merriweather Sans', sans-serif;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-size: 0.9rem;
  border: none;
  cursor: pointer;
  transition: transform 0.2s, background-color 0.2s;
  box-shadow: 0 4px 15px rgba(210, 20, 28, 0.35);
}

.btn-primary-pro:hover {
  background-color: var(--osp-red-hover);
  transform: translateY(-2px);
}

.btn-cancel-pro {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 26px;
  border-radius: 26px;
  background: rgba(30, 41, 59, 0.85);
  border: 1px solid var(--line);
  color: var(--text-white);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.85rem;
  transition: all 0.2s ease;
}

.btn-cancel-pro:hover {
  border-color: var(--text-grey);
  color: var(--osp-yellow);
  transform: translateY(-1px);
}

/* ── Responsywność mobilna formularza ─────────────────── */
@media (max-width: 680px) {
  .pro-card {
    padding: 16px;
  }

  .pro-grid {
    grid-template-columns: 1fr;
  }

  .pro-grid .span-2 {
    grid-column: span 1;
  }

  .stream-item-row {
    flex-direction: column;
    align-items: stretch;
    position: relative;
    gap: 12px;
  }

  .btn-del-stream {
    width: 100% !important;
    height: 42px !important;
    border-radius: 8px !important;
    margin-top: 4px !important;
    background: rgba(220, 38, 38, 0.2) !important;
    border: 1px solid rgba(239, 68, 68, 0.5) !important;
    color: #fca5a5 !important;
    font-size: 0.85rem !important;
    font-weight: 700 !important;
    letter-spacing: 0.3px !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
  }

  .btn-del-stream:hover,
  .btn-del-stream:active {
    background: #dc2626 !important;
    color: #fff !important;
  }

  .form-submit-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .btn-primary-pro,
  .btn-cancel-pro {
    width: 100%;
  }
}

.login-logo {
  width: 180px;
  /* Zwiększ rozmiar (np. 180px - 220px) */
  max-width: 80%;
  /* Bezpieczeństwo na węższych ekranach */
  height: auto;
  margin: 0 auto 18px;
  display: block;
  object-fit: contain;
  filter: drop-shadow(0 6px 16px rgba(0, 0, 0, 0.6));
}

/* ════════════════════════════════════════════════════════════════
   ŁATKA — brakujące klasy + poprawki (dopisz na koniec styles.css)
   ════════════════════════════════════════════════════════════════ */

/* Nagłówki paneli z tytułem + przyciskiem akcji */
.admin-head,
.form-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

/* Komunikaty "brak danych" */
.empty-state,
.no-streams {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-grey);
  border: 1px dashed var(--line);
  border-radius: 8px;
}

.no-streams a {
  color: var(--osp-yellow);
  font-weight: 700;
}

/* Siatka kart na stronach Zdarzenia / Historia */
.events-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}

.event-card {
  display: block;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  transition: border-color .2s ease, transform .2s ease;
}

.event-card:hover {
  border-color: var(--osp-yellow);
  transform: translateY(-2px);
}

.event-card-top {
  margin-bottom: 10px;
}

.event-card-title {
  margin: 0 0 8px;
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-white);
  font-family: 'Merriweather Sans', sans-serif;
}

.event-card-meta {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: .82rem;
  color: var(--text-grey);
}

.event-card-meta span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.event-card-meta svg {
  flex-shrink: 0;
  color: var(--text-muted);
}

/* Mniejszy wariant pigułki statusu (tabela admina) */
.st-pill-sm {
  font-size: .65rem;
  padding: 3px 10px;
}

/* Skracanie długiej etykiety kanału w nagłówku karty streamu */
.stream-card-title {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-white);
}

/* Przewijanie poziome tabeli admina na wąskich ekranach */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}

/* ── Tryb pełnego ekranu dla karty streamu (całkowite wypełnienie, bez belki kanału) ── */
.stream-card.card-fullscreen {
  position: fixed !important;
  inset: 0 !important;
  z-index: 99999 !important;
  border-radius: 0 !important;
  border: none !important;
  display: block !important;
  background: #000 !important;
  width: 100% !important;
  width: 100vw !important;
  height: 100% !important;
  height: 100dvh !important;
}

.stream-card.card-fullscreen .stream-card-head {
  display: none !important;
}

.stream-card.card-fullscreen .video-wrap {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  aspect-ratio: auto !important;
  z-index: 1 !important;
}

body.no-scroll {
  overflow: hidden;
}

/* Wymuszenie widoczności OSD ponad interfejsem odtwarzacza */
.ovenplayer .op-ui {
  z-index: 100 !important;
}

#osd {
  z-index: 2147483647 !important;
}

#osdToggle {
  z-index: 2147483647 !important;
}

/* Podpowiedź o podwójnym kliknięciu w nagłówku strumienia */
.dbl-click-hint {
  margin-left: auto;
  /* Automatycznie wypycha tekst do prawej krawędzi */
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: rgba(255, 255, 255, 0.05);
  padding: 4px 8px;
  border-radius: 4px;
  border: 1px dashed var(--line);
  pointer-events: none;
  /* Żeby nie blokowało klikania, jeśli ktoś trafi w sam tekst */
}

/* Czerwona kropka (Dron 1) */
.drone-dot-1 {
  background-color: #ff3b3b;
  animation: mapPulse 1.5s infinite;
  /* ... */
}

/* Pomarańczowa kropka (Dron 2) */
.drone-dot-2 {
  background-color: #ff9800;
  animation: mapPulse 1.5s infinite;
  /* ... */
}

/* Fioletowa kropka (Dron 3) */
.drone-dot-3 {
  background-color: #9c27b0;
  animation: mapPulse 1.5s infinite;
  /* ... */
}

/* ══════════════════════════════════════════════════════════════════
   DRAG & DROP KAFELKÓW WIDEO
   ══════════════════════════════════════════════════════════════════ */
.stream-card {
  transition: transform 0.2s cubic-bezier(0.2, 0, 0, 1), box-shadow 0.2s ease, border-color 0.2s ease;
  user-select: none;
  border-top: 2px solid var(--drone-color, var(--line));
}

.drone-badge-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
  display: inline-block;
}

.stream-card-drag-handle {
  cursor: grab;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1;
  padding: 2px 4px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  user-select: none;
  -webkit-user-select: none;
}

.stream-card-drag-handle:hover {
  color: var(--osp-yellow);
  background: rgba(255, 215, 0, 0.15);
}

.stream-card-head {
  cursor: grab;
}

.stream-card-head:active,
.stream-card-drag-handle:active {
  cursor: grabbing;
}

.stream-card.is-dragging {
  opacity: 0.4;
  transform: scale(0.96);
  border: 2px dashed var(--osp-yellow) !important;
  box-shadow: 0 0 25px rgba(255, 215, 0, 0.35) !important;
}

.stream-card.drag-over {
  border-color: var(--osp-yellow) !important;
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
}

.grid-dragging-active iframe {
  pointer-events: none !important;
}

/* ══════════════════════════════════════════════════════════════════
   TRYB TV / SZTAB (COMMAND WALL MODE)
   ══════════════════════════════════════════════════════════════════ */
.btn-tv-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 15px;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 700;
  background: rgba(59, 130, 246, 0.15);
  border: 1px solid #3b82f6;
  color: #60a5fa;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

.btn-tv-toggle:hover {
  background: #2563eb;
  color: #ffffff;
  box-shadow: 0 0 14px rgba(59, 130, 246, 0.5);
  transform: translateY(-1px);
}

.btn-tv-toggle.active {
  background: #2563eb;
  color: #fff;
  border-color: #60a5fa;
}

.btn-tv-icon {
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.btn-tv-toggle:hover .btn-tv-icon {
  transform: scale(1.08);
}

/* Pływający pasek sterowania w trybie TV */
.tv-mode-bar {
  display: none;
  position: fixed;
  top: 10px;
  right: 14px;
  z-index: 999999;
  background: rgba(13, 14, 18, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 30px;
  padding: 6px 14px;
  gap: 10px;
  align-items: center;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.7);
}

.btn-tv-subaction {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: var(--text-white);
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-tv-subaction:hover {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  transform: translateY(-1px);
}

.btn-tv-exit {
  background: var(--osp-red);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  padding: 5px 14px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-tv-exit:hover {
  background: var(--osp-red-hover);
  box-shadow: 0 0 10px rgba(220, 38, 38, 0.5);
  transform: translateY(-1px);
}

/* Stan aktywny Trybu TV */
html.tv-mode,
body.tv-mode {
  overflow: hidden !important;
  height: 100vh !important;
  max-height: 100vh !important;
  width: 100vw !important;
  max-width: 100vw !important;
  background: #060709 !important;
  margin: 0 !important;
  padding: 0 !important;
}

body.tv-mode .navbar,
body.tv-mode .ev-hero {
  display: none !important;
}

body.tv-mode .tv-mode-bar {
  display: inline-flex !important;
}

body.tv-mode main.container {
  max-width: 100vw !important;
  width: 100vw !important;
  height: 100vh !important;
  max-height: 100vh !important;
  padding: 8px !important;
  margin: 0 !important;
  box-sizing: border-box !important;
  overflow: hidden !important;
}

body.tv-mode .ev-layout {
  display: flex !important;
  height: 100% !important;
  max-height: 100% !important;
  width: 100% !important;
  gap: 8px !important;
  align-items: stretch !important;
  overflow: hidden !important;
}

body.tv-mode .ev-main {
  flex: 1 1 auto !important;
  height: 100% !important;
  max-height: 100% !important;
  display: flex !important;
  flex-direction: column !important;
  min-width: 0 !important;
  overflow: hidden !important;
}

.btn-hide-stream-card {
  display: none !important;
}

body.tv-mode .btn-hide-stream-card {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px 5px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  line-height: 1;
}
body.tv-mode .btn-hide-stream-card:hover {
  background: rgba(239, 68, 68, 0.25);
  color: #ef4444;
}

body.tv-mode .stream-card.is-hidden-by-user {
  display: none !important;
}

.btn-tv-subaction.active {
  background: #2563eb !important;
  color: #fff !important;
  border-color: #60a5fa !important;
  box-shadow: 0 0 10px rgba(37, 99, 235, 0.5) !important;
}

.tv-cam-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 8px;
  background: rgba(18, 22, 31, 0.97);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  box-shadow: 0 10px 35px rgba(0, 0, 0, 0.85);
  width: 290px;
  max-width: 90vw;
  z-index: 1000000;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: fadeIn 0.15s ease;
}

.tv-cam-dropdown-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.05);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 11px;
  font-weight: 700;
  color: var(--text-white);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.btn-tv-drop-link {
  background: transparent;
  border: none;
  color: var(--osp-yellow);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  padding: 2px 4px;
}
.btn-tv-drop-link:hover {
  text-decoration: underline;
}

.tv-cam-dropdown-list {
  padding: 6px 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 280px;
  overflow-y: auto;
}

.tv-cam-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}
.tv-cam-item:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.15);
}

.tv-cam-item input[type="checkbox"] {
  cursor: pointer;
  accent-color: var(--osp-yellow);
  width: 14px;
  height: 14px;
  margin: 0;
}

.tv-cam-item-title {
  font-size: 11.5px;
  font-weight: 600;
  color: #fff;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tv-cam-item-status {
  font-size: 9.5px;
  font-weight: 700;
  padding: 2px 5px;
  border-radius: 3px;
  text-transform: uppercase;
}
.tv-cam-item-status.online {
  background: rgba(34, 197, 94, 0.2);
  color: #4ade80;
  border: 1px solid rgba(34, 197, 94, 0.4);
}
.tv-cam-item-status.offline {
  background: rgba(148, 163, 184, 0.1);
  color: #94a3b8;
  border: 1px solid rgba(148, 163, 184, 0.2);
}

body.tv-mode .streams-grid {
  flex: 1 1 auto !important;
  height: 100% !important;
  max-height: 100% !important;
  display: grid !important;
  gap: 8px !important;
  grid-template-columns: repeat(2, 1fr) !important;
  grid-template-rows: repeat(2, 1fr) !important;
  overflow: hidden !important;
}

body.tv-mode .streams-grid[data-visible-count="1"] {
  grid-template-columns: 1fr !important;
  grid-template-rows: 1fr !important;
}

body.tv-mode .streams-grid[data-visible-count="2"] {
  grid-template-columns: 1fr 1fr !important;
  grid-template-rows: 1fr !important;
}

body.tv-mode .streams-grid[data-visible-count="3"] {
  grid-template-columns: 1fr 1fr !important;
  grid-template-rows: 1fr 1fr !important;
}
body.tv-mode .streams-grid[data-visible-count="3"] .stream-card.stream-card-hero {
  grid-column: span 2 !important;
}

body.tv-mode .streams-grid[data-visible-count="4"] {
  grid-template-columns: 1fr 1fr !important;
  grid-template-rows: 1fr 1fr !important;
}

body.tv-mode .streams-grid[data-visible-count="5"],
body.tv-mode .streams-grid[data-visible-count="6"] {
  grid-template-columns: repeat(3, 1fr) !important;
  grid-template-rows: 1fr 1fr !important;
}

body.tv-mode .stream-card {
  height: 100% !important;
  max-height: 100% !important;
  display: flex !important;
  flex-direction: column !important;
  border-radius: 6px !important;
  background: #0d0e12 !important;
  overflow: hidden !important;
}

body.tv-mode .stream-card-head {
  padding: 6px 12px !important;
  font-size: 0.92rem !important;
  flex-shrink: 0 !important;
}

body.tv-mode .video-wrap {
  flex: 1 1 auto !important;
  height: 100% !important;
  aspect-ratio: auto !important;
  overflow: hidden !important;
}

body.tv-mode .ev-aside {
  width: var(--map-tv-width, 380px) !important;
  flex: 0 0 var(--map-tv-width, 380px) !important;
  max-width: 75vw !important;
  min-width: 260px !important;
  height: 100% !important;
  max-height: 100% !important;
  display: flex !important;
  flex-direction: column !important;
  transition: width 0.15s ease !important;
  overflow: hidden !important;
}

body.tv-mode .ev-aside.tv-hidden {
  display: none !important;
}

/* Splitter do płynnego skalowania szerokości mapy palcem/myszką - TYLKO W TRYBIE TV */
body.tv-mode .ev-resizer {
  width: 14px;
  cursor: col-resize !important;
  background: rgba(255, 255, 255, 0.03);
  display: flex !important;
  align-items: center;
  justify-content: center;
  position: relative;
  user-select: none !important;
  touch-action: none;
  z-index: 1000;
  margin: 0 -3px;
  border-left: 1px solid rgba(255, 255, 255, 0.08);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  transition: background 0.2s ease, border-color 0.2s ease;
  flex-shrink: 0;
  height: 100%;
}

body.tv-mode .ev-resizer::after {
  content: '⋮⋮';
  color: var(--text-muted);
  font-size: 13px;
  letter-spacing: -2px;
  width: 10px;
  height: 48px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

body.tv-mode .ev-resizer:hover,
body.tv-mode .ev-resizer.is-resizing {
  background: rgba(255, 215, 0, 0.15) !important;
  border-color: rgba(255, 215, 0, 0.6) !important;
}

body.tv-mode .ev-resizer:hover::after,
body.tv-mode .ev-resizer.is-resizing::after {
  background: var(--osp-yellow) !important;
  color: #000 !important;
  box-shadow: 0 0 14px rgba(255, 215, 0, 0.9) !important;
  height: 72px !important;
}

body.is-resizing-map .ev-aside {
  transition: none !important;
}
body.is-resizing-map,
body.is-resizing-map * {
  cursor: col-resize !important;
  user-select: none !important;
}

body.tv-mode .ev-aside.tv-hidden + .ev-resizer,
body.tv-mode .ev-aside.tv-hidden ~ .ev-resizer,
.ev-layout:has(.ev-aside.tv-hidden) .ev-resizer {
  display: none !important;
}

@media (max-width: 900px) {
  /* Ukrycie modułu i przycisku Trybu TV na telefonach i małych tabletach */
  .btn-tv-toggle,
  .tv-mode-bar,
  .ev-resizer {
    display: none !important;
  }
}

/* ── Nowoczesna stylizacja przeciągania kafelków (SortableJS) ── */
.streams-grid,
.stream-card {
  touch-action: pan-y;
}

.stream-card-head {
  user-select: none;
  touch-action: pan-y;
}

.stream-card-drag-handle {
  cursor: grab;
  color: var(--text-muted);
  font-size: 16px;
  padding: 4px 8px;
  margin: -2px 4px -2px -4px;
  border-radius: 4px;
  opacity: 0.6;
  touch-action: none;
  user-select: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.stream-card-drag-handle:hover,
.stream-card-drag-handle:active {
  opacity: 1;
  color: var(--osp-yellow);
  background: rgba(255, 215, 0, 0.15);
  cursor: grabbing;
}

/* Karta w trakcie przeciągania (klon/fallback) */
.sortable-fallback-card,
.stream-card.sortable-drag {
  opacity: 0.96 !important;
  transform: scale(1.02) !important;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.85), 0 0 0 2px var(--osp-yellow) !important;
  z-index: 999999 !important;
  cursor: grabbing !important;
  background: #0d0e12 !important;
  border-radius: 8px !important;
  overflow: hidden !important;
}

/* Miejsce docelowe (Ghost placeholder) */
.stream-card.sortable-ghost {
  opacity: 0.35 !important;
  background: rgba(255, 215, 0, 0.08) !important;
  border: 2px dashed var(--osp-yellow) !important;
  box-shadow: inset 0 0 20px rgba(255, 215, 0, 0.15) !important;
}

.stream-card.sortable-chosen {
  border-color: var(--osp-yellow) !important;
}

/* Wyłączenie pointer-events na iframe podczas przeciągania kart i skalowania mapy */
body.sortable-dragging-active iframe,
body.is-resizing-map iframe {
  pointer-events: none !important;
}
body.sortable-dragging-active {
  user-select: none !important;
}

body.tv-mode .sidebar-card {
  height: 100% !important;
  max-height: 100% !important;
  display: flex !important;
  flex-direction: column !important;
  box-sizing: border-box !important;
  overflow: hidden !important;
}

body.tv-mode .sidebar-tabs {
  flex-shrink: 0 !important;
}

body.tv-mode .map-main-container {
  flex: 1 1 auto !important;
  height: 100% !important;
  max-height: 100% !important;
  min-height: 0 !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
  container-type: inline-size;
  container-name: tvmap;
}

body.tv-mode .map-view-wrapper {
  flex: 1 1 auto !important;
  height: 100% !important;
  min-height: 0 !important;
  overflow: hidden !important;
}

body.tv-mode .map-leaflet-canvas {
  height: 100% !important;
  min-height: 0 !important;
  width: 100% !important;
}

/* Nowoczesne przyciski i pasek narzędzi mapy w Trybie TV (Tactical Pill Dock) */
body.tv-mode .map-controls {
  flex-shrink: 0 !important;
  display: grid !important;
  grid-template-columns: repeat(6, 1fr) !important;
  gap: 6px !important;
  padding: 8px 10px !important;
  background: rgba(15, 23, 42, 0.95) !important;
  backdrop-filter: blur(12px) !important;
  -webkit-backdrop-filter: blur(12px) !important;
  border-top: 1px solid rgba(255, 255, 255, 0.1) !important;
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.35) !important;
  box-sizing: border-box !important;
}

body.tv-mode .map-controls #btnBaseMap { grid-column: span 2 !important; }
body.tv-mode .map-controls #btnSatMap  { grid-column: span 2 !important; }
body.tv-mode .map-controls #btnBdlMap  { grid-column: span 2 !important; }
body.tv-mode .map-controls #btnMeasure     { grid-column: span 3 !important; }
body.tv-mode .map-controls #btnToggleTrack { grid-column: span 3 !important; }

body.tv-mode .map-controls .mc-btn {
  width: 100% !important;
  padding: 7px 8px !important;
  font-size: 11.5px !important;
  font-weight: 600 !important;
  border-radius: 30px !important;
  background: rgba(30, 41, 59, 0.85) !important;
  color: #cbd5e1 !important;
  border: 1px solid #334155 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 5px !important;
  white-space: nowrap !important;
  box-sizing: border-box !important;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25) !important;
  cursor: pointer !important;
}

body.tv-mode .map-controls .mc-btn svg {
  flex-shrink: 0;
  width: 12px;
  height: 12px;
  opacity: 0.85;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

body.tv-mode .map-controls .mc-btn:hover {
  background: #334155 !important;
  color: #f1f5f9 !important;
  border-color: #64748b !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.35) !important;
}

body.tv-mode .map-controls .mc-btn:hover svg {
  opacity: 1;
}

body.tv-mode .map-controls .mc-btn.active {
  background: rgba(255, 215, 0, 0.2) !important;
  color: var(--osp-yellow, #FFD700) !important;
  border-color: var(--osp-yellow, #FFD700) !important;
  box-shadow: 0 0 14px rgba(255, 215, 0, 0.28) !important;
}

body.tv-mode .map-controls .mc-btn.active svg {
  opacity: 1;
  stroke: var(--osp-yellow, #FFD700);
}

@container tvmap (min-width: 500px) {
  body.tv-mode .map-controls {
    grid-template-columns: repeat(5, 1fr) !important;
  }
  body.tv-mode .map-controls #btnBaseMap,
  body.tv-mode .map-controls #btnSatMap,
  body.tv-mode .map-controls #btnBdlMap,
  body.tv-mode .map-controls #btnMeasure,
  body.tv-mode .map-controls #btnToggleTrack {
    grid-column: span 1 !important;
  }
}

@container tvmap (max-width: 320px) {
  body.tv-mode .mc-lbl-short {
    display: inline !important;
  }
  body.tv-mode .mc-lbl-full {
    display: none !important;
  }
}

/* ── Baza Wiedzy & FAQ ─────────────────────────────────── */
.faq-search-wrap {
  position: relative;
  margin-bottom: 20px;
}
.faq-search-input {
  width: 100%;
  padding: 13px 20px 13px 46px;
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 28px;
  color: var(--text-white);
  font-size: 0.95rem;
  transition: all 0.2s ease;
  box-sizing: border-box;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}
.faq-search-input:focus {
  border-color: var(--osp-yellow);
  background: rgba(30, 41, 59, 0.95);
  box-shadow: 0 0 14px rgba(255, 215, 0, 0.28);
  outline: none;
}
.faq-search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-grey);
  opacity: 0.8;
  pointer-events: none;
}
.faq-categories {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}
.faq-cat-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(30, 41, 59, 0.85);
  border: 1px solid #334155;
  color: #cbd5e1;
  padding: 7px 16px;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}
.faq-cat-btn svg {
  flex-shrink: 0;
  transition: color 0.2s ease, stroke 0.2s ease;
}
.faq-cat-btn:hover,
.faq-cat-btn.active {
  background: var(--osp-yellow);
  color: #000;
  border-color: var(--osp-yellow);
  box-shadow: 0 0 12px rgba(255, 215, 0, 0.35);
  transform: translateY(-1px);
}
.faq-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  margin-bottom: 12px;
  overflow: hidden;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}
.faq-card:hover {
  border-color: rgba(255, 215, 0, 0.4);
}
details[open].faq-card {
  border-color: rgba(255, 215, 0, 0.5);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.45);
  background: rgba(15, 23, 42, 0.75);
}
.faq-question {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  cursor: pointer;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-white);
  user-select: none;
  list-style: none;
}
.faq-question::-webkit-details-marker {
  display: none;
}
.faq-question > span:first-child {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  flex: 1;
}
.faq-chevron {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--osp-yellow);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), background 0.2s ease, border-color 0.2s ease;
  flex-shrink: 0;
  margin-left: 12px;
}
details[open] .faq-chevron {
  transform: rotate(180deg);
  background: rgba(255, 215, 0, 0.15);
  border-color: rgba(255, 215, 0, 0.35);
}
.faq-answer {
  padding: 0 20px 20px 20px;
  color: #cbd5e1;
  font-size: 0.88rem;
  line-height: 1.65;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding-top: 14px;
}
.faq-badge-category {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 4px 12px;
  border-radius: 20px;
  margin-right: 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  vertical-align: middle;
  flex-shrink: 0;
  transition: all 0.2s ease;
}
.faq-badge-category svg {
  width: 11px;
  height: 11px;
  flex-shrink: 0;
}
.faq-badge-category.badge-start {
  background: rgba(59, 130, 246, 0.18);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.4);
}
.faq-badge-category.badge-pilot {
  background: rgba(239, 68, 68, 0.18);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.4);
}
.faq-badge-category.badge-sztab {
  background: rgba(168, 85, 247, 0.18);
  color: #c084fc;
  border: 1px solid rgba(168, 85, 247, 0.4);
}
.faq-badge-category.badge-skkp {
  background: rgba(245, 158, 11, 0.18);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.4);
}
.faq-badge-category.badge-troubleshoot {
  background: rgba(244, 63, 94, 0.18);
  color: #fb7185;
  border: 1px solid rgba(244, 63, 94, 0.4);
}
.faq-badge-category.badge-siron {
  background: rgba(249, 115, 22, 0.18);
  color: #f97316;
  border: 1px solid rgba(249, 115, 22, 0.4);
}
.faq-badge-category.badge-atak,
.faq-badge-category.badge-tactical {
  background: rgba(6, 182, 212, 0.18);
  color: #06b6d4;
  border: 1px solid rgba(6, 182, 212, 0.4);
}
.faq-badge-category.badge-adiat {
  background: rgba(168, 85, 247, 0.18);
  color: #c084fc;
  border: 1px solid rgba(168, 85, 247, 0.4);
}

/* ── Nowy, elegancki pasek modułów administracyjnych (Mobile & Desktop) ── */
.admin-module-nav {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 22px;
  width: 100%;
}

@media (min-width: 640px) {
  .admin-module-nav {
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
  }
}

@media (min-width: 1024px) {
  .admin-module-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
  }
}

.admin-nav-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 700;
  font-family: 'Lato', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  border-radius: 22px;
  text-decoration: none;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(30, 41, 59, 0.7);
  color: #cbd5e1;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  text-align: center;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.admin-nav-btn:hover {
  background: rgba(51, 65, 85, 0.9);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.25);
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.35);
}

.admin-nav-btn.active {
  background: var(--osp-yellow) !important;
  color: #000 !important;
  border-color: var(--osp-yellow) !important;
  box-shadow: 0 2px 12px rgba(255, 215, 0, 0.35);
  font-weight: 800;
}

.admin-nav-btn.active svg {
  stroke: #000 !important;
}

.admin-nav-btn svg {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
}

/* Wersja mobilna: równy 2-kolumnowy układ, idealnie symetryczny na Android i iOS */
@media (max-width: 639px) {
  .admin-module-nav {
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
  }
  .admin-nav-btn {
    padding: 10px 8px;
    font-size: 11px;
    letter-spacing: 0.1px;
    min-height: 44px;
    gap: 6px;
    border-radius: 20px;
  }
  .admin-nav-btn span {
    white-space: normal;
    line-height: 1.15;
  }
  .admin-nav-btn svg {
    width: 14px;
    height: 14px;
  }
}

/* Filtry historii zdarzeń sieciowych (bez przeładowania strony i bez skoku widoku) */
.log-filter-group {
  display: inline-flex;
  gap: 4px;
  background: rgba(0, 0, 0, 0.45);
  padding: 4px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  flex-wrap: wrap;
}

.log-filter-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  background: transparent;
  border: 1px solid transparent;
  color: #94a3b8;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.18s ease;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  font-family: inherit;
  outline: none;
}

.log-filter-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.log-filter-btn.active {
  background: rgba(255, 255, 255, 0.14) !important;
  color: #fff !important;
  border-color: rgba(255, 255, 255, 0.3) !important;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.5);
}

.log-filter-btn[data-filter="drops"].active {
  background: rgba(239, 68, 68, 0.22) !important;
  color: #fca5a5 !important;
  border-color: #ef4444 !important;
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.35);
}

.log-filter-btn[data-filter="recovered"].active {
  background: rgba(34, 197, 94, 0.22) !important;
  color: #86efac !important;
  border-color: #22c55e !important;
  box-shadow: 0 0 12px rgba(34, 197, 94, 0.35);
}

.log-filter-btn[data-filter="probes"].active {
  background: rgba(255, 215, 0, 0.2) !important;
  color: var(--osp-yellow) !important;
  border-color: var(--osp-yellow) !important;
  box-shadow: 0 0 12px rgba(255, 215, 0, 0.35);
}

@media (max-width: 639px) {
  .log-filter-group {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 4px;
  }
  .log-filter-btn {
    padding: 8px 6px;
    font-size: 11px;
    text-align: center;
  }
}