*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

body {
  font-family: system-ui, -apple-system, sans-serif;
  background: #eef2f7;
  color: #1a202c;
  min-height: 100vh;
}

body.modal-open {
  overflow: hidden;
  touch-action: none;
}

#site-header {
  background: #1e4d8c;
  color: white;
  padding: 1rem 2rem;
}
#header-inner {
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
#header-title h1 { font-size: 1.25rem; font-weight: 700; }
#header-tagline { font-size: 0.77rem; opacity: 0.75; margin-top: 0.1rem; }
#last-update { font-size: 0.78rem; opacity: 0.7; white-space: nowrap; }
#header-auth { display: flex; align-items: center; gap: 0.5rem; white-space: nowrap; }
#auth-username { font-size: 0.82rem; opacity: 0.9; }
#btn-login, #btn-logout {
  background: rgba(255,255,255,0.15);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.35);
  border-radius: 5px;
  padding: 0.3rem 0.75rem;
  font-size: 0.82rem;
  cursor: pointer;
}
#btn-login:hover, #btn-logout:hover { background: rgba(255,255,255,0.25); }

/* Elementy wymagające roli reports lub full */
.auth-reports { display: none; }
.role-reports .auth-reports,
.role-full    .auth-reports { display: inline-flex; }
.role-reports #smsr-report-row,
.role-full    #smsr-report-row { display: flex; }

/* Modal logowania */
#login-modal {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0,0,0,0.6);
  display: flex; align-items: center; justify-content: center;
}
#login-modal[hidden] { display: none; }
#login-box {
  background: #fff;
  border-radius: 12px;
  padding: 2rem 2.5rem;
  width: 100%;
  max-width: 340px;
  position: relative;
  color: #1e293b;
  box-shadow: 0 20px 60px rgba(0,0,0,0.35);
}
#login-box h2 { margin: 0 0 0.5rem; font-size: 1.1rem; color: #1e4d8c; }
#login-info { font-size: 0.82rem; color: #64748b; margin: 0 0 1rem; }
#login-close {
  position: absolute; top: 0.6rem; right: 0.8rem;
  background: none; border: none; font-size: 1.4rem;
  cursor: pointer; color: #94a3b8; line-height: 1;
}
#login-form { display: flex; flex-direction: column; gap: 0.6rem; }
#login-form input {
  padding: 0.5rem 0.7rem;
  border: 1px solid #cbd5e0;
  border-radius: 6px;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.15s;
}
#login-form input:focus { border-color: #1e4d8c; box-shadow: 0 0 0 2px rgba(30,77,140,0.15); }
#login-form button[type=submit] {
  background: #1e4d8c; color: #fff;
  border: none; border-radius: 6px;
  padding: 0.55rem; font-size: 0.9rem;
  cursor: pointer; font-weight: 600;
  margin-top: 0.3rem;
}
#login-form button[type=submit]:hover { background: #163d72; }
#login-error { font-size: 0.82rem; color: #dc2626; margin: 0; padding: 0.3rem 0; }
#login-error[hidden] { display: none; }

#site-intro {
  background: #dbeafe;
  border-bottom: 1px solid #bfdbfe;
  padding: 0.65rem 2rem;
}
#site-intro p {
  max-width: 900px;
  margin: 0 auto;
  font-size: 0.82rem;
  color: #1e3a5f;
  line-height: 1.55;
}
#site-intro a { color: #1e4d8c; }

