/* TORRE: mapa interesariuszy. Ładowany tylko na tej stronie, po styles.css. */
.smap { --smap-gap: clamp(20px, 3vw, 40px); position: relative; color: var(--ink); min-width: 0; }
.smap *, .smap *::before, .smap *::after { box-sizing: border-box; }
.smap-sr { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.smap-muted { color: var(--muted); font-size: 15px; line-height: 1.5; margin: 0; }
.smap-label { margin: 0 0 12px; font-size: 13px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }

/* ---------- Pasek narzędzi ---------- */
.smap-toolbar {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 20px var(--smap-gap); align-items: end;
  padding-bottom: 24px; margin-bottom: 28px; border-bottom: 1px solid var(--line);
}
.smap-presets { display: flex; flex-wrap: wrap; gap: 8px; }
.smap-preset {
  display: inline-flex; align-items: center; gap: 8px; min-height: 38px; padding: 6px 10px 6px 12px;
  font: inherit; font-size: 14px; font-weight: 500; line-height: 1.2; text-align: left; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: 0; cursor: pointer;
  transition: border-color .3s var(--ease), background-color .3s var(--ease), color .3s var(--ease);
}
.smap-preset .icon { width: 17px; height: 17px; }
.smap-preset__ico { color: var(--muted); }
.smap-preset__state { color: var(--accent); width: 15px !important; height: 15px !important; }
.smap-preset:hover { border-color: var(--ink); }
.smap-preset.is-on { background: transparent; color: var(--muted); border-style: dashed; cursor: default; }
.smap-preset.is-on .smap-preset__state { color: var(--muted); }
.smap-preset.is-on:hover { border-color: var(--line-strong); }

.smap-custom { display: flex; gap: 8px; margin-top: 12px; max-width: 520px; }
.smap-input {
  flex: 1 1 auto; min-width: 0; height: 44px; padding: 0 14px;
  font: inherit; font-size: 15px; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line-strong); border-radius: 0;
}
.smap-input::placeholder { color: var(--muted); opacity: 1; }
.smap-input:focus-visible { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
.smap-custom__btn { flex: none; gap: 8px; }
.smap-custom__btn .icon, .smap-export .icon { width: 18px; height: 18px; }

.smap-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 4px 6px; }
.smap-act {
  display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 12px;
  font: inherit; font-size: 15px; font-weight: 600; color: var(--ink);
  background: transparent; border: 1px solid transparent; border-radius: 0; cursor: pointer;
  transition: border-color .3s var(--ease), color .3s var(--ease);
}
.smap-act .icon { width: 18px; height: 18px; }
.smap-act:hover { border-color: var(--line-strong); }
.smap-act--danger { color: var(--danger); padding-inline: 0; height: 40px; }
.smap-act--danger:hover { border-color: transparent; text-decoration: underline; text-underline-offset: 4px; }
.smap-export { margin-left: 6px; gap: 10px; }

/* ---------- Układ ---------- */
.smap-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 380px); gap: var(--smap-gap); align-items: start; }
.smap-stage {
  display: grid; grid-template-columns: 28px minmax(0, 1fr); grid-template-rows: auto auto auto;
  column-gap: 10px; row-gap: 10px; min-width: 0;
}

/* ---------- Osie ---------- */
.smap-yaxis, .smap-xaxis {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 12px; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted);
}
.smap-axis__name { font-weight: 700; color: var(--ink); letter-spacing: 0.14em; }
.smap-axis__name b { color: var(--accent); font-weight: 700; }
.smap-yaxis { writing-mode: vertical-rl; transform: rotate(180deg); }
.smap-yaxis .smap-axis__lo { order: 0; }

/* ---------- Siatka ---------- */
.smap-board {
  position: relative; aspect-ratio: 5 / 4; min-height: 300px; overflow: hidden;
  display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr;
  background-color: var(--surface);
  background-image:
    linear-gradient(to right, var(--line) 1px, transparent 1px),
    linear-gradient(to bottom, var(--line) 1px, transparent 1px);
  background-size: 10% 10%;
  background-position: -1px -1px;
  border: 1px solid var(--ink);
  touch-action: pan-y;
  user-select: none; -webkit-user-select: none;
}
.smap-board::before, .smap-board::after { content: ""; position: absolute; background: var(--line-strong); pointer-events: none; }
.smap-board::before { left: 50%; top: 0; bottom: 0; width: 1px; }
.smap-board::after { top: 50%; left: 0; right: 0; height: 1px; }

