:root {
  font-family: "Segoe UI", Arial, sans-serif;
  font-size: 13px;
  color: #243a45;
  background: #f3f5f7;
  --accent: #087f81;
  --accent-dark: #066c6e;
  --teal: #47d3bc;
  --muted: #697d86;
  --border: #dce3e7;
  --shadow: 0 6px 24px rgba(18, 45, 57, 0.25);
  line-height: 1.4;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  height: 100vh;
  overflow: hidden;
  display: grid;
  grid-template-rows: 36px 34px 1fr 24px;
}
/* Row 1: App Bar / Header */
.appbar {
  background: white;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 12px;
  gap: 16px;
  height: 36px;
  z-index: 50;
}
.brand-section {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
/* znak aplikacji — ten sam wygląd co w SP Concept (litera na jasnozielonym tle) */
.mark {
  width: 24px;
  height: 24px;
  background: #47d3bc;
  color: #123a43;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-style: italic;
  font-weight: 700;
  font-size: 15px;
  flex-shrink: 0;
}
.brand-text {
  font-size: 14px;
  font-weight: 700;
  color: #243a45;
  white-space: nowrap;
}
/* Menu bar */
.menubar {
  display: flex;
  gap: 2px;
  flex: 1;
  position: relative;
}
.menubar-btn {
  background: none;
  border: none;
  padding: 4px 11px;
  font-size: 12px;
  color: #243a45;
  cursor: pointer;
  position: relative;
  transition: background 0.15s;
  border-radius: 4px;
}
.menubar-btn:hover {
  background: #f0f2f4;
}
.menubar-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}
.menu {
  position: absolute;
  top: 36px;
  left: 0;
  background: white;
  border: 1px solid var(--border);
  border-radius: 6px;
  min-width: 220px;
  box-shadow: var(--shadow);
  z-index: 1200;
}
.menu[hidden] {
  display: none;
}
.menuitem {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: 6px 12px;
  font-size: 12.5px;
  color: #243a45;
  cursor: pointer;
  transition: background 0.1s;
}
.menuitem:hover {
  background: #e6f4f1;
}
.menuitem:disabled {
  opacity: 0.45;
  cursor: default;
}
.menuitem:disabled:hover {
  background: none;
}
.menu-separator {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}
/* Project selector group */
.project-selector {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.project-selector select {
  font-size: 12px;
  padding: 4px 6px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: white;
  color: #243a45;
  max-width: 140px;
  height: 26px;
}
.compact-btn,
.compact-link {
  font-size: 12px;
  padding: 4px 8px;
  height: 26px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: white;
  color: #243a45;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}
.compact-btn:hover,
.compact-link:hover {
  background: #f0f2f4;
  border-color: #b8cbd2;
}
.compact-btn.primary {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}
.compact-btn.primary:hover {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
}
/* Row 2: Toolbar */
.toolbar {
  background: #f8fafb;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 8px;
  gap: 8px;
  height: 34px;
  overflow: hidden;
  flex-wrap: nowrap;
}
.toolbar-section {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}
.toolbar-btn {
  background: none;
  border: none;
  padding: 3px 7px;
  font-size: 12px;
  color: #243a45;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
  border-radius: 3px;
}
@media (max-width: 1200px) {
  /* Wąski ekran: etykiety zostają (wcześniej znikały — przyciski bez data-icon), mniejsza czcionka i odstępy. */
  .toolbar-btn { font-size: 11px; padding: 3px 5px; }
}
.toolbar-btn:hover {
  background: #e6f4f1;
  color: var(--accent);
}
.toolbar-separator {
  width: 1px;
  height: 18px;
  background: var(--border);
  flex-shrink: 0;
}
/* Segmented Control */
.seg {
  display: flex;
  gap: 0;
  flex-shrink: 0;
  border-radius: 4px;
  background: white;
  border: 1px solid var(--border);
}
.seg-btn {
  background: white;
  border: none;
  padding: 3px 7px;
  font-size: 12px;
  color: #243a45;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
  flex: 1;
}
.seg-btn:not(:last-child) {
  border-right: 1px solid var(--border);
}
.seg-btn[aria-pressed="true"] {
  background: var(--accent);
  color: white;
}
.seg-btn:hover:not([disabled]) {
  background: #f0f2f4;
}
.seg-btn[aria-pressed="true"]:hover {
  background: var(--accent-dark);
  color: white;
}
.seg-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.metrics-strip {
  display: flex;
  gap: 12px;
  margin-left: auto;
  flex-shrink: 1;
  min-width: 0;
  font-size: 11px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.metric-label {
  font-size: 11px;
}
.metrics-strip strong {
  color: #243a45;
  font-weight: 600;
  font-size: 12px;
}
/* Row 3: Work Area */
.workarea {
  position: relative;
  min-height: 0;
  overflow: hidden;
  background: #0f2530;
  background-image:
    linear-gradient(0deg, transparent calc(100% - 1px), #1a3a47 calc(100% - 1px)),
    linear-gradient(90deg, transparent calc(100% - 1px), #1a3a47 calc(100% - 1px));
  background-size: 50px 50px;
}
#basemap.basemap {
  position: absolute;
  inset: 0;
  z-index: 0;
}
#basemap.basemap[hidden] {
  display: none;
}
canvas#map {
  display: block;
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1;
}
/* Basemap loading indicator */
.basemap-loading {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 1050;
  background: white;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 8px 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: #243a45;
  box-shadow: 0 2px 8px rgba(18, 45, 57, 0.12);
  white-space: nowrap;
}
.basemap-loading[hidden] {
  display: none;
}
.basemap-loading-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
/* Floating Palettes */
.floating-palette {
  position: absolute;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
  z-index: 1100;
  min-width: 160px;
}
.floating-palette[hidden] {
  display: none;
}
#palette-tools {
  left: 12px;
  top: 12px;
  width: 176px;
}
#palette-info {
  left: 200px;
  top: 12px;
  width: 170px;
}
.palette-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
  height: 24px;
  font-size: 11px;
  font-weight: 700;
  border-radius: 7px 7px 0 0;
  user-select: none;
  cursor: move;
}
.palette-close {
  background: none;
  border: none;
  padding: 0;
  color: var(--muted);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  transition: color 0.15s;
}
.palette-close:hover {
  color: #243a45;
}
.palette-content {
  padding: 8px;
}
/* Tool Grid */
.tool-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
}
.tool-btn {
  aspect-ratio: 1;
  background: #f8fafb;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.tool-btn:hover {
  background: #e6f4f1;
  border-color: var(--accent);
}
/* Info Palette */
.info-palette {
  width: 270px;
}
.info-palette .info-row[hidden] { display: none; }
#info-cursor-value { white-space: nowrap; }
.info-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.info-palette .info-row {
  display: grid;
  grid-template-columns: 60px 1fr;
  gap: 6px;
  padding: 6px 0;
  font-size: 12px;
  align-items: center;
  border-bottom: 1px solid var(--border);
}
.info-palette .info-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}
.info-key {
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  text-align: left;
}
.info-value {
  font-size: 12px;
  color: #243a45;
  font-feature-settings: "tnum" 1;
  word-break: break-word;
}
#info-x, #info-y, #info-gx, #info-gy {
  display: none;
}
/* Right Drawer */
.drawer {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 360px;
  max-width: 92%;
  background: white;
  border-left: 1px solid var(--border);
  box-shadow: -6px 0 24px rgba(18, 45, 57, 0.15);
  overflow-y: auto;
  z-index: 1150;
}
.drawer[hidden] {
  display: none;
}
.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
  background: #f8fafb;
  height: 34px;
  flex-shrink: 0;
  gap: 4px;
}
.drawer-title {
  font-size: 13px;
  font-weight: 600;
  margin: 0;
  color: #243a45;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.drawer-home {
  background: none;
  border: none;
  padding: 2px 6px;
  color: var(--muted);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  transition: color 0.15s;
  flex-shrink: 0;
}
.drawer-home:hover {
  color: #243a45;
}
.drawer-close {
  background: none;
  border: none;
  padding: 2px 6px;
  color: var(--muted);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  transition: color 0.15s;
  flex-shrink: 0;
}
.drawer-close:hover {
  color: #243a45;
}
.drawer-content {
  padding: 8px;
  background: white;
}
.panel-section {
  display: none;
}
.panel-section.active {
  display: block;
}
/* Panel Cards */
.panel {
  background: white;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  margin-bottom: 8px;
}
.panelhead {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.panelhead h2,
.panelhead h3 {
  font-size: 13.5px;
  font-weight: 600;
  margin: 0;
  color: #243a45;
  flex: 1;
}
.badge {
  font-size: 8.5px;
  letter-spacing: 0.8px;
  color: var(--accent);
  background: #e6f4f1;
  border: 1px solid #cce8e0;
  border-radius: 5px;
  padding: 3px 6px;
  text-transform: uppercase;
  white-space: nowrap;
}
.exp-badge {
  vertical-align: super;
  margin-right: 4px;
}
/* Forms and inputs in drawer */
label {
  display: block;
  font-size: 11px;
  color: #6d818c;
  margin: 6px 0 3px;
}
select,
input,
textarea {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 7px;
  background: white;
  font-family: inherit;
  font-size: 12px;
  width: 100%;
  max-width: 100%;
  color: #243a45;
}
select:focus,
input:focus,
textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
}
textarea {
  display: block;
  resize: vertical;
  min-height: 5em;
}
input[type="color"] {
  width: 50px;
  height: 30px;
  padding: 2px;
}
input[type="checkbox"],
input[type="radio"] {
  width: auto;
  margin-right: 6px;
}
/* Buttons */
button {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 10px;
  color: #243a45;
  background: white;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  white-space: nowrap;
}
button:hover {
  background: #f0f2f4;
  border-color: #b8cbd2;
}
button.primary {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}
button.primary:hover {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
}
button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
/* Tables */
table {
  border-collapse: collapse;
  width: 100%;
  font-size: 12px;
  margin-top: 6px;
}
table th {
  background: #f5f8f9;
  color: #6c818d;
  font-weight: 600;
  text-align: left;
  padding: 4px 8px;
  border-bottom: 1px solid #e4ebee;
  font-size: 11px;
}
table td {
  padding: 4px 8px;
  border-bottom: 1px solid #e4ebee;
}
table td.num {
  text-align: right;
}
/* Layers list — Compact div/flex layout matching SoundPLAN Geo-Baza */
.layers-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  font-size: 13px;
}
.layer-row {
  display: flex;
  align-items: center;
  gap: 2px;
  height: 24px;
  padding: 0 4px;
  cursor: pointer;
  background: white;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}
