/* Shared spatial UI design system */

.spatial-mode {
  background: #f6f8fb;
  overflow-x: hidden;
}

.spatial-mode .primary-btn {
  background: #0f172a;
  color: #fff;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 14px 32px;
  font-weight: 700;
  font-size: 16px;
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.18);
}

.spatial-mode .primary-btn:hover {
  background: #1e293b;
}

.spatial-mode .primary-btn.spatial-start-btn {
  cursor: pointer;
  transition: all 0.15s ease;
}

.spatial-mode .primary-btn.spatial-start-btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.03);
}

.spatial-mode .primary-btn.spatial-start-btn:active {
  transform: translateY(0);
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.16);
}

.spatial-mode .primary-btn.spatial-start-btn:disabled,
.spatial-mode .primary-btn.spatial-start-btn[disabled] {
  cursor: not-allowed;
  opacity: 0.6;
  pointer-events: none;
}

.sp-step {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px 60px;
}

body.spatial-mode[data-spatial-step="sp-postcode"] .hero.hero-section,
body.spatial-mode[data-spatial-step="sp-map"] .hero.hero-section,
body.spatial-mode[data-spatial-step="sp-analysis"] .hero.hero-section,
body.spatial-mode[data-spatial-step="sp-report"] .hero.hero-section {
  display: none;
}

.sp-step-inner {
  background: #fff;
  border-radius: 20px;
  padding: 40px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.05);
}

.sp-step--active-flow {
  padding-top: 24px;
  padding-bottom: 48px;
}

.sp-step--active-flow .sp-step-inner {
  padding: 40px 28px 24px;
}

.sp-step--postcode {
  max-width: 960px;
}

.sp-postcode-shell {
  max-width: 720px;
  margin: 0 auto;
}

.sp-postcode-header {
  margin-bottom: 18px;
}

.spatial-workflow-bar {
  max-width: 720px;
  margin: 0 auto 18px;
}

.spatial-workflow-bar .sp-flow-stages {
  margin: 0;
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 6px;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  font-size: 13px;
  line-height: 1.5;
  color: #64748b;
}

.spatial-workflow-bar .sp-flow-stages::-webkit-scrollbar {
  display: none;
}

.spatial-workflow-bar .sp-flow-stages__stage {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 0;
  white-space: nowrap;
  color: #94a3b8;
}

.spatial-workflow-bar .sp-flow-stages__stage--completed {
  color: #475569;
  font-weight: 600;
}

.spatial-workflow-bar .sp-flow-stages__stage--active {
  padding: 5px 10px;
  border-radius: 999px;
  background: #e8eef8;
  color: #0f2746;
  font-weight: 700;
}

.spatial-workflow-bar .sp-flow-stages__stage--future {
  color: #94a3b8;
}

.spatial-workflow-bar .sp-flow-stages__arrow {
  flex: 0 0 auto;
  white-space: nowrap;
  color: #cbd5e1;
}

.sp-postcode-card {
  padding: 20px;
  border-radius: 18px;
  border: 1px solid #e2e8f0;
  background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.04);
}

.sp-step--postcode .sp-postcode-field {
  margin-bottom: 0;
}

.sp-step--postcode .sp-label {
  margin-bottom: 8px;
  font-size: 14px;
  font-weight: 700;
  color: #334155;
}

.sp-step--postcode .sp-input,
.sp-step--postcode .sp-select {
  max-width: 100%;
  width: 100%;
  min-height: 48px;
  border-radius: 12px;
  border-color: #cbd5e1;
  box-sizing: border-box;
}

.sp-step--postcode .sp-input:focus,
.sp-step--postcode .sp-select:focus {
  outline: 3px solid rgba(37, 99, 235, 0.14);
  outline-offset: 2px;
  border-color: #94a3b8;
}

.sp-step--postcode .postcode-helper-text {
  margin: 12px 0 0;
  font-size: 13px;
  line-height: 1.55;
  color: #64748b;
}

.sp-postcode-address-helper {
  margin: 0 0 8px;
  font-size: 13px;
  line-height: 1.5;
  color: #475569;
  font-weight: 600;
}

.sp-step--postcode .address-selector {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid #eef2f7;
}

.sp-step--postcode .sp-select {
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.sp-step--postcode .sp-select:hover {
  border-color: #94a3b8;
  background: #fbfdff;
}

.sp-step--postcode .postcode-notice {
  margin-top: 14px;
  font-size: 13px;
  line-height: 1.5;
}

.sp-step--postcode .postcode-notice[data-status-kind="postcode-fallback"] {
  margin-top: 16px;
  padding-top: 2px;
}

.sp-step--postcode .postcode-fallback .postcode-fallback-copy {
  margin-bottom: 14px;
  color: #475569;
}

@media (max-width: 768px) {
  .sp-step--postcode .postcode-fallback .postcode-fallback-copy {
    margin-bottom: 16px;
  }
}

.spatial-mode .pd-postcode-confirm-btn {
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}

.spatial-mode .pd-postcode-confirm-btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.03);
}

