:root {
  --icar-green: #1f6b3a;
  --icar-green-dark: #144d29;
  --icar-green-light: #eaf5ee;
  --surface: #ffffff;
  --bg: #f4f7f5;
  --text-primary: #1c1f1d;
  --text-secondary: #5b615c;
  --border: #dfe6e1;
  --radius: 8px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text-primary);
}

.topbar {
  background: var(--icar-green);
  color: #fff;
  padding: 14px 24px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
}
.brand { grid-column: 2; text-align: center; }
.topbar > button { grid-column: 3; justify-self: end; }
.brand-title { font-weight: 600; font-size: 18px; margin-right: 10px; }
.brand-sub { display: block; font-size: 22px; opacity: 0.85;}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.filters {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr 1fr 1fr auto;
  gap: 8px;
}
.filters input, .filters select {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  background: var(--surface);
}

.stat-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.stat { text-align: left; }
.stat-label { font-size: 12px; color: var(--text-secondary); margin: 0 0 6px; }
.stat-value { font-size: 26px; font-weight: 600; margin: 0; color: var(--icar-green-dark); }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
}
.card-title { font-size: 13px; color: var(--text-secondary); margin: 0 0 10px; font-weight: 600; }

.chart-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 12px;
}

.table-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.table-wrap { overflow-x: auto; max-height: 420px; overflow-y: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { position: sticky; top: 0; background: var(--icar-green-light); color: var(--icar-green-dark); font-weight: 600; }
tr:hover td { background: var(--icar-green-light); }

.btn {
  padding: 8px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 13px;
  cursor: pointer;
  text-decoration: none;
  color: var(--text-primary);
  display: inline-block;
}
.btn-primary { background: var(--icar-green); color: #fff; border-color: var(--icar-green); }
.btn-primary:hover { background: var(--icar-green-dark); }
.btn-ghost:hover { background: var(--icar-green-light); }
.btn-sm { padding: 4px 10px; }

.delete-row-btn {
  background: none;
  border: none;
  color: #a32d2d;
  font-size: 14px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
}
.delete-row-btn:hover { background: #fdecea; }

.hidden { display: none !important; }

.error-banner {
  background: #fdecea;
  border: 1px solid #e6a1a1;
  color: #a32d2d;
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 13px;
}

#indiaMap {
  height: 460px;
  width: 100%;
  border-radius: var(--radius);
  background: #f4f7f5;
}
.state-tooltip {
  font-size: 12px;
  line-height: 1.5;
  max-width: 220px;
}
.state-tooltip strong { color: var(--icar-green-dark); }
.state-tooltip ul { margin: 4px 0 0; padding-left: 16px; }
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.4);
  display: flex; align-items: center; justify-content: center; z-index: 2000;
}
.modal {
  background: var(--surface); border-radius: 12px; padding: 20px;
  width: 420px; max-width: 90vw;
}
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.hint { font-size: 12px; color: var(--text-secondary); margin: 0 0 12px; }
.hint code { background: var(--icar-green-light); padding: 1px 4px; border-radius: 4px; }
#uploadForm { display: flex; flex-direction: column; gap: 10px; }
#uploadForm input { padding: 8px; border: 1px solid var(--border); border-radius: var(--radius); }
#uploadResult { margin-top: 12px; font-size: 13px; }
.upload-ok { color: var(--icar-green-dark); }
.upload-err { color: #a32d2d; }
.hint-link { display: block; margin-top: 10px; font-size: 12px; color: var(--icar-green-dark); }