/* ── Stopka ─────────────────────────────────────────────────────────────── */
#site-footer {
  background: #1a202c;
  color: #a0aec0;
  margin-top: 3rem;
  font-size: 0.82rem;
}
#footer-inner {
  max-width: 900px;
  margin: 0 auto;
  padding: 2rem 1.5rem 1.5rem;
  display: grid;
  grid-template-columns: 2fr 1fr 1.5fr;
  gap: 2rem;
}
.footer-col h3 { color: #e2e8f0; font-size: 0.9rem; margin-bottom: 0.5rem; }
.footer-col p, .footer-col a { color: #a0aec0; line-height: 1.6; }
.footer-col a { text-decoration: underline; }
#footer-stats { list-style: none; line-height: 2; }
#footer-stats strong { color: #e2e8f0; }
#contact-form { display: flex; flex-direction: column; gap: 0.5rem; }
.hp-field { position: absolute; left: -9999px; opacity: 0; pointer-events: none; }
#contact-form input, #contact-form textarea {
  background: #2d3748; border: 1px solid #4a5568; color: #e2e8f0;
  border-radius: 5px; padding: 0.4rem 0.6rem; font-size: 0.82rem;
}
#contact-form button {
  background: #1e4d8c; color: white; border: none; border-radius: 5px;
  padding: 0.45rem; cursor: pointer; font-size: 0.82rem;
}
#contact-form button:hover { background: #163d72; }
#contact-status { font-size: 0.78rem; color: #68d391; }
#footer-bottom {
  border-top: 1px solid #2d3748;
  text-align: center;
  padding: 0.75rem 1rem;
  font-size: 0.75rem;
}
#footer-bottom a { color: #718096; }
@media (max-width: 640px) {
  #footer-inner { grid-template-columns: 1fr; gap: 1.5rem; }
}

main {
  max-width: 900px;
  margin: 2rem auto;
  padding: 0 1rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.5rem;
}

.loading, .error {
  grid-column: 1 / -1;
  text-align: center;
  padding: 2rem;
  color: #718096;
}

.error { color: #c53030; }

.station-card {
  background: white;
  border-radius: 10px;
  box-shadow: 0 1px 6px rgba(0,0,0,0.08);
  overflow: hidden;
}

.station-header {
  background: #1e4d8c;
  color: white;
  padding: 1rem 1.25rem 0.75rem;
}

.station-header h2 { font-size: 1.15rem; font-weight: 600; }

.station-gmina {
  display: block;
  font-size: 0.75rem;
  opacity: 0.8;
  margin-top: 0.15rem;
}

.station-timestamp {
  font-size: 0.75rem;
  color: #718096;
  padding: 0.5rem 1.25rem;
  background: #f7fafc;
  border-bottom: 1px solid #e2e8f0;
}

.params-group { padding: 0.5rem 0; }

.param-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 0.45rem 1.25rem;
  border-bottom: 1px solid #f0f4f8;
  font-size: 0.9rem;
}

.param-row:last-child { border-bottom: none; }