.spatial-mode .pd-postcode-confirm-btn:active {
  transform: translateY(0);
}

.spatial-mode .pd-postcode-confirm-btn:disabled,
.spatial-mode .pd-postcode-confirm-btn[disabled] {
  cursor: not-allowed;
  opacity: 0.6;
  pointer-events: none;
}

.sp-step--postcode .pd-button-secondary {
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.sp-step--postcode .pd-button-secondary:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
}

.sp-step--postcode .pd-button-secondary:active {
  transform: translateY(0);
}

.sp-step--postcode .pd-button-secondary:disabled,
.sp-step--postcode .pd-button-secondary[disabled] {
  cursor: not-allowed;
  opacity: 0.6;
  pointer-events: none;
}

.sp-step--postcode #address-list {
  cursor: pointer;
}

.sp-map-container,
.sp-map-container canvas {
  cursor: grab;
}

.sp-map-container:active,
.sp-map-container:active canvas {
  cursor: grabbing;
}

.sp-report-header {
  margin-bottom: 32px;
}

.sp-report-complete-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #ecfdf5;
  color: #065f46;
  font-size: 13px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 100px;
  margin-bottom: 16px;
}

.sp-report-title {
  font-size: 24px;
  font-weight: 700;
  color: #111827;
  margin-bottom: 4px;
}

.sp-report-address {
  font-size: 14px;
  color: #6b7280;
}

.sp-constraints-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.sp-constraint-card {
  border-radius: 14px;
  padding: 20px;
  border: 1px solid #e5e7eb;
}

.sp-constraint-card--detected {
  border-color: #fcd34d;
  background: #fffbeb;
}

.sp-constraint-card--clear {
  background: #f9fafb;
}

.sp-constraint-card--unavailable {
  background: #f9fafb;
  opacity: 0.6;
}

.sp-constraint-card__header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.sp-constraint-card__name {
  font-size: 15px;
  font-weight: 600;
  color: #111827;
}

