:root {
  --bg: #f3efe4;
  --surface: rgba(255, 252, 245, 0.9);
  --surface-strong: #fffdf7;
  --text: #1f2933;
  --muted: #6b7280;
  --line: rgba(63, 78, 68, 0.12);
  --accent: #2f5d50;
  --accent-soft: #dbe8dd;
  --alert: #b9352f;
  --warning: #d09b2e;
  --shadow: 0 24px 60px rgba(45, 55, 63, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.8), transparent 38%),
    linear-gradient(180deg, #e6ecdf 0%, var(--bg) 42%, #efe7d7 100%);
}

a {
  color: inherit;
  text-decoration: none;
}

.page-shell {
  width: min(1280px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 48px;
}

.site-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 18px;
}

.site-brand {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--accent);
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.site-nav a {
  color: var(--muted);
}

.messages {
  display: grid;
  gap: 12px;
  margin-bottom: 18px;
}

.message {
  padding: 14px 18px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(255, 252, 245, 0.92);
  box-shadow: var(--shadow);
}

.message-success {
  border-color: rgba(46, 125, 50, 0.28);
}

.toolbelt {
  display: grid;
  grid-template-columns: minmax(220px, 1.1fr) minmax(0, 1.6fr) auto;
  gap: 16px;
  align-items: center;
  margin-bottom: 22px;
}

.search-box,
.filter-chips,
.quick-actions {
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255, 252, 245, 0.82);
  box-shadow: var(--shadow);
}

.search-box {
  display: grid;
  gap: 6px;
  padding: 14px 18px;
}

.search-box span {
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.search-box input {
  border: 0;
  background: transparent;
  font: inherit;
  color: var(--text);
  outline: none;
}

.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px;
}

.filter-chip {
  border: 0;
  border-radius: 999px;
  padding: 10px 14px;
  background: rgba(47, 93, 80, 0.08);
  color: var(--accent);
  font: inherit;
  cursor: pointer;
  transition: transform 140ms ease, background-color 140ms ease;
}

.filter-chip:hover,
.filter-chip.active {
  background: var(--accent);
  color: white;
  transform: translateY(-1px);
}

.quick-actions {
  display: flex;
  gap: 10px;
  padding: 10px;
}

.action-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 12px 16px;
  background: var(--accent);
  color: white;
  white-space: nowrap;
}

.action-button-soft {
  background: rgba(47, 93, 80, 0.12);
  color: var(--accent);
}

.hero,
.detail-hero {
  display: grid;
  gap: 24px;
  align-items: start;
  margin-bottom: 28px;
}

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

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

.hero-copy,
.panel,
.fact-card,
.stat-card {
  backdrop-filter: blur(10px);
}