.param-label { color: #4a5568; }

.param-value { font-weight: 600; color: #1a202c; }

.unit { font-weight: 400; font-size: 0.8rem; color: #718096; }

/* Przycisk wykresów */
.card-footer {
  padding: 0.75rem 1.25rem;
  border-top: 1px solid #e2e8f0;
  display: flex;
  gap: 0.5rem;
}

.btn-charts {
  background: #1e4d8c;
  color: white;
  border: none;
  border-radius: 6px;
  padding: 0.4rem 0.9rem;
  font-size: 0.85rem;
  cursor: pointer;
  flex: 1;
}

.btn-charts:hover { background: #163d72; }

.btn-source {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #0f4c2a;
  color: #86efac;
  border: 1px solid #166534;
  border-radius: 6px;
  padding: 0.4rem 0.75rem;
  font-size: 0.82rem;
  text-decoration: none;
  white-space: nowrap;
}

.btn-source:hover { background: #14532d; color: #bbf7d0; }

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

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

.modal {
  background: white;
  border-radius: 12px;
  width: min(820px, 95vw);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.25rem 0.75rem;
  background: #1e4d8c;
  color: white;
}

.modal-header h2 { font-size: 1.1rem; font-weight: 600; }

.modal-close {
  background: none;
  border: none;
  color: white;
  font-size: 1.2rem;
  cursor: pointer;
  line-height: 1;
  padding: 0.1rem 0.3rem;
}

.no-history-banner {
  background: #fff7ed;
  border-left: 4px solid #f97316;
  color: #92400e;
  font-size: 0.82rem;
  padding: 0.55rem 1rem;
}

/* Przełącznik Dzienne / Godzinowe */
.agg-toggle {
  display: flex;
  gap: 0;
  padding: 0.6rem 1.25rem;
  background: #f7fafc;
  border-bottom: 1px solid #e2e8f0;
}

.agg-btn {
  background: white;
  border: 1px solid #cbd5e0;
  padding: 0.3rem 1.1rem;
  font-size: 0.85rem;
  cursor: pointer;
  color: #4a5568;
  transition: background 0.15s, color 0.15s;
  text-align: center;
}

.agg-btn:first-child { border-radius: 6px 0 0 6px; }
.agg-btn:last-child  { border-radius: 0 6px 6px 0; border-left: none; }

.agg-btn.active {
  background: #1e4d8c;
  border-color: #1e4d8c;
  color: white;
}

.agg-btn:not(.active):hover { background: #edf2f7; }

.modal-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: flex-end;
  padding: 0.9rem 1.25rem;
  background: #f7fafc;
  border-bottom: 1px solid #e2e8f0;
  font-size: 0.85rem;
}

.modal-controls label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  color: #4a5568;
}

.modal-controls select,
.modal-controls input[type=date] {
  border: 1px solid #cbd5e0;
  border-radius: 5px;
  padding: 0.3rem 0.5rem;
  font-size: 0.85rem;
}

.modal-controls select { min-width: 220px; }

#chart-load {
  background: #1e4d8c;
  color: white;
  border: none;
  border-radius: 6px;
  padding: 0.4rem 1rem;
  font-size: 0.85rem;
  cursor: pointer;
  align-self: flex-end;
}

#chart-load:disabled { opacity: 0.6; cursor: default; }
#chart-load:not(:disabled):hover { background: #163d72; }

.period-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0.6rem 1.25rem;
  background: #f7fafc;
  border-bottom: 1px solid #e2e8f0;
}

.period-btn {
  background: white;
  border: 1px solid #cbd5e0;
  border-radius: 20px;
  padding: 0.25rem 0.75rem;
  font-size: 0.8rem;
  cursor: pointer;
  color: #4a5568;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  text-align: center;
}

.period-btn:hover { background: #edf2f7; border-color: #a0aec0; }

.period-btn.active {
  background: #1e4d8c;
  border-color: #1e4d8c;
  color: white;
}

.chart-wrapper {
  padding: 1rem 1.25rem 1.25rem;
  flex: 1;
  min-height: 300px;
  position: relative;
}

#chart-canvas { width: 100% !important; height: 300px !important; }

#chart-empty {
  text-align: center;
  color: #718096;
  padding: 3rem 0;
}

.chart-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  background: #f0f7ff;
  border-top: 1px solid #e2e8f0;
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: white;
  border: 1px solid #bee3f8;
  border-radius: 8px;
  padding: 0.4rem 0.9rem;
  min-width: 90px;
  flex: 1;
}

.stat-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #718096;
  font-weight: 600;
}

.stat-value {
  font-size: 1rem;
  font-weight: 700;
  color: #1e4d8c;
  white-space: nowrap;
}

.stat-date {
  font-size: 0.7rem;
  color: #a0aec0;
  margin-top: 0.1rem;
}

.stat-item.stat-count .stat-value {
  color: #4a5568;
  font-size: 0.9rem;
}

.chart-footer {
  padding: 0.5rem 1.25rem 0.75rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  justify-content: flex-end;
  border-top: 1px solid #e2e8f0;
  background: #f7fafc;
}

/* wspólny styl dla wszystkich 4 przycisków w stopce modalu */
.chart-footer > button,
.chart-footer > .table-dl-wrap > button {
  padding: 0.48rem 1rem;
  font-size: 0.82rem;
  border-radius: 5px;
  border: none;
  cursor: pointer;
  white-space: nowrap;
}

