:root {
  --ink: #20312b;
  --muted: #6c7973;
  --paper: #f3f2eb;
  --surface: #fffefa;
  --line: #d8ded7;
  --line-strong: #bac8bd;
  --green: #267b62;
  --green-2: #3b9b77;
  --lime: #b9d84c;
  --amber: #eba73e;
  --red: #c8644f;
  --blue: #4e8fa1;
  --dark: #173c31;
  --shadow: 0 18px 50px rgba(23, 60, 49, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Noto Sans JP", sans-serif;
  font-size: 14px;
}

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

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(185, 216, 76, 0.75);
  outline-offset: 2px;
}

.topbar {
  position: sticky;
  z-index: 100;
  top: 0;
  min-height: 72px;
  padding: 0 4vw;
  border-bottom: 1px solid rgba(216, 222, 215, 0.9);
  background: rgba(255, 254, 250, 0.94);
  backdrop-filter: blur(16px);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: flex;
  gap: 11px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 700;
  font-size: 17px;
  line-height: 1.05;
  flex: 0 0 auto;
}

.brand small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font: 9px "DM Mono", monospace;
  letter-spacing: 0.12em;
}

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 52% 48% 45% 55%;
  background: var(--green);
  color: #fff;
  display: grid;
  place-items: center;
  font: 600 13px "Outfit", sans-serif;
  box-shadow: inset -5px -5px 0 rgba(0, 0, 0, 0.08);
}

.topbar nav {
  display: flex;
  gap: 23px;
  align-items: center;
}

.topbar nav a {
  position: relative;
  padding: 8px 0;
  color: var(--muted);
  text-decoration: none;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.topbar nav a.active {
  color: var(--green);
}

.topbar nav a.active:not(.nav-admin)::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 2px;
  background: var(--lime);
}

.topbar nav .nav-admin {
  padding: 10px 15px;
  border-radius: 3px;
  background: var(--dark);
  color: #fff;
}

.map-page {
  max-width: 1600px;
  margin: 0 auto;
  padding: 24px 3.2vw 42px;
}

.map-hero {
  margin-bottom: 16px;
  display: grid;
  grid-template-columns: minmax(300px, 1fr) minmax(430px, 0.9fr);
  gap: 18px;
  align-items: stretch;
}

.map-heading {
  padding: 11px 0 4px;
}

.eyebrow {
  color: var(--green);
  font: 500 10px "DM Mono", monospace;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.map-heading h1 {
  margin: 7px 0 7px;
  max-width: 720px;
  font-size: clamp(22px, 2.2vw, 34px);
  line-height: 1.35;
  letter-spacing: 0.01em;
}

.map-heading p {
  margin: 0;
  color: var(--muted);
  line-height: 1.75;
  font-size: 12px;
}

.question-card {
  position: relative;
  overflow: hidden;
  min-height: 136px;
  padding: 20px 22px 18px;
  border: 1px solid #c8d6c9;
  background: #ecf3e7;
}

.question-card::after {
  content: "?";
  position: absolute;
  right: -5px;
  bottom: -38px;
  color: rgba(38, 123, 98, 0.09);
  font: 700 150px "Outfit", sans-serif;
}

.question-top {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.question-top strong {
  font-size: 12px;
}

.confidence {
  padding: 4px 7px;
  border: 1px solid #aebea8;
  color: #52684f;
  font: 10px "DM Mono", monospace;
}

.question-card h2 {
  position: relative;
  z-index: 1;
  margin: 11px 0 12px;
  font-size: 15px;
  line-height: 1.65;
}

.evidence-row,
.chip-row {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.evidence-chip,
.data-chip,
.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 7px;
  border: 1px solid #cad4c8;
  background: rgba(255, 255, 255, 0.68);
  color: #55655d;
  font-size: 9px;
  font-weight: 600;
}

.data-chip::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--blue);
}

.data-chip.sensor::before {
  background: var(--green);
}

.data-chip.human::before {
  background: var(--amber);
}

.time-strip {
  min-height: 66px;
  margin-bottom: 11px;
  padding: 11px 14px;
  border: 1px solid var(--line);
  background: var(--surface);
  display: grid;
  grid-template-columns: 140px minmax(220px, 1fr) minmax(250px, auto);
  gap: 18px;
  align-items: center;
}

.time-label strong {
  display: block;
  margin-top: 3px;
  font: 600 18px "Outfit", sans-serif;
}

.observation-date {
  width: 128px;
  margin-top: 5px;
  padding: 5px 6px;
  border: 1px solid var(--line-strong);
  border-radius: 0;
  background: #fff;
  color: var(--ink);
  font: 10px "DM Mono", monospace;
}

.time-control {
  position: relative;
}

