:root {
  --postep-ink: #0b1220;
  --postep-muted: #6b7280;
  --postep-bg: #f6f7fb;
  --postep-surface: #f8fafc;
  --postep-card: #ffffff;
  --postep-border: rgba(15, 23, 42, 0.14);
  --postep-primary: #0f1a2e;
  --postep-accent: #1e293b;
  --postep-danger: #be123c;
  --postep-success: #166534;
  --postep-plan: #64748b;
  --postep-progress: #2563eb;
  --postep-delay: #be123c;
  --postep-done: #15803d;
}

body.postep-page {
  font-family: 'Manrope', 'Segoe UI', sans-serif;
  color: var(--postep-ink);
  background:
    radial-gradient(1200px 520px at 14% 10%, rgba(15, 26, 46, 0.08), transparent 55%),
    radial-gradient(800px 420px at 88% 6%, rgba(30, 41, 59, 0.08), transparent 60%),
    linear-gradient(180deg, #f6f7fb 0%, #f8fafc 100%);
}

.postep-page .topbar h1 {
  font-family: 'Sora', 'Segoe UI', sans-serif;
  letter-spacing: 0.01em;
}

/* Leaflet controls use high z-index by default; keep nav always above map. */
.postep-page header.topbar {
  z-index: 2500;
}

.postep-page .leaflet-top,
.postep-page .leaflet-bottom {
  z-index: 1200;
}

.postep-main {
  display: grid;
  gap: 18px;
}

.postep-hero {
  position: relative;
  overflow: hidden;
  border-radius: 18px;
  border: 1px solid rgba(15, 23, 42, 0.18);
  background:
    linear-gradient(130deg, rgba(15, 26, 46, 0.98) 0%, rgba(22, 37, 60, 0.95) 52%, rgba(30, 41, 59, 0.9) 100%);
  color: #f8fcff;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 480px);
  gap: 18px;
}

.postep-hero::before,
.postep-hero::after {
  content: '';
  position: absolute;
  border-radius: 999px;
  pointer-events: none;
}

.postep-hero::before {
  width: 360px;
  height: 360px;
  right: -130px;
  top: -180px;
  background: radial-gradient(circle, rgba(71, 85, 105, 0.28), transparent 72%);
}

.postep-hero::after {
  width: 420px;
  height: 420px;
  left: -170px;
  bottom: -230px;
  background: radial-gradient(circle, rgba(148, 163, 184, 0.24), transparent 70%);
}

.hero-kicker {
  margin: 0 0 8px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: rgba(240, 247, 255, 0.75);
}

.postep-hero h2 {
  margin: 0;
  font-family: 'Sora', 'Segoe UI', sans-serif;
  font-size: clamp(25px, 3vw, 38px);
  line-height: 1.14;
}

.hero-lead {
  margin: 14px 0 0;
  color: rgba(242, 248, 255, 0.9);
  max-width: 72ch;
}

.hero-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  align-self: center;
}

.hero-metrics article {
  position: relative;
  z-index: 1;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(3px);
  padding: 14px;
}

.hero-metrics span {
  display: block;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(241, 248, 255, 0.84);
}

.hero-metrics strong {
  display: block;
  margin-top: 6px;
  font-family: 'Sora', 'Segoe UI', sans-serif;
  font-size: 30px;
  line-height: 1;
}

.postep-layout {
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(0, 1.35fr) minmax(360px, 0.9fr);
  grid-template-areas:
    'map controls'
    'detail controls'
    'timeline timeline';
}

.map-card { grid-area: map; }
.control-card { grid-area: controls; }
.detail-card { grid-area: detail; }
.timeline-card { grid-area: timeline; }

