:root {
  color-scheme: light;
  --bg: #f6f3eb;
  --surface: #fffdf8;
  --surface-2: #ece8dc;
  --ink: #1f2923;
  --muted: #617069;
  --line: #d6d0c2;
  --green: #2d6a4f;
  --green-2: #74a57f;
  --blue: #2f6690;
  --amber: #b7791f;
  --red: #a13d3d;
  --shadow: 0 14px 35px rgba(31, 41, 35, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
}

body {
  margin: 0;
  background:
    linear-gradient(135deg, rgba(45, 106, 79, 0.08), transparent 36%),
    linear-gradient(315deg, rgba(47, 102, 144, 0.08), transparent 34%),
    var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

main {
  width: min(1480px, calc(100vw - 32px));
  margin: 0 auto 48px;
}

.topbar {
  width: min(1480px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 24px 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.preparedness-ribbon {
  position: relative;
  width: min(1480px, calc(100vw - 32px));
  min-height: 82px;
  margin: 0 auto 14px;
  overflow: hidden;
  border: 1px solid #355347;
  border-radius: 8px;
  background: #20352b;
  color: #fffdf8;
  box-shadow: var(--shadow);
}

.preparedness-ribbon-inner {
  display: grid;
  grid-template-columns: minmax(150px, 0.42fr) minmax(0, 1.58fr) auto;
  gap: 16px;
  align-items: center;
  min-height: 82px;
  padding: 12px 14px 14px;
}

.ribbon-labels,
.ribbon-stage {
  min-width: 0;
}

.ribbon-labels {
  display: grid;
  justify-items: start;
  gap: 5px;
}

.ribbon-kind,
.ribbon-region {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0;
}

.ribbon-kind {
  padding: 4px 6px;
  border-radius: 4px;
  background: #dce9de;
  color: #20352b;
  text-transform: uppercase;
}

.ribbon-kind.fact {
  background: #f2d39a;
  color: #553a12;
}

.ribbon-kind.tip {
  background: #d9e8ff;
  color: #173c5a;
}

.ribbon-region {
  color: #bcd2c2;
}

.ribbon-stage {
  display: grid;
  gap: 5px;
}

.ribbon-stage.is-entering {
  animation: ribbon-entry 240ms ease-out;
}

.ribbon-text,
.ribbon-citation {
  margin: 0;
}

.ribbon-text {
  color: #fffdf8;
  font-size: 0.95rem;
  font-weight: 800;
  line-height: 1.35;
}

.ribbon-citation {
  color: #bcd2c2;
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1.3;
}

.ribbon-citation a {
  color: #d9e8ff;
  text-underline-offset: 2px;
}

.ribbon-citation a:hover,
.ribbon-citation a:focus {
  color: #fffdf8;
}

.ribbon-controls {
  display: grid;
  justify-items: end;
  gap: 6px;
}

.ribbon-buttons {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.ribbon-count {
  color: #bcd2c2;
  font-size: 0.7rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.ribbon-mute-button,
.ribbon-next-button {
  min-height: 36px;
  border: 1px solid #769587;
  border-radius: 6px;
  background: transparent;
  color: #fffdf8;
  padding: 7px 10px;
  font-size: 0.76rem;
  font-weight: 900;
  white-space: nowrap;
}

.ribbon-next-button {
  width: 36px;
  padding: 0;
  font-size: 1rem;
}

.ribbon-mute-button:hover,
.ribbon-mute-button:focus-visible,
.ribbon-mute-button[aria-pressed="true"],
.ribbon-next-button:hover,
.ribbon-next-button:focus-visible {
  background: #fffdf8;
  color: #20352b;
}

.ribbon-progress {
  position: absolute;
  inset: auto 0 0;
  height: 3px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.12);
}

.ribbon-progress::after {
  display: block;
  width: 100%;
  height: 100%;
  background: #f2d39a;
  transform-origin: left center;
  animation: ribbon-progress 12s linear infinite;
  content: "";
}

.preparedness-ribbon[data-muted="true"] .ribbon-progress::after {
  animation-play-state: paused;
}

@keyframes ribbon-entry {
  from {
    opacity: 0.35;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes ribbon-progress {
  from {
    transform: scaleX(0);
  }
  to {
    transform: scaleX(1);
  }
}

.eyebrow {
  margin: 0 0 3px;
  color: var(--green);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(2rem, 5vw, 4.8rem);
  line-height: 0.92;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 1.05rem;
}

.top-actions,
.section-heading,
.tabs {
  display: flex;
  align-items: center;
  gap: 8px;
}

.top-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.save-status {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.save-status.good {
  color: var(--green);
}

.save-status.bad {
  color: var(--red);
}

.advisor-evidence {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
}

.control-band,
.dashboard,
.workspace,
.chart-band,
.split-layout,
.map-layout,
.planning-grid,
.scenario-grid,
.guide-layout,
.guide-cards,
.ops-grid,
.onboarding-list,
.sop-grid,
.equation-grid,
.advisor-layout {
  display: grid;
  gap: 12px;
}

.control-band {
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  align-items: end;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.86);
  box-shadow: var(--shadow);
}

.field {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.field label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.compact label {
  white-space: nowrap;
}

input,
select,
textarea {
  min-width: 0;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  padding: 9px 10px;
  outline: 0;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(47, 102, 144, 0.16);
}

.unit-input {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  overflow: hidden;
}

.unit-input input {
  border: 0;
  border-radius: 0;
  background: transparent;
}

.unit-input span {
  padding: 0 10px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  white-space: nowrap;
}

.dashboard {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  margin: 14px 0;
}

.metric {
  min-height: 128px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.metric span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

.metric strong {
  font-size: clamp(1.45rem, 3vw, 2.5rem);
  line-height: 1;
}

.metric em {
  color: var(--muted);
  font-size: 0.84rem;
  font-style: normal;
}

.metric.critical {
  background: #20352b;
  color: #fdfaf2;
  border-color: #20352b;
}

.metric.critical span,
.metric.critical em {
  color: #dce9de;
}

.workspace {
  grid-template-columns: 180px minmax(0, 1fr);
  align-items: start;
}

.tabs {
  position: sticky;
  top: 12px;
  max-height: calc(100vh - 24px);
  flex-direction: column;
  align-items: stretch;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.9);
  box-shadow: var(--shadow);
}

.tab {
  min-height: 42px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
  text-align: left;
  padding: 9px 10px;
}

.tab.active {
  background: #20352b;
  color: #fffdf8;
}

.simple-mode .tab[data-tab="agriculture"],
.simple-mode .tab[data-tab="livestock"],
.simple-mode .tab[data-tab="land"],
.simple-mode .tab[data-tab="mapping"],
.simple-mode .tab[data-tab="guides"],
.simple-mode .tab[data-tab="operations"],
.simple-mode .tab[data-tab="resilience"],
.simple-mode .tab[data-tab="wrol"],
.simple-mode .tab[data-tab="equations"] {
  display: none;
}

.tab-panel {
  display: none;
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.94);
  box-shadow: var(--shadow);
}

.tab-panel.active {
  display: block;
}

.section-heading {
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.section-note {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
  text-align: right;
}

.primary-button,
.danger-button,
.icon-button {
  min-height: 38px;
  border-radius: 6px;
  border: 1px solid transparent;
  font-weight: 900;
}

.primary-button {
  background: var(--green);
  color: #fffdf8;
  padding: 8px 12px;
}

.danger-button {
  background: #fff7f4;
  border-color: #e3b1aa;
  color: var(--red);
  padding: 8px 12px;
}

.icon-button {
  width: 42px;
  display: inline-grid;
  place-items: center;
  background: var(--surface);
  border-color: var(--line);
  color: var(--ink);
  font-size: 1rem;
}

.file-button {
  position: relative;
}

.file-button input {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
}

.split-layout {
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr);
}

.chart-band {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 16px;
}

.scenario-grid {
  grid-template-columns: repeat(4, minmax(170px, 1fr));
  margin-bottom: 16px;
}

.guide-layout {
  grid-template-columns: minmax(230px, 0.45fr) minmax(0, 1fr);
  align-items: start;
}

.template-heading {
  margin-top: 10px;
}

.ops-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
}

.ops-panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 14px;
}

.ops-panel.wide {
  grid-column: 1 / -1;
}

.compact-table table {
  min-width: 760px;
}

.simulator-field {
  width: min(280px, 100%);
}

.next-action-panel {
  margin-bottom: 16px;
}

.next-action-card {
  display: grid;
  gap: 14px;
  border: 1px solid #20352b;
  border-radius: 8px;
  background: #20352b;
  color: #fffdf8;
  padding: 18px;
}

.next-action-card header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
}

.next-badge {
  width: 44px;
  height: 44px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: #fffdf8;
  color: #20352b;
  font-weight: 900;
}

.next-action-card h3 {
  margin-bottom: 4px;
  font-size: clamp(1.35rem, 3vw, 2.25rem);
  line-height: 1.02;
}

.next-action-card p {
  margin: 0;
  color: #dce9de;
}

.next-action-card .status {
  background: rgba(255, 253, 248, 0.16);
  color: #fffdf8;
}

.kid-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(160px, 1fr));
  gap: 10px;
}

.kid-step {
  min-height: 86px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 12px;
  border: 1px solid rgba(255, 253, 248, 0.22);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.08);
}

.kid-step strong {
  width: 26px;
  height: 26px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: #fffdf8;
  color: #20352b;
}

.kid-step span {
  color: #fffdf8;
}

.next-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.next-actions .primary-button {
  background: #fffdf8;
  color: #20352b;
}

.next-actions .step-button {
  background: transparent;
  border-color: rgba(255, 253, 248, 0.34);
  color: #fffdf8;
}

.onboarding-step {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 12px;
}

.onboarding-rank {
  width: 32px;
  height: 32px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: #20352b;
  color: #fffdf8;
  font-weight: 900;
}

.onboarding-step.done {
  opacity: 0.68;
}

.onboarding-step.done .onboarding-rank {
  background: var(--green-2);
}

.field-checklist {
  display: grid;
  gap: 10px;
}

.field-task {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--green);
  border-radius: 8px;
  background: var(--surface);
}

