:root {
  --bg: #efe8d8;
  --bg-deep: #d9e2d4;
  --ink: #16261f;
  --muted: #4f645a;
  --panel: rgba(255, 252, 245, 0.86);
  --panel-strong: rgba(255, 249, 238, 0.96);
  --line: rgba(22, 38, 31, 0.1);
  --accent: #214f3f;
  --watch: #ae8115;
  --alert: #ba5b21;
  --severe: #a12b18;
  --severe-reviewed: #66170d;
  --normal: #355447;
  --shadow: 0 18px 54px rgba(18, 38, 29, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Manrope", "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(45, 125, 104, 0.26), transparent 28%),
    radial-gradient(circle at right 20%, rgba(174, 129, 21, 0.22), transparent 24%),
    linear-gradient(180deg, var(--bg) 0%, #f8f5ef 40%, var(--bg-deep) 100%);
}

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

.hero {
  padding: 24px 0 10px;
}

.page-nav {
  display: flex;
  gap: 10px;
  margin: 6px 0 18px;
  flex-wrap: wrap;
}

.page-nav-link {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  text-decoration: none;
  font-weight: 700;
  border: 1px solid rgba(22, 38, 31, 0.08);
}

.page-nav-link.active {
  background: var(--accent);
  color: #fff;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.24em;
  font-size: 0.76rem;
  color: var(--muted);
  margin-bottom: 10px;
}

.hero-copy {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-start;
}

h1,
h2 {
  font-family: "Newsreader", Georgia, serif;
  margin: 0;
}

h1 {
  max-width: 11ch;
  font-size: clamp(2.8rem, 5vw, 5.2rem);
  line-height: 0.94;
}

.hero-subheading {
  max-width: 34ch;
  font-family: "Newsreader", Georgia, serif;
  font-size: clamp(1.1rem, 1.9vw, 1.45rem);
  line-height: 1.2;
  color: var(--ink);
  margin-top: 10px;
}

.hero p {
  max-width: 64ch;
  font-size: 1rem;
  line-height: 1.6;
  color: var(--muted);
  margin-top: 18px;
}

#headline-text {
  margin-top: 12px;
}

.hero-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.chip {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  background: var(--accent);
  color: #f6f4ef;
  font-weight: 700;
  box-shadow: var(--shadow);
}

.chip.subtle {
  background: rgba(255, 255, 255, 0.62);
  color: var(--ink);
}

.link-chip {
  text-decoration: none;
}

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

.prose-layout {
  display: grid;
  gap: 18px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
  padding: 22px;
}

.prose-panel {
  max-width: 920px;
}

.prose-panel h2 {
  margin-bottom: 14px;
}

.prose-panel h3 {
  margin: 18px 0 8px;
  font-size: 1.04rem;
}

.prose-panel p,
.prose-panel li {
  color: var(--ink);
  line-height: 1.7;
}

.prose-panel ul,
.prose-panel ol {
  margin: 10px 0 0;
  padding-left: 22px;
}

.callout {
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(33, 79, 63, 0.08);
  border: 1px solid rgba(33, 79, 63, 0.12);
}

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

.prose-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.96rem;
}

.prose-table th,
.prose-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid rgba(22, 38, 31, 0.1);
}

.prose-table th {
  font-weight: 700;
  color: var(--ink);
}

.headline-panel,
.map-panel {
  grid-column: span 6;
}

.alerts-panel,
.district-panel,
.taluk-panel,
.hotspot-panel,
.health-panel {
  grid-column: span 12;
}

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

.subtle-text,
.label {
  color: var(--muted);
  font-size: 0.92rem;
}

.timeframe-toggle {
  display: inline-flex;
  gap: 8px;
  background: rgba(255, 255, 255, 0.8);
  padding: 6px;
  border-radius: 999px;
}

.timeframe-toggle button,
.map-point,
.alert-row,
.risk-card {
  transition: transform 180ms ease, background-color 180ms ease, border-color 180ms ease;
}