.map-card,
.control-card,
.detail-card,
.timeline-card {
  border-radius: 16px;
  border: 1px solid var(--postep-border);
  background: linear-gradient(180deg, #ffffff 0%, var(--postep-surface) 100%);
  box-shadow: 0 8px 20px rgba(16, 24, 40, 0.06);
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.section-head p {
  margin: 0;
  color: var(--postep-muted);
  font-size: 13px;
}

.progress-map {
  height: min(62vh, 520px);
  border-radius: 14px;
  border: 1px solid var(--postep-border);
  overflow: hidden;
  position: relative;
}

.legend {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  color: var(--postep-muted);
  font-size: 13px;
}

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

.dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 999px;
}

.status-plan { background: var(--postep-plan); }
.status-progress { background: var(--postep-progress); }
.status-delay { background: var(--postep-delay); }
.status-done { background: var(--postep-done); }

.filter-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.filter-grid label,
.update-form label,
.new-grid label {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.filter-grid span,
.update-form span,
.new-grid span {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #6b7280;
}

.filter-grid input,
.filter-grid select,
.update-form input,
.update-form select,
.update-form textarea,
.new-grid input,
.new-grid select,
.new-grid textarea {
  min-height: 40px;
  border-radius: 10px;
  border: 1px solid rgba(15, 23, 42, 0.14);
  background: #ffffff;
  padding: 8px 10px;
  font: inherit;
  color: inherit;
}

.update-form textarea,
.new-grid textarea {
  min-height: 94px;
  resize: vertical;
}

.filter-actions {
  display: flex;
  align-items: end;
  gap: 8px;
}

.investor-board {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.investor-chip {
  border: 1px solid rgba(15, 23, 42, 0.14);
  border-radius: 10px;
  background: #f8fafc;
  padding: 9px 10px;
}

.investor-chip-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.investor-chip b {
  display: block;
  font-size: 14px;
  margin-bottom: 4px;
}

.investor-chip small {
  color: #6b7280;
  font-size: 12px;
}

.investment-list {
  margin-top: 12px;
  display: grid;
  gap: 10px;
  max-height: 56vh;
  overflow: auto;
  padding-right: 2px;
}

.investment-group {
  display: grid;
  gap: 8px;
}

.investment-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-radius: 9px;
  background: #f1f5f9;
  border: 1px solid rgba(15, 23, 42, 0.14);
}

.investment-group-head strong {
  font-size: 13px;
}

.investment-group-head span {
  font-size: 12px;
  color: #6b7280;
}

.investor-head-main {
  display: flex;
  align-items: center;
  gap: 8px;
}

.owner-logo {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  object-fit: contain;
  background: #ffffff;
  border: 1px solid rgba(15, 23, 42, 0.14);
  padding: 2px;
}

.owner-logo-lg {
  width: 30px;
  height: 30px;
}

.investment-item {
  border: 1px solid rgba(15, 23, 42, 0.14);
  border-radius: 12px;
  background: #ffffff;
  padding: 12px;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.investment-item:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.09);
}

.investment-item.is-active {
  border-color: rgba(30, 41, 59, 0.55);
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.13);
}

.investment-top {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 8px;
}

.investment-name {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}

.investment-code {
  margin: 3px 0 0;
  font-size: 12px;
  color: #6b7280;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.status-chip {
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border: 1px solid transparent;
}

.status-chip.planowanie {
  background: rgba(106, 122, 143, 0.13);
  color: #39495d;
  border-color: rgba(106, 122, 143, 0.32);
}

.status-chip.w_toku {
  background: rgba(37, 99, 235, 0.14);
  color: #1d4ed8;
  border-color: rgba(37, 99, 235, 0.3);
}

.status-chip.opoznienie {
  background: rgba(198, 67, 58, 0.14);
  color: #7b231d;
  border-color: rgba(198, 67, 58, 0.33);
}

.status-chip.zakonczone {
  background: rgba(47, 138, 87, 0.14);
  color: #165e37;
  border-color: rgba(47, 138, 87, 0.32);
}

.investment-meta {
  margin: 8px 0 4px;
  font-size: 13px;
  color: var(--postep-muted);
}

.address-flag {
  display: inline-flex;
  align-items: center;
  margin: 0 0 4px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  color: #334155;
  background: rgba(148, 163, 184, 0.2);
  border: 1px solid rgba(100, 116, 139, 0.32);
}

.meta-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 12px;
  margin-top: 8px;
  font-size: 12px;
  color: #6b7280;
}

.meta-row span {
  display: block;
}

.progress-track {
  height: 8px;
  border-radius: 999px;
  background: #e2e8f0;
  overflow: hidden;
}

.progress-track > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #1e293b 0%, #334155 55%, #475569 100%);
}

.progress-meta {
  margin: 7px 0 0;
  font-size: 12px;
  color: #6b7280;
}

.pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 700;
  color: #1e293b;
  background: rgba(51, 65, 85, 0.12);
  border: 1px solid rgba(51, 65, 85, 0.22);
}

.hidden {
  display: none !important;
}

.detail-empty {
  border-radius: 12px;
  border: 1px dashed rgba(15, 23, 42, 0.2);
  background: rgba(248, 250, 252, 0.85);
  padding: 18px;
  text-align: center;
  color: #6b7280;
}

.detail-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.detail-top h3 {
  margin: 0;
  font-family: 'Sora', 'Segoe UI', sans-serif;
  font-size: 21px;
}

.muted-line {
  margin: 6px 0 0;
  color: #6b7280;
  font-size: 13px;
}