.field-task.warn {
  border-left-color: var(--amber);
}

.field-task.bad {
  border-left-color: var(--red);
}

.field-task-index {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: #20352b;
  color: #fffdf8;
  font-weight: 900;
}

.field-task p {
  margin-top: 3px;
  color: var(--muted);
}

.field-task-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.step-button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--green);
  font-weight: 900;
  padding: 6px 10px;
}

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

.sop-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 12px;
}

.sop-card h3 {
  margin-bottom: 8px;
}

.sop-card ul {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
}

.guide-cards {
  position: sticky;
  top: 12px;
}

.readiness-blocks {
  margin-top: 16px;
}

.planning-grid {
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  margin-bottom: 16px;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  min-width: 1120px;
  border-collapse: collapse;
  background: var(--surface);
}

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

th {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 900;
  text-transform: uppercase;
}

td input,
td select {
  padding: 7px 8px;
}

tr:last-child td {
  border-bottom: 0;
}

.row-action {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff7f4;
  color: var(--red);
  font-weight: 900;
}

.data-list,
.tip-stack,
.summary-strip,
.check-grid,
.advisor-output {
  display: grid;
  gap: 10px;
}

.data-item,
.tip,
.summary-pill,
.scenario-card,
.guide-card,
.guide-panel,
.sop-card,
.calendar-month,
.equation-card,
.advisor-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.data-item {
  display: grid;
  grid-template-columns: minmax(160px, 0.8fr) minmax(0, 1.4fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
}

.data-item strong {
  display: block;
}

.data-item span {
  color: var(--muted);
  font-size: 0.84rem;
}

.status {
  padding: 5px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 900;
  white-space: nowrap;
}

button.status {
  border: 0;
  cursor: pointer;
}

.status.good {
  background: rgba(116, 165, 127, 0.18);
  color: var(--green);
}

.status.warn {
  background: rgba(183, 121, 31, 0.18);
  color: var(--amber);
}

.status.bad {
  background: rgba(161, 61, 61, 0.14);
  color: var(--red);
}

.tip {
  padding: 12px;
  border-left: 4px solid var(--green);
}

.tip.warn {
  border-left-color: var(--amber);
}

.tip.bad {
  border-left-color: var(--red);
}

.tip strong {
  display: block;
  margin-bottom: 4px;
}

.tip p {
  margin: 0;
  color: var(--muted);
}

.tip ul {
  margin: 8px 0 0;
  padding-left: 18px;
  color: var(--muted);
}

.tip li + li {
  margin-top: 4px;
}

.reference-item a {
  text-align: center;
  text-decoration: none;
}

.check-grid {
  grid-template-columns: repeat(2, minmax(180px, 1fr));
}

.check-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.check-card input {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  accent-color: var(--green);
}

.check-card strong {
  display: block;
  margin-bottom: 4px;
}

.check-card span {
  display: block;
  color: var(--muted);
  font-size: 0.84rem;
}

.check-card.complete {
  border-color: rgba(45, 106, 79, 0.42);
  background: rgba(116, 165, 127, 0.1);
}

.bar-chart {
  min-height: 220px;
  display: grid;
  align-content: end;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.bar-row {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr) 78px;
  align-items: center;
  gap: 10px;
  min-height: 30px;
}

.bar-track {
  height: 12px;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--green);
}