.timeframe-toggle button {
  border: 0;
  padding: 10px 14px;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
}

.timeframe-toggle button.active {
  background: var(--accent);
  color: #fff;
}

.headline-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 16px;
}

.headline-card,
.review-card,
.risk-card,
.source-card,
.alert-row {
  border-radius: 24px;
  padding: 18px;
  background: var(--panel-strong);
  border: 1px solid rgba(22, 38, 31, 0.09);
}

.headline-card {
  min-height: 180px;
}

.source-facts {
  display: grid;
  gap: 6px;
  margin: 10px 0 0;
}

.source-fact-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(22, 38, 31, 0.08);
}

.source-fact-row:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.source-fact-label {
  color: var(--muted);
  font-size: 0.84rem;
}

.source-fact-value {
  text-align: right;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--ink);
  max-width: 58%;
}

.headline-card .level-pill,
.risk-card .level-pill,
.alert-row .level-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 0.86rem;
  font-weight: 700;
  color: #fff;
}

.metric {
  font-size: 3rem;
  font-weight: 800;
  line-height: 1;
  margin: 14px 0 8px;
}

.map-stage {
  position: relative;
  min-height: 560px;
  border-radius: 28px;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(11, 36, 28, 0.95), rgba(34, 79, 63, 0.85)),
    linear-gradient(135deg, rgba(255, 255, 255, 0.1), transparent);
}

.district-map {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  opacity: 0.98;
}

.district-shape {
  stroke: rgba(255, 249, 238, 0.72);
  stroke-width: 1.2;
  vector-effect: non-scaling-stroke;
  cursor: pointer;
  transition: opacity 180ms ease, transform 180ms ease;
}

.district-shape.taluk-shape {
  stroke: rgba(255, 252, 245, 0.98);
  stroke-width: 2;
  fill-opacity: 0.82;
}

.district-shape.district-context {
  stroke: rgba(255, 249, 238, 0.28);
  stroke-width: 2.2;
  pointer-events: none;
}

.hotspot-footprint {
  fill-opacity: 0.22;
  stroke: rgba(255, 255, 255, 0.36);
  stroke-width: 0.8;
  vector-effect: non-scaling-stroke;
  pointer-events: none;
}

.district-shape:hover {
  opacity: 0.88;
}

.district-label {
  fill: rgba(255, 255, 255, 0.88);
  font-size: 10px;
  font-weight: 700;
  text-anchor: middle;
  paint-order: stroke;
  stroke: rgba(13, 31, 25, 0.8);
  stroke-width: 3px;
  stroke-linejoin: round;
  pointer-events: none;
}

.district-label.taluk-label {
  font-size: 8px;
  fill: rgba(255, 252, 245, 0.96);
  stroke-width: 4px;
}

.hotspot-marker,
.district-shape,
.hotspot-footprint {
  transition: transform 180ms ease, opacity 180ms ease;
}

.hotspot-marker:hover,
.risk-card:hover,
.alert-row:hover {
  transform: translateY(-2px);
}

.hotspot-marker {
  stroke: rgba(255, 255, 255, 0.78);
  stroke-width: 1.6;
  vector-effect: non-scaling-stroke;
  cursor: pointer;
}

.card-grid,
.stack {
  display: grid;
  gap: 14px;
}

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