#station-report-download {
  background: #4a5568;
  color: white;
  border: none;
  border-radius: 6px;
  padding: 0.35rem 1rem;
  font-size: 0.82rem;
  cursor: pointer;
  margin-right: auto;
}
#station-report-download:hover { background: #2d3748; }

#chart-download {
  background: #2c7a5a;
  color: white;
  border: none;
  border-radius: 6px;
  padding: 0.35rem 1rem;
  font-size: 0.82rem;
  cursor: pointer;
}

#chart-download:not(:disabled):hover { background: #206349; }
#chart-download:disabled { opacity: 0.4; cursor: default; }

#pdf-download {
  background: #1e4d8c;
  color: white;
  border: none;
  border-radius: 6px;
  padding: 0.35rem 1rem;
  font-size: 0.82rem;
  cursor: pointer;
}
#pdf-download:not(:disabled):hover { background: #163a6b; }
#pdf-download:disabled { opacity: 0.4; cursor: default; }

@media (max-width: 640px) {

  header { padding: 1rem; }
  header h1 { font-size: 1.1rem; }

  main { margin: 1rem auto; padding: 0 0.75rem; gap: 1rem; }

  .modal-overlay { align-items: center; }

  .modal {
    width: 95vw;
    max-height: 95dvh;
    border-radius: 12px;
    overflow-y: auto;
  }

  .modal-header { padding: 0.85rem 1rem 0.7rem; }
  .modal-header h2 { font-size: 0.95rem; }

  .agg-toggle { padding: 0.5rem 1rem; }

  .modal-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    padding: 0.75rem 1rem;
    gap: 0.5rem;
  }

  .modal-controls label:first-child {
    grid-column: 1 / -1;
  }

  .modal-controls select,
  .modal-controls input[type=date] {
    width: 100%;
    min-width: 0;
    font-size: 1rem;
  }

  .period-btns { padding: 0.5rem 1rem; gap: 0.35rem; }
  .period-btn { font-size: 0.75rem; padding: 0.2rem 0.6rem; }

  .chart-wrapper { padding: 0.75rem 0.75rem 2rem; min-height: 220px; }
  #chart-canvas { height: 200px !important; }

  .chart-stats { padding: 0.6rem 0.75rem; gap: 0.4rem; }
  .stat-item { min-width: 70px; padding: 0.35rem 0.5rem; }
  .stat-value { font-size: 0.9rem; }

  .chart-footer { padding: 0.5rem 1rem; flex-direction: column; align-items: stretch; }
  .chart-footer > button,
  .chart-footer > .table-dl-wrap { width: 100%; }
  .chart-footer > button { text-align: center; }
  .chart-footer > .table-dl-wrap > button { width: 100%; text-align: center; }
}

/* ── Mapa stacji ─────────────────────────────────────────────────────────── */
#map-section {
  padding: 1.5rem 1rem 0.5rem;
  max-width: 860px;
  margin: 0 auto;
  position: relative;
}

#map-clip {
  overflow: hidden;
  position: relative;
}

#map-container {
  position: relative;
  display: inline-block;
  width: 100%;
  line-height: 0;
  overflow: hidden;
  touch-action: pan-y;
  user-select: none;
}

#map-svg {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 12px;
  opacity: 0.9;
}

#map-dots {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.map-dot {
  position: absolute;
  width: 10px;
  height: 10px;
  background: #f97316;
  border: 2px solid #fff;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  cursor: pointer;
  pointer-events: all;
  transition: transform 0.15s, background 0.15s;
  box-shadow: 0 0 6px rgba(249,115,22,0.7);
}

.map-dot:hover {
  transform: translate(-50%, -50%) scale(1.6);
  background: #fb923c;
}