.detail-owner-brand {
  margin-top: 8px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid rgba(15, 23, 42, 0.14);
  background: rgba(248, 250, 252, 0.95);
  font-size: 12px;
  font-weight: 700;
  color: #334155;
}

.progress-ring {
  --pct: 0%;
  width: 90px;
  height: 90px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at center, #ffffff 57%, transparent 58%),
    conic-gradient(#334155 var(--pct), #e2e8f0 var(--pct));
  border: 1px solid rgba(15, 23, 42, 0.14);
}

.progress-ring span {
  font-weight: 700;
  color: #334155;
}

.detail-grid {
  margin: 14px 0 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 14px;
}

.detail-grid dt {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #6b7280;
}

.detail-grid dd {
  margin: 3px 0 0;
  font-size: 14px;
}

.detail-desc {
  margin: 12px 0;
  padding: 12px;
  border-radius: 10px;
  background: rgba(248, 250, 252, 0.95);
  border: 1px solid rgba(15, 23, 42, 0.14);
}

.detail-table {
  width: 100%;
  border-collapse: collapse;
}

.detail-table th,
.detail-table td {
  border-bottom: 1px solid rgba(15, 23, 42, 0.14);
  text-align: left;
  vertical-align: top;
  padding: 6px 0;
}

.detail-table th {
  width: 38%;
  font-size: 12px;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.address-list {
  margin: 8px 0 0;
  padding-left: 18px;
}

.address-list li {
  margin-bottom: 3px;
}

.update-form {
  margin-top: 6px;
  border-top: 1px solid rgba(15, 23, 42, 0.12);
  padding-top: 12px;
}

.update-form h4 {
  margin: 0 0 8px;
}

.update-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.update-grid .full {
  grid-column: 1 / -1;
}

.inline-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}

.inline-msg {
  min-height: 20px;
  color: #1e293b;
  font-size: 13px;
}

.inline-msg.is-error {
  color: #be123c;
}

.photo-gallery {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
}

.photo-empty {
  border: 1px dashed rgba(15, 23, 42, 0.2);
  border-radius: 10px;
  padding: 10px;
  color: #64748b;
  font-size: 12px;
  background: rgba(248, 250, 252, 0.75);
}

.photo-card {
  display: grid;
  gap: 6px;
  border: 1px solid rgba(15, 23, 42, 0.14);
  border-radius: 10px;
  background: #ffffff;
  padding: 6px;
}

.photo-thumb {
  display: block;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid rgba(15, 23, 42, 0.14);
  background: #f8fafc;
}

.photo-thumb img {
  width: 100%;
  height: 132px;
  object-fit: cover;
  display: block;
}

.photo-meta {
  margin: 0;
  font-size: 11px;
  color: #64748b;
  line-height: 1.35;
}

.timeline-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.timeline-item {
  border-radius: 12px;
  border: 1px solid rgba(15, 23, 42, 0.14);
  background: #ffffff;
  padding: 12px;
}

.timeline-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.timeline-title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
}

.timeline-date {
  color: #6b7280;
  font-size: 12px;
}

.timeline-note {
  margin: 7px 0 0;
  color: #334155;
}

.new-investment {
  border: 1px dashed rgba(15, 23, 42, 0.2);
  border-radius: 12px;
  padding: 12px;
  background: rgba(248, 250, 252, 0.95);
}

.new-investment h3 {
  margin: 0 0 10px;
  font-family: 'Sora', 'Segoe UI', sans-serif;
}

.new-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.new-grid .full {
  grid-column: 1 / -1;
}

.leaflet-popup-content-wrapper {
  border-radius: 12px;
  box-shadow: 0 12px 26px rgba(15, 23, 42, 0.18);
}

.leaflet-popup-content {
  margin: 10px 12px;
  font-family: 'Manrope', 'Segoe UI', sans-serif;
}

.map-popup-title {
  margin: 0;
  font-weight: 700;
  font-size: 14px;
}

.map-popup-meta {
  margin: 6px 0 0;
  font-size: 12px;
  color: #6b7280;
}

@media (max-width: 1240px) {
  .postep-layout {
    grid-template-columns: 1fr;
    grid-template-areas:
      'map'
      'controls'
      'detail'
      'timeline';
  }

  .postep-hero {
    grid-template-columns: 1fr;
  }

  .hero-metrics {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  .hero-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .filter-grid,
  .update-grid,
  .new-grid,
  .detail-grid {
    grid-template-columns: 1fr;
  }

  .meta-row {
    grid-template-columns: 1fr;
  }

  .progress-map {
    height: 52vh;
    min-height: 340px;
  }

  .section-head {
    flex-direction: column;
    align-items: flex-start;
  }
}