.hotspot-grid {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.taluk-grid {
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.risk-card,
.source-card,
.alert-row {
  cursor: pointer;
}

.risk-card .score,
.source-card .score {
  font-size: 1.75rem;
  font-weight: 800;
}

.risk-card .meta,
.source-card .meta,
.alert-row .meta {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.88rem;
}

.source-status-note {
  margin: 12px 0 8px;
  padding: 10px 12px;
  border-radius: 14px;
  font-size: 0.9rem;
  line-height: 1.45;
  border: 1px solid rgba(22, 38, 31, 0.08);
}

.source-status-note.status-ok {
  background: rgba(37, 104, 79, 0.08);
}

.source-status-note.status-degraded,
.source-status-note.status-stale {
  background: rgba(155, 108, 13, 0.1);
}

.source-status-note.status-offline {
  background: rgba(157, 42, 23, 0.09);
}

.alert-row {
  display: grid;
  grid-template-columns: 1.4fr 1fr auto;
  align-items: center;
  gap: 18px;
}

.evidence-dialog {
  width: min(760px, calc(100vw - 24px));
  border: 0;
  border-radius: 28px;
  padding: 28px;
  box-shadow: 0 32px 90px rgba(0, 0, 0, 0.28);
  background: #fffaf0;
}

.evidence-dialog::backdrop {
  background: rgba(16, 28, 23, 0.46);
}

.dialog-close {
  position: absolute;
  right: 18px;
  top: 14px;
  border: 0;
  background: transparent;
  font-size: 2rem;
  cursor: pointer;
}

.evidence-list,
.actions-list {
  padding-left: 18px;
}

.status-ok {
  color: #25684f;
}

.status-degraded,
.status-stale {
  color: #9b6c0d;
}

.status-offline {
  color: #9d2a17;
}

@media (max-width: 980px) {
  .headline-panel,
  .map-panel {
    grid-column: span 12;
  }

  .headline-grid,
  .alert-row {
    grid-template-columns: 1fr;
  }

  .hero-copy {
    flex-direction: column;
  }
}

@media (max-width: 720px) {
  .page-shell {
    width: min(100vw - 20px, 1320px);
  }

  .panel {
    padding: 18px;
    border-radius: 24px;
  }

  .map-stage {
    min-height: 520px;
  }

  .district-label {
    font-size: 8px;
  }
}
.control-stack {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.archive-control {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.8);
  padding: 8px 12px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.9rem;
}

.archive-control select {
  border: 0;
  background: transparent;
  font: inherit;
  color: var(--ink);
}

/* Source card redesign */
.source-card {
  position: relative;
  padding: 16px;
}

.source-info-btn {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1.5px solid var(--accent);
  background: transparent;
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 700;
  font-style: italic;
  font-family: "Georgia", "Newsreader", serif;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 180ms ease, color 180ms ease, transform 180ms ease;
  z-index: 1;
  line-height: 1;
  padding: 0;
}

.source-info-btn:hover {
  background: var(--accent);
  color: #fff;
  transform: scale(1.12);
}

.source-desc {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.4;
  margin: 4px 0 8px;
}

.source-card h3 {
  margin: 2px 28px 8px 0;
  font-size: 1.05rem;
  line-height: 1.2;
}

.source-card .label {
  margin-right: 28px;
  font-size: 0.8rem;
}

.source-link {
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
}

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

/* Source detail popup */
.source-detail-desc {
  color: var(--muted);
  font-size: 1rem;
  margin-bottom: 18px;
  line-height: 1.5;
}

.source-detail-grid {
  display: grid;
  gap: 0;
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  margin-bottom: 18px;
}

.source-detail-row {
  display: grid;
  grid-template-columns: 160px 1fr;
  padding: 11px 16px;
  border-bottom: 1px solid var(--line);
  font-size: 0.92rem;
  align-items: center;
}

.source-detail-row:last-child {
  border-bottom: none;
}

.source-detail-label {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.84rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.source-detail-value {
  font-weight: 500;
}

.source-detail-fetch-note {
  padding: 10px 14px;
  background: rgba(22, 38, 31, 0.04);
  border-radius: 12px;
  font-size: 0.88rem;
  color: var(--muted);
  font-family: "Roboto Mono", "Consolas", monospace;
  word-break: break-all;
  line-height: 1.5;
}

.source-detail-impact {
  padding: 10px 14px;
  background: rgba(157, 42, 23, 0.06);
  border: 1px solid rgba(157, 42, 23, 0.12);
  border-radius: 12px;
  font-size: 0.92rem;
  color: #6b2a1a;
  line-height: 1.5;
}