.smap-quad { position: relative; display: flex; padding: clamp(10px, 1.6vw, 20px); pointer-events: none; }
.smap-quad__title {
  font-family: var(--font-display); font-weight: 500; font-optical-sizing: auto;
  font-size: clamp(15px, 1.9vw, 24px); line-height: 1.1; letter-spacing: -0.01em; color: var(--ink-2);
  max-width: 11ch; opacity: .9;
}
.smap-quad--satisfy { align-items: flex-start; justify-content: flex-start; }
.smap-quad--manage { align-items: flex-start; justify-content: flex-end; text-align: right; background: var(--accent-soft); }
.smap-quad--manage .smap-quad__title { color: var(--accent); }
.smap-quad--monitor { align-items: flex-end; justify-content: flex-start; }
.smap-quad--inform { align-items: flex-end; justify-content: flex-end; text-align: right; }

.smap-board__empty {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 1;
  width: min(80%, 360px); margin: 0; padding: 14px 16px; text-align: center;
  font-size: 14px; line-height: 1.45; color: var(--muted); background: var(--surface); border: 1px dashed var(--line-strong);
}

/* ---------- Etykiety ---------- */
.smap-chip {
  position: absolute; left: 0; top: 0; z-index: 2;
  display: inline-flex; align-items: center; gap: 7px; max-width: min(44%, 220px);
  min-height: 34px; padding: 6px 10px;
  font: inherit; font-size: 13px; font-weight: 600; line-height: 1.15; text-align: left;
  color: var(--ink); background: var(--bg); border: 1px solid var(--line-strong); border-radius: 0;
  cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none;
  box-shadow: 0 1px 0 var(--line);
  transition: background-color .25s var(--ease), color .25s var(--ease), border-color .25s var(--ease), box-shadow .25s var(--ease);
}
.smap-chip .smap-chip__ico { width: 15px; height: 15px; color: var(--accent); }
.smap-chip__txt { min-width: 0; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: break-word; -webkit-hyphens: auto; hyphens: auto; }
.smap-chip.is-high { background: var(--navy); color: var(--on-navy); border-color: var(--navy); }
.smap-chip:hover { border-color: var(--ink); }
.smap-chip.is-high:hover { border-color: var(--on-navy-muted); }
.smap-chip.is-selected { outline: 2px solid var(--accent); outline-offset: 2px; z-index: 3; }
.smap-chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; z-index: 3; }
.smap-chip.is-dragging { cursor: grabbing; z-index: 4; box-shadow: 0 10px 28px rgba(11, 31, 51, 0.24); transition: none; }
.smap.is-dragging, .smap.is-dragging * { cursor: grabbing !important; }

.smap-help { grid-column: 2; display: flex; gap: 10px; align-items: flex-start; margin: 8px 0 0; font-size: 14px; line-height: 1.5; color: var(--muted); max-width: 70ch; }
.smap-help .icon { width: 18px; height: 18px; margin-top: 2px; color: var(--ink-2); }

/* ---------- Panel ---------- */
.smap-panel { display: grid; gap: 28px; min-width: 0; }
.smap-panel__h {
  margin: 0 0 14px; font-family: var(--font-sans); font-size: 13px; font-weight: 600;
  letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted);
}
.smap-count { color: var(--ink); letter-spacing: 0.04em; }
.smap-editor { padding: 20px; background: var(--surface); border: 1px solid var(--line); border-top: 2px solid var(--ink); }
.smap-editor__name { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin-bottom: 16px; }
.smap-editor__name .icon { width: 20px; height: 20px; color: var(--accent); }
.smap-editor__name strong { font-size: 17px; font-weight: 600; line-height: 1.25; min-width: 0; overflow-wrap: anywhere; }
.smap-tag {
  display: inline-block; padding: 3px 8px; font-size: 12px; font-weight: 600; letter-spacing: 0.04em;
  color: var(--ink-2); border: 1px solid var(--line-strong);
}
.smap-tag--manage { color: var(--on-accent); background: var(--accent); border-color: var(--accent); }

