:root {
  --ink: #1a2420;
  --ink-soft: #4b5a54;
  --line: #dde4e0;
  --bg: #f6f8f6;
  --card: #ffffff;
  --brand: #1b4d3e;
  --brand-dark: #123329;
  --brand-tint: #eaf2ee;
  --danger: #b3261e;
  --danger-tint: #fdecea;
  --ok: #1b4d3e;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(20, 30, 25, 0.06), 0 4px 16px rgba(20, 30, 25, 0.06);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

.wrap {
  max-width: 760px;
  margin: 0 auto;
  padding: 24px 18px 64px;
}

header.top {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 22px 0 18px;
}

header.top .mark {
  width: 40px;
  height: 40px;
  border-radius: 9px;
  background: var(--brand);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 18px;
  flex-shrink: 0;
}

header.top h1 {
  font-size: 19px;
  margin: 0;
  color: var(--brand-dark);
}

header.top p {
  margin: 2px 0 0;
  font-size: 13.5px;
  color: var(--ink-soft);
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  margin-bottom: 18px;
}

.intro-card {
  padding: 18px 22px;
  color: var(--ink-soft);
  font-size: 14.5px;
}
.intro-card strong { color: var(--ink); }

fieldset {
  border: none;
  margin: 0 0 22px;
  padding: 0;
}
fieldset:last-of-type { margin-bottom: 0; }

legend {
  font-weight: 700;
  font-size: 13px;
  letter-spacing: .03em;
  text-transform: uppercase;
  color: var(--brand);
  padding: 0 0 10px;
  width: 100%;
  border-bottom: 1px solid var(--line);
  margin-bottom: 14px;
}

.field { margin-bottom: 16px; }
.field:last-child { margin-bottom: 0; }

.field label {
  display: block;
  font-weight: 600;
  font-size: 14.5px;
  margin-bottom: 5px;
}

.field .hint {
  font-size: 12.5px;
  color: var(--ink-soft);
  margin: 3px 0 0;
}

.field .req {
  color: var(--danger);
  font-weight: 400;
}

.row2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
@media (max-width: 560px) {
  .row2 { grid-template-columns: 1fr; }
}

input[type=text], input[type=tel], input[type=number], textarea, select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 15px;
  font-family: inherit;
  background: #fff;
  color: var(--ink);
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-tint);
}

textarea { resize: vertical; min-height: 76px; }
textarea.tall { min-height: 130px; }

.actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 6px;
}

button, .btn {
  appearance: none;
  border: 1px solid var(--brand);
  background: var(--brand);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  padding: 11px 22px;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
}
button:hover, .btn:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
button:disabled { opacity: .55; cursor: default; }

.btn.ghost {
  background: transparent;
  color: var(--brand);
}
.btn.ghost:hover { background: var(--brand-tint); }

.btn.danger {
  background: var(--danger);
  border-color: var(--danger);
}
.btn.danger:hover { background: #8f1d17; border-color: #8f1d17; }

.msg {
  border-radius: 8px;
  padding: 11px 14px;
  font-size: 14px;
  margin-bottom: 16px;
  display: none;
}
.msg.show { display: block; }
.msg.error { background: var(--danger-tint); color: var(--danger); }
.msg.ok { background: var(--brand-tint); color: var(--brand-dark); }

footer.foot {
  text-align: center;
  font-size: 12.5px;
  color: var(--ink-soft);
  padding: 20px 0 0;
}

/* ---- admin ---- */
.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.count-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--brand-tint);
  color: var(--brand-dark);
  font-size: 13px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 999px;
}