.bar-fill.warn {
  background: var(--amber);
}

.bar-fill.bad {
  background: var(--red);
}

.summary-strip {
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  margin-top: 14px;
}

.summary-pill {
  padding: 12px;
}

.scenario-card {
  padding: 12px;
}

.guide-card {
  width: 100%;
  padding: 12px;
  text-align: left;
  color: var(--ink);
}

.guide-card.active {
  border-color: #20352b;
  background: #20352b;
  color: #fffdf8;
}

.guide-card strong {
  display: block;
  margin-bottom: 4px;
}

.guide-card span {
  color: var(--muted);
  font-size: 0.82rem;
}

.guide-card.active span {
  color: #dce9de;
}

.guide-detail {
  display: grid;
  gap: 12px;
}

.guide-panel {
  padding: 14px;
}

.guide-panel h3 {
  margin-bottom: 8px;
}

.guide-panel p {
  color: var(--muted);
}

.guide-panel ol,
.guide-panel ul {
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
}

.guide-panel li + li {
  margin-top: 6px;
}

.guide-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(130px, 1fr));
  gap: 10px;
}

.guide-warning {
  border-left: 4px solid var(--amber);
}

.scenario-card span {
  display: block;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

.scenario-card strong {
  display: block;
  margin-top: 6px;
  font-size: 1.2rem;
}

.scenario-card p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.summary-pill span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.summary-pill strong {
  display: block;
  margin-top: 4px;
  font-size: 1.25rem;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(220px, 1fr));
  gap: 12px;
}

