/* Katalog warstw: panel Warstwy, wybór podkładu, status źródeł
   Wydzielone z dawnego 20-legacy.css (17.8.3, 2577 linii) — podział wyłącznie
   mechaniczny, żadna reguła nie zmieniła treści. Kolejność reguł w tym pliku
   jest zachowana z oryginału; tam gdzie ten sam selektor pojawiał się w
   pliku dwukrotnie (np. późniejsza poprawka odstępów), obie deklaracje
   trafiły do TEGO SAMEGO pliku w tej samej kolejności — kaskada więc działa
   identycznie jak wcześniej. Ten plik nadal deklaruje warstwę „legacy"
   (patrz 00-layers.css) — kolejność linków w index.html decyduje o
   kolejności w warstwie, nie nazwa pliku.
*/
@layer legacy {

.layers-panel {
  position: absolute;
  z-index: 24;
  top: 10px;
  left: 66px;
  bottom: 38px;
  width: 304px;
  min-width: 276px;
  max-width: min(360px, calc(100vw - 150px));
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface-solid);
  box-shadow: var(--shadow);
}

.layers-panel > .panel-header { min-height: 43px; padding-block: 5px; }

.layers-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

.layer-group + .layer-group { border-top: 1px solid var(--border); }
.layer-group-title {
  position: sticky;
  top: 0;
  z-index: 2;
  height: 24px;
  display: flex;
  align-items: center;
  padding: 0 8px;
  color: var(--text);
  background: var(--surface-solid);
  border-bottom: 1px solid var(--border);
  font-size: var(--fs-sm);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
}

.layer-row {
  padding: 4px 7px 3px;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 72%, transparent);
  background: var(--surface-solid);
}
.layer-row:last-child { border-bottom: 0; }
.layer-row:hover { background: color-mix(in srgb, var(--surface-hover) 58%, var(--surface-solid)); }
.layer-row--error { background: color-mix(in srgb, var(--danger) 7%, var(--surface-solid)); }
.layer-row-main {
  display: grid;
  grid-template-columns: 27px minmax(0, 1fr) auto;
  align-items: center;
  gap: 5px;
}
.layer-visibility {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 7px;
  color: var(--text-faint);
  background: transparent;
  cursor: pointer;
}
.layer-visibility:hover { color: var(--text); background: var(--surface-hover); }
.layer-visibility:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.layer-visibility.is-visible { color: var(--accent); background: var(--accent-soft); }

.layer-row-copy { min-width: 0; }
.layer-row-titleline {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 5px;
}
.layer-row-titleline strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
  font-size: var(--fs-md);
  font-weight: 600;
}




.is-spinning { animation: layer-spin 850ms linear infinite; }
@keyframes layer-spin { to { transform: rotate(360deg); } }

@media (max-width: 980px) {
  .layers-panel { width: 284px; max-width: calc(100vw - 145px); }
}

@media (max-width: 620px) {
  .layers-panel {
      left: 62px;
      right: 8px;
      width: auto;
      min-width: 0;
      max-width: none;
    }
}

/* Step 6 — basemap selector */

/* Warstwy */
.layers-panel.compact-panel { width: 292px; min-width: 264px; }
.layer-group-toggle {
  min-width: 0;
  flex: 1;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 7px;
  border: 0;
  background: transparent;
  color: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  cursor: pointer;
  text-align: left;
}
.layer-group-toggle:hover { color: var(--text); background: var(--surface-hover); }
.layer-group-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.layer-group-toggle > svg { flex: 0 0 auto; }
.layer-group-toggle > span { flex: 1 1 auto; min-width: 0; }
.layer-group-toggle > small {
  flex: 0 0 auto;
  color: var(--text-faint);
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: 0;
}
.layer-group-checkbox { appearance: none; flex: 0 0 15px; width: 15px; height: 15px; margin: 0 2px 0 8px; border: 1px solid var(--border-strong); border-radius: 4px; background: var(--surface-solid); cursor: pointer; }
.layer-group-checkbox:checked { border-color: var(--accent); background: var(--accent); }
.layer-group-checkbox:checked::after { content: '✓'; display: block; color: var(--surface-solid); text-align: center; font-size: var(--fs-md); line-height: 13px; }
.layer-group-checkbox:indeterminate { border-color: var(--accent); background: var(--accent-soft); }
.layer-group-checkbox:indeterminate::after { content: '−'; display: block; color: var(--accent); text-align: center; font-size: var(--fs-lg); line-height: 13px; }
.layer-group-checkbox:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.layer-expanded-info { margin: 3px 3px 5px 29px; padding: 5px 7px; border-radius: 6px; background: var(--surface-raised); color: var(--text-muted); font-size: var(--fs-sm); line-height: 1.45; overflow-wrap: anywhere; }
.layer-expanded-info p { margin: 2px 0 6px; }
.layer-expanded-info strong { color: var(--text); }
.zone-legend-panel { max-height: 125px; overflow: auto; border-bottom: 1px solid var(--border); padding: 6px 9px; font-size: var(--fs-sm); }
.zone-legend-panel > strong { display: block; margin-bottom: 3px; }
.zone-legend-panel .layer-legend-image { max-width: 100%; height: auto; }
.layer-row--compact { padding: 3px 5px 2px; }
.layer-row--compact .layer-row-main { grid-template-columns: 25px minmax(0, 1fr) auto; gap: 4px; }
.layer-row--compact .layer-visibility { width: 24px; height: 24px; border-radius: 6px; }
.layer-row--compact .layer-row-titleline strong { font-size: var(--fs-md); }