.time-control input {
  width: 100%;
  accent-color: var(--green);
}

.time-ticks {
  margin-top: 1px;
  display: flex;
  justify-content: space-between;
  color: #849089;
  font: 9px "DM Mono", monospace;
}

.season-presets {
  margin-top: 7px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.season-presets button {
  padding: 5px 7px;
  border: 1px solid var(--line);
  background: #f7f8f3;
  color: #4d6259;
  cursor: pointer;
  font-size: 8px;
}

.season-presets button:hover,
.season-presets button:focus-visible {
  border-color: var(--green);
  color: var(--green);
}

.time-context {
  color: #55655e;
  font-size: 11px;
  line-height: 1.55;
}

.time-context b {
  color: var(--ink);
}

.map-layout {
  min-height: 654px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  display: grid;
  grid-template-columns: minmax(0, 1fr) 390px;
  box-shadow: 0 2px 0 rgba(23, 60, 49, 0.04);
}

.city-map {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  min-height: 654px;
  background:
    radial-gradient(circle at 15% 90%, rgba(91, 173, 185, 0.45), transparent 27%),
    linear-gradient(145deg, #d8e4d8, #edf0df);
}

.cesium-stage {
  position: absolute;
  z-index: 2;
  inset: 0;
}

.fallback-city {
  position: absolute;
  z-index: 0;
  inset: 0;
  opacity: 0.82;
}

.fallback-grid {
  position: absolute;
  inset: 0;
  transform: skewY(-8deg) scale(1.2);
  opacity: 0.56;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.75) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.75) 1px, transparent 1px);
  background-size: 38px 38px;
}

.fallback-lake {
  position: absolute;
  left: -8%;
  bottom: -5%;
  width: 50%;
  height: 42%;
  border: 12px solid #b4d5c9;
  border-radius: 45% 60% 52% 38%;
  background: #82c2cc;
  transform: rotate(-12deg);
}

.map-status {
  position: absolute;
  z-index: 5;
  left: 15px;
  bottom: 14px;
  max-width: calc(100% - 330px);
  padding: 8px 10px;
  border: 1px solid rgba(214, 222, 213, 0.8);
  background: rgba(255, 254, 250, 0.92);
  color: #596860;
  font-size: 10px;
  backdrop-filter: blur(8px);
}

.terrain-attribution {
  position: absolute;
  z-index: 5;
  right: 15px;
  bottom: 14px;
  padding: 5px 7px;
  border: 1px solid rgba(214, 222, 213, 0.72);
  background: rgba(255, 254, 250, 0.86);
  color: #68766f;
  font-size: 9px;
  line-height: 1.2;
  backdrop-filter: blur(8px);
}

.status-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 6px;
  border-radius: 50%;
  background: var(--amber);
}

.status-dot.good {
  background: var(--lime);
}

.map-controls {
  position: absolute;
  z-index: 6;
  top: 14px;
  right: 14px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 7px 22px rgba(23, 60, 49, 0.15);
}

.map-controls button {
  width: 36px;
  height: 35px;
  border: 1px solid var(--line);
  background: rgba(255, 254, 250, 0.96);
  color: var(--ink);
  cursor: pointer;
  font-size: 18px;
}

.map-filters {
  position: absolute;
  z-index: 6;
  top: 14px;
  left: 14px;
  width: 208px;
  border: 1px solid rgba(216, 222, 215, 0.92);
  background: rgba(255, 254, 250, 0.94);
  box-shadow: 0 12px 35px rgba(23, 60, 49, 0.13);
  backdrop-filter: blur(12px);
}

.map-filter-section {
  padding: 12px 13px;
  border-bottom: 1px solid var(--line);
}

.map-filter-section:last-child {
  border-bottom: 0;
}

.map-filter-title {
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font: 500 9px "DM Mono", monospace;
  letter-spacing: 0.1em;
}

.layer-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px 6px;
}

.layer-list label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
}

.layer-list input {
  margin: 0;
  accent-color: var(--green);
}

.lod-select {
  width: 100%;
  padding: 8px 9px;
  border: 1px solid #cfd8cf;
  border-radius: 2px;
  background: #fff;
  color: var(--ink);
  font-size: 11px;
}

.lod-hint {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.5;
}

.lod-active {
  color: var(--green);
  font-weight: 700;
}

.detail-panel {
  position: relative;
  overflow: auto;
  max-height: 654px;
  border-left: 1px solid var(--line);
  background: var(--surface);
}

.detail-empty {
  padding: 58px 34px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.9;
}

.detail-empty strong {
  display: block;
  margin-bottom: 8px;
  color: var(--ink);
  font-size: 17px;
}