.calendar-month {
  padding: 12px;
}

.calendar-month h3 {
  margin-bottom: 8px;
  font-size: 1rem;
}

.calendar-month ul {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
}

.calendar-month li + li {
  margin-top: 5px;
}

.calendar-events {
  display: grid;
  gap: 8px;
  padding-left: 0;
  list-style: none;
}

.calendar-event {
  display: grid;
  gap: 4px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
  min-width: 0;
}

.calendar-event:first-child {
  padding-top: 0;
  border-top: 0;
}

.calendar-event + .calendar-event {
  margin-top: 0;
}

.calendar-event-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.calendar-check {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.calendar-check input {
  width: 16px;
  height: 16px;
  accent-color: var(--green);
  flex: 0 0 auto;
}

.calendar-date {
  color: var(--blue);
  font-size: 0.76rem;
  font-weight: 900;
}

.calendar-event strong {
  color: var(--ink);
  font-size: 0.88rem;
  line-height: 1.25;
}

.calendar-event > span:not(.status),
.calendar-event > p {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
}

.calendar-event.bad strong {
  color: var(--red);
}

.calendar-event.warn strong {
  color: var(--amber);
}

.calendar-event.complete {
  opacity: 0.64;
}

.calendar-event.complete strong {
  text-decoration: line-through;
}

.calendar-note-preview {
  padding: 7px 8px;
  border-left: 3px solid var(--blue);
  background: rgba(47, 102, 144, 0.08);
  color: var(--ink);
}

.calendar-note-field {
  display: grid;
  gap: 4px;
}

.calendar-note-field span {
  color: var(--green);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.calendar-note-field textarea {
  width: 100%;
  min-height: 54px;
  resize: vertical;
}

.equation-grid {
  grid-template-columns: repeat(2, minmax(260px, 1fr));
}

.source-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(220px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.source-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 12px;
}

.source-card h3 {
  margin-top: 8px;
}

.source-card p {
  margin-top: 8px;
  color: var(--muted);
}

.source-card a {
  display: inline-block;
  margin-top: 10px;
  color: var(--green);
  font-weight: 900;
}

.equation-card {
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 12px;
}

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

.equation-card h3 {
  margin-bottom: 0;
  font-size: 0.95rem;
}

.equation-plain {
  padding: 8px;
  border-left: 3px solid var(--green);
  background: rgba(116, 165, 127, 0.1);
  color: var(--ink);
}

.equation-section {
  display: grid;
  gap: 4px;
}

.equation-label {
  color: var(--green);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.equation-card code {
  display: block;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--ink);
  white-space: normal;
}

.equation-card p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.4;
}

.binder-print-pack {
  display: none;
}

.binder-header,
.binder-section {
  margin-bottom: 18px;
}

.binder-section {
  break-inside: avoid;
}

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

.binder-row,
.binder-line {
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}

.binder-row strong,
.binder-line strong {
  display: block;
}

.binder-row span,
.binder-line span,
.binder-row li {
  color: var(--muted);
  font-size: 0.9rem;
}

.binder-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.advisor-layout {
  grid-template-columns: minmax(260px, 0.8fr) minmax(0, 1.2fr);
}

.advisor-output {
  align-content: start;
}

.advisor-card {
  padding: 14px;
}

.advisor-card strong {
  display: block;
  margin-bottom: 6px;
}

.advisor-card p {
  margin-bottom: 0;
  color: var(--muted);
}

.template-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(240px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.template-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.template-card header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: start;
}

.template-card h3 {
  margin-bottom: 4px;
  font-size: 1rem;
}

.template-card p {
  margin: 0;
  color: var(--muted);
}

.template-card ul {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
}

.template-card li + li {
  margin-top: 4px;
}

.download-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.download-card {
  display: grid;
  gap: 10px;
  align-content: start;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf8;
}

.download-card h3 {
  margin: 0;
}

.download-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.download-card .primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.site-metrics-panel {
  margin: 24px 0;
}

.site-metrics-grid {
  margin-top: 12px;
}

.metrics-detail-grid {
  display: grid;
  grid-template-columns: minmax(240px, 0.72fr) minmax(300px, 1.28fr);
  gap: 24px;
  margin-top: 18px;
}

.metrics-detail-grid h3 {
  margin-bottom: 10px;
  font-size: 0.9rem;
}

.metrics-platform-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.metrics-platform-grid div {
  padding: 10px;
  border-left: 3px solid var(--green);
  background: var(--surface-2);
}

.metrics-platform-grid span,
.metrics-platform-grid strong {
  display: block;
}

.metrics-platform-grid span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
}