.sp-constraint-card__status {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.sp-constraint-card--detected .sp-constraint-card__status { color: #b45309; }
.sp-constraint-card--clear .sp-constraint-card__status { color: #6b7280; }
.sp-constraint-card--unavailable .sp-constraint-card__status { color: #9ca3af; }

.sp-constraint-card__meta {
  font-size: 13px;
  color: #6b7280;
  line-height: 1.5;
}

.sp-report-context {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 32px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 14px 18px;
  margin-bottom: 24px;
}

.sp-report-context:empty {
  display: none;
}

.sp-context-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sp-context-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: #94a3b8;
}

.sp-context-value {
  font-size: 13px;
  font-weight: 500;
  color: #1e293b;
}

.sp-meta-row {
  font-size: 13px;
  color: #475569;
  margin-top: 5px;
  line-height: 1.5;
}

.sp-meta-row strong {
  color: #1e293b;
  font-weight: 600;
}

.sp-meta-block {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid #f1f5f9;
}

.sp-meta-source {
  font-size: 11px;
  color: #94a3b8;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid #f1f5f9;
  letter-spacing: 0.01em;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid transparent;
  margin-right: 8px;
  margin-bottom: 8px;
}

.status-pill--green { background: #ecfdf5; border-color: #bbf7d0; color: #065f46; }
.status-pill--amber { background: #fffbeb; border-color: #fde68a; color: #92400e; }
.status-pill--red { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.status-pill--blue { background: #eff6ff; border-color: #bfdbfe; color: #1d4ed8; }
.status-pill--grey { background: #f3f4f6; border-color: #e5e7eb; color: #374151; }

.sp-secondary-btn {
  background: #fff;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 500;
  color: #374151;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

.sp-secondary-btn:hover {
  background: #f9fafb;
}

.sp-next-actions {
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: flex-start;
}

.sp-next-actions-label {
  font-size: 12px;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 0;
}

.report-section.is-collapsed .report-section-body {
  display: none;
}

.text-muted {
  color: #6b7280;
}

@media (max-width: 768px) {
  .sp-step {
    padding: 0 16px 40px;
  }

  .sp-step-inner {
    padding: 22px 16px;
    border-radius: 16px;
  }

  .sp-step--postcode {
    padding-bottom: 36px;
  }

  .sp-step--active-flow .sp-step-inner {
    padding: 22px 16px 18px;
  }

  .sp-postcode-card {
    padding: 18px;
    border-radius: 16px;
  }

  .spatial-workflow-bar {
    margin-bottom: 14px;
  }

  .spatial-workflow-bar .sp-flow-stages {
    font-size: 12px;
  }

  .sp-report-header {
    margin-bottom: 24px;
  }

  .sp-report-context {
    gap: 10px 14px;
    padding: 12px 14px;
  }

  .sp-context-row {
    min-width: min(100%, 220px);
  }

  .sp-constraints-grid {
    grid-template-columns: 1fr;
    gap: 12px;
    margin-bottom: 24px;
  }

  .sp-constraint-card {
    padding: 16px;
  }

  .sp-next-actions {
    align-items: stretch;
  }

  .spatial-mode .primary-btn,
  .sp-secondary-btn {
    width: 100%;
    min-height: 44px;
    justify-content: center;
    white-space: normal;
    text-align: center;
  }
}

@media (max-width: 480px) {
  .sp-step {
    padding: 0 12px 32px;
  }

  .sp-step-inner {
    padding: 18px 14px;
  }

  .sp-step--active-flow .sp-step-inner {
    padding: 18px 14px;
  }

  .sp-postcode-card {
    padding: 16px 14px;
  }

  .spatial-workflow-bar {
    margin-bottom: 12px;
  }

  .sp-step--postcode .postcode-helper-text,
  .sp-postcode-address-helper {
    font-size: 12px;
  }

  .sp-report-title {
    font-size: 1.35rem;
    line-height: 1.2;
  }

  .sp-report-context,
  .sp-constraint-card {
    border-radius: 12px;
  }
}

/* ─── Planning history prototype (static sample — no live data) ─── */
.ph-planning-spatial-mount {
  margin: 16px 0 8px;
}

.ph-planning-prototype {
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  background: #fafbfc;
  box-shadow: none;
}

.ph-planning-prototype__head {
  padding: 14px 18px 0;
  border-bottom: none;
}

.ph-planning-prototype__body {
  padding: 0 18px 16px;
}

.ph-proto-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #475569;
  background: #e2e8f0;
  vertical-align: middle;
}

.ph-proto-lead {
  margin: 0 0 8px;
  font-size: 0.9rem;
  font-weight: 600;
  color: #334155;
}

.ph-proto-muted,
.text-muted.ph-proto-muted {
  color: #64748b;
  font-size: 0.88rem;
  line-height: 1.5;
}

.ph-proto-banner {
  margin: 0 0 10px;
  padding: 8px 10px;
  border-radius: 8px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
}

.ph-proto-compact {
  margin: 0;
  padding-left: 18px;
  color: #374151;
  line-height: 1.55;
  font-size: 0.9rem;
}

.ph-proto-visual {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 12px 0 4px;
}

.ph-proto-visual--signals {
  align-items: center;
}

.ph-proto-stat {
  flex: 1 1 72px;
  min-width: 72px;
  padding: 10px 8px;
  border-radius: 10px;
  border: 1px solid #e5e7eb;
  background: #fff;
  text-align: center;
}

.ph-proto-stat-n {
  display: block;
  font-size: 1.25rem;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.1;
}

.ph-proto-stat-l {
  display: block;
  margin-top: 4px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #64748b;
}

.ph-proto-pill {
  display: inline-flex;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  color: #475569;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
}

.ph-proto-spatial-visual {
  margin-top: 8px;
}

.ph-planning-prototype__details {
  padding-top: 4px;
}

.ph-proto-section {
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid #eef2f7;
}

.ph-proto-section:last-of-type {
  border-bottom: none;
}

.ph-proto-h4 {
  margin: 0 0 6px;
  font-size: 0.95rem;
  font-weight: 700;
  color: #111827;
}

.ph-proto-count {
  font-weight: 600;
  color: #64748b;
}

.ph-proto-sub {
  margin: 0 0 8px;
  font-size: 0.82rem;
}

.ph-proto-bullets {
  margin: 0 0 10px;
  padding-left: 18px;
  color: #475569;
  font-size: 0.85rem;
  line-height: 1.45;
}

.ph-proto-record-list {
  margin: 0;
  padding-left: 0;
  list-style: none;
}

.ph-proto-rec {
  margin-bottom: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid #eef2f7;
  background: #fff;
  font-size: 0.84rem;
  line-height: 1.45;
  color: #334155;
}

.ph-proto-ref {
  font-weight: 700;
  color: #0f172a;
}

.ph-proto-pc {
  color: #64748b;
}

.ph-proto-meta {
  display: block;
  margin-top: 4px;
  font-size: 0.78rem;
  color: #64748b;
}

.ph-proto-caveat {
  margin: 12px 0 0;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px dashed #cbd5e1;
  background: #f8fafc;
  font-size: 0.82rem;
  color: #475569;
  line-height: 1.45;
}

.ph-proto-foot {
  margin: 10px 0 0;
  font-size: 0.8rem;
}

@media print {
  .ph-planning-prototype,
  .ph-proto-section {
    break-inside: avoid;
  }
}

