:root {
  --primary: #0f5132;
  --primary-light: #146c43;
  --accent: #d9822b;
  --bg: #f5f6f7;
  --card-bg: #ffffff;
  --text: #1c1c1c;
  --text-muted: #6b7280;
  --border: #e2e5e9;
  --danger: #c0392b;
  --radius: 12px;
  --nav-height: 64px;
  --header-height: 56px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, "Noto Sans", "Noto Sans Telugu", "Noto Sans Devanagari", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.45;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

button, input, select, textarea { font: inherit; }
a { color: var(--primary); }

/* ---------- App shell ---------- */
.app-header {
  position: sticky; top: 0; z-index: 20;
  height: var(--header-height);
  background: var(--primary);
  color: #fff;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 12px;
  padding-top: env(safe-area-inset-top, 0px);
}
.app-header h1 { font-size: 1.05rem; margin: 0; font-weight: 600; }
.lang-select {
  background: rgba(255,255,255,0.15); color: #fff; border: 1px solid rgba(255,255,255,0.4);
  border-radius: 8px; padding: 6px 8px;
}
.lang-select option { color: #000; }

.offline-banner {
  background: #fff3cd; color: #664d03; text-align: center;
  padding: 6px 10px; font-size: 0.85rem; display: none;
}
body.offline .offline-banner { display: block; }

main { padding: 12px 14px calc(var(--nav-height) + 20px); max-width: 640px; margin: 0 auto; }

.screen { display: none; }
.screen.active { display: block; animation: fadeIn .15s ease-in; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ---------- Bottom nav ---------- */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
  display: flex; background: #fff; border-top: 1px solid var(--border);
  height: var(--nav-height);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.bottom-nav button {
  flex: 1; border: none; background: none; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 2px; color: var(--text-muted);
  font-size: 0.68rem; padding: 6px 2px; cursor: pointer;
}
.bottom-nav button .icon { font-size: 1.25rem; }
.bottom-nav button.active { color: var(--primary); font-weight: 600; }

/* ---------- Cards / generic ---------- */
.card {
  background: var(--card-bg); border-radius: var(--radius); padding: 14px;
  margin-bottom: 12px; border: 1px solid var(--border);
}
.card h3 { margin: 0 0 6px; font-size: 1rem; }
.muted { color: var(--text-muted); font-size: 0.85rem; }
.section-title { font-size: 1.1rem; font-weight: 700; margin: 4px 0 12px; }

.quick-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 16px; }
.quick-grid button {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 6px; display: flex; flex-direction: column; align-items: center; gap: 6px;
  font-size: 0.75rem; color: var(--text); cursor: pointer;
}
.quick-grid .icon { font-size: 1.6rem; }

/* ---------- Forms ---------- */
label { display: block; font-weight: 600; margin: 12px 0 4px; font-size: 0.9rem; }
input[type=text], input[type=tel], input[type=search], select, textarea {
  width: 100%; border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px;
  background: #fff;
}
textarea { min-height: 90px; resize: vertical; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--primary); color: #fff; border: none; border-radius: 10px;
  padding: 12px 18px; font-weight: 600; cursor: pointer; width: 100%; margin-top: 14px;
}
.btn:active { background: var(--primary-light); }
.btn.secondary { background: #fff; color: var(--primary); border: 1px solid var(--primary); }
.btn.small { width: auto; padding: 8px 14px; margin-top: 0; font-size: 0.85rem; }

.photo-row { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.photo-thumb { width: 72px; height: 72px; border-radius: 8px; object-fit: cover; border: 1px solid var(--border); }

.field-hint { font-size: 0.78rem; color: var(--text-muted); margin-top: 2px; }
.form-msg { padding: 10px 12px; border-radius: 8px; margin-top: 10px; font-size: 0.88rem; }
.form-msg.success { background: #d1f5e0; color: var(--primary); }
.form-msg.error { background: #fde3e0; color: var(--danger); }

/* ---------- Status badges ---------- */
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 0.75rem; font-weight: 600; }
.badge.received { background: #e2e8f0; color: #334155; }
.badge.assigned { background: #dbeafe; color: #1e40af; }
.badge.in_progress { background: #fef3c7; color: #92400e; }
.badge.resolved { background: #d1fae5; color: #065f46; }
.badge.rejected { background: #fde3e0; color: var(--danger); }

/* ---------- Timeline ---------- */
.timeline { list-style: none; margin: 10px 0 0; padding: 0; border-left: 2px solid var(--border); }
.timeline li { position: relative; padding: 0 0 16px 18px; }
.timeline li::before {
  content: ""; position: absolute; left: -6px; top: 3px; width: 10px; height: 10px;
  border-radius: 50%; background: var(--primary);
}
.timeline .t-date { font-size: 0.75rem; color: var(--text-muted); }

/* ---------- Tag pill filter row ---------- */
.pill-row { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 8px; margin-bottom: 8px; }
.pill {
  flex: 0 0 auto; padding: 6px 14px; border-radius: 999px; border: 1px solid var(--border);
  background: #fff; font-size: 0.82rem; cursor: pointer; white-space: nowrap;
}
.pill.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ---------- News type tag ---------- */
.tag-emergency { color: var(--danger); font-weight: 700; }

.loading { text-align: center; padding: 24px; color: var(--text-muted); }
.empty-state { text-align: center; padding: 30px 10px; color: var(--text-muted); }

@media (min-width: 700px) {
  .quick-grid { grid-template-columns: repeat(4, 1fr); }
}

/* ---------- Progress bars (works tracker, polls) ---------- */
.progress-bar { background: var(--border); border-radius: 999px; height: 8px; overflow: hidden; margin: 6px 0; }
.progress-bar-fill { background: var(--primary); height: 100%; border-radius: 999px; transition: width .3s ease; }

.works-timeline-box { margin-top: 10px; display: none; }

/* ---------- Poll options ---------- */
.poll-option { margin: 10px 0; font-size: 0.9rem; }
.poll-vote-select { width: 100%; }

/* ---------- FAQ accordion ---------- */
.faq-card { padding: 0; overflow: hidden; }
.faq-question {
  width: 100%; background: none; border: none; text-align: left; padding: 14px;
  display: flex; justify-content: space-between; align-items: center; cursor: pointer;
  font-weight: 600; font-size: 0.92rem; color: var(--text);
}
.faq-question .faq-caret { transition: transform .15s ease; color: var(--text-muted); }
.faq-question.open .faq-caret { transform: rotate(180deg); }
.faq-answer { padding: 0 14px 14px; font-size: 0.88rem; color: var(--text-muted); }

/* ---------- Status badges: new statuses ---------- */
.badge.planned { background: #e2e8f0; color: #334155; }
.badge.ongoing { background: #fef3c7; color: #92400e; }
.badge.delayed { background: #fde3e0; color: var(--danger); }
.badge.completed { background: #d1fae5; color: #065f46; }
.badge.pending { background: #e2e8f0; color: #334155; }
.badge.confirmed { background: #d1fae5; color: #065f46; }