/* SMSR — fioletowy kolor punktu */
.map-dot--smsr { background: #7c3aed; box-shadow: 0 0 6px rgba(124,58,237,0.7); }
.map-dot--smsr:hover { background: #9f5ef8; }

/* Blask cienia zależny od smsr_status */
.map-dot--active  { box-shadow: 0 0 0 2px #fff, 0 0 8px 3px #22c55e; }
.map-dot--fault   { box-shadow: 0 0 0 2px #fff, 0 0 8px 3px #f97316; }
.map-dot--no-data { box-shadow: 0 0 0 2px #fff, 0 0 8px 3px #ef4444; }

/* Odznaka SMSR — globalna */
.smsr-badge {
  display: inline-block;
  background: #7c3aed;
  color: #fff;
  font-size: 0.66rem;
  font-weight: 700;
  padding: 0.05rem 0.4rem;
  border-radius: 4px;
  letter-spacing: 0.04em;
  vertical-align: middle;
  flex-shrink: 0;
}
.smsr-active  { color: #22c55e; }
.smsr-fault   { color: #f97316; }
.smsr-no-data { color: #ef4444; }
#map-tooltip .smsr-active  { color: #4ade80; }
#map-tooltip .smsr-fault   { color: #fb923c; }
#map-tooltip .smsr-no-data { color: #f87171; }

/* Nagłówek karty stacji */
.station-title-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}
.station-smsr-status {
  font-size: 0.72rem;
  font-weight: 600;
}
.station-operator {
  display: block;
  font-size: 0.72rem;
  opacity: 0.75;
  margin-top: 0.15rem;
}
.station-location {
  display: block;
  font-size: 0.75rem;
  opacity: 0.85;
  margin-top: 0.1rem;
}

/* ── Sekcja filtrów ─────────────────────────────────────────────────────────── */
#filters-section {
  max-width: 860px;
  margin: 0.5rem auto 0;
  padding: 0 1rem;
}

#filters-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.filter-group {
  position: relative;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  flex: 0 0 auto;
}

.filter-group summary {
  padding: 0.45rem 0.9rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: #1e4d8c;
  cursor: pointer;
  user-select: none;
  background: #f7fafc;
  border-radius: 8px;
  list-style: none;
  white-space: nowrap;
}
.filter-group[open] summary { border-radius: 8px 8px 0 0; border-bottom: 1px solid #e2e8f0; }
.filter-group summary::after { content: ' ▸'; font-size: 0.7rem; }
.filter-group[open] summary::after { content: ' ▾'; }

.filter-checkboxes {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 50;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-top: none;
  border-radius: 0 0 8px 8px;
  min-width: 100%;
  max-height: 220px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.5rem 0.9rem;
  box-shadow: 0 6px 16px rgba(0,0,0,0.1);
}

.filter-checkboxes label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  color: #2d3748;
  cursor: pointer;
  white-space: nowrap;
}

.filter-checkboxes input[type=checkbox] { cursor: pointer; accent-color: #1e4d8c; }

#filters-top-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}
#filters-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: #4a5568;
  white-space: nowrap;
}

/* ── Wyszukiwarka stacji ──────────────────────────────────────────────────── */
#station-search-wrap {
  position: relative;
  margin-top: 0.6rem;
}
#station-search {
  width: 100%;
  box-sizing: border-box;
  padding: 0.5rem 0.9rem;
  border: 1px solid #cbd5e0;
  border-radius: 8px;
  font-size: 0.9rem;
  background: #fff;
  color: #2d3748;
  outline: none;
  transition: border-color 0.15s;
}
#station-search:focus { border-color: #1e4d8c; box-shadow: 0 0 0 2px rgba(30,77,140,0.15); }
#station-search-list {
  position: absolute;
  top: calc(100% + 2px);
  left: 0; right: 0;
  background: #fff;
  border: 1px solid #cbd5e0;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.13);
  list-style: none;
  margin: 0; padding: 0.3rem 0;
  z-index: 60;
  max-height: 280px;
  overflow-y: auto;
}
#station-search-list li {
  display: flex;
  flex-direction: column;
  padding: 0.45rem 0.9rem;
  cursor: pointer;
  gap: 0.1rem;
}
#station-search-list li:hover { background: #ebf4ff; }
.sr-name { font-size: 0.9rem; font-weight: 600; color: #1e4d8c; }
.sr-meta { font-size: 0.75rem; color: #718096; }
#station-search-list mark { background: #fef08a; color: inherit; border-radius: 2px; }

.search-highlight {
  outline: 2px solid #1e4d8c;
  outline-offset: 2px;
  animation: search-flash 1.8s ease forwards;
}
@keyframes search-flash {
  0%   { box-shadow: 0 0 0 4px rgba(30,77,140,0.45); }
  100% { box-shadow: none; }
}

#smsr-report-row {
  max-width: 860px;
  margin: 0.5rem auto 0;
  padding: 0 1rem;
  display: flex;
  justify-content: flex-end;
}
.user-logged-in #smsr-report-row { display: flex; }

#btn-smsr-report {
  background: #7c3aed;
  color: white;
  border: none;
  border-radius: 6px;
  padding: 0.4rem 1rem;
  font-size: 0.82rem;
  cursor: pointer;
}
#btn-smsr-report:hover { background: #6d28d9; }

/* ── Przycisk "do góry" ─────────────────────────────────────────────────────── */
#scroll-btns {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  z-index: 200;
}
#btn-scroll-top, #btn-scroll-bottom {
  width: 44px;
  height: 44px;
  background: #1e4d8c;
  color: white;
  border: none;
  border-radius: 50%;
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 10px rgba(0,0,0,0.25);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}
#btn-scroll-top.visible, #btn-scroll-bottom.visible { opacity: 1; pointer-events: all; }
#btn-scroll-top:hover, #btn-scroll-bottom:hover { background: #163d72; }