/* Keep content usable when a panel has been moved downward. */
.layers-panel,
.objects-panel {
  max-height: calc(100% - 48px);
}
.layers-panel[style*="top"],
.objects-panel[style*="top"] {
  bottom: 38px;
}@media (max-width: 1366px) and (max-height: 820px) {
  .layers-panel,
    .objects-panel,
    .export-panel { top: 8px; bottom: 35px; }
}

@media (max-width: 620px) {
  .layers-panel,
    .objects-panel {
      left: 68px !important;
      right: 8px !important;
      top: 8px !important;
      bottom: 35px !important;
      width: auto !important;
      max-width: none !important;
    }
}
.source-health-panel {
  position: absolute;
  z-index: 46;
  left: 50%;
  bottom: 34px;
  width: min(620px, calc(100vw - 120px));
  max-height: min(62vh, 520px);
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  /* 17.8.13 — panel nie miał tła: lista źródeł rysowała się na mapie. */
  background: var(--surface-solid);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.source-health-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 9px;
  border-bottom: 1px solid var(--border-soft);
  background: var(--surface-raised);
}
.source-health-summary,
.source-health-actions { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }

.source-health-actions button {
  min-height: 25px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0 7px;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-muted);
  background: var(--surface-solid);
  font: inherit;
  font-size: var(--fs-xs);
  cursor: pointer;
}
.source-health-actions button.is-active,
.source-health-actions button:hover { color: var(--text); border-color: var(--accent); background: var(--accent-soft); }
.source-health-list { overflow: auto; padding: 5px 7px 8px; }
.source-health-row {
  display: grid;
  grid-template-columns: 10px minmax(0,1fr) 28px;
  gap: 7px;
  align-items: center;
  padding: 6px 5px;
  border-bottom: 1px solid var(--border-soft);
}
.source-health-row:last-child { border-bottom: 0; }
.source-health-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-faint); }
.source-health-dot--ok { background: var(--success); }
.source-health-dot--warn { background: var(--warning); }
.source-health-dot--down { background: var(--danger); }
.source-health-dot--busy { background: var(--accent); }
.source-health-copy { min-width: 0; display: grid; gap: 2px; }
.source-health-title { display: flex; align-items: center; gap: 7px; min-width: 0; }
.source-health-title strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--fs-sm); }
.source-health-title span { margin-left: auto; font-size: var(--fs-xs); color: var(--text-muted); }
.source-health-copy small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-muted); font-size: var(--fs-xs); }
.source-health-retry {
  width: 25px; height: 25px; display: grid; place-items: center;
  border: 1px solid var(--border); border-radius: 6px; background: var(--surface-solid); color: var(--text-muted); cursor: pointer;
}
.source-health-retry:hover { color: var(--accent); border-color: var(--accent); }
.source-health-empty { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 18px; color: var(--text-muted); font-size: var(--fs-sm); }

.layers-panel--v2 .layers-list { min-height: 0; overflow: auto; }
.layer-shortcuts { padding: 5px 6px; border-bottom: 1px solid var(--border-soft); background: color-mix(in srgb, var(--surface-raised) 84%, var(--accent) 4%); }
.layer-shortcuts-title { display: flex; align-items: center; gap: 4px; margin-bottom: 4px; color: var(--text-muted); font-size: var(--fs-xs); font-weight: 600; }
.layer-shortcuts-list { display: flex; flex-wrap: wrap; gap: 4px; max-height: 78px; overflow: auto; }
.layer-shortcuts-list button {
  max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  min-height: 22px; padding: 0 6px; border: 1px solid var(--border-soft); border-radius: 999px; background: var(--surface-solid); color: var(--text-muted); font: inherit; font-size: var(--fs-xs); cursor: pointer;
}
.layer-shortcuts-list button.is-active { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 48%, var(--border)); background: var(--accent-soft); }
.layer-row--compact .layer-row-main { grid-template-columns: 16px 25px minmax(0, 1fr) 25px 25px 25px; }
.layer-drag-handle { width: 16px; height: 24px; display: grid; place-items: center; color: var(--text-faint); cursor: grab; }
.layer-row.is-dragging { opacity: .45; }
.layer-health-badge {
  margin-left: auto; flex: 0 0 auto; padding: 1px 4px; border-radius: 999px; border: 1px solid var(--border-soft); color: var(--text-faint); font-size: var(--fs-xs); font-weight: 500;
}
.layer-health-badge--ok { color: var(--success); }
.layer-health-badge--warn { color: var(--warning); }
.layer-health-badge--down { color: var(--danger); }
.layer-health-badge--busy { color: var(--accent); }

@media (max-width: 760px), (pointer: coarse) and (max-height: 500px) {
  .source-health-panel { left: 8px; right: 8px; width: auto; transform: none; bottom: 32px; }
  .source-health-toolbar { align-items: flex-start; flex-direction: column; }
}
.layers-panel { left: 86px; }@media (max-width: 760px), (pointer: coarse) and (max-height: 500px) {
  .layers-panel { left: 70px; }
}

.analysis-source-meta{font-size:var(--fs-md);color:var(--text-muted);margin-top:6px;line-height:1.35}
}