.detail-cover {
  position: relative;
  height: 150px;
  overflow: hidden;
  background: #dbe6dc;
}

.detail-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.height-badge {
  position: absolute;
  right: 12px;
  bottom: 11px;
  padding: 7px 9px;
  background: rgba(23, 60, 49, 0.9);
  color: #fff;
  font: 500 11px "DM Mono", monospace;
}

.detail-content {
  padding: 19px 20px 25px;
}

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

.status-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  background: #eaf2e6;
  color: #3b654b;
  font-size: 10px;
  font-weight: 700;
}

.status-label.question {
  background: #fff0d6;
  color: #8b621d;
}

.status-label.change {
  background: #e5f0f3;
  color: #42717b;
}

.detail-title {
  margin: 10px 0 2px;
  font-size: 22px;
  line-height: 1.35;
}

.detail-subtitle {
  margin: 0 0 13px;
  color: var(--muted);
  font-size: 11px;
}

.detail-actions {
  margin: 15px 0 17px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}

.button,
.button-secondary,
.button-ghost,
.icon-button {
  border: 0;
  border-radius: 3px;
  cursor: pointer;
  text-decoration: none;
  font-weight: 700;
}

.button {
  padding: 12px 16px;
  background: var(--dark);
  color: #fff;
}

.button-secondary {
  padding: 11px 14px;
  background: #e7f0e9;
  color: #2b6d54;
}

.button-ghost {
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--ink);
}

.detail-actions button {
  padding: 10px 8px;
  font-size: 11px;
}

.detail-section {
  margin-top: 19px;
  padding-top: 17px;
  border-top: 1px solid var(--line);
}