.hero-copy,
.panel,
.fact-card,
.stat-card,
.nest-card,
.stack-item {
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.hero-copy {
  padding: 28px;
}

.hero-copy h1,
.detail-hero h1 {
  margin: 0;
  font-size: clamp(2.2rem, 4vw, 4.5rem);
  line-height: 0.98;
  letter-spacing: -0.03em;
}

.hero-text,
.soft-text {
  color: var(--muted);
}

.eyebrow,
.panel-kicker {
  margin: 0 0 12px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.76rem;
  color: var(--accent);
}

.hero-stats,
.detail-facts {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.stat-card,
.fact-card {
  padding: 20px;
}

.stat-card-alert {
  background: rgba(185, 53, 47, 0.08);
}

.stat-card-warning {
  background: rgba(208, 155, 46, 0.12);
}

.stat-label,
.fact-card span {
  display: block;
  color: var(--muted);
  font-size: 0.92rem;
  margin-bottom: 8px;
}

.stat-value,
.fact-card strong {
  font-size: 2rem;
}

.dashboard-grid {
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(12, minmax(0, 1fr));
}

.panel {
  padding: 22px;
  grid-column: span 4;
}

.panel-wide,
.panel-map {
  grid-column: span 8;
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
  margin-bottom: 18px;
}

.panel-heading h2 {
  margin: 0;
  font-size: 1.6rem;
}

.chip {
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.82rem;
}

.leaflet-board {
  min-height: 440px;
  border-radius: 28px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.7);
}

.panel-map {
  position: relative;
}

.map-floating-action {
  position: absolute;
  right: 22px;
  top: 22px;
  z-index: 500;
  padding: 12px 16px;
  border-radius: 999px;
  background: rgba(255, 252, 245, 0.96);
  color: var(--accent);
  font-weight: 700;
  box-shadow: var(--shadow);
}

.map-empty-overlay {
  position: absolute;
  left: 38px;
  right: 38px;
  bottom: 84px;
  padding: 18px 20px;
  border-radius: 20px;
  background: rgba(255, 252, 245, 0.88);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.map-empty-overlay h3 {
  margin: 0 0 8px;
}

.map-empty-overlay p {
  margin: 0;
  color: var(--muted);
}

.map-hint {
  margin: 14px 4px 0;
}

.map-popup strong {
  display: block;
  margin-bottom: 6px;
}

.map-popup p {
  margin: 0 0 6px;
  color: #46525c;
}

.map-popup-actions {
  display: flex;
  gap: 12px;
  margin-top: 10px;
}

.map-popup-actions a {
  color: var(--accent);
  font-weight: 700;
}

.inline-actions {
  margin-top: 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.selected-nest-badge {
  display: inline-flex;
  margin-top: 18px;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(47, 93, 80, 0.1);
  color: var(--accent);
  font-weight: 700;
}

.create-grid .panel-map {
  grid-column: span 5;
}

.create-grid .panel-wide {
  grid-column: span 7;
}

.location-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 12px;
  margin-bottom: 16px;
}

.search-box-map {
  margin: 0;
}

.form-layout {
  display: grid;
  gap: 20px;
}

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

.form-field {
  display: grid;
  gap: 8px;
}

.form-field-wide {
  grid-column: span 2;
}

.form-field label {
  font-weight: 700;
}

.form-field input,
.form-field textarea,
.form-field select {
  width: 100%;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  color: var(--text);
  font: inherit;
}

.form-field small {
  color: var(--muted);
}

.errorlist {
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--alert);
  font-size: 0.92rem;
}

.form-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

.checkbox-field {
  align-content: end;
}

.checkbox-field label {
  display: flex;
  gap: 10px;
  align-items: center;
}

.checkbox-field input[type="checkbox"] {
  width: auto;
  transform: scale(1.2);
}

.checkbox-field small {
  grid-column: 1 / -1;
}

.schedule-preview {
  display: grid;
  gap: 12px;
}

.schedule-date {
  font-size: clamp(2rem, 4vw, 3.6rem);
  line-height: 1;
  letter-spacing: -0.03em;
}

.operation-photo-link {
  display: inline-block;
  margin: 10px 0 6px;
}

.operation-photo {
  display: block;
  width: min(280px, 100%);
  border-radius: 18px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.search-results {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.search-result,
.search-result-empty {
  width: 100%;
  text-align: left;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(255, 252, 245, 0.88);
  color: var(--text);
}

.search-result {
  cursor: pointer;
}

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

.search-result span {
  margin-top: 6px;
  color: var(--muted);
}

.stack-list,
.timeline,
.district-list {
  display: grid;
  gap: 14px;
}

.stack-item,
.nest-card {
  display: block;
  padding: 16px 18px;
}

.stack-item {
  background: var(--surface-strong);
}

.stack-item span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
}

.stack-item-red {
  border-left: 6px solid var(--alert);
}

.stack-item-yellow {
  border-left: 6px solid var(--warning);
}

.timeline-item {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.timeline-item:first-child {
  padding-top: 0;
  border-top: 0;
}

.timeline-date {
  font-size: 0.88rem;
  color: var(--muted);
}

.timeline-body strong {
  display: block;
  margin-bottom: 6px;
}

.timeline-body p {
  margin: 0 0 6px;
}

.nest-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.nest-card {
  background: var(--surface-strong);
}

.nest-card[hidden] {
  display: none;
}

.nest-card h3 {
  margin: 10px 0 8px;
  font-size: 1.22rem;
}

.nest-card p {
  margin: 0 0 12px;
  color: var(--muted);
}

.nest-card-top,
.nest-meta,
.district-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.nest-meta {
  flex-direction: column;
  align-items: start;
  color: var(--muted);
  font-size: 0.92rem;
}

.nest-actions {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.text-link {
  color: var(--accent);
  font-weight: 700;
  font-size: 0.95rem;
}

.text-link:hover {
  text-decoration: underline;
}

.signal-green {
  background: #2e7d32;
}

.signal-yellow {
  background: #d09b2e;
}

.signal-red {
  background: #b9352f;
}

.signal-gray {
  background: #6b7280;
}

.signal {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 999px;
}

.district-row {
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.district-row:first-child {
  border-top: 0;
}

.empty-state {
  padding: 28px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.55);
  border: 1px dashed rgba(47, 93, 80, 0.24);
}

.empty-state h3 {
  margin-top: 0;
}

.back-link {
  display: inline-block;
  margin-bottom: 20px;
  color: var(--accent);
}

.detail-grid {
  align-items: start;
}

.detail-copy p {
  margin: 0 0 12px;
}

@media (max-width: 1024px) {
  .toolbelt {
    grid-template-columns: 1fr;
  }

  .create-grid .panel-map,
  .create-grid .panel-wide {
    grid-column: span 12;
  }

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

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

  .panel,
  .panel-wide,
  .panel-map {
    grid-column: span 12;
  }
}

@media (max-width: 720px) {
  .page-shell {
    width: min(100% - 20px, 1280px);
    padding: 20px 0 32px;
  }

  .quick-actions {
    flex-direction: column;
  }

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

  .form-field-wide {
    grid-column: span 1;
  }

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

  .hero-stats,
  .detail-facts {
    grid-template-columns: 1fr;
  }

  .timeline-item {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .leaflet-board {
    min-height: 320px;
  }

  .map-empty-overlay {
    left: 24px;
    right: 24px;
    bottom: 72px;
  }

  .map-floating-action {
    position: static;
    display: inline-flex;
    margin-bottom: 14px;
  }
}
