:root {
  --bg: #f8f7f4;
  --card: #ffffff;
  --text: #161616;
  --muted: #6b6b6b;
  --line: #ebe8e1;
  --high: #c0392b;
  --medium: #d35400;
  --accent: #1a2f28;
  --shadow: 0 10px 30px rgba(22, 22, 22, 0.05);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }
.wrap { max-width: 1200px; margin: 0 auto; padding: 0 22px 48px; }

/* Nav */
.nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}
.brand {
  display: flex;
  gap: 10px;
  align-items: center;
  font-weight: 700;
  text-decoration: none;
  font-size: 15px;
  letter-spacing: -0.01em;
}
.brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 700;
}
.nav-links {
  display: flex;
  gap: 20px;
  font-size: 14px;
  color: var(--muted);
}
.nav-links a {
  text-decoration: none;
}
.nav-links a:hover { color: var(--text); }

/* Header */
.page-header { margin: 28px 0 20px; }
.page-header h1 {
  font-size: 34px;
  letter-spacing: -0.035em;
  margin: 0 0 6px;
  font-weight: 700;
}
.page-header .sub {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

/* Main grid */
.grid {
  display: grid;
  grid-template-columns: 1.45fr 0.9fr;
  gap: 18px;
  align-items: stretch;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
}
.card-pad { padding: 16px 18px 18px; }
.card-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 12px;
}
.card h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -0.01em;
}
.card-meta {
  font-size: 12px;
  color: var(--muted);
}

/* Map */
#map {
  height: 430px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #eef1f0;
}
.legend {
  display: flex;
  gap: 16px;
  font-size: 12px;
  color: var(--muted);
  margin-top: 12px;
}
.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 6px;
  vertical-align: middle;
}
.dot.high { background: var(--high); }
.dot.medium { background: var(--medium); }

/* Conflict list */
.conflict {
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
  display: block;
  transition: background 0.15s ease;
}
.conflict:last-child { border-bottom: 0; }
.conflict:hover .conflict-name { text-decoration: underline; }
.conflict-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}
.conflict-name {
  font-weight: 650;
  font-size: 14px;
}
.badge {
  font-size: 11px;
  font-weight: 700;
  text-transform: capitalize;
  white-space: nowrap;
}
.badge.high { color: var(--high); }
.badge.medium { color: var(--medium); }
.meta {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}
.summary {
  font-size: 13px;
  color: #333;
  margin-top: 5px;
  line-height: 1.45;
}

/* Timeline section */
.timeline-card {
  margin-top: 18px;
}
.timeline-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}
.timeline-controls {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 12px;
  color: var(--muted);
}
.timeline-controls span {
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fafaf8;
}

.timeline-track {
  position: relative;
  padding: 8px 4px 4px;
}
.timeline-line {
  position: absolute;
  left: 0;
  right: 0;
  top: 34px;
  height: 3px;
  background: linear-gradient(90deg, #e8a598 0%, #d35400 55%, #c0392b 100%);
  border-radius: 999px;
  opacity: 0.85;
}
.timeline-events {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  position: relative;
  z-index: 1;
}
.tl-event {
  text-align: center;
  padding-top: 2px;
}
.tl-date {
  font-size: 11px;
  font-weight: 650;
  color: var(--text);
  margin-bottom: 10px;
}
.tl-marker {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  margin: 0 auto 10px;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.08);
}
.tl-marker.high { background: var(--high); }
.tl-marker.medium { background: var(--medium); }
.tl-text {
  font-size: 12px;
  color: #444;
  line-height: 1.35;
  max-width: 150px;
  margin: 0 auto;
}

.timeline-range {
  margin-top: 14px;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
}

/* Detail pages */
.page { padding: 8px 0 40px; }
.back {
  font-size: 13px;
  color: var(--muted);
  text-decoration: none;
}
.back:hover { color: var(--text); }
.status-row {
  display: flex;
  gap: 12px;
  align-items: center;
  margin: 8px 0 18px;
}
.columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 16px;
}
.note { font-size: 13px; color: var(--muted); }


.social {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
  margin-left: auto;
}
.social a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  color: #6a6a6a;
  text-decoration: none;
}
.social a:hover { color: var(--text); }
.social svg { display: block; width: 16px; height: 16px; }

footer {
  border-top: 1px solid var(--line);
  margin-top: 28px;
  padding: 20px 0 8px;
  color: var(--muted);
  font-size: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  row-gap: 8px;
  flex-wrap: nowrap;
}
footer > span:not(.social) {
  flex: 1 1 0;
  min-width: 0;
}

/* Leaflet popup polish */
.leaflet-popup-content-wrapper {
  border-radius: 10px;
  box-shadow: var(--shadow);
}
.leaflet-popup-content {
  margin: 10px 12px;
  font-size: 13px;
  line-height: 1.4;
}

@media (max-width: 900px) {
  .grid, .columns { grid-template-columns: 1fr; }
  .page-header h1 { font-size: 28px; }
  #map { height: 300px; }
  .timeline-events {
    grid-template-columns: 1fr;
    gap: 14px;
  }
  .timeline-line { display: none; }
  .tl-event { text-align: left; display: grid; grid-template-columns: 70px 14px 1fr; gap: 10px; align-items: start; }
  .tl-date { margin: 0; }
  .tl-marker { margin: 4px 0 0; }
  .tl-text { max-width: none; text-align: left; }
}
