/* assets/css/layout-planner.css */

.layout-hero {
  background:
    radial-gradient(1200px 600px at 15% -10%, rgba(255,255,255,.35), rgba(255,255,255,0)),
    linear-gradient(90deg, #0ea5e9, #1197d8);
  color: #fff;
}

.layout-shell {
  background: #f8fafc;
  min-height: calc(100vh - 180px);
}

.layout-sidebar,
.layout-properties {
  background: #ffffff;
  height: calc(100vh - 170px);
  overflow-y: auto;
}

.layout-map-panel {
  background: #eef6ff;
  height: calc(100vh - 170px);
  display: flex;
  flex-direction: column;
}

.layout-map-toolbar {
  background: #ffffff;
  z-index: 2;
}

#layoutMap {
  flex: 1;
  min-height: 620px;
  width: 100%;
  background: #dbeafe;
}

.layout-statusbar {
  min-height: 34px;
  padding: 0.45rem 0.75rem;
  background: #ffffff;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.tool-btn.active {
  background: #0ea5e9;
  color: #ffffff;
  border-color: #0ea5e9;
}

.layer-list {
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  padding: 0.75rem;
}

.schedule-table-wrap {
  max-height: 260px;
  overflow-y: auto;
}

#validationPanel .validation-item {
  border-left: 4px solid #e5e7eb;
  background: #f8fafc;
  border-radius: 0.35rem;
  padding: 0.55rem 0.65rem;
  margin-bottom: 0.5rem;
}

#validationPanel .validation-item.warning {
  border-left-color: #f59e0b;
  background: #fffbeb;
}

#validationPanel .validation-item.success {
  border-left-color: #16a34a;
  background: #f0fdf4;
}

#validationPanel .validation-item.danger {
  border-left-color: #dc2626;
  background: #fef2f2;
}

.layout-label {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(15, 23, 42, 0.15);
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 700;
  color: #0f172a;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.12);
}

.ad-slot {
  background: #f8fafc;
  min-height: 80px;
}

.leaflet-popup-content {
  font-size: 0.85rem;
}

@media (max-width: 991.98px) {
  .layout-sidebar,
  .layout-properties,
  .layout-map-panel {
    height: auto;
  }

  #layoutMap {
    min-height: 520px;
  }

  .layout-statusbar {
    flex-wrap: wrap;
  }
}

.layout-title-block-wrap {
  background: transparent;
  border: none;
}

.layout-title-block {
  background: rgba(255, 255, 255, 0.95);
  border: 2px solid #0f172a;
  padding: 10px 14px;
  min-width: 220px;
  font-size: 12px;
  color: #0f172a;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.25);
}

.leaflet-div-icon.layout-label {
  border: none;
  background: transparent;
}

#btnSnapMode.active,
#btnMeasure.active {
  background: #0ea5e9;
  color: #fff;
  border-color: #0ea5e9;
}

.north-arrow-control {
  background: rgba(255,255,255,.95);
  border: 1px solid rgba(15,23,42,.15);
  border-radius: 10px;
  padding: 6px 10px;
  box-shadow: 0 4px 14px rgba(15,23,42,.15);
}

.north-arrow {
  text-align: center;
  font-weight: 800;
  color: #0f172a;
  line-height: 1;
}

.north-arrow-symbol {
  font-size: 22px;
}