.layer-row:hover {
  background: #f3f8f8;
}
.layer-row.active-layer {
  background: #e6f4f1;
  border-left: 3px solid var(--accent);
  padding-left: 1px;
}
.lyr-icon {
  width: 14px;
  height: 14px;
  padding: 0;
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: currentColor;
  transition: background 0.15s;
  flex-shrink: 0;
}
.lyr-icon:hover {
  background: #e6ecf0;
}
.lyr-icon svg {
  width: 14px;
  height: 14px;
  display: block;
}
.lyr-visible {
  color: var(--muted);
}
.lyr-visible[aria-pressed="true"] {
  color: #243a45;
}
.lyr-calc {
  color: var(--muted);
}
.lyr-calc[aria-pressed="true"] {
  color: #243a45;
}
.lyr-locked {
  color: var(--muted);
}
.lyr-locked[aria-pressed="true"] {
  color: #243a45;
}
.lyr-color {
  width: 10px;
  height: 10px;
  padding: 0;
  background: #245a8d;
  border: 1px solid var(--border);
  border-radius: 2px;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.1s;
}
.lyr-color:hover {
  transform: scale(1.2);
}
.layer-name {
  flex: 1;
  min-width: 0;
  color: #243a45;
  font-size: 13px;
  user-select: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.layer-name:hover {
  cursor: text;
}
.layer-count {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  flex-shrink: 0;
  margin-left: 8px;
}
/* Paging controls */
.paging-controls {
  display: flex;
  gap: 6px;
  justify-content: space-between;
  align-items: center;
  margin-top: 6px;
}
.paging-controls button {
  padding: 4px 8px;
  font-size: 11px;
}
/* Utility sections */
.section-margin {
  margin-top: 6px;
}
.button-group {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 6px;
}
.layer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}
.filters-div {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.filters-div label {
  display: flex;
  flex-direction: column;
  margin: 0;
}
.filters-div select {
  min-width: 100px;
}
.viewtools {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
  padding: 4px 0;
}
#details {
  white-space: pre-wrap;
  padding: 8px;
  background: #f5f8f9;
  border-radius: 4px;
  font-size: 10px;
  overflow-x: auto;
  margin-top: 6px;
  word-break: break-word;
}
/* Dynamic content styles */
.layers-section,
.approval-section,
.bulk-section,
.import-section,
.terrain-section,
.scene-section {
  display: block;
}
.approval-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}
.approval-form label {
  display: flex;
  flex-direction: column;
  margin: 0;
}
#approval-attr-label {
  display: none;
}
.calc-form,
.calc-results,
.import-counts,
.import-blockers,
.import-tabs,
.terrain-sample,
.terrain-report {
  display: block;
  margin-top: 8px;
}
.calc-results-table {
  font-size: 11px;
  border-collapse: collapse;
  margin-top: 8px;
}
.calc-results-table th,
.calc-results-table td {
  border: 1px solid #ccc;
  padding: 3px 6px;
  font-size: 10px;
}
.calc-results-table th {
  background: #f5f8f9;
  font-weight: 600;
}
details {
  margin: 6px 0;
}
summary {
  cursor: pointer;
  font-weight: 600;
  padding: 4px 0;
  user-select: none;
}
summary:hover {
  background: #f9fafb;
  border-radius: 3px;
}
ul {
  margin: 6px 0;
  padding-left: 20px;
}
li {
  margin: 3px 0;
  font-size: 12px;
}
/* Scene grid layout */
.scene-grid {
  display: grid;
  gap: 8px;
  margin-top: 8px;
  padding: 10px;
  background: #f9fafb;
  border-radius: 6px;
}
.scene-grid h3 {
  margin: 0 0 8px 0;
  font-size: 13px;
}
.scene-grid label {
  display: inline-flex;
  align-items: center;
  flex-direction: row;
  gap: 6px;
  margin: 6px 10px 6px 0;
}
.scene-grid > div {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.scene-grid > div label {
  margin: 0;
  flex: 0 0 auto;
}
.scene-grid > div input {
  flex: 0 0 100px;
}
/* Terrain section */
.terrain-source {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 10px;
  padding: 8px;
  background: #f9fafb;
  border-radius: 6px;
}
.terrain-source label {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 6px;
  margin: 0;
}
.terrain-source input[type="radio"] {
  margin: 0;
}
.terrain-sample {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  margin-top: 10px;
  padding: 8px;
  background: #f9fafb;
  border-radius: 6px;
}
.terrain-sample label {
  display: flex;
  flex-direction: column;
  margin: 0;
  flex: 0 0 auto;
}
.terrain-sample input {
  width: 80px;
}
#terrain-sample-result {
  margin-left: 8px;
  padding: 4px 8px;
  background: white;
  border: 1px solid var(--border);
  border-radius: 3px;
  font-size: 11px;
}
/* Import preview */
.import-counts ul,
.import-blockers ul {
  margin: 8px 0;
  padding-left: 20px;
}
.import-tabs {
  display: block;
  margin-top: 10px;
}
.import-tabs > div:first-child {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
}
#import-details {
  padding: 8px;
  background: #f9fafb;
  border-radius: 6px;
  font-size: 11px;
}
/* Row 4: Status Bar */
.statusbar {
  background: #f3f5f7;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 12px;
  gap: 16px;
  font-size: 11px;
  color: var(--muted);
  height: 24px;
}
.status-cell {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.status-message {
  flex: 1;
  min-width: 0;
}
#notice {
  color: #243a45;
  font-size: 11px;
}
#notice:empty::before {
  content: "Gotowe";
  color: var(--muted);
}
/* About Modal */
.about-modal {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(18, 45, 57, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1300;
}
.about-modal[hidden] {
  display: none;
}
.about-card {
  background: white;
  border-radius: 8px;
  box-shadow: var(--shadow);
  max-width: 500px;
  width: 90%;
}
.about-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px;
  border-bottom: 1px solid var(--border);
}
.about-header h2 {
  font-size: 16px;
  margin: 0;
  color: #243a45;
}
.about-close {
  background: none;
  border: none;
  padding: 0;
  color: var(--muted);
  cursor: pointer;
  font-size: 24px;
  line-height: 1;
  transition: color 0.15s;
}
.about-close:hover {
  color: #243a45;
}
.about-body {
  padding: 12px;
  font-size: 13px;
  line-height: 1.6;
  color: #243a45;
}
.about-body p {
  margin: 0 0 8px 0;
}
.about-body p:last-child {
  margin-bottom: 0;
}
/* Save As Modal */
.saveas-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(18, 45, 57, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1300;
}
.saveas-card {
  background: white;
  border-radius: 8px;
  box-shadow: var(--shadow);
  max-width: 400px;
  width: 90%;
}
.saveas-header {
  display: flex;
  align-items: center;
  padding: 12px;
  border-bottom: 1px solid var(--border);
}
.saveas-header h2 {
  font-size: 16px;
  margin: 0;
  color: #243a45;
}
.saveas-body {
  padding: 16px;
}
.saveas-body label {
  display: block;
  font-size: 13px;
  margin-bottom: 8px;
  color: #243a45;
}
.saveas-input {
  width: 100%;
  padding: 8px 12px;
  font-size: 13px;
  border: 1px solid var(--border);
  border-radius: 4px;
  box-sizing: border-box;
  font-family: inherit;
  color: #243a45;
}
.saveas-input:focus {
  outline: none;
  border-color: #2c7bb6;
  box-shadow: 0 0 0 2px rgba(44, 123, 182, 0.1);
}
.saveas-buttons {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding: 12px;
  border-top: 1px solid var(--border);
}
.saveas-btn {
  padding: 6px 16px;
  font-size: 13px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.15s;
}
.saveas-btn-primary {
  background-color: #2c7bb6;
  color: white;
}
.saveas-btn-primary:hover {
  background-color: #1f5a8f;
}
.saveas-btn-secondary {
  background-color: #f5f5f5;
  color: #243a45;
}
.saveas-btn-secondary:hover {
  background-color: #e0e0e0;
}
/* 3D View */
.workarea {
  position: relative;
}
#view3d {
  position: absolute;
  inset: 0;
  z-index: 2;
  background: #0f2530;
  display: block;
}
#view3d[hidden] {
  display: none;
}
#view3d-btn {
  margin-left: 8px;
}
/* Responsive (mobile) */
@media (max-width: 900px) {
  body {
    grid-template-rows: 36px 34px 1fr 24px;
  }
  .project-selector {
    max-width: 200px;
  }
  .drawer {
    width: 100%;
    max-width: 100%;
  }
  .workarea {
    flex-direction: column;
  }
  #palette-tools,
  #palette-info {
    display: none;
  }
}
/* Widok 3D: płótno na całą strefę rysunku (wcześniej miało rozmiar domyślny 300×150). */
.workarea > #view3d { position: absolute; inset: 0; width: 100%; height: 100%; display: block; z-index: 2; }
.workarea > #view3d[hidden] { display: none; }
/* Przycisk „Widok główny” — wyróżniony obramowaniem akcentu. */
.toolbar .home-btn { border: 1px solid var(--accent, #087f81); color: var(--accent, #087f81); font-weight: 600; border-radius: 6px; margin-right: 4px; }
.toolbar .home-btn:hover { background: #e6f4f1; }
/* Pasek postępu wczytywania modelu (tworzenie kopii roboczej / przesłanie z viewera). */
.load-progress { position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%); z-index: 1250; width: min(460px, 90%); background: #fff; border: 1px solid #dce3e7; border-radius: 10px; box-shadow: 0 12px 40px rgba(18, 45, 57, .35); padding: 14px 16px 12px; font-size: 12px; color: #243a45; }
.load-progress[hidden] { display: none; }
.load-progress-title { font-size: 13.5px; font-weight: 600; margin-bottom: 10px; }
.load-progress-track { height: 10px; border-radius: 5px; background: #e6eef1; overflow: hidden; }
.load-progress-fill { height: 100%; width: 0; background: linear-gradient(90deg, #087f81, #2bb3a3); border-radius: 5px; transition: width .25s ease; }
.load-progress-row { display: flex; justify-content: space-between; gap: 10px; margin-top: 8px; }
.load-progress-row strong { color: #087f81; font-variant-numeric: tabular-nums; }
.load-progress-detail { margin-top: 4px; color: #697d86; font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* CAD-style Accordion (Folds) */
.fold {
  background: white;
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-bottom: 6px;
  overflow: hidden;
}
.fold-tools {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
  align-items: center;
  padding: 0 0 6px 0;
  font-size: 11px;
}
.fold-tools button {
  font-size: 11px;
  padding: 4px 9px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: white;
  color: #243a45;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.fold-tools button:hover {
  background: #f0f2f4;
  border-color: #b8cbd2;
}
.fold-head {
  width: 100%;
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 7px 10px;
  background: #f8fafb;
  border: 0;
  border-bottom: none;
  text-align: left;
  font-size: 12.5px;
  font-weight: 600;
  color: #243a45;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.fold-head:hover {
  background: #edf4f5;
}
.fold-head[aria-expanded="true"] {
  color: #087f81;
  border-bottom: 1px solid var(--border);
}
.fold-caret {
  display: inline-block;
  width: 12px;
  height: 12px;
  text-align: center;
  line-height: 12px;
  font-size: 10px;
  flex-shrink: 0;
  transition: transform 0.15s ease;
}
.fold-head[aria-expanded="true"] .fold-caret {
  transform: rotate(90deg);
}
.fold-title {
  flex: 1;
  min-width: 0;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
}
.fold-badge {
  flex-shrink: 0;
  font-size: 8.5px;
  letter-spacing: 0.8px;
  color: var(--accent);
  background: #e6f4f1;
  border: 1px solid #cce8e0;
  border-radius: 5px;
  padding: 3px 6px;
  text-transform: uppercase;
  white-space: nowrap;
}
.fold-body {
  display: none;
  padding: 8px 10px;
  background: white;
}
.fold-body.open {
  display: block;
}
.fold-body label {
  display: block;
  font-size: 11px;
  color: #6d818c;
  margin: 6px 0 3px;
}
.fold-body select,
.fold-body input,
.fold-body textarea {
  width: 100%;
  font-size: 12px;
  padding: 4px 6px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: white;
  color: #243a45;
  font-family: inherit;
}
.fold-body select:focus,
.fold-body input:focus,
.fold-body textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
}
.fold-body button {
  font-size: 12px;
  padding: 4px 9px;
}
.fold-body table {
  font-size: 11.5px;
}
.fold-body table th,
.fold-body table td {
  padding: 3px 6px;
}
.fold-body p {
  font-size: 11.5px;
  margin: 6px 0;
  line-height: 1.4;
}
.fold-body ul,
.fold-body ol {
  font-size: 11.5px;
  margin: 6px 0;
  padding-left: 20px;
}
.fold-body > div {
  margin: 6px 0;
}
.fold-body small {
  display: block;
  font-size: 10px;
  color: #697d86;
  margin: 4px 0 6px;
}
.hidden {
  display: none !important;
}
.calc-hint {
  display: block;
  font-size: 10px;
  color: #697d86;
  margin: 4px 0 8px;
}
.calc-add-source {
  background: white;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: #243a45;
  cursor: pointer;
  font-size: 11px;
  margin-top: 6px;
  padding: 4px 9px;
  transition: background 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.calc-add-source:hover {
  background: #f0f2f4;
  border-color: #b8cbd2;
}
.calc-conditions-summary {
  font-size: 11px !important;
  color: #697d86;
  font-weight: 400;
}
.fold-head[aria-expanded="true"] .calc-conditions-summary {
  color: #087f81;
}
/* Panel boczny: o 1/3 węższy od pierwotnych 460 px (prośba użytkownika, 27.09.2026). */
.drawer { width: 306px; max-width: 92%; }
.drawer .fold-body table { font-size: 11px; }
.drawer .fold-body th, .drawer .fold-body td { padding: 3px 5px; }
/* Tool palette */
.tp { display: flex; flex-direction: column; gap: 4px; }
.tp-group { display: grid; grid-template-columns: repeat(5, 28px); gap: 3px; padding-bottom: 4px; border-bottom: 1px solid var(--border); }
.tp-group:last-child { border-bottom: none; padding-bottom: 0; }
.tp-btn { width: 28px; height: 28px; aspect-ratio: auto; padding: 0; color: #243a45; }
.tp-btn svg { width: 16px; height: 16px; display: block; }
.tp-btn:disabled { opacity: .35; cursor: default; }
.tp-btn:disabled:hover { background: #f8fafb; border-color: var(--border); }


/* Ikony warstw (kłódka, słońce, żarówka): .fold-body button nadpisywał padding i ikony miały zerową szerokość. */
.fold-body .lyr-icon { width: 18px; height: 18px; padding: 0; border: none; border-radius: 3px; background: none; display: inline-flex; align-items: center; justify-content: center; }
.fold-body .lyr-icon:hover { background: #e6ecf0; }
.fold-body .lyr-color { width: 10px; height: 10px; padding: 0; margin: 0 4px 0 3px; border: 1px solid rgba(0,0,0,.25); border-radius: 2px; }
.lyr-locked { color: #9aa7ae; }
.lyr-locked[aria-pressed="true"] { color: #243a45; }
.lyr-calc { color: #9aa7ae; }
.lyr-calc[aria-pressed="true"] { color: #b07d00; }
.lyr-calc[aria-pressed="true"] .sun-disc { fill: #f5c542; }
.lyr-visible { color: #9aa7ae; }
.lyr-visible .bulb-glass { fill: none; }
.lyr-visible[aria-pressed="true"] { color: #7a6a1a; }
.lyr-visible[aria-pressed="true"] .bulb-glass { fill: #f2c230; }

/* Teksty (adnotacje) na podkładzie Leaflet; formularz atrybutów narzędzia w panelu edycji. */
.map-annotation-icon { background: none; border: none; }
.map-annotation { display: inline-block; white-space: nowrap; font: 600 12px "Segoe UI", Arial, sans-serif; color: #122d39; background: rgba(255, 255, 255, .8); padding: 1px 4px; border-radius: 3px; }
.tool-attr-form { margin: 6px 0 10px; }
.tool-attr-head { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.tool-attr-badge { padding: 1px 6px; border-radius: 3px; background: #e6f4f1; color: #066c6e; font-size: 11px; font-weight: 600; }
.tool-attr-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.tool-attr-table th { text-align: left; font-weight: 400; color: #697d86; padding: 2px 4px; }
.tool-attr-table td { padding: 2px 4px; }
.tool-attr-table input, .tool-attr-table select { width: 100%; box-sizing: border-box; font: 12px "Segoe UI", Arial, sans-serif; }
.annotation-list { margin: 6px 0 0; padding-left: 16px; font-size: 12px; }

/* Okno zaznaczenia jak w CAD: L→P okno (ciągła niebieska), P→L przecięcie (przerywana zielona). */
.sel-box { position: fixed; z-index: 5000; pointer-events: none; }
.sel-box[hidden] { display: none; }
.sel-window { border: 1.5px solid #2a6fdb; background: rgba(42, 111, 219, .12); }
.sel-crossing { border: 1.5px dashed #1e9e5a; background: rgba(30, 158, 90, .12); }
.tool-attr-actions { display: flex; align-items: center; gap: 6px; margin-top: 8px; }
.tool-attr-actions button { font-size: 12px; padding: 4px 12px; }
.tool-attr-status { font-size: 11px; color: #697d86; }
.tool-attr-table input.attr-changed, .tool-attr-table select.attr-changed { border-color: #087f81; background: #e6f4f1; }
.tool-attr-table input.attr-invalid, .tool-attr-table select.attr-invalid { border-color: #c24a25; background: #fff3ef; }

/* Calculation form buttons and default tags */
.calc-form-actions { display: flex; align-items: center; gap: 6px; margin-top: 12px; padding-top: 8px; border-top: 1px solid var(--border); }
.calc-form-actions button { font-size: 12px; padding: 4px 12px; }
.calc-form-actions .calc-restore-defaults { margin-left: auto; font-size: 11px; color: #087f81; cursor: pointer; text-decoration: underline; padding: 0; background: none; border: none; }
.calc-form-actions .calc-restore-defaults:hover { color: #055f61; }
.calc-form-status { font-size: 11px; color: #697d86; }
.calc-default-tag { display: inline-block; padding: 1px 6px; border-radius: 3px; background: #f5f5f5; color: #888; font-size: 10px; font-weight: 600; margin-left: 4px; }
.calc-dirty-indicator { display: inline-block; margin-left: 4px; font-size: 13px; color: #d32f2f; font-weight: 600; }

/* Płótno całego projektu nad kafelkami podkładu (basemap.js); kliknięcia przechodzą do mapy. */
.mithra-scene-overlay { position: absolute; left: 0; top: 0; z-index: 450; pointer-events: none; }
.saveas-card { max-width: 560px; }
.saveas-body label + .saveas-input, .saveas-folder-row { margin-bottom: 12px; }
.saveas-folder-row { display: flex; gap: 6px; }
.saveas-folder-row .saveas-input { flex: 1; min-width: 0; }
.saveas-browser { border: 1px solid var(--border); border-radius: 4px; margin-bottom: 12px; background: #f6f8f9; }
.saveas-browser-path { padding: 6px 8px; font-size: 12px; color: #243a45; border-bottom: 1px solid var(--border); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.saveas-browser-list { list-style: none; margin: 0; padding: 4px 0; max-height: 200px; overflow: auto; }
.saveas-browser-item { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 4px 10px; font-size: 13px; color: #243a45; cursor: pointer; }
.saveas-browser-item:hover { background: #e3ebef; }
.saveas-browser-empty { padding: 4px 10px; font-size: 12px; color: #6b7c85; }
.saveas-browser-bar { display: flex; gap: 6px; justify-content: flex-end; padding: 6px 8px; border-top: 1px solid var(--border); }
.saveas-error { min-height: 16px; font-size: 12px; color: #b3261e; }
.saveas-browser-places { display: flex; flex-wrap: wrap; gap: 4px; padding: 6px 8px; border-bottom: 1px solid var(--border); }
.saveas-place { font-size: 12px; padding: 2px 8px; border: 1px solid var(--border); border-radius: 4px; background: #fff; color: #243a45; cursor: pointer; }
.saveas-place:hover { background: #f0f2f4; }
/* Okno stanu obliczenia mapy siatkowej (jak pasek postępu wczytywania). */
.noise-calc-box { top: 38%; width: min(520px, 92%); max-height: 70vh; overflow: auto; }
.noise-calc-running .load-progress-fill { width: 35%; animation: nc-slide 1.1s ease-in-out infinite; }
@keyframes nc-slide { 0% { margin-left: -35%; } 100% { margin-left: 100%; } }
.noise-calc-failed .load-progress-fill { background: #c0392b; }
.noise-calc-failed .load-progress-title { color: #a8321f; }
.noise-calc-list { list-style: none; margin: 10px 0 0; padding: 0; }
.noise-calc-list[hidden], .noise-calc-actions[hidden] { display: none; }
.noise-calc-list li { padding: 6px 8px; border: 1px solid #dce3e7; border-left-width: 3px; border-radius: 4px; margin-bottom: 6px; background: #fbfcfd; }
.noise-calc-list li.nc-problem { border-left-color: #c0392b; }
.noise-calc-list li.nc-warning { border-left-color: #d68910; }
.noise-calc-list .nc-text { font-weight: 600; }
.noise-calc-list .nc-count { float: right; color: #697d86; font-variant-numeric: tabular-nums; }
.noise-calc-list .nc-hint { margin-top: 3px; color: #697d86; font-size: 11px; }
.noise-calc-actions { display: flex; justify-content: flex-end; gap: 6px; margin-top: 10px; }
.nc-btn { font-size: 12px; padding: 4px 12px; border: 1px solid #dce3e7; border-radius: 4px; background: #fff; color: #243a45; cursor: pointer; }
.nc-btn:hover { background: #f0f2f4; }
.nc-btn-primary { background: #087f81; border-color: #087f81; color: #fff; }
.nc-btn-primary:hover { background: #066a6c; }
#tab-calc label[hidden], .fold-body label[hidden] { display: none !important; }
/* Sugestia układu współrzędnych (kopia bez CRS). */
.crs-suggestion { padding: 10px 12px; background: #eef7f7; border: 1px solid #087f81; border-radius: 4px; margin: 8px 0; font-size: 12px; color: #243a45; }
.crs-suggestion p { margin: 0 0 6px; }
.crs-suggestion-title { font-weight: 600; }
.crs-suggestion-evidence { color: #697d86; font-size: 11px; }
.crs-suggestion-btn { font-size: 12px; padding: 5px 12px; background: #087f81; color: #fff; border: 1px solid #087f81; border-radius: 4px; cursor: pointer; }
.crs-suggestion-btn:hover { background: #066a6c; }
.crs-suggestion-saved { padding: 8px; background: #e6f4ea; color: #1e6b35; border-radius: 4px; font-size: 12px; }
/* Panel Obliczenia: sprawdzenie danych i opis silnika zwinięte pod formularzem. */
.calc-about { margin: 10px 0 4px; border: 1px solid #dce3e7; border-radius: 4px; background: #fbfcfd; font-size: 12px; color: #243a45; }
.calc-about > summary { cursor: pointer; padding: 7px 10px; font-weight: 600; color: #087f81; }
.calc-about[open] > summary { border-bottom: 1px solid #dce3e7; }
.calc-about > *:not(summary) { margin: 8px 10px; }
.calc-about-text { color: #697d86; font-size: 11px; line-height: 1.45; }
/* Sekcja „Mapa hałasu (siatka)” — zwarta siatka etykieta | pole. */
.nm-section { margin: 4px 0 10px; font-size: 12px; color: #243a45; }
.nm-title { margin: 0 0 8px; font-size: 13px; font-weight: 600; }
.nm-grid { display: grid; grid-template-columns: 74px 1fr; gap: 6px 8px; align-items: start; }
.nm-label { padding-top: 5px; color: #697d86; font-size: 11px; }
.nm-cell select, .nm-cell input { width: 100%; box-sizing: border-box; font-size: 12px; padding: 3px 6px; height: 26px; border: 1px solid #dce3e7; border-radius: 4px; background: #fff; color: #243a45; }
.nm-hint { display: block; margin-top: 2px; color: #8a9aa2; font-size: 10.5px; line-height: 1.3; }
.nm-actions { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.nm-calc-btn { font-size: 12px; padding: 5px 12px; background: #087f81; border: 1px solid #087f81; color: #fff; border-radius: 4px; cursor: pointer; }
.nm-calc-btn:hover { background: #066a6c; }
.nm-toggle { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: #243a45; cursor: pointer; }
.nm-results { margin-top: 8px; }
.nm-result p { margin: 0 0 4px; font-size: 11.5px; }
.nm-limitations { font-size: 11px; color: #697d86; }
.nm-limitations > summary { cursor: pointer; color: #087f81; }
.nm-limitations ul { margin: 4px 0 0 16px; padding: 0; }
.nm-runid { word-break: break-all; }
.nm-toggle { flex-direction: row !important; white-space: nowrap; }
.nm-toggle input[type="checkbox"] { width: auto; height: auto; margin: 0; display: inline-block; }
.calc-add-source { white-space: normal; text-align: left; line-height: 1.3; }
.info-palette { width: 300px; }