#map-tooltip {
  position: fixed;
  background: rgba(15, 30, 55, 0.95);
  color: #e2e8f0;
  font-size: 0.78rem;
  padding: 0.4rem 0.75rem;
  border-radius: 6px;
  pointer-events: auto;
  white-space: nowrap;
  z-index: 300;
  border: 1px solid rgba(74,144,196,0.4);
  line-height: 1.5;
  display: flex;
  flex-direction: column;
  cursor: pointer;
}
#map-tooltip[hidden] { display: none; }
#map-tooltip strong { color: #fff; font-size: 0.82rem; }
#map-tooltip span   { opacity: 0.8; }
#map-tooltip .tooltip-hint { font-size: 0.72rem; color: #94d2e6; margin-top: 3px; font-style: italic; }

/* Przycisk reset zoom mapy */
#btn-map-reset {
  position: absolute;
  bottom: 0.6rem;
  right: 0.6rem;
  background: rgba(30, 77, 140, 0.85);
  color: white;
  border: none;
  border-radius: 5px;
  padding: 0.3rem 0.6rem;
  font-size: 0.72rem;
  cursor: pointer;
  z-index: 20;
  backdrop-filter: blur(4px);
}
#btn-map-reset:hover { background: rgba(22, 61, 114, 0.95); }