.smap-range { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 6px 12px; margin-bottom: 14px; }
.smap-range label { font-size: 14px; font-weight: 600; }
.smap-range output { font-family: var(--font-mono); font-size: 13px; color: var(--muted); min-width: 3ch; text-align: right; }
.smap-range input[type=range] {
  grid-column: 1 / -1; width: 100%; height: 28px; margin: 0; background: transparent;
  -webkit-appearance: none; appearance: none; cursor: pointer;
}
.smap-range input[type=range]::-webkit-slider-runnable-track { height: 2px; background: var(--line-strong); }
.smap-range input[type=range]::-moz-range-track { height: 2px; background: var(--line-strong); }
.smap-range input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; margin-top: -8px; background: var(--navy); border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--navy); border-radius: 0; }
.smap-range input[type=range]::-moz-range-thumb { width: 16px; height: 16px; background: var(--navy); border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--navy); border-radius: 0; }
.smap-range input[type=range]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.smap-groups__list { display: grid; }
.smap-group { padding: 18px 0 20px; border-top: 1px solid var(--line-strong); }
.smap-group__title {
  display: flex; align-items: center; gap: 10px; margin: 0 0 8px;
  font-family: var(--font-display); font-weight: 500; font-size: 22px; line-height: 1.15; letter-spacing: -0.01em;
}
.smap-group__swatch { width: 10px; height: 10px; flex: none; border: 1px solid var(--ink); }
.smap-group--manage .smap-group__swatch { background: var(--accent); border-color: var(--accent); }
.smap-group--manage .smap-group__title { color: var(--accent); }
.smap-group--satisfy .smap-group__swatch { background: var(--navy); border-color: var(--navy); }
.smap-group__n { margin-left: auto; font-family: var(--font-mono); font-size: 13px; color: var(--muted); }
.smap-group__advice { margin: 0 0 12px; font-size: 14.5px; line-height: 1.55; color: var(--ink-2); }
.smap-group__empty { margin: 0; font-size: 13px; color: var(--muted); font-style: italic; }
.smap-group__list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.smap-group__list li { display: inline-flex; border: 1px solid var(--line-strong); background: var(--surface); max-width: 100%; }
.smap-group__list li.is-selected { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.smap-group__item, .smap-group__rm {
  display: inline-flex; align-items: center; gap: 6px; min-height: 36px;
  font: inherit; font-size: 13.5px; font-weight: 500; color: var(--ink);
  background: transparent; border: 0; border-radius: 0; cursor: pointer;
}
.smap-group__item { padding: 4px 6px 4px 10px; min-width: 0; text-align: left; }
.smap-group__item span { overflow-wrap: anywhere; }
.smap-group__item .icon { width: 15px; height: 15px; color: var(--muted); }
.smap-group__rm { padding: 0 9px; color: var(--muted); border-left: 1px solid var(--line); }
.smap-group__rm .icon { width: 14px; height: 14px; }
.smap-group__rm:hover { color: var(--danger); }
.smap-group__item:hover span { text-decoration: underline; text-underline-offset: 3px; }

.smap-cta { padding: 20px; background: var(--navy); color: var(--on-navy); }
.smap-cta p { margin: 0 0 14px; font-family: var(--font-display); font-weight: 500; font-size: 20px; line-height: 1.25; }
.smap-cta .btn--ghost { border-color: var(--on-navy); color: var(--on-navy); }
.smap-cta .btn--ghost::before { background: var(--on-navy); }
.smap-cta .btn--ghost:hover { color: var(--navy); }
.smap-privacy { display: flex; gap: 10px; margin: 0; font-size: 13px; line-height: 1.5; color: var(--muted); }
.smap-privacy .icon { width: 16px; height: 16px; margin-top: 2px; }

.smap-printimg { display: none; }

/* ---------- Responsywność ---------- */
@media (max-width: 1080px) {
  .smap-toolbar { grid-template-columns: minmax(0, 1fr); }
  .smap-actions { justify-content: flex-start; }
  .smap-export { margin-left: auto; }
  .smap-body { grid-template-columns: minmax(0, 1fr); }
  .smap-panel { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
  .smap-groups { grid-row: span 3; }
}
@media (max-width: 720px) {
  .smap-panel { grid-template-columns: minmax(0, 1fr); }
  .smap-groups { grid-row: auto; }
  .smap-board { aspect-ratio: 1 / 1; }
  .smap-stage { grid-template-columns: 20px minmax(0, 1fr); column-gap: 6px; }
  .smap-yaxis, .smap-xaxis { font-size: 10.5px; letter-spacing: 0.06em; }
  .smap-chip { font-size: 11.5px; padding: 5px 7px; gap: 5px; min-height: 30px; max-width: 46%; }
  .smap-chip .smap-chip__ico { width: 13px; height: 13px; }
  .smap-quad__title { font-size: 14px; }
  .smap-help { grid-column: 1 / -1; font-size: 13px; }
  .smap-preset { font-size: 13px; min-height: 36px; padding: 5px 8px 5px 10px; }
  .smap-actions { gap: 4px; }
  .smap-act { padding: 0 10px; }
  .smap-export { margin-left: 0; width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .smap-chip, .smap-preset, .smap-act { transition: none; }
}

/* ---------- Druk: tylko wygenerowany obraz mapy ---------- */
@media print {
  @page { size: A4 landscape; margin: 12mm; }
  body * { visibility: hidden !important; }
  .smap-printimg, .smap-printimg * { visibility: visible !important; }
  .smap-printimg { display: block !important; position: fixed; left: 0; top: 0; width: 100%; height: auto; max-height: 100%; object-fit: contain; }
  html, body { background: #fff !important; }
}