.metrics-platform-grid strong {
  margin-top: 3px;
  font-size: 1.05rem;
}

.metrics-legend {
  display: flex;
  gap: 14px;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
}

.metrics-legend span::before {
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-right: 5px;
  background: var(--green);
  content: "";
}

.metrics-legend span + span::before {
  background: var(--blue);
}

.metrics-history {
  display: grid;
  gap: 7px;
}

.metrics-history-row {
  display: grid;
  grid-template-columns: 52px minmax(80px, 1fr) 72px;
  gap: 8px;
  align-items: center;
  min-height: 18px;
  font-size: 0.76rem;
}

.metrics-history-row > span {
  color: var(--muted);
}

.metrics-history-row > strong {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.metrics-history-track {
  display: flex;
  gap: 2px;
  height: 10px;
  overflow: hidden;
  background: var(--surface-2);
}

.metrics-history-track i {
  display: block;
  min-width: 0;
  height: 100%;
}

.metrics-history-visits {
  background: var(--green);
}

.metrics-history-downloads {
  background: var(--blue);
}

.metrics-empty {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.metrics-status {
  margin-top: 14px;
  padding: 9px 10px;
  border-left: 4px solid var(--amber);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.metrics-status.good {
  border-left-color: var(--green);
}

.about-statement {
  max-width: 980px;
  margin: 10px 0 22px;
  padding: 4px 0 4px 16px;
  border-left: 4px solid var(--green);
}

.about-statement p {
  margin: 0;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.65;
}

.about-principles {
  margin-top: 20px;
}

.about-closing-quote {
  max-width: 980px;
  margin: 28px auto 4px;
  padding: 22px 24px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  text-align: center;
}

.about-closing-quote p {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.2rem, 2.4vw, 1.75rem);
  font-style: italic;
  line-height: 1.45;
}

.template-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.template-meta span {
  padding: 4px 7px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 900;
}

.map-layout {
  grid-template-columns: minmax(0, 1.15fr) minmax(300px, 0.85fr);
  align-items: start;
  margin-top: 16px;
}

.property-plot {
  position: relative;
  min-height: 520px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(rgba(31, 41, 35, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(31, 41, 35, 0.08) 1px, transparent 1px),
    #edf3e7;
  background-size: 10% 10%;
  overflow: hidden;
  user-select: none;
}

.map-compass {
  position: absolute;
  z-index: 3;
  top: 10px;
  left: 10px;
  display: grid;
  gap: 4px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.9);
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 900;
}

.map-compass span:first-child {
  color: var(--green);
  font-size: 1rem;
}

.map-item {
  position: absolute;
  z-index: 2;
  min-width: 44px;
  min-height: 34px;
  display: grid;
  align-content: center;
  gap: 2px;
  padding: 6px;
  border: 2px solid rgba(31, 41, 35, 0.18);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.88);
  color: var(--ink);
  box-shadow: 0 8px 18px rgba(31, 41, 35, 0.08);
  overflow: hidden;
  cursor: grab;
  touch-action: none;
}

.map-item.dragging {
  z-index: 5;
  cursor: grabbing;
  opacity: 0.88;
  box-shadow: 0 14px 28px rgba(31, 41, 35, 0.18);
}

.map-item strong {
  display: block;
  font-size: clamp(0.62rem, 1.4vw, 0.82rem);
  line-height: 1.05;
}

.map-item span {
  color: var(--muted);
  font-size: 0.64rem;
  font-weight: 900;
}

.map-item.flagged {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(161, 61, 61, 0.14);
}

.map-item.water {
  background: rgba(47, 102, 144, 0.16);
}

.map-item.food {
  background: rgba(116, 165, 127, 0.2);
}

.map-item.animal {
  background: rgba(183, 121, 31, 0.18);
}

.map-item.waste {
  background: rgba(161, 61, 61, 0.12);
}

.map-item.utility {
  background: rgba(236, 232, 220, 0.86);
}

.map-item.access {
  background: rgba(31, 41, 35, 0.12);
}

.map-item.wild {
  background: rgba(45, 106, 79, 0.18);
}

.map-table table {
  min-width: 980px;
}

.shelter-map {
  position: relative;
  min-height: 190px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(31, 41, 35, 0.08) 1px, transparent 1px),
    linear-gradient(rgba(31, 41, 35, 0.08) 1px, transparent 1px),
    #eef3ec;
  background-size: 20% 25%;
  overflow: hidden;
}