.section-title {
  margin-bottom: 11px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.section-title h3 {
  margin: 0;
  font-size: 12px;
}

.section-title span {
  color: var(--muted);
  font: 9px "DM Mono", monospace;
}

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

.metric {
  min-width: 0;
  padding: 9px 8px;
  background: #f3f5ef;
}

.metric span {
  display: block;
  overflow: hidden;
  color: var(--muted);
  font-size: 8px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metric strong {
  display: block;
  margin-top: 3px;
  font: 600 17px "Outfit", sans-serif;
}

.metric small {
  color: var(--muted);
  font-size: 8px;
}

.profile-note {
  margin: 10px 0 0;
  color: #53645b;
  font-size: 11px;
  line-height: 1.7;
}

.spark-bars {
  height: 52px;
  padding-top: 5px;
  display: flex;
  align-items: flex-end;
  gap: 3px;
  border-bottom: 1px solid var(--line);
}

.spark-bars span {
  flex: 1;
  min-height: 4px;
  border-radius: 2px 2px 0 0;
  background: linear-gradient(#64ad89, #287d62);
}

.spark-legend {
  margin-top: 5px;
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font: 8px "DM Mono", monospace;
}

.observation-snippet {
  padding: 11px 12px;
  border-left: 3px solid var(--amber);
  background: #faf6e9;
}

.observation-snippet p {
  margin: 5px 0 0;
  color: #4f5d56;
  font-size: 11px;
  line-height: 1.65;
}

.observation-meta {
  color: var(--muted);
  font-size: 9px;
}

.match-list {
  display: grid;
  gap: 7px;
}

.match-card {
  padding: 10px 11px;
  border: 1px solid var(--line);
  background: #fff;
}

.match-card button {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--green);
  cursor: pointer;
  font-size: 10px;
  font-weight: 700;
}

.match-card strong {
  display: block;
  margin-bottom: 3px;
  font-size: 11px;
}

.match-card p {
  margin: 0 0 7px;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.55;
}

.source-note {
  padding: 9px 10px;
  background: #f1f2ec;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.6;
}

.environment-loading {
  margin: 16px 0;
  padding: 14px;
  border: 1px solid var(--line);
  background: #f6f8f2;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 5px 8px;
  align-items: center;
  color: #52635b;
  font-size: 10px;
}

.environment-loading small,
.environment-loading span:not(.status-dot) {
  grid-column: 2;
  color: var(--muted);
}

.environment-loading.error {
  border-color: #deb1a8;
  background: #fff4f0;
}

.environment-advice {
  margin: 18px -7px 4px;
  padding: 15px;
  border: 1px solid #cbd8cc;
  background:
    radial-gradient(circle at 100% 0, rgba(216, 236, 112, 0.24), transparent 34%),
    #f7f9f1;
}

.environment-advice .section-title span {
  padding: 4px 6px;
  background: #e9f2d0;
  color: var(--green);
}

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

.environment-metrics > div {
  min-width: 0;
  padding: 9px;
  border: 1px solid rgba(205, 215, 205, 0.82);
  background: rgba(255, 255, 255, 0.78);
}

.environment-metrics > div.wide {
  grid-column: 1 / -1;
}

.environment-metrics span,
.environment-metrics small {
  display: block;
  color: var(--muted);
  font-size: 8px;
  line-height: 1.45;
}

.environment-metrics strong {
  display: block;
  margin: 3px 0 2px;
  color: var(--ink);
  font: 600 15px "Outfit", sans-serif;
}

.ai-comment {
  margin-top: 9px;
  padding: 11px 12px;
  border-left: 3px solid var(--green);
  background: #fff;
}

.ai-comment > span {
  color: var(--green);
  font: 8px "DM Mono", monospace;
  letter-spacing: 0.04em;
}

.ai-comment p {
  margin: 6px 0 8px;
  color: #42584f;
  font-size: 10px;
  line-height: 1.7;
}

.driver-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.driver-list span {
  padding: 3px 5px;
  background: #edf2e8;
  color: #516158;
  font-size: 8px;
}

.confidence-row {
  margin-top: 8px;
  padding: 8px 10px;
  background: #fff7df;
  color: #66562d;
  display: grid;
  gap: 3px;
  font-size: 9px;
  line-height: 1.5;
}

.environment-actions {
  margin-top: 9px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
}

.environment-actions button {
  min-height: 34px;
  padding: 7px 6px;
  font-size: 9px;
}

.threshold-note {
  margin-top: 8px;
  color: var(--muted);
  font-size: 8px;
}

.human-event-summary {
  margin-top: 8px;
  padding: 8px 9px;
  border-left: 3px solid var(--amber);
  background: #fff8e8;
  display: grid;
  gap: 3px;
  color: #675936;
  font-size: 8px;
}

.environment-chart-head,
.chart-axis-note {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 8px;
}

.chart-legend span {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  color: var(--muted);
  font-size: 8px;
}

.chart-legend i {
  width: 12px;
  height: 5px;
}

.chart-legend i.dash {
  height: 0;
  border-top: 2px dashed;
  background: transparent !important;
}

.data-kind {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 8px;
}

.timeline-range-switch {
  flex: 0 0 auto;
  display: flex;
  gap: 2px;
}

.timeline-range-switch button {
  padding: 4px 6px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  cursor: pointer;
  font-size: 8px;
}

.timeline-range-switch button.active {
  border-color: var(--green);
  background: var(--green);
  color: #fff;
}

.environment-canvas {
  width: 100%;
  height: 190px;
  margin-top: 8px;
  border: 1px solid var(--line);
  background: #fff;
}

.chart-axis-note {
  margin-top: 4px;
  color: var(--muted);
  font: 8px "DM Mono", monospace;
}

.data-provenance dl {
  margin: 0;
  display: grid;
  gap: 5px;
}

.historical-replay-card {
  padding: 14px !important;
  border: 1px solid #d8cba6 !important;
  background: #fffaf0;
}

.historical-replay-card p {
  margin: 0 0 8px;
  color: #625b49;
  font-size: 9px;
  line-height: 1.6;
}

.replay-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.replay-facts span {
  padding: 4px 6px;
  background: #fff;
  color: #625b49;
  font-size: 8px;
}

.data-provenance dl div {
  padding: 7px 8px;
  background: #f5f6f1;
}

.data-provenance dt {
  color: var(--muted);
  font-size: 8px;
}

.data-provenance dd {
  margin: 2px 0 0;
  color: #43564e;
  font-size: 9px;
  line-height: 1.5;
}

.source-warning {
  padding: 7px 8px;
  background: #fff2e7;
  color: #785039;
  font-size: 9px;
}

.sensor-import-button {
  padding: 9px 10px;
  border: 1px dashed var(--green);
  background: #f2f7ef;
  color: var(--green);
  cursor: pointer;
  display: inline-flex;
  font-size: 9px;
  font-weight: 700;
}

.sensor-import-button input {
  display: none;
}

.sensor-settings details {
  margin-top: 10px;
}

.sensor-settings summary {
  cursor: pointer;
  color: var(--green);
  font-size: 9px;
  font-weight: 700;
}

.calibration-grid {
  margin-top: 9px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.calibration-grid label {
  color: var(--muted);
  font-size: 8px;
}

.calibration-grid input {
  width: 100%;
  margin-top: 3px;
  padding: 6px;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 9px;
}

.calibration-grid button {
  grid-column: 1 / -1;
}

.compare-drawer {
  margin-top: 11px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.compare-head {
  min-height: 50px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.compare-head h2 {
  margin: 0;
  font-size: 13px;
}

.compare-head p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 9px;
}

.compare-actions {
  display: flex;
  gap: 7px;
}

.compare-actions button {
  padding: 8px 10px;
  font-size: 10px;
}

.compare-grid {
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: 124px repeat(var(--compare-count, 2), minmax(140px, 1fr));
}

.compare-cell {
  min-height: 39px;
  padding: 9px 11px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  font-size: 10px;
}

.compare-cell:nth-child(odd) {
  background: rgba(243, 245, 239, 0.55);
}

.compare-cell.label {
  color: var(--muted);
  font-weight: 600;
}

.compare-cell strong {
  display: block;
  font-size: 11px;
}

.compare-cell button {
  float: right;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.compare-empty {
  padding: 20px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  text-align: center;
  font-size: 11px;
}

.page {
  max-width: 1180px;
  margin: 0 auto;
  padding: 46px 4.5vw 70px;
}

.page-header {
  margin-bottom: 27px;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
}

.page-header h1 {
  margin: 7px 0 8px;
  font-size: clamp(26px, 3vw, 39px);
  line-height: 1.3;
}

.page-header p {
  max-width: 650px;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.75;
}

.page-header-actions {
  display: flex;
  gap: 8px;
}

.timeline-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 22px;
  align-items: start;
}

.timeline-feed {
  display: grid;
  gap: 13px;
}

.timeline-card {
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--surface);
}

.timeline-card-inner {
  padding: 18px;
}

.timeline-author {
  display: flex;
  align-items: center;
  gap: 9px;
}

.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #dce9dd;
  color: var(--green);
  display: grid;
  place-items: center;
  font: 600 11px "Outfit", sans-serif;
}

.timeline-author strong {
  display: block;
  font-size: 11px;
}

.timeline-author span {
  color: var(--muted);
  font-size: 9px;
}

.timeline-card h2 {
  margin: 14px 0 7px;
  font-size: 16px;
}

.timeline-card p {
  margin: 0;
  color: #526159;
  font-size: 12px;
  line-height: 1.8;
}

.timeline-photo {
  width: 100%;
  max-height: 340px;
  margin-top: 14px;
  object-fit: cover;
}

.snapshot {
  margin-top: 13px;
  padding: 10px 11px;
  background: #f1f3ed;
  display: flex;
  flex-wrap: wrap;
  gap: 11px;
  color: var(--muted);
  font-size: 9px;
}

.snapshot b {
  color: var(--ink);
}

.timeline-actions {
  min-height: 45px;
  padding: 8px 14px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 6px;
}

.timeline-actions button,
.timeline-actions a {
  padding: 7px 9px;
  border: 0;
  background: transparent;
  color: var(--green);
  cursor: pointer;
  text-decoration: none;
  font-size: 10px;
  font-weight: 700;
}

.timeline-actions .count {
  color: var(--muted);
  font-weight: 500;
}

.comments {
  padding: 12px 18px 16px;
  border-top: 1px solid var(--line);
  background: #fafaf5;
}

.comment {
  margin-bottom: 8px;
  color: #58665f;
  font-size: 10px;
  line-height: 1.55;
}

.comment b {
  color: var(--ink);
}

.comment-form {
  display: flex;
  gap: 6px;
}

.comment-form input {
  flex: 1;
  min-width: 0;
  padding: 8px 9px;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 10px;
}

.comment-form button {
  padding: 8px 10px;
  border: 0;
  background: var(--dark);
  color: #fff;
  cursor: pointer;
  font-size: 9px;
  font-weight: 700;
}

.sidebar-card {
  margin-bottom: 12px;
  padding: 17px;
  border: 1px solid var(--line);
  background: var(--surface);
}

.sidebar-card h2 {
  margin: 0 0 10px;
  font-size: 13px;
}

.sidebar-card p {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.7;
}

.summary-stat {
  margin-top: 10px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.summary-stat div {
  padding: 9px;
  background: #f2f4ed;
}

.summary-stat strong {
  display: block;
  font: 600 19px "Outfit", sans-serif;
}

.summary-stat span {
  color: var(--muted);
  font-size: 8px;
}

.mission-hero {
  position: relative;
  overflow: hidden;
  min-height: 260px;
  padding: 35px;
  background: var(--dark);
  color: #fff;
}

.mission-hero::before,
.mission-hero::after {
  content: "";
  position: absolute;
  border: 1px solid rgba(185, 216, 76, 0.28);
  border-radius: 50%;
}

.mission-hero::before {
  right: -90px;
  bottom: -170px;
  width: 440px;
  height: 440px;
}

.mission-hero::after {
  right: 44px;
  bottom: -70px;
  width: 230px;
  height: 230px;
}

.mission-hero-content {
  position: relative;
  z-index: 1;
  max-width: 680px;
}

.mission-hero .eyebrow {
  color: var(--lime);
}

.mission-hero h1 {
  margin: 10px 0 12px;
  font-size: clamp(26px, 3.5vw, 43px);
}

.mission-hero p {
  margin: 0 0 21px;
  color: #d5e1db;
  line-height: 1.85;
  font-size: 12px;
}

.mission-meta {
  margin-top: 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.mission-meta span {
  padding: 6px 8px;
  border: 1px solid rgba(255, 255, 255, 0.23);
  color: #e8efeb;
  font-size: 9px;
}

.mission-grid {
  margin-top: 18px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.mission-panel {
  padding: 23px;
  border: 1px solid var(--line);
  background: var(--surface);
}

.mission-panel h2 {
  margin: 0 0 14px;
  font-size: 15px;
}

.mission-steps {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: steps;
}

.mission-steps li {
  position: relative;
  min-height: 43px;
  padding: 3px 0 14px 41px;
  color: #56635d;
  font-size: 11px;
  line-height: 1.65;
  counter-increment: steps;
}

.mission-steps li::before {
  content: counter(steps);
  position: absolute;
  top: 0;
  left: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #e7f0e9;
  color: var(--green);
  display: grid;
  place-items: center;
  font: 600 11px "Outfit", sans-serif;
}

.participant-list {
  display: grid;
  gap: 8px;
}

.participant {
  padding: 10px 11px;
  border: 1px solid var(--line);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
}

.participant strong {
  display: block;
  font-size: 11px;
}

.participant span {
  color: var(--muted);
  font-size: 9px;
}

.mission-result {
  margin-top: 18px;
  padding: 22px;
  border: 1px solid #ccd7c6;
  background: #edf3e8;
}

.mission-result h2 {
  margin: 0 0 12px;
  font-size: 15px;
}

.mission-result-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.mission-result-grid div {
  padding: 11px;
  background: rgba(255, 255, 255, 0.72);
}

.mission-result-grid strong {
  display: block;
  font-size: 11px;
}

.mission-result-grid span {
  color: var(--muted);
  font-size: 9px;
}

.cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.card {
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--surface);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}

.card img,
.card-image-placeholder {
  display: block;
  width: 100%;
  height: 176px;
  object-fit: cover;
  background: linear-gradient(135deg, #dbe8dc, #e9e8d4);
}

.card-body {
  padding: 16px;
}

.category {
  display: inline-block;
  padding: 4px 7px;
  background: #e4f0e8;
  color: #2c6c54;
  font-size: 9px;
  font-weight: 700;
}

.category.bee {
  background: #fff0d3;
  color: #8d631e;
}

.card h2 {
  margin: 9px 0 6px;
  font-size: 17px;
}

.card p {
  min-height: 44px;
  margin: 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.65;
}

.card-stats {
  margin-top: 13px;
  display: flex;
  gap: 6px;
}

.card-stats span {
  padding: 5px 7px;
  background: #f1f3ed;
  color: #59665f;
  font-size: 8px;
}

.card-footer {
  margin-top: 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 7px;
  color: var(--muted);
  font-size: 9px;
}

.text-link {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--green);
  cursor: pointer;
  font-size: 10px;
  font-weight: 700;
}

.empty {
  padding: 65px;
  border: 1px dashed var(--line-strong);
  background: var(--surface);
  color: var(--muted);
  text-align: center;
}

.form-wrap {
  max-width: 850px;
  padding: 30px;
  border: 1px solid var(--line);
  background: var(--surface);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.field {
  display: grid;
  gap: 7px;
}

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

.field label {
  font-size: 11px;
  font-weight: 700;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 11px;
  border: 1px solid #cfd8cf;
  border-radius: 2px;
  background: #fff;
  color: var(--ink);
  font-size: 12px;
}

.field textarea {
  min-height: 100px;
  resize: vertical;
}

.req {
  margin-left: 4px;
  color: var(--red);
}

.form-tip {
  margin: 0;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.55;
}

.image-preview {
  display: none;
  width: 190px;
  height: 110px;
  border: 1px solid var(--line);
  object-fit: cover;
}

.image-preview.visible {
  display: block;
}

.form-actions {
  margin-top: 25px;
  padding-top: 19px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 12px;
}

.modal-backdrop {
  position: fixed;
  z-index: 500;
  inset: 0;
  padding: 24px;
  background: rgba(13, 31, 25, 0.55);
  display: grid;
  place-items: center;
  backdrop-filter: blur(5px);
}

.modal {
  overflow: auto;
  width: min(560px, 100%);
  max-height: calc(100vh - 48px);
  padding: 24px;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: 0 30px 90px rgba(13, 31, 25, 0.28);
}

.modal-head {
  margin-bottom: 19px;
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 20px;
}

.modal-head h2 {
  margin: 5px 0 0;
  font-size: 20px;
}

.modal-close {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}

.quick-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.quick-tag {
  padding: 7px 9px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  cursor: pointer;
  font-size: 10px;
}

.quick-tag.active {
  border-color: var(--green);
  background: #e8f1e9;
  color: var(--green);
  font-weight: 700;
}

.beacon-types {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}

.beacon-types label {
  padding: 10px;
  border: 1px solid var(--line);
  font-size: 10px;
}

.beacon-types input {
  margin-right: 6px;
  accent-color: var(--green);
}

.toast {
  position: fixed;
  z-index: 700;
  right: 22px;
  bottom: 22px;
  max-width: 360px;
  padding: 12px 15px;
  border-left: 4px solid var(--lime);
  background: var(--dark);
  color: #fff;
  box-shadow: var(--shadow);
  font-size: 11px;
  line-height: 1.55;
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

[hidden] {
  display: none !important;
}

.role-control {
  margin-left: 18px;
  padding-left: 16px;
  border-left: 1px solid var(--line);
  display: grid;
  gap: 3px;
  flex: 0 0 auto;
}

.role-control span {
  color: var(--muted);
  font: 8px "DM Mono", monospace;
  letter-spacing: 0.08em;
}

.role-control select {
  padding: 5px 25px 5px 7px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font-size: 10px;
  font-weight: 700;
}

.role-readonly,
.permission-badge {
  display: inline-flex;
  align-items: center;
  padding: 7px 9px;
  border: 1px solid var(--line);
  background: #f1f2ec;
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
}

.permission-badge.admin {
  border-color: #c9bfa8;
  background: #f7f0df;
  color: #745a24;
}

.access-denied {
  max-width: 680px;
  padding: 42px;
  border: 1px solid var(--line);
  background: var(--surface);
}

.access-denied h1 {
  margin: 8px 0 12px;
  font-size: 26px;
}

.access-denied p {
  margin: 0 0 22px;
  color: var(--muted);
  line-height: 1.8;
}

.import-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 17px;
  align-items: start;
}

.import-panel,
.import-guide,
.integration-card,
.role-matrix {
  padding: 23px;
  border: 1px solid var(--line);
  background: var(--surface);
}

.import-panel h2,
.import-guide h2,
.integration-card h2,
.role-matrix h2 {
  margin: 7px 0 13px;
  font-size: 17px;
}

.import-textarea {
  min-height: 250px !important;
  font: 10px/1.65 "DM Mono", monospace !important;
  white-space: pre;
}

.import-divider {
  margin: 18px 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
  text-align: center;
  font-size: 9px;
}

.import-divider span {
  position: relative;
  top: -8px;
  padding: 0 8px;
  background: var(--surface);
}

.field-guide {
  margin: 0;
}

.field-guide div {
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
}

.field-guide dt {
  color: var(--green);
  font: 500 10px "DM Mono", monospace;
}

.field-guide dd {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.65;
}

.import-preview-panel {
  margin-top: 17px;
}

.import-empty {
  padding: 42px 20px;
  border: 1px dashed var(--line-strong);
  color: var(--muted);
  text-align: center;
  font-size: 11px;
}

.import-summary {
  padding: 11px 13px;
  background: #e9f2e8;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 17px;
  align-items: center;
  font-size: 10px;
}

.import-summary.has-errors {
  background: #fff0e9;
}

.import-table-wrap {
  overflow: auto;
  margin-top: 12px;
}

.import-table {
  width: 100%;
  min-width: 820px;
  border-collapse: collapse;
  font-size: 9px;
}

.import-table th,
.import-table td {
  padding: 9px;
  border: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.import-table th {
  background: #f1f3ed;
}

.import-table small {
  color: var(--muted);
}

.import-table .row-error {
  background: #fff8f4;
}

.import-error {
  color: var(--red);
  font-weight: 700;
}

.import-ok {
  color: var(--green);
  font-weight: 700;
}

.integration-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 17px;
  margin-bottom: 17px;
}

.integration-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
}

.integration-head > div {
  display: flex;
  gap: 10px;
  align-items: center;
}

.integration-head h2,
.integration-head p {
  margin: 0;
}

.integration-head p,
.integration-card > p {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.7;
}

.integration-logo {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: #06c755;
  color: #fff;
  display: grid;
  place-items: center;
  font: 700 11px "Outfit", sans-serif;
}

.connection-status {
  padding: 5px 7px;
  border: 1px solid #d5b9ad;
  color: #9a5c48;
  font-size: 8px;
  font-weight: 700;
}

.line-preview {
  margin: 18px 0;
  padding: 18px;
  border-radius: 6px;
  background: #7bb4d1;
}

.line-message {
  width: 88%;
  padding: 11px;
  border-radius: 4px 12px 12px;
  background: #fff;
}

.line-message small {
  color: var(--green);
  font-weight: 700;
}

.line-message p {
  margin: 7px 0;
  color: var(--ink);
  font-size: 10px;
  line-height: 1.6;
}

.line-message span {
  color: #1683aa;
  font-size: 9px;
}

.integration-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.integration-options label {
  padding: 9px;
  background: #f2f4ee;
  font-size: 9px;
}

.integration-options input {
  accent-color: var(--green);
}

.api-grid {
  align-items: stretch;
}

.api-endpoint {
  margin: 12px 0;
  display: flex;
  gap: 9px;
  align-items: center;
}

.api-endpoint span {
  padding: 5px 7px;
  background: var(--green);
  color: #fff;
  font: 700 9px "DM Mono", monospace;
}

.api-endpoint code {
  font: 11px "DM Mono", monospace;
}

.code-sample {
  overflow: auto;
  margin: 0;
  padding: 15px;
  background: #162a23;
  color: #d9eccb;
  font: 9px/1.7 "DM Mono", monospace;
}

.integration-flow {
  margin: 12px 0 0;
  padding-left: 22px;
  color: #55645c;
  font-size: 10px;
  line-height: 2;
}

.role-matrix {
  margin-top: 17px;
}

.role-table {
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.role-row {
  display: grid;
  grid-template-columns: 2fr repeat(3, 1fr);
}

.role-row > * {
  padding: 9px 11px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  font-size: 10px;
  text-align: center;
}

.role-row > :first-child {
  text-align: left;
}

.role-row.head {
  background: #eef1ea;
}

.cesium-viewer-bottom,
.cesium-viewer-toolbar {
  display: none !important;
}

@media (max-width: 1120px) {
  .role-control {
    margin-left: 10px;
    padding-left: 10px;
  }

  .topbar nav {
    gap: 10px;
  }

  .topbar nav a {
    font-size: 11px;
  }

  .map-layout {
    grid-template-columns: minmax(0, 1fr) 345px;
  }

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

@media (max-width: 900px) {
  .topbar {
    padding: 0 18px;
  }

  .topbar nav a:not(.nav-admin):not([data-route="map"]) {
    display: none;
  }

  .role-control {
    margin-left: auto;
  }

  .map-page {
    padding: 18px;
  }

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

  .map-heading {
    padding-top: 0;
  }

  .time-strip {
    grid-template-columns: 100px 1fr;
  }

  .time-context {
    grid-column: 1 / -1;
  }

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

  .city-map {
    min-height: 570px;
  }

  .detail-panel {
    max-height: none;
    border-top: 1px solid var(--line);
    border-left: 0;
  }

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

  .import-layout,
  .integration-grid {
    grid-template-columns: 1fr;
  }

  .timeline-sidebar {
    order: -1;
  }

  .cards {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .brand {
    font-size: 15px;
  }

  .brand small {
    display: none;
  }

  .topbar nav .nav-admin {
    display: none;
  }

  .role-control span {
    display: none;
  }

  .map-page {
    padding: 14px 12px 30px;
  }

  .map-heading p {
    display: none;
  }

  .question-card {
    padding: 16px;
  }

  .time-strip {
    grid-template-columns: 82px 1fr;
    gap: 10px;
  }

  .city-map {
    min-height: 540px;
  }

  .map-filters {
    width: 184px;
  }

  .map-filter-section {
    padding: 10px;
  }

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

  .map-status {
    right: 12px;
    bottom: 42px;
    max-width: none;
  }

  .terrain-attribution {
    right: 12px;
    bottom: 12px;
  }

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

  .compare-grid {
    overflow-x: auto;
    grid-template-columns: 90px repeat(var(--compare-count, 2), 145px);
  }

  .page {
    padding: 30px 18px 55px;
  }

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

  .cards,
  .mission-grid,
  .mission-result-grid {
    grid-template-columns: 1fr;
  }

  .mission-hero {
    padding: 26px 22px;
  }

  .form-wrap {
    padding: 19px;
  }

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

  .field.full {
    grid-column: auto;
  }

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

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

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

@media (max-width: 640px) {
  .observation-date {
    width: 100%;
    padding-inline: 3px;
    font-size: 8px;
  }

  .season-presets {
    grid-column: 1 / -1;
  }

  .season-presets button {
    flex: 1 1 30%;
  }

  .environment-metrics,
  .environment-actions,
  .calibration-grid {
    grid-template-columns: 1fr;
  }

  .environment-metrics > div.wide,
  .calibration-grid button {
    grid-column: auto;
  }
}