table.doctors {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
table.doctors th, table.doctors td {
  border-bottom: 1px solid var(--line);
  padding: 9px 10px;
  text-align: left;
  vertical-align: top;
}
table.doctors th {
  background: var(--brand-tint);
  color: var(--brand-dark);
  position: sticky;
  top: 0;
  font-size: 12.5px;
  text-transform: uppercase;
  letter-spacing: .02em;
}
table.doctors td.name { font-weight: 600; white-space: nowrap; }
table.doctors td.trunc {
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
table.doctors tr:hover td { background: #fafcfb; }
.table-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--ink-soft);
}

.small-link {
  font-size: 13px;
  color: var(--ink-soft);
  text-decoration: none;
}
.small-link:hover { color: var(--brand); text-decoration: underline; }

.login-wrap {
  max-width: 380px;
  margin: 12vh auto 0;
  padding: 0 18px;
}

/* ---- grievances additions ---- */
.wrap.wide { max-width: 1180px; }
.cats, .checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; }
.opt { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 8px;
  padding: 9px 12px; cursor: pointer; font-size: 14.5px; background: #fff; }
.opt:hover { border-color: var(--brand); }
.opt input { accent-color: var(--brand); width: 16px; height: 16px; margin: 0; }
.opt:has(input:checked) { border-color: var(--brand); background: var(--brand-tint); }
.field.consent .opt { background: transparent; border: none; padding: 0; }
.callout { background: var(--brand-tint); border-radius: 8px; padding: 12px 14px; font-size: 14px; color: var(--brand-dark); }
.bignum { font-size: 30px; font-weight: 800; letter-spacing: .04em; color: var(--brand); margin: 6px 0; }
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.b-new { background: #fff3cd; color: #7a5b00; }
.b-responded { background: #e3effd; color: #1a4d8f; }
.b-solution_offered { background: #e7f3ec; color: #1b4d3e; }
.b-not_satisfied { background: var(--danger-tint); color: var(--danger); }
.b-closed { background: #e8ebe9; color: #4b5a54; }
.steps { display: flex; gap: 0; margin: 4px 0 18px; }
.step { flex: 1; text-align: center; font-size: 12.5px; color: var(--ink-soft); position: relative; padding-top: 22px; }
.step::before { content: ""; position: absolute; top: 4px; left: 50%; width: 14px; height: 14px; margin-left: -7px;
  border-radius: 50%; background: var(--line); z-index: 1; }
.step::after { content: ""; position: absolute; top: 10px; left: -50%; width: 100%; height: 3px; background: var(--line); }
.step:first-child::after { display: none; }
.step.done { color: var(--ink); font-weight: 600; }
.step.done::before, .step.done::after { background: var(--brand); }
.step small { display: block; font-weight: 400; color: var(--ink-soft); }
.answerbox { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.btn.warn { background: var(--danger); border-color: var(--danger); }
.quote { border-left: 3px solid var(--brand); padding: 4px 12px; margin: 8px 0; background: #fafcfb; white-space: pre-wrap; }
.lbl { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: var(--brand); margin-top: 14px; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; flex-wrap: wrap; }
.tab { background: none; border: none; color: var(--ink-soft); padding: 10px 16px; border-radius: 8px 8px 0 0; font-weight: 600; }
.tab:hover { background: var(--brand-tint); color: var(--brand-dark); }
.tab.on { color: var(--brand); border-bottom: 3px solid var(--brand); background: transparent; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; align-items: end; }
.filters select, .filters input { width: auto; min-width: 130px; padding: 8px 10px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; }
.tile { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.tile .v { font-size: 30px; font-weight: 800; color: var(--brand-dark); line-height: 1.1; }
.tile .k { font-size: 12.5px; color: var(--ink-soft); }
.tile.alert .v { color: var(--danger); }
table.t { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.t th, table.t td { border-bottom: 1px solid var(--line); padding: 8px 10px; text-align: left; vertical-align: top; }
table.t th { background: var(--brand-tint); color: var(--brand-dark); font-size: 12px; text-transform: uppercase; letter-spacing: .02em; white-space: nowrap; }
table.t tr.click { cursor: pointer; }
table.t tr.click:hover td { background: #f3f8f5; }
table.t td.num { text-align: right; font-variant-numeric: tabular-nums; }
.bar-cell { display: flex; height: 10px; border-radius: 5px; overflow: hidden; background: var(--line); min-width: 90px; }
.bar-cell i { display: block; height: 100%; }
.bar-sorted { background: var(--brand); } .bar-pending { background: #d98e04; }
.legend { font-size: 12.5px; color: var(--ink-soft); margin: 6px 0 14px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin: 0 4px 0 10px; vertical-align: -1px; }
.overlay { position: fixed; inset: 0; background: rgba(15,25,20,.5); display: flex; justify-content: center; align-items: flex-start;
  overflow-y: auto; padding: 24px 12px; z-index: 10; }
.modal { background: #fff; border-radius: 12px; width: 100%; max-width: 780px; padding: 22px; box-shadow: 0 10px 40px rgba(0,0,0,.3); }
.modal h2 { margin: 0 0 4px; font-size: 20px; color: var(--brand-dark); }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 4px 12px; font-size: 14px; margin: 10px 0; }
.kv dt { color: var(--ink-soft); } .kv dd { margin: 0; }
.timeline { list-style: none; padding: 0; margin: 8px 0; font-size: 13.5px; }
.timeline li { border-left: 2px solid var(--line); padding: 2px 0 10px 12px; margin-left: 4px; }
.timeline .when { color: var(--ink-soft); font-size: 12px; }
.actionbox { border: 1px solid var(--line); border-radius: 10px; padding: 14px; margin-top: 14px; background: #fafcfb; }
.actionbox h3 { margin: 0 0 8px; font-size: 15px; color: var(--brand-dark); }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.btn.small { padding: 6px 12px; font-size: 13px; }

/* ---- logo, language toggle, voice ---- */
html[lang=ml] body { font-family: "Noto Sans Malayalam", "Nirmala UI", "Kartika", -apple-system, "Segoe UI", Roboto, sans-serif; line-height: 1.65; }
header.top img.logo { width: 52px; height: 52px; flex-shrink: 0; object-fit: contain; }
header.top.topbar { justify-content: space-between; }
header.top .tools { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.btn.small, a.btn.small { text-decoration: none; display: inline-block; }
.voicebar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 8px; }
.mic .micdot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--brand); margin-right: 7px; }
.mic.on { background: var(--danger); border-color: var(--danger); color: #fff; }
.mic.on .micdot { background: #fff; animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .25; } }
.login-top { display: flex; justify-content: flex-end; margin-bottom: 4px; }

/* the hidden attribute must always win over display rules (the empty modal overlay was showing as a dark layer) */
[hidden] { display: none !important; }