.shelter-map::before,
.shelter-map::after {
  content: "";
  position: absolute;
  background: rgba(31, 41, 35, 0.12);
}

.shelter-map::before {
  left: 50%;
  top: 10px;
  width: 1px;
  height: calc(100% - 20px);
}

.shelter-map::after {
  left: 10px;
  top: 50%;
  width: calc(100% - 20px);
  height: 1px;
}

.shelter-compass {
  position: absolute;
  z-index: 2;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
}

.shelter-compass.north {
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
}

.shelter-compass.east {
  top: 50%;
  right: 10px;
  transform: translateY(-50%);
}

.shelter-compass.south {
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
}

.shelter-compass.west {
  top: 50%;
  left: 10px;
  transform: translateY(-50%);
}

.shelter-home,
.shelter-marker {
  position: absolute;
  z-index: 3;
  display: grid;
  place-items: center;
  border-radius: 999px;
  font-weight: 900;
  box-shadow: 0 8px 18px rgba(31, 41, 35, 0.12);
}

.shelter-home {
  left: 18px;
  top: 50%;
  width: 58px;
  height: 58px;
  transform: translateY(-50%);
  background: #20352b;
  color: #fffdf8;
  font-size: 0.78rem;
}

.shelter-marker {
  width: 34px;
  height: 34px;
  border: 2px solid #fffdf8;
  color: #fffdf8;
  transform: translate(-50%, -50%);
}