/* Status badges (Live / Baza) */
.status-badge {
  display: inline-block;
  border-radius: 3px;
  font-size: 0.63rem;
  font-weight: 700;
  padding: 0.07rem 0.38rem;
  margin-left: 0.3rem;
  vertical-align: middle;
  cursor: default;
  letter-spacing: 0.03em;
}
.badge-green  { background: #16a34a; color: #fff; }
.badge-orange { background: #ea580c; color: #fff; }
.badge-red    { background: #dc2626; color: #fff; }
.badge-grey   { background: #9ca3af; color: #fff; }

/* Popup dymek dla badge (mobile) */
#badge-popup {
  position: fixed;
  bottom: 5rem;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 30, 55, 0.97);
  color: #e2e8f0;
  font-size: 0.78rem;
  padding: 0.5rem 0.9rem;
  border-radius: 7px;
  border: 1px solid rgba(74,144,196,0.4);
  z-index: 500;
  max-width: 85vw;
  text-align: center;
  line-height: 1.5;
  pointer-events: none;
  animation: badge-popup-fade 3.5s forwards;
}
@keyframes badge-popup-fade {
  0%   { opacity: 0; transform: translateX(-50%) translateY(6px); }
  12%  { opacity: 1; transform: translateX(-50%) translateY(0); }
  75%  { opacity: 1; }
  100% { opacity: 0; }
}

/* ── Dropdown tabelki ─────────────────────────────────────────────────────── */
.table-dl-wrap { position: relative; }

#table-download {
  background: #4a5568;
  color: white;
  border: none;
  border-radius: 6px;
  padding: 0.35rem 1rem;
  font-size: 0.82rem;
  cursor: pointer;
}
#table-download:not(:disabled):hover { background: #2d3748; }
#table-download:disabled { opacity: 0.4; cursor: default; }

#table-dropdown {
  position: absolute;
  bottom: calc(100% + 4px);
  right: 0;
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
  overflow: hidden;
  z-index: 50;
  min-width: 180px;
}
#table-dropdown button {
  display: block;
  width: 100%;
  padding: 0.55rem 1rem;
  text-align: left;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 0.85rem;
  color: #1a202c;
}
#table-dropdown button:hover { background: #f0f7ff; color: #1e4d8c; }

/* === PWA baner instalacyjny === */
#pwa-banner {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: #0f2342;
  color: #fff;
  z-index: 2000;
  box-shadow: 0 -2px 16px rgba(0,0,0,0.3);
  border-top: 2px solid #4fc3f7;
  animation: pwa-slide-up 0.35s ease;
}
#pwa-banner img { border-radius: 8px; flex-shrink: 0; }
#pwa-banner-text { flex: 1; min-width: 0; }
#pwa-banner-text strong { display: block; font-size: 0.95rem; }
#pwa-banner-sub { font-size: 0.8rem; color: #90caf9; }
#pwa-install-btn {
  background: #4fc3f7;
  color: #0f2342;
  border: none;
  border-radius: 20px;
  padding: 0.45rem 1.1rem;
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}
#pwa-install-btn:hover { background: #81d4fa; }
#pwa-banner-close {
  background: none; border: none; color: rgba(255,255,255,0.5);
  font-size: 1.1rem; cursor: pointer; padding: 0.2rem 0.3rem; flex-shrink: 0;
}
#pwa-banner-close:hover { color: #fff; }

/* iOS tip */
#pwa-ios-tip {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: #1a3a6b;
  color: #fff;
  font-size: 0.85rem;
  z-index: 2000;
  box-shadow: 0 -2px 16px rgba(0,0,0,0.3);
  border-top: 2px solid #4fc3f7;
  animation: pwa-slide-up 0.35s ease;
}
#pwa-ios-tip strong { color: #4fc3f7; }
#pwa-ios-close {
  background: none; border: none; color: rgba(255,255,255,0.5);
  font-size: 1.1rem; cursor: pointer; padding: 0.2rem;
}
#pwa-ios-close:hover { color: #fff; }

@keyframes pwa-slide-up {
  from { transform: translateY(100%); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

/* === Legenda mapy === */
#map-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem 1.2rem;
  padding: 0.5rem 1rem 0.25rem;
  font-size: 0.78rem;
  color: #4a5568;
}
.ml-item {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.ml-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid #fff;
  flex-shrink: 0;
}
.ml-sep {
  width: 1px;
  height: 14px;
  background: #cbd5e0;
  align-self: center;
}
@media (max-width: 640px) {
  .ml-sep { width: 100%; height: 1px; }
}