.north-arrow-label {
  font-size: 12px;
  margin-top: 2px;
}
/* Version 5.1 / 6 refinements */
.automation-panel .card-body { max-height: 520px; overflow-y: auto; }
.generation-budget .d-flex { padding: .15rem 0; border-bottom: 1px dashed rgba(15,23,42,.08); }
.generation-budget .d-flex:last-child { border-bottom: 0; }
.layout-sidebar h2 { letter-spacing: .04em; }
.tool-btn.active,
#btnMeasure.active,
#btnSnapMode.active { background: #0ea5e9; border-color: #0ea5e9; color: #fff; }
.layout-map-panel .leaflet-container { font-family: inherit; }
.layout-title-block-wrap { background: transparent; border: 0; }
.layout-title-block { background: rgba(255,255,255,.96); border: 2px solid #0f172a; min-width: 220px; padding: 10px 12px; font-size: 12px; color: #0f172a; box-shadow: 0 4px 16px rgba(15,23,42,.2); }
.north-arrow-control { background: rgba(255,255,255,.95); border: 1px solid rgba(15,23,42,.18); border-radius: 8px; padding: 6px 9px; box-shadow: 0 4px 14px rgba(15,23,42,.16); }
.north-arrow { text-align: center; line-height: 1; font-weight: 800; color: #0f172a; }
.north-arrow-symbol { font-size: 22px; }
.north-arrow-label { font-size: 12px; margin-top: 2px; }
@media (max-width: 1199.98px) { .automation-panel .card-body { max-height: none; } }

/* Township Generator runtime feedback */
.automation-panel button { pointer-events: auto; position: relative; z-index: 1; }
.automation-panel .generator-action-active { opacity: .78; cursor: progress; }
#generatorRuntimeStatus { max-width: 160px; overflow: hidden; text-overflow: ellipsis; }
html[data-layout-planner-ready="true"] .automation-panel { border-color: rgba(14,165,233,.35); }

/* ==========================================================
   Version 6.2 Generated Township Layer Manager
========================================================== */

.generated-layer-manager {
  border: 1px solid #e2e8f0;
  border-radius: 0.65rem;
  overflow: hidden;
  background: #ffffff;
}

.generated-layer-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.7rem 0.75rem;
  background: linear-gradient(180deg, #f8fafc, #f1f5f9);
  border-bottom: 1px solid #e2e8f0;
}

.generated-layer-list {
  display: flex;
  flex-direction: column;
}

.generated-layer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.65rem 0.7rem;
  border-bottom: 1px solid #eef2f7;
  transition: background-color 0.15s ease;
}

.generated-layer-row:last-child {
  border-bottom: 0;
}

.generated-layer-row:hover {
  background: #f8fafc;
}

.generated-layer-row.is-empty {
  opacity: 0.58;
}

.generated-layer-main {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-width: 0;
  flex: 1;
}

.generated-layer-switch {
  flex: 0 0 auto;
  min-height: auto;
  padding-left: 2.15rem;
}

.generated-layer-switch .form-check-input {
  margin-top: 0;
}

.generated-toggle-indeterminate {
  opacity: 0.7;
}

.generated-layer-swatch {
  width: 0.7rem;
  height: 1.85rem;
  flex: 0 0 0.7rem;
  border-radius: 999px;
  background: var(--generated-layer-color, #64748b);
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.12);
}

.generated-layer-copy {
  min-width: 0;
  flex: 1;
}

.generated-layer-title {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
  font-weight: 600;
  color: #0f172a;
  line-height: 1.2;
}

.generated-layer-title > span:not(.badge) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.generated-layer-title .badge {
  font-size: 0.68rem;
  font-weight: 700;
}

.generated-layer-metric {
  margin-top: 0.15rem;
  color: #64748b;
  font-size: 0.74rem;
  line-height: 1.2;
}

.generated-layer-actions {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  flex: 0 0 auto;
}

.generated-layer-actions .btn {
  width: 2rem;
  height: 2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.generated-layer-empty {
  padding: 0.75rem;
  border-top: 1px dashed #e2e8f0;
  background: #f8fafc;
}

@media (max-width: 575.98px) {
  .generated-layer-row {
    align-items: flex-start;
  }

  .generated-layer-actions {
    flex-direction: column;
  }
}

/* ==========================================================
   Version 6.3 Generator Quality Dashboard
========================================================== */

.generator-quality-dashboard {
  border: 1px solid #e2e8f0;
  border-radius: 0.7rem;
  background: #ffffff;
  overflow: hidden;
}

.quality-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  padding: 0.7rem;
  border-bottom: 1px solid #e2e8f0;
  background: #f8fafc;
}

.quality-empty {
  padding: 1.15rem 0.9rem;
  text-align: center;
}

.quality-empty-icon {
  width: 2.8rem;
  height: 2.8rem;
  margin: 0 auto 0.55rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #e0f2fe;
  color: #0284c7;
  font-size: 1.3rem;
}

.quality-running {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem;
  background: #f8fafc;
}

.quality-overall {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin: 0.7rem;
  padding: 0.7rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.6rem;
}

.quality-overall-success {
  background: #f0fdf4;
  border-color: #bbf7d0;
}

.quality-overall-warning {
  background: #fffbeb;
  border-color: #fde68a;
}

.quality-overall-danger {
  background: #fef2f2;
  border-color: #fecaca;
}

.quality-overall-icon {
  width: 2rem;
  height: 2rem;
  flex: 0 0 2rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(255,255,255,.75);
  font-size: 1rem;
}

.quality-overall-success .quality-overall-icon { color: #15803d; }
.quality-overall-warning .quality-overall-icon { color: #b45309; }
.quality-overall-danger .quality-overall-icon { color: #b91c1c; }

.quality-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.45rem;
  padding: 0 0.7rem 0.7rem;
}

.quality-summary-card {
  min-width: 0;
  padding: 0.55rem 0.4rem;
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-areas:
    "icon value"
    "label label";
  align-items: center;
  gap: 0.15rem 0.35rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.55rem;
  background: #ffffff;
  color: #0f172a;
  text-align: left;
}

.quality-summary-card i { grid-area: icon; }
.quality-summary-value {
  grid-area: value;
  font-size: 1.05rem;
  font-weight: 800;
  line-height: 1;
}
.quality-summary-label {
  grid-area: label;
  font-size: 0.7rem;
  color: #64748b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.quality-summary-danger { border-color: #fecaca; color: #b91c1c; }
.quality-summary-warning { border-color: #fde68a; color: #b45309; }
.quality-summary-success { border-color: #bbf7d0; color: #15803d; }

.quality-check-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.4rem;
  padding: 0 0.7rem 0.7rem;
}

.quality-check-card {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  padding: 0.55rem 0.6rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.55rem;
  background: #ffffff;
  color: #0f172a;
  text-align: left;
}

.quality-check-card:hover { background: #f8fafc; }
.quality-check-icon {
  width: 1.75rem;
  height: 1.75rem;
  flex: 0 0 1.75rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #f1f5f9;
}
.quality-check-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.quality-check-title {
  font-size: 0.78rem;
  font-weight: 700;
}
.quality-check-meta {
  font-size: 0.68rem;
  color: #64748b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.quality-check-success .quality-check-icon { color: #15803d; background: #dcfce7; }
.quality-check-warning .quality-check-icon { color: #b45309; background: #fef3c7; }
.quality-check-danger .quality-check-icon { color: #b91c1c; background: #fee2e2; }
.quality-check-secondary .quality-check-icon { color: #64748b; background: #f1f5f9; }

.quality-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0.65rem 0.7rem;
  border-top: 1px solid #e2e8f0;
  border-bottom: 1px solid #e2e8f0;
  background: #f8fafc;
}

.quality-issue-list {
  max-height: 360px;
  overflow-y: auto;
}

.quality-issue {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 0.55rem;
  align-items: start;
  padding: 0.65rem 0.7rem;
  border-bottom: 1px solid #eef2f7;
}

.quality-issue:last-child { border-bottom: 0; }
.quality-issue-danger { background: #fffafa; }
.quality-issue-warning { background: #fffdf7; }

.quality-issue-icon {
  padding-top: 0.1rem;
  color: #64748b;
}
.quality-issue-danger .quality-issue-icon { color: #dc2626; }
.quality-issue-warning .quality-issue-icon { color: #d97706; }

.quality-issue-copy { min-width: 0; }
.quality-issue-check {
  font-size: 0.63rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #64748b;
}
.quality-issue-title {
  margin-top: 0.08rem;
  font-size: 0.76rem;
  font-weight: 700;
  color: #0f172a;
}
.quality-issue-message {
  margin-top: 0.12rem;
  font-size: 0.7rem;
  line-height: 1.35;
  color: #475569;
}
.quality-issue-zoom {
  width: 2rem;
  height: 2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.quality-all-clear {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.85rem;
  color: #166534;
  background: #f0fdf4;
}
.quality-all-clear > i { font-size: 1.2rem; }

.quality-filter-empty {
  padding: 0.85rem;
  text-align: center;
}

.quality-disclaimer {
  display: flex;
  gap: 0.45rem;
  padding: 0.65rem 0.7rem;
  border-top: 1px solid #e2e8f0;
  background: #f8fafc;
  color: #64748b;
  font-size: 0.68rem;
  line-height: 1.35;
}

@media (max-width: 575.98px) {
  .quality-summary-grid { grid-template-columns: 1fr; }
  .quality-summary-card {
    grid-template-columns: auto auto 1fr;
    grid-template-areas: "icon value label";
  }
}

/* ==========================================================
   VERSION 6.4 — TOWNSHIP SCENARIO MANAGER
========================================================== */

.scenario-manager-shell {
  overflow: hidden;
  border: 1px solid #dbe4ef;
  border-radius: 0.7rem;
  background: #ffffff;
  box-shadow: 0 0.2rem 0.8rem rgba(15, 23, 42, 0.05);
}

.scenario-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  min-height: 5rem;
  color: #64748b;
  background: #f8fafc;
}

.scenario-manager-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.7rem;
  padding: 0.75rem;
  border-bottom: 1px solid #e2e8f0;
  background: linear-gradient(135deg, #eff6ff, #f8fafc);
}

.scenario-manager-title {
  font-size: 0.86rem;
  font-weight: 800;
  color: #0f172a;
}

.scenario-manager-subtitle {
  margin-top: 0.1rem;
  font-size: 0.69rem;
  line-height: 1.35;
  color: #64748b;
}

.scenario-slot-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.55rem;
  padding: 0.65rem;
  background: #f8fafc;
}

.scenario-slot {
  padding: 0.65rem;
  border: 1px solid #dbe4ef;
  border-radius: 0.65rem;
  background: #ffffff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.scenario-slot:hover {
  border-color: #93c5fd;
  box-shadow: 0 0.25rem 0.7rem rgba(37, 99, 235, 0.08);
}

.scenario-slot-active {
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.12);
}

.scenario-slot-preferred {
  background: linear-gradient(135deg, #fffdf4, #ffffff);
  border-color: #facc15;
}

.scenario-slot-heading {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
}

.scenario-slot-letter {
  width: 2rem;
  height: 2rem;
  flex: 0 0 2rem;
  display: grid;
  place-items: center;
  border-radius: 0.55rem;
  background: #1d4ed8;
  color: #ffffff;
  font-size: 0.9rem;
  font-weight: 900;
}

.scenario-name-input {
  min-width: 0;
  font-weight: 700;
}

.scenario-slot-status {
  margin-top: 0.18rem;
  font-size: 0.64rem;
  color: #64748b;
}

.scenario-slot-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.35rem;
  margin-top: 0.55rem;
  font-size: 0.68rem;
  color: #475569;
}

.scenario-slot-metrics > span {
  padding: 0.35rem 0.42rem;
  border-radius: 0.45rem;
  background: #f8fafc;
}

.scenario-slot-empty {
  margin-top: 0.55rem;
  padding: 0.55rem;
  border: 1px dashed #cbd5e1;
  border-radius: 0.5rem;
  font-size: 0.68rem;
  color: #64748b;
  text-align: center;
}

.scenario-quality-score {
  font-weight: 800;
}

.scenario-score-good {
  color: #166534;
  background: #f0fdf4 !important;
}

.scenario-score-fair {
  color: #92400e;
  background: #fffbeb !important;
}

.scenario-score-poor {
  color: #991b1b;
  background: #fef2f2 !important;
}

.scenario-slot-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto auto;
  gap: 0.35rem;
  margin-top: 0.55rem;
}

.scenario-comparison-wrap {
  border-top: 1px solid #e2e8f0;
}

.scenario-comparison-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem;
  padding: 0.6rem 0.7rem;
  font-size: 0.72rem;
  font-weight: 800;
  color: #0f172a;
  background: #f8fafc;
}

.scenario-comparison-empty {
  padding: 0.8rem;
  border-top: 1px solid #e2e8f0;
  font-size: 0.7rem;
  line-height: 1.4;
  color: #64748b;
  text-align: center;
  background: #f8fafc;
}

.scenario-comparison-table {
  min-width: 460px;
  font-size: 0.66rem;
}

.scenario-comparison-table th,
.scenario-comparison-table td {
  padding: 0.38rem 0.45rem;
  vertical-align: middle;
  white-space: nowrap;
}

.scenario-comparison-table tbody th {
  color: #475569;
  font-weight: 700;
}

.scenario-preferred-column {
  background: #fffbea !important;
}

.scenario-manager-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0.65rem;
  border-top: 1px solid #e2e8f0;
  background: #ffffff;
}

.min-width-0 {
  min-width: 0;
}

@media (min-width: 1600px) {
  .scenario-slot-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .scenario-slot-actions {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 575.98px) {
  .scenario-slot-actions {
    grid-template-columns: 1fr 1fr;
  }

  .scenario-slot-metrics {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================
   VERSION 6.5 — INTELLIGENT SCENARIO RECOMMENDATION
========================================================== */

.recommendation-shell {
  overflow: hidden;
  border: 1px solid #dbe4ef;
  border-radius: 0.75rem;
  background: #ffffff;
  box-shadow: 0 0.2rem 0.8rem rgba(15, 23, 42, 0.05);
}

.recommendation-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.78rem;
  border-bottom: 1px solid #e2e8f0;
  background: linear-gradient(135deg, #ecfeff, #eff6ff 60%, #f8fafc);
}

.recommendation-title {
  color: #0f172a;
  font-size: 0.86rem;
  font-weight: 850;
}

.recommendation-subtitle {
  margin-top: 0.12rem;
  color: #64748b;
  font-size: 0.68rem;
  line-height: 1.4;
}

.recommendation-controls {
  padding: 0.72rem;
  border-bottom: 1px solid #e2e8f0;
  background: #f8fafc;
}

.recommendation-preset-row {
  margin-bottom: 0.55rem;
}

.recommendation-weight-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.42rem;
  padding: 0.35rem 0.48rem;
  border: 1px solid #dbe4ef;
  border-radius: 0.45rem;
  background: #ffffff;
  color: #64748b;
  font-size: 0.66rem;
}

.recommendation-weight-summary strong {
  font-size: 0.8rem;
}

.recommendation-weight-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.42rem;
}

.recommendation-weight-item {
  padding: 0.45rem 0.5rem 0.32rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  background: #ffffff;
}

.recommendation-weight-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  margin-bottom: 0.1rem;
  color: #475569;
  font-size: 0.65rem;
  font-weight: 750;
}

.recommendation-weight-value {
  min-width: 1.7rem;
  padding: 0.08rem 0.3rem;
  border-radius: 999px;
  background: #dbeafe;
  color: #1d4ed8;
  text-align: center;
  font-size: 0.62rem;
  font-weight: 850;
}

.recommendation-range {
  height: 0.75rem;
  margin: 0;
}

.recommendation-action-row,
.recommendation-export-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.6rem;
}

.recommendation-results {
  padding: 0.7rem;
  background: #ffffff;
}

.recommendation-empty {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-height: 5rem;
  padding: 0.8rem;
  border: 1px dashed #cbd5e1;
  border-radius: 0.6rem;
  background: #f8fafc;
  color: #64748b;
}

.recommendation-empty > i {
  color: #2563eb;
  font-size: 1.35rem;
}

.recommendation-empty strong,
.recommendation-empty span {
  display: block;
}

.recommendation-empty strong {
  margin-bottom: 0.12rem;
  color: #0f172a;
  font-size: 0.76rem;
}

.recommendation-empty span {
  font-size: 0.68rem;
  line-height: 1.4;
}

.recommendation-winner {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.55rem;
  padding: 0.7rem;
  border: 1px solid #a7f3d0;
  border-radius: 0.65rem;
  background: linear-gradient(135deg, #ecfdf5, #ffffff);
}

.recommendation-winner.confidence-moderate {
  border-color: #fde68a;
  background: linear-gradient(135deg, #fffbeb, #ffffff);
}

.recommendation-winner.confidence-low {
  border-color: #bfdbfe;
  background: linear-gradient(135deg, #eff6ff, #ffffff);
}

.recommendation-winner-rank {
  width: 2rem;
  height: 2rem;
  flex: 0 0 2rem;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: #047857;
  color: #ffffff;
  font-size: 0.86rem;
  font-weight: 900;
}

.confidence-moderate .recommendation-winner-rank {
  background: #b45309;
}

.confidence-low .recommendation-winner-rank {
  background: #2563eb;
}

.recommendation-winner-label {
  color: #64748b;
  font-size: 0.6rem;
  font-weight: 750;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.recommendation-winner-name {
  overflow: hidden;
  color: #0f172a;
  font-size: 0.9rem;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recommendation-winner-meta {
  margin-top: 0.12rem;
  color: #64748b;
  font-size: 0.62rem;
  line-height: 1.35;
}

.recommendation-total-score {
  min-width: 4.25rem;
  text-align: right;
}

.recommendation-total-score strong {
  color: #0f172a;
  font-size: 1.2rem;
  font-weight: 900;
}

.recommendation-total-score span {
  color: #64748b;
  font-size: 0.62rem;
}

.recommendation-preferred-action,
.recommendation-confidence-note {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.55rem;
  margin-bottom: 0.55rem;
  padding: 0.5rem 0.58rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  background: #f8fafc;
  color: #475569;
  font-size: 0.66rem;
  line-height: 1.35;
}

.recommendation-confidence-note {
  justify-content: flex-start;
  background: #eff6ff;
  color: #1e3a8a;
}

.recommendation-rationale-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
  margin-bottom: 0.6rem;
}

.recommendation-rationale-card {
  padding: 0.56rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.55rem;
  background: #ffffff;
}

.recommendation-rationale-title {
  margin-bottom: 0.3rem;
  font-size: 0.68rem;
  font-weight: 850;
}

.recommendation-rationale-card ul {
  margin: 0;
  padding-left: 1rem;
  color: #475569;
  font-size: 0.64rem;
  line-height: 1.45;
}

.recommendation-table-wrap {
  overflow: hidden;
  margin-bottom: 0.6rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.55rem;
}

.recommendation-ranking-table {
  min-width: 560px;
  font-size: 0.65rem;
}

.recommendation-ranking-table th,
.recommendation-ranking-table td {
  padding: 0.4rem 0.45rem;
  vertical-align: middle;
  white-space: nowrap;
}

.recommendation-ranking-winner {
  background: #f0fdf4;
}

.recommendation-rank-badge {
  display: inline-grid;
  width: 1.35rem;
  height: 1.35rem;
  place-items: center;
  border-radius: 999px;
  background: #e2e8f0;
  color: #334155;
  font-size: 0.61rem;
  font-weight: 850;
}

.recommendation-ranking-winner .recommendation-rank-badge {
  background: #16a34a;
  color: #ffffff;
}

.recommendation-breakdown {
  padding: 0.6rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.55rem;
  background: #f8fafc;
}

.recommendation-breakdown-title {
  margin-bottom: 0.5rem;
  color: #0f172a;
  font-size: 0.7rem;
  font-weight: 850;
}

.recommendation-breakdown-scenario + .recommendation-breakdown-scenario {
  margin-top: 0.65rem;
  padding-top: 0.65rem;
  border-top: 1px solid #e2e8f0;
}

.recommendation-breakdown-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.32rem;
  color: #334155;
  font-size: 0.67rem;
}

.recommendation-score-row {
  display: grid;
  grid-template-columns: 5rem minmax(4rem, 1fr) 1.8rem;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.24rem;
  color: #64748b;
  font-size: 0.61rem;
}

.recommendation-score-track {
  overflow: hidden;
  height: 0.38rem;
  border-radius: 999px;
  background: #e2e8f0;
}

.recommendation-score-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #2563eb, #14b8a6);
}

.recommendation-score-row strong {
  color: #334155;
  text-align: right;
}

.recommendation-disclaimer {
  display: flex;
  align-items: flex-start;
  gap: 0.45rem;
  padding: 0.65rem 0.7rem;
  border-top: 1px solid #e2e8f0;
  background: #f8fafc;
  color: #64748b;
  font-size: 0.64rem;
  line-height: 1.4;
}

@media (max-width: 575.98px) {
  .recommendation-weight-grid,
  .recommendation-rationale-grid {
    grid-template-columns: 1fr;
  }

  .recommendation-winner {
    align-items: flex-start;
  }

  .recommendation-total-score {
    min-width: 3.4rem;
  }

  .recommendation-preferred-action {
    align-items: stretch;
    flex-direction: column;
  }

  .recommendation-score-row {
    grid-template-columns: 4.5rem minmax(3rem, 1fr) 1.7rem;
  }
}

/* ==========================================================
   VERSION 6.6 — INFRASTRUCTURE ESTIMATOR
========================================================== */

.infrastructure-estimator {
  font-size: 0.72rem;
}

.infrastructure-shell {
  overflow: hidden;
  border: 1px solid #dbe4ee;
  border-radius: 0.7rem;
  background: #ffffff;
  box-shadow: 0 0.35rem 1rem rgba(15, 23, 42, 0.05);
}

.infrastructure-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.65rem;
  padding: 0.75rem;
  border-bottom: 1px solid #dbe4ee;
  background: linear-gradient(135deg, #eff6ff, #f8fafc 58%, #ecfeff);
}

.infrastructure-title {
  color: #0f172a;
  font-size: 0.82rem;
  font-weight: 900;
}

.infrastructure-subtitle {
  margin-top: 0.14rem;
  color: #64748b;
  font-size: 0.64rem;
  line-height: 1.4;
}

.infrastructure-controls,
.infrastructure-results {
  padding: 0.72rem;
}

.infrastructure-controls {
  border-bottom: 1px solid #e2e8f0;
  background: #f8fafc;
}

.infrastructure-preset-note {
  margin-top: 0.38rem;
  color: #64748b;
  font-size: 0.62rem;
  line-height: 1.35;
}

.infrastructure-assumption-group {
  margin-top: 0.55rem;
  border: 1px solid #dbe4ee;
  border-radius: 0.55rem;
  background: #ffffff;
}

.infrastructure-assumption-group > summary {
  padding: 0.52rem 0.58rem;
  color: #334155;
  cursor: pointer;
  font-size: 0.68rem;
  font-weight: 850;
  list-style: none;
}

.infrastructure-assumption-group > summary::-webkit-details-marker {
  display: none;
}

.infrastructure-assumption-group > summary::after {
  float: right;
  color: #94a3b8;
  content: "+";
  font-size: 0.86rem;
  font-weight: 800;
}

.infrastructure-assumption-group[open] > summary::after {
  content: "−";
}

.infrastructure-assumption-group[open] > summary {
  border-bottom: 1px solid #e2e8f0;
}

.infrastructure-field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
  padding: 0.58rem;
}

.infrastructure-field-grid-cost {
  grid-template-columns: 1fr;
}

.infrastructure-field {
  min-width: 0;
}

.infrastructure-field > span {
  display: block;
  margin-bottom: 0.2rem;
  color: #475569;
  font-size: 0.61rem;
  font-weight: 700;
}

.infrastructure-field .input-group-text {
  max-width: 7.2rem;
  overflow: hidden;
  font-size: 0.57rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.infrastructure-check-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.32rem;
  padding: 0 0.58rem 0.58rem;
  color: #475569;
  font-size: 0.62rem;
}

.infrastructure-action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.38rem;
  margin-top: 0.65rem;
}

.infrastructure-empty {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  min-height: 5.5rem;
  padding: 0.85rem;
  border: 1px dashed #cbd5e1;
  border-radius: 0.6rem;
  background: #f8fafc;
  color: #64748b;
}

.infrastructure-empty > i {
  color: #0ea5e9;
  font-size: 1.45rem;
}

.infrastructure-empty strong,
.infrastructure-empty span {
  display: block;
}

.infrastructure-empty strong {
  color: #0f172a;
  font-size: 0.78rem;
}

.infrastructure-empty span {
  margin-top: 0.15rem;
  font-size: 0.64rem;
  line-height: 1.4;
}

.infrastructure-result-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.7rem;
  margin-bottom: 0.65rem;
  padding: 0.65rem;
  border: 1px solid #bae6fd;
  border-radius: 0.62rem;
  background: linear-gradient(135deg, #f0f9ff, #ffffff);
}

.infrastructure-result-heading span,
.infrastructure-result-heading strong {
  display: block;
}

.infrastructure-result-heading span {
  color: #64748b;
  font-size: 0.59rem;
  font-weight: 750;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.infrastructure-result-heading > div:first-child strong {
  overflow: hidden;
  max-width: 13rem;
  margin-top: 0.12rem;
  color: #0f172a;
  font-size: 0.82rem;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.infrastructure-result-total {
  min-width: 6rem;
  text-align: right;
}

.infrastructure-result-total strong {
  margin-top: 0.12rem;
  color: #0369a1;
  font-size: 1.15rem;
  font-weight: 950;
}

.infrastructure-kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.46rem;
  margin-bottom: 0.65rem;
}

.infrastructure-kpi {
  display: flex;
  align-items: center;
  gap: 0.46rem;
  min-width: 0;
  padding: 0.52rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.52rem;
  background: #ffffff;
}

.infrastructure-kpi > i {
  display: grid;
  width: 1.65rem;
  height: 1.65rem;
  flex: 0 0 1.65rem;
  place-items: center;
  border-radius: 0.45rem;
  background: #e0f2fe;
  color: #0369a1;
  font-size: 0.8rem;
}

.infrastructure-kpi strong,
.infrastructure-kpi span {
  display: block;
}

.infrastructure-kpi strong {
  overflow: hidden;
  color: #0f172a;
  font-size: 0.72rem;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.infrastructure-kpi span {
  margin-top: 0.05rem;
  color: #64748b;
  font-size: 0.56rem;
}

.infrastructure-cost-summary {
  overflow: hidden;
  margin-bottom: 0.58rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.55rem;
}

.infrastructure-cost-summary > div {
  display: flex;
  justify-content: space-between;
  gap: 0.7rem;
  padding: 0.37rem 0.5rem;
  background: #ffffff;
  color: #475569;
  font-size: 0.63rem;
}

.infrastructure-cost-summary > div + div {
  border-top: 1px solid #f1f5f9;
}

.infrastructure-cost-summary strong {
  color: #1e293b;
  text-align: right;
}

.infrastructure-cost-summary .infrastructure-cost-total {
  background: #ecfdf5;
  color: #065f46;
  font-size: 0.68rem;
  font-weight: 850;
}

.infrastructure-cost-summary .infrastructure-cost-total strong {
  color: #047857;
}

.infrastructure-unit-cost-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.38rem;
  margin-bottom: 0.62rem;
}

.infrastructure-unit-cost-grid > div {
  min-width: 0;
  padding: 0.48rem;
  border-radius: 0.48rem;
  background: #f1f5f9;
  text-align: center;
}

.infrastructure-unit-cost-grid span,
.infrastructure-unit-cost-grid strong {
  display: block;
}

.infrastructure-unit-cost-grid span {
  color: #64748b;
  font-size: 0.53rem;
  line-height: 1.2;
}

.infrastructure-unit-cost-grid strong {
  overflow: hidden;
  margin-top: 0.16rem;
  color: #0f172a;
  font-size: 0.66rem;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.infrastructure-breakdown {
  overflow: hidden;
  margin-bottom: 0.65rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.55rem;
  background: #ffffff;
}

.infrastructure-breakdown > summary {
  padding: 0.52rem 0.58rem;
  background: #f8fafc;
  color: #334155;
  cursor: pointer;
  font-size: 0.67rem;
  font-weight: 850;
}

.infrastructure-cost-table,
.infrastructure-comparison-table {
  min-width: 620px;
  font-size: 0.61rem;
}

.infrastructure-cost-table th,
.infrastructure-cost-table td,
.infrastructure-comparison-table th,
.infrastructure-comparison-table td {
  padding: 0.38rem 0.42rem;
  vertical-align: middle;
  white-space: nowrap;
}

.infrastructure-comparison {
  overflow: hidden;
  border: 1px solid #dbe4ee;
  border-radius: 0.55rem;
  background: #ffffff;
}

.infrastructure-comparison-title {
  padding: 0.52rem 0.58rem;
  border-bottom: 1px solid #e2e8f0;
  background: #f8fafc;
  color: #0f172a;
  font-size: 0.68rem;
  font-weight: 850;
}

.infrastructure-comparison-lowest {
  background: #f0fdf4;
}

.infrastructure-slot-letter {
  display: inline-grid;
  width: 1.25rem;
  height: 1.25rem;
  margin-right: 0.32rem;
  place-items: center;
  font-size: 0.58rem;
}

.infrastructure-comparison-note {
  padding: 0.48rem 0.58rem;
  border-top: 1px solid #e2e8f0;
  background: #fffbeb;
  color: #92400e;
  font-size: 0.58rem;
  line-height: 1.4;
}

.infrastructure-disclaimer {
  display: flex;
  align-items: flex-start;
  gap: 0.45rem;
  padding: 0.65rem 0.72rem;
  border-top: 1px solid #dbe4ee;
  background: #f8fafc;
  color: #64748b;
  font-size: 0.61rem;
  line-height: 1.42;
}

.infrastructure-disclaimer i {
  margin-top: 0.08rem;
  color: #0284c7;
}

@media (max-width: 575.98px) {
  .infrastructure-field-grid,
  .infrastructure-kpi-grid,
  .infrastructure-unit-cost-grid {
    grid-template-columns: 1fr;
  }

  .infrastructure-result-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .infrastructure-result-total {
    text-align: left;
  }
}

/* ==========================================================
   Version 6.7 — Development Feasibility & Phasing
========================================================== */

.development-feasibility {
  min-width: 0;
}

.feasibility-shell {
  overflow: hidden;
  border: 1px solid #dbe4ee;
  border-radius: 0.65rem;
  background: #ffffff;
}

.feasibility-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.8rem;
  padding: 0.7rem 0.72rem;
  border-bottom: 1px solid #dbe4ee;
  background: linear-gradient(135deg, #f8fafc, #eef2ff);
}

.feasibility-title {
  color: #0f172a;
  font-size: 0.78rem;
  font-weight: 900;
}

.feasibility-subtitle {
  margin-top: 0.12rem;
  color: #64748b;
  font-size: 0.59rem;
  line-height: 1.4;
}

.feasibility-controls {
  padding: 0.7rem;
  border-bottom: 1px solid #e2e8f0;
  background: #ffffff;
}

.feasibility-preset-note {
  margin: 0.45rem 0 0.55rem;
  padding: 0.45rem 0.5rem;
  border-radius: 0.45rem;
  background: #f8fafc;
  color: #64748b;
  font-size: 0.58rem;
  line-height: 1.4;
}

.feasibility-phase-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.45rem;
  margin-bottom: 0.55rem;
}

.feasibility-phase-grid > label,
.feasibility-field {
  min-width: 0;
}

.feasibility-phase-grid > label > span,
.feasibility-field > span {
  display: block;
  margin-bottom: 0.22rem;
  color: #475569;
  font-size: 0.57rem;
  font-weight: 750;
  line-height: 1.25;
}

.feasibility-assumption-group {
  overflow: hidden;
  margin-top: 0.45rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.52rem;
  background: #ffffff;
}

.feasibility-assumption-group > summary {
  padding: 0.5rem 0.55rem;
  background: #f8fafc;
  color: #334155;
  cursor: pointer;
  font-size: 0.64rem;
  font-weight: 850;
}

.feasibility-field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.45rem;
  padding: 0.55rem;
}

.feasibility-action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.6rem;
}

.feasibility-results {
  padding: 0.68rem;
  background: #f8fafc;
}

.feasibility-empty {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.75rem;
  border: 1px dashed #cbd5e1;
  border-radius: 0.55rem;
  background: #ffffff;
  color: #64748b;
}

.feasibility-empty > i {
  color: #4f46e5;
  font-size: 1.15rem;
}

.feasibility-empty strong,
.feasibility-empty span {
  display: block;
}

.feasibility-empty strong {
  color: #334155;
  font-size: 0.67rem;
}

.feasibility-empty span {
  margin-top: 0.1rem;
  font-size: 0.58rem;
  line-height: 1.4;
}

.feasibility-result-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.58rem;
}

.feasibility-result-heading span,
.feasibility-result-heading strong {
  display: block;
}

.feasibility-result-heading span {
  color: #64748b;
  font-size: 0.55rem;
  font-weight: 750;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.feasibility-result-heading > div:first-child strong {
  overflow: hidden;
  max-width: 13rem;
  margin-top: 0.12rem;
  color: #0f172a;
  font-size: 0.8rem;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.feasibility-result-total {
  text-align: right;
}

.feasibility-result-total strong {
  margin-top: 0.12rem;
  color: #4338ca;
  font-size: 1.05rem;
  font-weight: 950;
}

.feasibility-kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.42rem;
  margin-bottom: 0.58rem;
}

.feasibility-kpi {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
  padding: 0.48rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  background: #ffffff;
}

.feasibility-kpi > i {
  display: grid;
  width: 1.6rem;
  height: 1.6rem;
  flex: 0 0 1.6rem;
  place-items: center;
  border-radius: 0.42rem;
  background: #eef2ff;
  color: #4f46e5;
  font-size: 0.76rem;
}

.feasibility-kpi strong,
.feasibility-kpi span {
  display: block;
}

.feasibility-kpi strong {
  overflow: hidden;
  color: #0f172a;
  font-size: 0.69rem;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.feasibility-kpi span {
  margin-top: 0.04rem;
  color: #64748b;
  font-size: 0.54rem;
}

.feasibility-coverage-card {
  margin-bottom: 0.58rem;
  padding: 0.55rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.52rem;
  background: #ffffff;
}

.feasibility-coverage-heading {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
  color: #475569;
  font-size: 0.62rem;
}

.feasibility-coverage-heading strong {
  color: #0f172a;
}

.feasibility-coverage-card .progress {
  height: 0.45rem;
}

.feasibility-status-message {
  margin-top: 0.35rem;
  color: #64748b;
  font-size: 0.56rem;
  line-height: 1.35;
}

.feasibility-cost-summary {
  overflow: hidden;
  margin-bottom: 0.58rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.52rem;
}

.feasibility-cost-summary > div {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.36rem 0.48rem;
  background: #ffffff;
  color: #475569;
  font-size: 0.61rem;
}

.feasibility-cost-summary > div + div {
  border-top: 1px solid #f1f5f9;
}

.feasibility-cost-summary strong {
  color: #1e293b;
  text-align: right;
}

.feasibility-cost-summary .feasibility-cost-total {
  background: #eef2ff;
  color: #3730a3;
  font-weight: 850;
}

.feasibility-cost-summary .feasibility-cost-total strong {
  color: #4338ca;
}

.feasibility-phase-wrap,
.feasibility-comparison {
  overflow: hidden;
  margin-bottom: 0.6rem;
  border: 1px solid #dbe4ee;
  border-radius: 0.52rem;
  background: #ffffff;
}

.feasibility-section-title {
  padding: 0.5rem 0.55rem;
  border-bottom: 1px solid #e2e8f0;
  background: #f8fafc;
  color: #0f172a;
  font-size: 0.66rem;
  font-weight: 850;
}

.feasibility-phase-table,
.feasibility-comparison-table {
  min-width: 760px;
  font-size: 0.58rem;
}

.feasibility-phase-table th,
.feasibility-phase-table td,
.feasibility-comparison-table th,
.feasibility-comparison-table td {
  padding: 0.35rem 0.4rem;
  vertical-align: middle;
  white-space: nowrap;
}

.feasibility-phase-table td:first-child .text-muted {
  margin-top: 0.08rem;
  font-size: 0.5rem;
}

.feasibility-comparison-best {
  background: #f0fdf4;
}

.feasibility-slot-letter {
  display: inline-grid;
  width: 1.18rem;
  height: 1.18rem;
  margin-right: 0.3rem;
  place-items: center;
  font-size: 0.55rem;
}

.feasibility-comparison-note,
.feasibility-comparison-empty {
  padding: 0.48rem 0.55rem;
  color: #64748b;
  font-size: 0.56rem;
  line-height: 1.4;
}

.feasibility-comparison-note {
  border-top: 1px solid #e2e8f0;
  background: #fffbeb;
  color: #92400e;
}

.feasibility-comparison-empty {
  border: 1px dashed #cbd5e1;
  border-radius: 0.5rem;
  background: #ffffff;
}

.feasibility-disclaimer {
  display: flex;
  align-items: flex-start;
  gap: 0.45rem;
  padding: 0.65rem 0.7rem;
  border-top: 1px solid #dbe4ee;
  background: #f8fafc;
  color: #64748b;
  font-size: 0.59rem;
  line-height: 1.42;
}

.feasibility-disclaimer i {
  margin-top: 0.08rem;
  color: #4f46e5;
}

@media (max-width: 575.98px) {
  .feasibility-phase-grid,
  .feasibility-field-grid,
  .feasibility-kpi-grid {
    grid-template-columns: 1fr;
  }

  .feasibility-result-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .feasibility-result-total {
    text-align: left;
  }
}

/* ==========================================================
   VERSION 6.8 — SPATIAL DEVELOPMENT PHASING
========================================================== */

.spatial-phasing {
  --spatial-border: #dbe4ee;
  --spatial-soft: #f8fafc;
  --spatial-text: #0f172a;
  --spatial-muted: #64748b;
}

.spatial-phase-shell {
  overflow: hidden;
  border: 1px solid var(--spatial-border);
  border-radius: 0.65rem;
  background: #ffffff;
}

.spatial-phase-intro {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.65rem;
  padding: 0.62rem 0.68rem;
  border-bottom: 1px solid var(--spatial-border);
  background: linear-gradient(135deg, #eff6ff 0%, #f8fafc 70%);
}

.spatial-phase-intro strong,
.spatial-phase-intro span {
  display: block;
}

.spatial-phase-intro strong {
  color: var(--spatial-text);
  font-size: 0.72rem;
  font-weight: 900;
}

.spatial-phase-intro > div > span {
  margin-top: 0.08rem;
  color: var(--spatial-muted);
  font-size: 0.56rem;
  line-height: 1.35;
}

.spatial-phase-intro > .badge {
  flex: 0 0 auto;
  font-size: 0.53rem;
}

.spatial-message {
  margin: 0.55rem 0.6rem 0;
  padding: 0.45rem 0.55rem;
  font-size: 0.57rem;
  line-height: 1.35;
}

.spatial-origin-card,
.spatial-manual-card,
.spatial-validation-card,
.spatial-export-card {
  margin: 0.58rem;
  padding: 0.58rem;
  border: 1px solid var(--spatial-border);
  border-radius: 0.55rem;
  background: #ffffff;
}

.spatial-origin-card {
  background: #f8fafc;
}

.spatial-origin-status {
  display: flex;
  align-items: flex-start;
  gap: 0.48rem;
}

.spatial-origin-status > i {
  display: grid;
  width: 1.65rem;
  height: 1.65rem;
  flex: 0 0 1.65rem;
  place-items: center;
  border-radius: 50%;
  background: #dbeafe;
  color: #2563eb;
  font-size: 0.75rem;
}

.spatial-origin-status strong,
.spatial-origin-status span,
.spatial-manual-card strong,
.spatial-manual-card span {
  display: block;
}

.spatial-origin-status strong,
.spatial-manual-card strong {
  color: var(--spatial-text);
  font-size: 0.64rem;
  font-weight: 850;
}

.spatial-origin-status span,
.spatial-manual-card span {
  margin-top: 0.08rem;
  color: var(--spatial-muted);
  font-size: 0.54rem;
  line-height: 1.35;
}

.spatial-control-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.48rem;
  padding: 0 0.58rem;
}

.spatial-control-grid label,
.spatial-feasibility-link {
  min-width: 0;
}

.spatial-control-grid label > span,
.spatial-feasibility-link > span {
  display: block;
  margin-bottom: 0.2rem;
  color: #475569;
  font-size: 0.54rem;
  font-weight: 750;
}

.spatial-control-grid .form-select,
.spatial-feasibility-link .btn {
  min-height: 1.95rem;
  font-size: 0.58rem;
}

.spatial-check-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.22rem 0.45rem;
  margin: 0.58rem;
  padding: 0.48rem;
  border: 1px solid #edf2f7;
  border-radius: 0.5rem;
  background: var(--spatial-soft);
}

.spatial-check-item {
  min-width: 0;
  margin: 0;
  font-size: 0.56rem;
}

.spatial-check-item .form-check-input {
  margin-top: 0.15rem;
}

.spatial-generate-btn {
  width: calc(100% - 1.16rem) !important;
  margin: 0 0.58rem 0.6rem;
  font-size: 0.64rem;
  font-weight: 800;
}

.spatial-section-title {
  padding: 0.48rem 0.58rem;
  border-top: 1px solid var(--spatial-border);
  border-bottom: 1px solid var(--spatial-border);
  background: #f8fafc;
  color: var(--spatial-text);
  font-size: 0.61rem;
  font-weight: 850;
}

.spatial-phase-list {
  background: #ffffff;
}

.spatial-phase-row {
  display: grid;
  grid-template-columns: 0.38rem minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 0.45rem;
  padding: 0.48rem 0.55rem;
  border-bottom: 1px solid #eef2f7;
}

.spatial-phase-swatch {
  width: 0.38rem;
  height: 2.15rem;
  border-radius: 999px;
}

.spatial-phase-main {
  min-width: 0;
}

.spatial-phase-row-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.45rem;
}

.spatial-phase-row-heading strong {
  color: var(--spatial-text);
  font-size: 0.62rem;
  font-weight: 900;
}

.spatial-phase-row-heading span {
  overflow: hidden;
  color: var(--spatial-muted);
  font-size: 0.51rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.spatial-phase-row-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem 0.55rem;
  margin-top: 0.12rem;
  color: #64748b;
  font-size: 0.5rem;
}

.spatial-phase-toggle {
  min-height: 1.15rem;
  margin: 0;
}

.spatial-phase-toggle .form-check-input {
  width: 1.8rem;
  margin: 0;
}

.spatial-phase-actions {
  display: flex;
  gap: 0.18rem;
}

.spatial-phase-actions .btn {
  width: 1.65rem;
  height: 1.65rem;
  padding: 0;
  border: 1px solid #e2e8f0;
  color: #475569;
  font-size: 0.6rem;
}

.spatial-empty {
  display: flex;
  align-items: flex-start;
  gap: 0.48rem;
  margin: 0 0.58rem 0.58rem;
  padding: 0.62rem;
  border: 1px dashed #cbd5e1;
  border-radius: 0.52rem;
  background: #f8fafc;
  color: #64748b;
  font-size: 0.57rem;
  line-height: 1.4;
}

.spatial-empty i {
  color: #2563eb;
}

.spatial-manual-card {
  background: #f8fafc;
}

.spatial-manual-card .form-select,
.spatial-manual-card .btn {
  font-size: 0.58rem;
}

.spatial-validation-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.65rem;
}

.spatial-validation-heading strong,
.spatial-validation-heading span {
  display: block;
}

.spatial-validation-heading strong {
  color: var(--spatial-text);
  font-size: 0.64rem;
  font-weight: 850;
}

.spatial-validation-heading span {
  color: var(--spatial-muted);
  font-size: 0.52rem;
}

.spatial-quality-score {
  flex: 0 0 auto;
  padding: 0.28rem 0.4rem;
  border-radius: 0.42rem;
  background: #e2e8f0;
  color: #334155;
  font-size: 0.62rem;
  font-weight: 900;
}

.spatial-quality-score.success {
  background: #dcfce7;
  color: #166534;
}

.spatial-quality-score.warning {
  background: #fef3c7;
  color: #92400e;
}

.spatial-quality-score.danger {
  background: #fee2e2;
  color: #991b1b;
}

.spatial-validation-badges {
  display: flex;
  gap: 0.3rem;
  margin-top: 0.42rem;
}

.spatial-validation-badges .badge {
  font-size: 0.5rem;
}

.spatial-issue-list {
  margin-top: 0.42rem;
}

.spatial-issue {
  display: flex;
  align-items: flex-start;
  gap: 0.4rem;
  padding: 0.35rem 0;
  border-top: 1px solid #f1f5f9;
}

.spatial-issue > i {
  margin-top: 0.05rem;
  font-size: 0.58rem;
}

.spatial-issue.error > i {
  color: #dc2626;
}

.spatial-issue.warning > i {
  color: #d97706;
}

.spatial-issue strong,
.spatial-issue span {
  display: block;
}

.spatial-issue strong {
  color: #334155;
  font-size: 0.55rem;
  font-weight: 800;
}

.spatial-issue span {
  margin-top: 0.04rem;
  color: #64748b;
  font-size: 0.5rem;
  line-height: 1.35;
}

.spatial-validation-pass {
  margin-top: 0.45rem;
  padding: 0.42rem;
  border-radius: 0.45rem;
  background: #f0fdf4;
  color: #166534;
  font-size: 0.54rem;
  line-height: 1.35;
}

.spatial-export-card {
  background: #f8fafc;
}

.spatial-export-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.28rem;
}

.spatial-export-grid .btn {
  padding-inline: 0.25rem;
  font-size: 0.52rem;
}

.spatial-phase-footer {
  display: flex;
  justify-content: space-between;
  gap: 0.45rem;
  padding: 0 0.58rem 0.58rem;
}

.spatial-phase-footer .btn {
  flex: 1 1 0;
  font-size: 0.56rem;
}

.spatial-disclaimer {
  display: flex;
  align-items: flex-start;
  gap: 0.42rem;
  padding: 0.62rem 0.68rem;
  border-top: 1px solid var(--spatial-border);
  background: #f8fafc;
  color: #64748b;
  font-size: 0.54rem;
  line-height: 1.42;
}

.spatial-disclaimer i {
  margin-top: 0.05rem;
  color: #2563eb;
}

.phase-origin-picking {
  cursor: crosshair !important;
}

@media (max-width: 575.98px) {
  .spatial-control-grid,
  .spatial-check-grid {
    grid-template-columns: 1fr;
  }

  .spatial-phase-row {
    grid-template-columns: 0.34rem minmax(0, 1fr) auto;
  }

  .spatial-phase-actions {
    grid-column: 2 / -1;
  }

  .spatial-export-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
