:root {
  color-scheme: light;
  --bg: #eef3ec;
  --panel: #ffffff;
  --ink: #18251e;
  --muted: #657168;
  --line: #d9e2d8;
  --green: #2f7c4f;
  --green-dark: #1f5f3a;
  --field: #f7faf6;
  --shadow: 0 18px 50px rgba(38, 62, 44, 0.16);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(320px, 410px) minmax(0, 1fr);
  height: 100vh;
  min-height: 100vh;
  overflow: hidden;
}

.controls {
  background: var(--panel);
  border-right: 1px solid var(--line);
  overflow-y: auto;
  padding: 22px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 1.25rem;
}

.control-section {
  padding: 20px 0;
  border-bottom: 1px solid var(--line);
}

.control-section h2 {
  margin-bottom: 14px;
  font-size: 0.88rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--green-dark);
}

.grid-two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.grid-two h2 {
  grid-column: 1 / -1;
  margin-bottom: 0;
}

.compact-grid {
  margin-top: 14px;
}

label {
  display: grid;
  gap: 7px;
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 650;
}

select,
button {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--field);
  color: var(--ink);
  font: inherit;
}

select {
  min-height: 39px;
  padding: 0 10px;
}

input[type="range"] {
  accent-color: var(--green);
  width: 100%;
}