.shelter-marker.good {
  background: var(--green);
}

.shelter-marker.warn {
  background: var(--amber);
}

.shelter-marker.bad {
  background: var(--red);
}

@media (max-width: 1160px) {
  .control-band,
  .dashboard {
    grid-template-columns: repeat(3, minmax(150px, 1fr));
  }

  .planning-grid,
  .scenario-grid,
  .summary-strip,
  .source-grid,
  .equation-grid,
  .calendar-grid {
    grid-template-columns: repeat(2, minmax(180px, 1fr));
  }

  .split-layout,
  .chart-band,
  .guide-layout,
  .ops-grid,
  .map-layout,
  .advisor-layout,
  .metrics-detail-grid {
    grid-template-columns: 1fr;
  }

  .guide-cards {
    position: static;
    grid-template-columns: repeat(2, minmax(180px, 1fr));
  }

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

  .sop-grid {
    grid-template-columns: repeat(2, minmax(180px, 1fr));
  }
}

@media (max-width: 760px) {
  main,
  .topbar,
  .preparedness-ribbon {
    width: min(100vw - 20px, 1480px);
  }

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

  .preparedness-ribbon-inner {
    grid-template-columns: 1fr auto;
    gap: 8px 12px;
  }

  .ribbon-labels {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .ribbon-text {
    font-size: 0.88rem;
  }

  .control-band,
  .dashboard,
  .planning-grid,
  .scenario-grid,
  .summary-strip,
  .source-grid,
  .equation-grid,
  .calendar-grid {
    grid-template-columns: 1fr;
  }

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

  .tabs {
    position: static;
    max-height: none;
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
  }

  .tab {
    min-width: 118px;
    text-align: center;
  }

  .data-item {
    grid-template-columns: 1fr;
  }

  .guide-cards,
  .sop-grid,
  .check-grid,
  .kid-steps,
  .guide-metrics,
  .download-grid,
  .metrics-platform-grid {
    grid-template-columns: 1fr;
  }

  .onboarding-step {
    grid-template-columns: 1fr;
  }

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

  .field-task-actions {
    justify-content: flex-start;
  }

  .next-action-card header {
    grid-template-columns: 1fr;
  }

  .bar-row {
    grid-template-columns: 82px minmax(0, 1fr) 60px;
    font-size: 0.86rem;
  }

  .property-plot {
    min-height: 420px;
  }
}

@media print {
  body {
    background: #fff;
  }

  .top-actions,
  .preparedness-ribbon,
  .tabs,
  .control-band,
  .dashboard,
  .section-heading button {
    display: none;
  }

  main,
  .topbar {
    width: 100%;
  }

  .workspace,
  .tab-panel.active {
    display: block;
  }

  body.print-binder > header,
  body.print-binder > main {
    display: none;
  }

  body.print-binder .binder-print-pack {
    display: block;
    color: #000;
  }

  body.print-binder .binder-header h1 {
    font-size: 2rem;
    line-height: 1.05;
  }

  body.print-binder .binder-section h2 {
    margin-bottom: 8px;
    font-size: 1.15rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ribbon-stage.is-entering,
  .ribbon-progress::after {
    animation: none;
  }
}
