:root {
  --bg: #f4f7fb;
  --card: #ffffff;
  --text: #213547;
  --muted: #617085;
  --line: #d9e3ef;
  --blue: #0b5cad;
  --blue-soft: #eef6ff;
  --shadow: 0 10px 30px rgba(31, 52, 84, 0.08);
  --radius: 18px;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Segoe UI", Tahoma, sans-serif;
  background: var(--bg);
  color: var(--text);
}

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

.hero {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}

.hero h1 {
  margin: 0 0 6px;
  font-size: 2rem;
}

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

.meta-strip {
  display: grid;
  grid-template-columns: repeat(2, minmax(260px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.meta-card,
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.meta-card {
  padding: 18px 22px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
}

.meta-label {
  color: var(--blue);
  font-weight: 700;
}

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

.map-panel,
.control-panel {
  padding: 18px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 10px;
}

.panel-head h2,
.control-panel h3,
.control-panel h4 {
  margin-top: 0;
}

.panel-note {
  color: var(--muted);
  font-size: 0.95rem;
}

#map {
  width: 100%;
  height: 820px;
}

.label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
}

select {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: 1rem;
  margin-bottom: 14px;
  background: #fff;
}

.desc-box,
.tip-box {
  background: #f8fbff;
  border: 1px solid #d7e7fb;
  border-radius: 14px;
  padding: 14px;
  margin: 14px 0;
}

.desc-title {
  font-weight: 700;
  color: var(--blue);
  margin-bottom: 6px;
}

.legend-item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: 12px;
}

.legend-dot {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  margin-top: 4px;
  flex: 0 0 14px;
}

.legend-main {
  font-weight: 700;
}

.legend-sub {
  color: var(--muted);
  font-size: 0.92rem;
}

.footer {
  margin-top: 18px;
  padding: 18px;
  color: var(--muted);
  text-align: center;
  font-size: 0.95rem;
}

.index-link {
  margin: 10px 0 16px 0;
  font-size: 0.9rem;
}

.index-link a {
  color: #2563eb;
  text-decoration: none;
  font-weight: 500;
}

.index-link a:hover {
  text-decoration: underline;
  color: #1d4ed8;
}

.search-box {
  margin-bottom: 16px;
}

#searchInput {
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid #ccc;
}

.suggestions {
  margin-top: 6px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid #ddd;
  max-height: 200px;
  overflow-y: auto;
  display: none;
}

.suggestion-item {
  padding: 8px 10px;
  cursor: pointer;
}

.suggestion-item:hover {
  background: #f3f4f6;
}

.search-wrapper {
  position: relative;
}

.clear-btn {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  cursor: pointer;
  font-size: 14px;
  color: #999;
  display: none;
}

.clear-btn:hover {
  color: #333;
}

.search-box {
  background: #b1cef0;
  padding: 10px;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
}

/* =========================================================
   AGRO DATA STORY PANEL
========================================================= */

.agro-story-panel {
  margin-top: 14px;
  background: #ffffff;
  border: 1px solid #dfe5ec;
  border-radius: 14px;
  padding: 16px 16px 14px 16px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.04);
}

.agro-story-header {
  margin-bottom: 10px;
}

.agro-story-header h3 {
  margin: 0 0 6px 0;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.3;
  color: #1f2937;
}

#agro-story-meta {
  font-size: 12px;
  color: #6b7280;
  line-height: 1.4;
}

.agro-story-body {
  line-height: 1.7;
}

.agro-story-short {
  margin: 0 0 10px 0;
  font-size: 14px;
  font-weight: 600;
  color: #1f2937;
}

.agro-story-full {
  margin: 0;
  font-size: 14px;
  color: #374151;
  white-space: normal;
}

.agro-story-rec-wrap {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed #d1d5db;
}

.agro-story-rec-title {
  margin-bottom: 4px;
  font-size: 12px;
  font-weight: 700;
  color: #4b5563;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.agro-story-recommendation {
  margin: 0;
  font-size: 14px;
  color: #374151;
}

.agro-story-panel.has-story {
  border-color: #cfd8e3;
}

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

  #map {
    height: 620px;
  }
}