.checks {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.checks label {
  grid-template-columns: auto 1fr;
  align-items: center;
  margin: 0;
  color: var(--ink);
  font-weight: 600;
}

.stage {
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(390px, 1fr) auto;
  min-width: 0;
  height: 100vh;
  min-height: 0;
}

.toolbar {
  z-index: 2;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 13px 18px;
  background: rgba(238, 243, 236, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

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

.toolbar span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.9rem;
}

.toolbar-actions {
  display: flex;
  flex: 1 1 auto;
  min-width: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

button {
  min-width: 108px;
  min-height: 38px;
  padding: 0 13px;
  background: var(--panel);
  cursor: pointer;
  font-weight: 700;
}

.toolbar-actions button {
  width: auto;
  min-width: 116px;
  min-height: 36px;
  padding: 0 12px;
  white-space: nowrap;
}

button:hover {
  border-color: #a8b8aa;
}

#scene {
  display: block;
  width: 100%;
  height: 100%;
  background: #e8f1ee;
}

.readout {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
  gap: 8px;
  padding: 10px 18px;
  background: rgba(238, 243, 236, 0.95);
  border-top: 1px solid var(--line);
}

.readout div,
.notes {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.readout div {
  border-radius: 8px;
  padding: 9px 11px;
  box-shadow: none;
}

.readout span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.readout strong {
  display: block;
  margin-top: 4px;
  font-size: 1.08rem;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 7px;
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin: 0;
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 700;
}

.legend i {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
}

.legend-frame {
  background: #9b6d34;
}

.legend-vent {
  background: #2f7c4f;
}

.legend-layout {
  background: #4c8a54;
}

.legend-cover {
  background: #d9f4ff;
  border: 1px solid #99c7cf;
}

.notes {
  margin: 0 18px 18px;
  border-radius: 8px;
  padding: 14px 16px;
}

.output-panel {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(250px, 0.9fr) minmax(230px, 0.9fr) minmax(230px, 0.9fr) minmax(220px, 1fr);
  gap: 18px;
  max-height: 210px;
  overflow: auto;
}

.notes h2 {
  margin-bottom: 9px;
  font-size: 0.92rem;
}

.notes ul {
  display: grid;
  gap: 6px;
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.35;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
}

th,
td {
  padding: 7px 6px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--green-dark);
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.table-note {
  display: inline-block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.25;
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
    height: auto;
    overflow: visible;
  }

  .controls {
    max-height: none;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .stage {
    height: auto;
    min-height: 740px;
  }

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

  .toolbar-actions {
    width: 100%;
  }

  .toolbar-actions button {
    flex: 1 1 0;
  }

  .readout {
    grid-template-columns: repeat(3, minmax(112px, 1fr));
  }
}

@media (max-width: 620px) {
  .controls,
  .toolbar {
    padding: 16px;
  }

  .grid-two {
    grid-template-columns: 1fr;
  }

  .readout {
    grid-template-columns: 1fr 1fr;
    padding: 10px 14px;
  }

  .output-panel {
    grid-template-columns: 1fr;
    max-height: none;
  }

  .stage {
    grid-template-rows: auto 430px auto;
  }
}

.scene-wrap {
  position: relative;
  min-height: 0;
  min-width: 0;
}

.scene-wrap #scene {
  position: absolute;
  inset: 0;
  height: 100%;
}

.member-info {
  position: absolute;
  top: 12px;
  left: 12px;
  max-width: 240px;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  font-size: 0.85rem;
  line-height: 1.45;
  pointer-events: none;
}

.member-info strong {
  color: var(--accent, #2f7c4f);
}

.walk-hint {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  padding: 7px 14px;
  border-radius: 999px;
  background: rgba(32, 42, 38, 0.82);
  color: #eef3ea;
  font-size: 0.8rem;
  letter-spacing: 0.02em;
  pointer-events: none;
  white-space: nowrap;
}

.design-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.design-actions input {
  flex: 1 1 auto;
  min-width: 0;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
  background: #fff;
}

.compare-wrap {
  overflow-x: auto;
}

#compareTable {
  min-width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

#compareTable th,
#compareTable td {
  padding: 5px 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

#compareTable th button {
  margin-left: 6px;
  padding: 1px 7px;
  font-size: 0.72rem;
}

#compareTable .best {
  color: #2f7c4f;
  font-weight: 700;
}

.env-card {
  cursor: pointer;
  outline: 2px solid transparent;
  transition: outline-color 0.15s ease;
}

.env-card:hover,
.env-card:focus-visible {
  outline-color: #2f7c4f;
}

.env-card em {
  display: block;
  font-style: normal;
  font-size: 0.68rem;
  color: #2f7c4f;
  margin-top: 2px;
}

.env-modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(24, 32, 28, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.env-modal[hidden] {
  display: none;
}

.env-dialog {
  width: min(860px, 100%);
  max-height: 92vh;
  overflow-y: auto;
  background: #f6f9f4;
  border-radius: 14px;
  box-shadow: 0 24px 70px rgba(20, 30, 24, 0.4);
  padding: 18px 22px 22px;
}

.env-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.env-header h2 {
  margin: 0;
  font-size: 1.1rem;
}

.env-header button {
  /* the global button rule stretches every button to the full width of its box, which
     turns a close cross into a banner across the top of the dialog */
  width: auto;
  min-width: 0;
  min-height: 0;
  flex: none;
  font-size: 1.2rem;
  line-height: 1;
  padding: 4px 10px;
}

.env-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.env-sliders {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px 16px;
  margin-bottom: 14px;
  font-size: 0.82rem;
}

.env-sliders label {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-weight: 650;
  color: #445248;
}

.env-sliders span {
  color: #2f7c4f;
}

.env-verdict {
  padding: 10px 14px;
  border-radius: 9px;
  font-weight: 700;
  margin-bottom: 12px;
}

.env-verdict.good {
  background: #e2f1e4;
  color: #226141;
  border: 1px solid #9ec9a8;
}

.env-verdict.bad {
  background: #f7e3de;
  color: #8f2f1d;
  border: 1px solid #dfa89a;
}

.env-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.env-grid div {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
}

.env-grid span {
  display: block;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.env-grid strong {
  font-size: 1.02rem;
}

.env-grid small {
  display: block;
  color: #5c6b62;
  margin-top: 1px;
}

.env-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.env-chips span {
  background: #e2ecdf;
  border: 1px solid #b9cdb6;
  border-radius: 999px;
  padding: 3px 11px;
  font-size: 0.76rem;
}

.env-warnings {
  margin: 0 0 12px;
  padding-left: 20px;
  color: #8f4a1d;
  font-size: 0.84rem;
}

.env-chart {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  margin-bottom: 10px;
}

.env-disclaimer {
  font-size: 0.74rem;
  color: var(--muted);
}

@media (max-width: 900px) {
  .env-sliders {
    grid-template-columns: 1fr 1fr;
  }
}

.season-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
  margin-bottom: 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.season-table th,
.season-table td {
  padding: 4px 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

.season-table th {
  background: #eef3ec;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

/* Details modal — moved out of the cramped bottom strip into a roomy popup */
.details-modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(24, 32, 28, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.details-modal[hidden] {
  display: none;
}

.details-dialog {
  width: min(1180px, 100%);
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  background: #f6f9f4;
  border-radius: 14px;
  box-shadow: 0 24px 70px rgba(20, 30, 24, 0.4);
  overflow: hidden;
}

.details-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 22px;
  border-bottom: 1px solid var(--line);
  flex: 0 0 auto;
}

.details-header h2 {
  margin: 0;
  font-size: 1.1rem;
}

.details-header button {
  font-size: 1.2rem;
  line-height: 1;
  padding: 4px 10px;
}

/* the panel inside the modal: comfortable multi-column grid, scrolls within the modal */
.details-dialog .output-panel {
  margin: 0;
  padding: 18px 22px;
  max-height: none;
  overflow-y: auto;
  background: transparent;
  border: 0;
  box-shadow: none;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  align-content: start;
  gap: 20px 26px;
}

.details-dialog .output-panel > div {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
}

.details-dialog .output-panel table {
  width: 100%;
}

/* Season playback HUD + play button */
.env-header-actions { display: flex; align-items: center; gap: 10px; }
.season-play {
  width: auto;
  min-height: 34px;
  padding: 0 14px;
  background: var(--green);
  color: #fff;
  border-color: var(--green);
  font-weight: 800;
  white-space: nowrap;
}
.season-play:hover { background: var(--green-dark); border-color: var(--green-dark); }

.season-hud {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  min-width: 320px;
  padding: 12px 16px;
  border-radius: 12px;
  background: rgba(20, 28, 24, 0.82);
  color: #eef3ea;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
  pointer-events: auto;
  z-index: 5;
}
.season-hud-row { display: flex; align-items: center; gap: 10px; }
.season-hud-row strong { font-size: 1.5rem; letter-spacing: 0.02em; }
.hud-season {
  padding: 2px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  font-size: 0.78rem;
  font-weight: 700;
}
.season-hud-row button {
  margin-left: auto;
  width: auto;
  min-width: 0;
  min-height: 28px;
  padding: 0 10px;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  border-color: transparent;
  font-size: 0.78rem;
}
.season-hud-weather { margin-top: 4px; font-size: 0.92rem; font-weight: 700; }
.season-hud-temps { margin-top: 3px; font-size: 0.82rem; color: #cfe0d2; }
.season-hud-temps b { color: #fff; }
.season-hud-bar {
  margin-top: 8px;
  height: 5px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.16);
  overflow: hidden;
}
.season-hud-bar i { display: block; height: 100%; width: 0%; background: #5fbf7f; transition: width 0.1s linear; }

/* Live season HUD (liveFarm.js) */
.live-hud { min-width: min(640px, 92%); max-width: 92%; padding: 10px 14px 10px; }
.lh-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.lh-date { font-size: 1.15rem; letter-spacing: 0.01em; }
.lh-stage { padding: 2px 9px; border-radius: 999px; background: rgba(255, 255, 255, 0.16); font-size: 0.74rem; font-weight: 700; }
.lh-day { font-size: 0.78rem; color: #cfe0d2; }
.lh-speed { display: flex; gap: 4px; margin-left: auto; }
.live-hud button {
  width: auto; min-width: 0; min-height: 26px; padding: 0 9px;
  background: rgba(255, 255, 255, 0.12); color: #fff; border: 1px solid transparent;
  border-radius: 6px; font-size: 0.74rem; cursor: pointer;
}
.live-hud button:hover { background: rgba(255, 255, 255, 0.22); }
.live-hud button.is-on { background: #5fbf7f; color: #0f2416; font-weight: 700; }
.lh-stop { background: rgba(192, 57, 43, 0.55) !important; }
.lh-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 2px 12px; margin-top: 8px; font-size: 0.76rem; color: #cfe0d2; }
.lh-grid b { color: #fff; font-weight: 700; }
.lh-grid b.warn { color: #f5c15b; }
.lh-grid b.crit { color: #ff7b6b; }
.lh-events { list-style: none; margin: 7px 0 0; padding: 0; font-size: 0.76rem; }
.lh-events li { padding: 1px 0 1px 8px; border-left: 3px solid rgba(255, 255, 255, 0.3); margin-top: 2px; }
.lh-events li.good { border-color: #5fbf7f; }
.lh-events li.warn { border-color: #f5c15b; }
.lh-events li.crit { border-color: #ff7b6b; font-weight: 700; }
.lh-bar { position: relative; margin-top: 8px; height: 6px; border-radius: 3px; background: rgba(255, 255, 255, 0.12); overflow: hidden; }
.lh-bar i { position: absolute; left: 0; top: 0; height: 100%; width: 0%; }
.lh-computed { background: rgba(95, 191, 127, 0.35); }
.lh-played { background: #5fbf7f; }
.lh-foot { display: flex; align-items: center; gap: 8px; margin-top: 6px; font-size: 0.74rem; color: #cfe0d2; }
.lh-results { margin-left: auto; background: #5fbf7f !important; color: #0f2416 !important; font-weight: 700; }
@media (max-width: 720px) { .lh-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Seasonal Simulation — placeholder-climate notice */
.env-climate-notice {
  margin-bottom: 14px;
  padding: 11px 14px;
  border-radius: 9px;
  background: #fff5e6;
  border: 1px solid #f0c98a;
  color: #7a4d12;
  font-size: 0.88rem;
  line-height: 1.4;
}
.env-climate-notice strong { font-weight: 800; }

/* Live control panel — operate the movable parts (roll-up vents, roof vent, fans) */
.control-panel {
  position: absolute;
  top: 16px;
  left: 16px;
  width: 260px;
  background: rgba(20, 32, 28, 0.92);
  color: #eaf3ee;
  border-radius: 12px;
  padding: 14px 15px 15px;
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(6px);
  z-index: 6;
  font-size: 0.86rem;
}
.control-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.control-panel-head strong { font-size: 0.98rem; letter-spacing: 0.01em; }
.control-panel-head button {
  background: none;
  border: none;
  color: #cfe0d8;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
}
.control-panel-note {
  margin: 0 0 12px;
  font-size: 0.74rem;
  line-height: 1.35;
  color: #a8bdb2;
}
.control-row { margin-bottom: 13px; }
.control-row label {
  display: flex;
  justify-content: space-between;
  font-weight: 600;
  margin-bottom: 5px;
  color: #dcece4;
}
.control-row label span { color: #8fd6a8; font-variant-numeric: tabular-nums; }
.control-row input[type="range"] { width: 100%; accent-color: #4fae72; cursor: pointer; }
.control-row.disabled { opacity: 0.4; pointer-events: none; }
.control-row-toggle { display: flex; align-items: center; justify-content: space-between; }
.control-toggle {
  border: 1px solid #4fae72;
  background: transparent;
  color: #8fd6a8;
  border-radius: 999px;
  padding: 4px 16px;
  font-weight: 700;
  cursor: pointer;
}
.control-toggle[aria-pressed="true"] { background: #4fae72; color: #10231a; }
.control-actions { display: flex; gap: 8px; margin-top: 4px; }
.control-actions button {
  flex: 1;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.06);
  color: #eaf3ee;
  border-radius: 8px;
  padding: 6px 0;
  cursor: pointer;
  font-size: 0.8rem;
}
.control-actions button:hover { background: rgba(255, 255, 255, 0.14); }

/* polysim bridge — Run-on-polysim button + real-report panel */
.polysim-btn { background: #7c3aed; }
.polysim-btn:hover { background: #6d28d9; }
.polysim-btn:disabled { opacity: 0.55; cursor: progress; }
.polysim-report {
  margin: 0 0 14px;
  padding: 14px 16px;
  border-radius: 10px;
  background: #f5f1ff;
  border: 1px solid #d7c9f5;
  color: #2c2140;
}
.polysim-report.error { background: #fdecec; border-color: #f0b4b4; color: #7a1f1f; }
.polysim-report h3 { margin: 0 0 4px; font-size: 1rem; }
.polysim-report .polysim-source { font-size: 0.78rem; color: #6b5a8a; margin-bottom: 12px; }
.polysim-report .polysim-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}
.polysim-report .polysim-grid div {
  background: #fff;
  border-radius: 8px;
  padding: 9px 11px;
  border: 1px solid #e6ddf7;
}
.polysim-report .polysim-grid span { display: block; font-size: 0.72rem; color: #6b5a8a; text-transform: uppercase; letter-spacing: 0.03em; }
.polysim-report .polysim-grid strong { font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.polysim-report .polysim-bad strong { color: #b3261e; }
.polysim-report .polysim-collapse {
  margin: 0 0 10px;
  padding: 8px 10px;
  border-left: 4px solid #b3261e;
  border-radius: 6px;
  background: #fdecea;
  color: #5c1a14;
  font-size: 0.8rem;
  line-height: 1.45;
}

/* Locality (real-world site) overlay */
.locality-info {
  position: absolute;
  top: 16px;
  right: 16px;
  max-width: 260px;
  background: rgba(20, 32, 28, 0.9);
  color: #eaf3ee;
  border-radius: 11px;
  padding: 12px 14px;
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(6px);
  z-index: 6;
  font-size: 0.84rem;
  line-height: 1.5;
}
.locality-info h4 { margin: 0 0 6px; font-size: 0.95rem; }
.locality-info .loc-row { display: flex; justify-content: space-between; gap: 12px; }
.locality-info .loc-row span { color: #a8bdb2; }
.locality-info .loc-row b { font-variant-numeric: tabular-nums; }
.locality-info .loc-aqi-good { color: #8fd6a8; }
.locality-info .loc-aqi-mod { color: #f0d27a; }
.locality-info .loc-aqi-bad { color: #f0a07a; }
.locality-info.loc-error { background: rgba(60, 30, 30, 0.92); }

/* Map picker modal */
.map-modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 22, 20, 0.55);
  backdrop-filter: blur(3px);
}
.map-modal[hidden] { display: none; }
.map-dialog {
  width: min(1100px, 94vw);
  height: min(780px, 90vh);
  display: flex;
  flex-direction: column;
  background: var(--panel, #fff);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.4);
}
.map-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line, #dfe4dc);
  flex-wrap: wrap;
}
.map-header #mapSearch {
  flex: 1 1 240px;
  min-width: 180px;
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line, #cfd6c8);
  border-radius: 8px;
}
.map-latlon { color: var(--muted, #6b7a70); font-size: 0.85rem; font-variant-numeric: tabular-nums; }
.map-use { background: #2f7c4f; color: #fff; }
.map-use:disabled { opacity: 0.5; cursor: not-allowed; }
#mapDiv { flex: 1 1 auto; width: 100%; }
.leaflet-container { font: inherit; }

.locality-info .loc-notes {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.18);
  font-size: 0.78rem;
  line-height: 1.4;
  color: #cfe0d8;
}
.locality-info .loc-notes div { margin-bottom: 3px; }

/* ---- Assumptions window: every editable belief of the engine ---- */
.assume-dialog { width: min(1240px, 96vw); max-height: 92vh; display: flex; flex-direction: column; }
.assume-intro { margin: 0; padding: 10px 18px 0; font-size: 0.82rem; line-height: 1.5; color: var(--muted); }
.assume-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 12px 18px; }
.assume-group { margin-bottom: 20px; }
.assume-group h3 { margin: 0 0 4px; font-size: 0.9rem; font-weight: 650; }
.assume-note { margin: 0 0 8px; font-size: 0.78rem; line-height: 1.5; color: var(--muted); }
.assume-table { width: 100%; border-collapse: collapse; font-size: 0.8rem; }
.assume-table td { padding: 5px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.assume-table td:first-child { width: 34%; }
.assume-table small { display: block; font-size: 0.72rem; color: var(--muted); }
.assume-table tr.is-dirty { background: #f3f8f3; }
.assume-table tr.is-dirty td:first-child { font-weight: 600; }
.assume-input { width: 150px; white-space: nowrap; }
.assume-input input { width: 88px; padding: 3px 6px; border: 1px solid var(--line); border-radius: 6px; font-size: 0.8rem; }
.assume-unit { margin-left: 6px; color: var(--muted); font-size: 0.75rem; }
.assume-source { font-size: 0.74rem; line-height: 1.4; color: var(--muted); }
.assume-flag { color: #a15c00; font-weight: 700; letter-spacing: 0.02em; }
.assume-reset { width: 74px; text-align: right; }
.assume-reset button { width: auto; min-width: 0; min-height: 0; padding: 2px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--field); cursor: pointer; }
.assume-default { font-size: 0.72rem; color: #b9c2ba; }
.assume-actions { display: flex; align-items: center; gap: 12px; padding: 10px 18px; border-top: 1px solid var(--line); }
.assume-count { flex: 1; font-size: 0.78rem; color: var(--muted); }
.assume-actions button { width: auto; min-width: 0; min-height: 0; padding: 6px 12px; border: 1px solid var(--line); border-radius: 7px; background: var(--field); font-size: 0.8rem; cursor: pointer; }
