/* ===========================================================================
   Gurugram Clean Air - citizen app
   Mobile-first app shell for the public /citizen surface. Kept separate from
   style.css (the staff console) so the two can never drift into each other.
   Layout rules: one column, 16px gutters, >=44px touch targets, bottom tab bar
   above the home-indicator safe area, and a desktop view that centres the same
   column inside a phone-width frame instead of stretching it.
   =========================================================================== */

:root {
  --app-bg: #eef2f6;
  --surface: #ffffff;
  --surface-2: #f6f8fb;
  --ink: #16222e;
  --ink-2: #4d5e6d;
  --ink-3: #7d8c99;
  --line: #e2e8ee;
  --line-strong: #cfd8e1;
  --brand: #0f2740;
  --brand-2: #1685c9;
  --brand-ink: #0d5f91;
  --brand-soft: #e8f3fb;
  --ok: #1f7a55;
  --ok-soft: #e4f3ec;
  --warn: #9a6a12;
  --warn-soft: #fcf2dc;
  --bad: #b23b32;
  --bad-soft: #fbe8e5;
  --radius: 16px;
  --radius-sm: 11px;
  --shadow: 0 1px 2px rgba(16, 36, 56, .05), 0 8px 24px rgba(16, 36, 56, .06);
  --shadow-bar: 0 -1px 0 var(--line), 0 -8px 24px rgba(16, 36, 56, .06);
  --tab-h: 62px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --aqi: #64748b;
  --aqi-soft: #eef2f6;
}

@media (prefers-color-scheme: dark) {
  :root {
    --app-bg: #0b1218;
    --surface: #141e27;
    --surface-2: #1a252f;
    --ink: #e9eff4;
    --ink-2: #a9b8c4;
    --ink-3: #7e8f9c;
    --line: #243139;
    --line-strong: #31414c;
    --brand: #0b1620;
    --brand-2: #3aa5e4;
    --brand-ink: #7cc6f0;
    --brand-soft: #16293a;
    --ok: #5fd0a2;
    --ok-soft: #12302a;
    --warn: #e6b65c;
    --warn-soft: #302714;
    --bad: #f08b80;
    --bad-soft: #35191a;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .35);
    --shadow-bar: 0 -1px 0 var(--line), 0 -8px 24px rgba(0, 0, 0, .4);
    --aqi-soft: #1b262f;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

/* An author rule like `.banner { display: flex }` has the same specificity as
   the user-agent's `[hidden] { display: none }` and therefore beats it, which
   silently defeated every `hidden` attribute in this app: the offline warning,
   the install button and the share button were all permanently on screen. */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body.citizen {
  margin: 0;
  background: var(--app-bg);
  color: var(--ink);
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  overscroll-behavior-y: contain;
}

/* --- App frame ----------------------------------------------------------- */

.app {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--app-bg);
  display: flex;
  flex-direction: column;
  position: relative;
}

/* On a wider screen the same column is simply centred and edged. It is NOT
   wrapped in a clipped "phone frame": `overflow: hidden` on this element kills
   `position: sticky` on the app bar, and a floating frame puts the fixed tab
   bar in the wrong place. One layout, two widths. */
@media (min-width: 600px) {
  body.citizen { background: #e3e9ef; }
  .app {
    min-height: 100vh;
    border-left: 1px solid var(--line);
    border-right: 1px solid var(--line);
    box-shadow: 0 0 48px rgba(12, 28, 44, .10);
  }
}

@media (min-width: 600px) and (prefers-color-scheme: dark) {
  body.citizen { background: #05090c; }
}

/* --- Top app bar --------------------------------------------------------- */

.appbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--brand);
  color: #fff;
  padding: calc(env(safe-area-inset-top, 0px) + 12px) 14px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.appbar-back,
.appbar-action {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  border: 0;
  border-radius: 12px;
  background: rgba(255, 255, 255, .12);
  color: #fff;
  display: grid;
  place-items: center;
  text-decoration: none;
  cursor: pointer;
  padding: 0;
}

.appbar-back:active,
.appbar-action:active { background: rgba(255, 255, 255, .24); }

.appbar-titles { min-width: 0; flex: 1; }

.appbar-kicker {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 1.4px;
  color: #8fb6d4;
  text-transform: uppercase;
}

.appbar-titles h1 {
  font: 700 17px/1.25 Manrope, 'DM Sans', sans-serif;
  margin: 2px 0 0;
  letter-spacing: -.2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* --- Scroll area --------------------------------------------------------- */

.app-main {
  flex: 1;
  padding: 14px 16px calc(var(--tab-h) + var(--safe-b) + 26px);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* --- Bottom tab bar ------------------------------------------------------ */

.tabbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 40;
  margin: 0 auto;
  max-width: 480px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  background: var(--surface);
  box-shadow: var(--shadow-bar);
  padding-bottom: var(--safe-b);
}

.tabbar.five { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.tabbar.five a { font-size: 9.5px; letter-spacing: 0; }
.tabbar.five span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.tabbar a {
  min-width: 0;          /* lets a long tab label ellipsise instead of widening the bar */
  min-height: var(--tab-h);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  text-decoration: none;
  color: var(--ink-3);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .2px;
}

.tabbar a.active { color: var(--brand-2); }
.tabbar a.active svg { transform: translateY(-1px); }
.tabbar svg { width: 22px; height: 22px; }

/* --- Cards --------------------------------------------------------------- */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}

.card.flush { padding: 0; overflow: hidden; }

.card h2 {
  font: 700 15px/1.3 Manrope, 'DM Sans', sans-serif;
  margin: 0 0 4px;
}

.card h3 {
  font: 700 13px/1.3 Manrope, 'DM Sans', sans-serif;
  margin: 0 0 6px;
}

.card p { margin: 0 0 10px; color: var(--ink-2); font-size: 13.5px; }
.card p:last-child { margin-bottom: 0; }

.section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin: 4px 2px -4px;
}

.section-title h2 {
  font: 800 12px/1 Manrope, 'DM Sans', sans-serif;
  letter-spacing: 1.1px;
  text-transform: uppercase;
  color: var(--ink-3);
  margin: 0;
}

.section-title a { font-size: 12px; font-weight: 700; color: var(--brand-ink); text-decoration: none; }

.sub-head {
  font: 700 12.5px Manrope, 'DM Sans', sans-serif;
  margin: 2px 2px -4px;
  color: var(--ink-2);
}

.muted { color: var(--ink-3); }
.small { font-size: 12px; }
.tiny { font-size: 11px; line-height: 1.45; }

/* --- AQI hero ------------------------------------------------------------ */

.aqi-hero {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.aqi-top {
  padding: 16px;
  display: flex;
  gap: 14px;
  align-items: center;
  background: var(--aqi-soft);
  border-bottom: 1px solid var(--line);
}

.aqi-dial {
  width: 86px;
  height: 86px;
  flex: 0 0 86px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--surface);
  border: 5px solid var(--aqi);
  text-align: center;
}

.aqi-dial b { font: 800 26px/1 Manrope, 'DM Sans', sans-serif; display: block; }
.aqi-dial span { font-size: 9px; font-weight: 800; letter-spacing: 1px; color: var(--ink-3); }

.aqi-meta { min-width: 0; }
.aqi-meta .band {
  font: 800 17px/1.2 Manrope, 'DM Sans', sans-serif;
  color: var(--aqi);
  margin: 0 0 1px;
}

.aqi-meta .index-note {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .4px;
  text-transform: uppercase;
  color: var(--ink-3);
  margin: 0 0 5px;
}
.aqi-meta .where { font-size: 13px; font-weight: 700; margin: 0 0 3px; }
.aqi-meta .when { font-size: 11px; color: var(--ink-3); margin: 0; }

.aqi-advice { padding: 13px 16px; font-size: 13px; color: var(--ink-2); }

/* Provenance: a footnote on the number, not a second alert competing with it. */
.hero-foot {
  margin: 0;
  padding: 9px 16px 11px;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
  font-size: 11px;
  line-height: 1.5;
  color: var(--ink-3);
}

.hero-foot::before {
  content: '';
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-right: 7px;
  vertical-align: 1px;
  background: var(--warn);
}

.hero-foot.official::before { background: var(--ok); }
.aqi-advice strong { color: var(--ink); }

/* No text-transform here: uppercasing would render the unit as MG/M3, which is
   a thousand-fold different quantity from the ug/m3 actually being shown. */
.pollutant-head {
  border-top: 1px solid var(--line);
  background: var(--surface-2);
  padding: 7px 16px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .4px;
  color: var(--ink-3);
}

.aqi-pollutants {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid var(--line);
}

.aqi-pollutants div {
  padding: 10px 6px;
  text-align: center;
  border-left: 1px solid var(--line);
}

.aqi-pollutants div:first-child { border-left: 0; }
.aqi-pollutants span { display: block; font-size: 9px; font-weight: 800; letter-spacing: .8px; color: var(--ink-3); }
.aqi-pollutants b { font: 700 14px Manrope, 'DM Sans', sans-serif; }

/* Band palette. Set on a wrapper; the hero reads --aqi / --aqi-soft. */
.band-good      { --aqi: #1f7a55; --aqi-soft: #e4f3ec; }
.band-ok        { --aqi: #4e7d1e; --aqi-soft: #eef6e2; }
.band-moderate  { --aqi: #a2730f; --aqi-soft: #fcf3dc; }
.band-poor      { --aqi: #b65a12; --aqi-soft: #fdeddd; }
.band-very-poor { --aqi: #b23b32; --aqi-soft: #fbe8e5; }
.band-severe    { --aqi: #7e2436; --aqi-soft: #f7e4e9; }
.band-nodata    { --aqi: #64748b; --aqi-soft: #eef2f6; }

@media (prefers-color-scheme: dark) {
  .band-good      { --aqi: #4fcb97; --aqi-soft: #112b25; }
  .band-ok        { --aqi: #9fcc5c; --aqi-soft: #1d2a14; }
  .band-moderate  { --aqi: #e5b652; --aqi-soft: #2d2512; }
  .band-poor      { --aqi: #ef9a5c; --aqi-soft: #30200f; }
  .band-very-poor { --aqi: #f28a7e; --aqi-soft: #351a19; }
  .band-severe    { --aqi: #e37e99; --aqi-soft: #301520; }
  .band-nodata    { --aqi: #8b9aa8; --aqi-soft: #1b262f; }
}

/* --- Area picker --------------------------------------------------------- */

.area-pick {
  display: flex;
  gap: 8px;
  align-items: center;
}

.area-pick select {
  flex: 1;
  min-width: 0;          /* lets the select shrink instead of pushing the row wide */
  min-height: 44px;
  padding: 10px 36px 10px 12px;
  font-size: 14px;
  font-weight: 700;
  background-position: right 10px center;
}

.area-pick .btn { flex: 0 0 auto; white-space: nowrap; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  overflow: hidden;
  white-space: nowrap;
}

/* --- Quick actions ------------------------------------------------------- */

.quick-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.quick {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 13px;
  text-decoration: none;
  color: var(--ink);
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-height: 86px;
  box-shadow: var(--shadow);
}

.quick svg { width: 20px; height: 20px; color: var(--brand-2); flex: 0 0 20px; }
.quick b { display: block; font: 700 13.5px Manrope, 'DM Sans', sans-serif; }
.quick span { display: block; font-size: 11.5px; color: var(--ink-3); line-height: 1.35; }

/* A full-width card for a step that is not the primary action but still needs
   a whole row: icon left, two lines of text right. */
.quick.wide-card {
  grid-column: 1 / -1;
  flex-direction: row;
  align-items: center;
  gap: 13px;
  min-height: 0;
  padding: 14px;
}

.quick.wide-card svg { width: 22px; height: 22px; flex: 0 0 22px; }
.quick.wide-card b { font-size: 14px; margin-bottom: 2px; }

.quick.primary {
  background: var(--brand-2);
  border-color: var(--brand-2);
  color: #fff;
  grid-column: 1 / -1;
  min-height: 0;
  flex-direction: row;
  align-items: center;
  gap: 13px;
  padding: 15px 14px;
}
.quick.primary svg { color: #fff; width: 24px; height: 24px; flex: 0 0 24px; }
.quick.primary b { font-size: 15px; margin-bottom: 2px; }
.quick.primary span { color: rgba(255, 255, 255, .85); }

/* --- GRAP (graded response) --------------------------------------------- */

.grap-hero {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 5px solid var(--aqi);
  border-radius: var(--radius);
  padding: 15px;
  box-shadow: var(--shadow);
}

.grap-stage {
  flex: 0 0 72px;
  text-align: center;
  background: var(--aqi-soft);
  border-radius: 12px;
  padding: 8px 4px;
}

.grap-stage span { display: block; font-size: 8.5px; font-weight: 800; letter-spacing: .9px; text-transform: uppercase; color: var(--ink-3); }
.grap-stage b { display: block; font: 800 28px/1.1 Manrope, 'DM Sans', sans-serif; color: var(--aqi); }
.grap-label { font: 800 17px/1.2 Manrope, 'DM Sans', sans-serif; margin: 0 0 3px; color: var(--aqi); }
.grap-range { margin: 0; font-size: 12px; color: var(--ink-2); font-weight: 700; }
.grap-carries { margin: 5px 0 0; font-size: 11.5px; color: var(--ink-3); line-height: 1.45; }

.charter { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 9px; }
.charter li { display: flex; gap: 9px; align-items: flex-start; font-size: 13px; color: var(--ink-2); line-height: 1.5; }
.charter svg { width: 16px; height: 16px; flex: 0 0 16px; margin-top: 2px; color: var(--ok); }

.restriction { padding: 13px 15px; border-top: 1px solid var(--line); }
.restriction:first-child { border-top: 0; }
.restriction p { margin: 0 0 9px; font-size: 13px; line-height: 1.55; color: var(--ink); }
.restriction-foot { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* A compact strip that puts the legal position directly under the AQI. */
.grap-strip {
  display: flex;
  align-items: center;
  gap: 11px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--aqi);
  border-radius: var(--radius-sm);
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 12px 13px;
  text-decoration: none;
  color: inherit;
}

.grap-strip .tag {
  flex: 0 0 auto;
  background: var(--aqi-soft);
  color: var(--aqi);
  border-radius: 8px;
  padding: 6px 9px;
  font: 800 12px Manrope, 'DM Sans', sans-serif;
  white-space: nowrap;
}

.grap-strip b { display: block; font-size: 13px; }
.grap-strip span { display: block; font-size: 11.5px; color: var(--ink-3); line-height: 1.4; margin-top: 2px; }
.grap-strip .chev { margin-left: auto; color: var(--ink-3); flex: 0 0 18px; width: 18px; height: 18px; }

/* --- Pollutant drivers --------------------------------------------------- */

.driver { padding: 12px 0; border-top: 1px solid var(--line); }
.driver:first-of-type { border-top: 0; }
.driver-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 5px; }
.driver-top b { font: 700 14px Manrope, 'DM Sans', sans-serif; color: var(--aqi); }
.driver p { margin: 0; }

/* --- Helplines ----------------------------------------------------------- */

.helplines { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }

.helpline {
  display: block;
  text-align: center;
  padding: 11px 6px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--surface);
  text-decoration: none;
  color: inherit;
  min-height: 56px;
}

.helpline b { display: block; font: 800 17px Manrope, 'DM Sans', sans-serif; color: var(--bad); }
.helpline span { display: block; font-size: 9.5px; color: var(--ink-3); line-height: 1.3; margin-top: 2px; }

/* --- Area record --------------------------------------------------------- */

.record { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.record div { background: var(--surface); padding: 12px 13px; }
.record b { display: block; font: 800 19px Manrope, 'DM Sans', sans-serif; }
.record span { display: block; font-size: 10.5px; color: var(--ink-3); margin-top: 2px; line-height: 1.35; }

.team { display: flex; gap: 11px; align-items: flex-start; padding: 11px 0; border-top: 1px solid var(--line); }
.team:first-of-type { border-top: 0; }
.team svg { width: 18px; height: 18px; flex: 0 0 18px; color: var(--brand-2); margin-top: 2px; }
.team b { display: block; font-size: 13px; }
.team span { display: block; font-size: 11.5px; color: var(--ink-3); margin-top: 2px; }

/* --- Buttons ------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 12px 18px;
  border: 1px solid transparent;
  border-radius: 12px;
  font: 700 14px 'DM Sans', sans-serif;
  text-decoration: none;
  cursor: pointer;
  background: var(--surface-2);
  color: var(--ink);
  width: 100%;
}

.btn svg { width: 18px; height: 18px; }
.btn-primary { background: var(--brand-2); color: #fff; }
.btn-primary:active { background: var(--brand-ink); }
.btn-ghost { background: transparent; border-color: var(--line-strong); color: var(--ink-2); }
.btn-soft { background: var(--brand-soft); color: var(--brand-ink); }
.btn-ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.btn-danger { background: var(--bad-soft); color: var(--bad); }
.btn-row { display: flex; gap: 10px; }
.btn-row .btn { width: auto; flex: 1; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn.sm { min-height: 40px; padding: 9px 13px; font-size: 12.5px; width: auto; }

.linkish {
  background: none;
  border: 0;
  padding: 0;
  font: 700 13px 'DM Sans', sans-serif;
  color: var(--brand-ink);
  text-decoration: underline;
  cursor: pointer;
}

/* --- Forms --------------------------------------------------------------- */

.field { display: block; margin-bottom: 14px; }

.field > .label,
.field > label {
  display: block;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .3px;
  color: var(--ink-2);
  margin-bottom: 7px;
}

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

input[type=text], input[type=tel], input[type=email], input[type=number], select, textarea {
  width: 100%;
  min-height: 48px;
  padding: 12px 13px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  font: 15px 'DM Sans', sans-serif;   /* 15px+ stops iOS from zooming on focus */
  appearance: none;
}

textarea { min-height: 110px; resize: vertical; line-height: 1.5; }

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--brand-2);
  box-shadow: 0 0 0 3px rgba(22, 133, 201, .18);
}

select {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237d8c99' stroke-width='2.4' stroke-linecap='round'><path d='M6 9l6 6 6-6'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 18px;
  padding-right: 40px;
}

/* Tappable option tiles, used for category and timing */
.options { display: grid; gap: 8px; }
.options.two { grid-template-columns: 1fr 1fr; }

.option {
  position: relative;
  display: flex;
  gap: 11px;
  align-items: flex-start;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--surface);
  padding: 12px 13px;
  cursor: pointer;
}

/* Visually hidden but still focusable and exposed to assistive tech - the
   tile next to it is the visible control. */
.option input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  border: 0;
  padding: 0;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  overflow: hidden;
  white-space: nowrap;
}
.option .tick {
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  border-radius: 50%;
  border: 2px solid var(--line-strong);
  margin-top: 1px;
  display: grid;
  place-items: center;
}

.option .tick::after { content: ''; width: 10px; height: 10px; border-radius: 50%; background: transparent; }
.option b { display: block; font: 700 13.5px Manrope, 'DM Sans', sans-serif; }
.option small { display: block; color: var(--ink-3); font-size: 11.5px; line-height: 1.4; margin-top: 2px; }
.option:has(input:checked) { border-color: var(--brand-2); background: var(--brand-soft); }
.option:has(input:checked) .tick { border-color: var(--brand-2); }
.option:has(input:checked) .tick::after { background: var(--brand-2); }
.option input:focus-visible ~ .tick { box-shadow: 0 0 0 3px rgba(22, 133, 201, .25); }

.check {
  display: flex;
  gap: 11px;
  align-items: flex-start;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--surface-2);
  padding: 13px;
  font-size: 12.5px;
  color: var(--ink-2);
  cursor: pointer;
}

.check input { width: 20px; height: 20px; margin: 1px 0 0; flex: 0 0 20px; accent-color: var(--brand-2); }

/* Pin map on the report form */
.pin-map-wrap {
  margin-top: 10px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface-2);
}

#pin-map {
  height: 230px;
  width: 100%;
  z-index: 0;            /* keeps Leaflet panes under the app bar and tab bar */
}

.pin-map-hint {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  padding: 9px 12px;
  border-top: 1px solid var(--line);
  font-size: 11.5px;
  color: var(--ink-3);
  background: var(--surface);
}

.pin-map-hint svg { width: 15px; height: 15px; flex: 0 0 15px; color: var(--brand-2); }

/* Leaflet's own controls sit above the map but must stay under the app chrome. */
.leaflet-pane, .leaflet-top, .leaflet-bottom { z-index: 1 !important; }
.leaflet-container { font: 12px 'DM Sans', sans-serif; background: var(--surface-2); }

/* Photo picker */
.photo-pick {
  display: flex;
  gap: 12px;
  align-items: center;
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
  padding: 13px;
  background: var(--surface-2);
  cursor: pointer;
}

.photo-pick input[type=file] { display: none; }
.photo-pick svg { width: 24px; height: 24px; color: var(--brand-2); flex: 0 0 24px; }
.photo-pick b { display: block; font-size: 13px; }
.photo-pick small { display: block; color: var(--ink-3); font-size: 11px; }
.photo-preview { margin-top: 10px; display: none; }
.photo-preview img { width: 100%; border-radius: 12px; display: block; }

.honeypot { position: absolute !important; left: -10000px !important; width: 1px; height: 1px; overflow: hidden; }

/* --- Wizard -------------------------------------------------------------- */

.steps { display: flex; gap: 6px; margin-bottom: 14px; }
.steps i {
  flex: 1;
  height: 4px;
  border-radius: 999px;
  background: var(--line-strong);
}
.steps i.on { background: var(--brand-2); }

.wizard-on .step { display: none; }
.wizard-on .step.current { display: block; }
.step-head { margin-bottom: 12px; }
.step-head b { font: 800 16px Manrope, 'DM Sans', sans-serif; display: block; }
.step-head span { font-size: 12px; color: var(--ink-3); }

/* --- Status pills -------------------------------------------------------- */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .2px;
  background: var(--surface-2);
  color: var(--ink-2);
}

.pill.submitted,
.pill.acknowledged { background: var(--brand-soft); color: var(--brand-ink); }
.pill.in-progress { background: var(--warn-soft); color: var(--warn); }
.pill.blocked { background: var(--bad-soft); color: var(--bad); }
.pill.resolved, .pill.closed { background: var(--ok-soft); color: var(--ok); }
.pill.withdrawn { background: var(--surface-2); color: var(--ink-3); }
.pill.overdue { background: var(--bad-soft); color: var(--bad); }

/* --- Case list ----------------------------------------------------------- */

.case-list { display: grid; gap: 10px; }

.case {
  display: block;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 13px;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow);
}

.case-top { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.case b { font: 700 13.5px Manrope, 'DM Sans', sans-serif; }
.case .code { font-size: 10.5px; letter-spacing: .4px; color: var(--ink-3); font-weight: 700; }
.case .meta { font-size: 11.5px; color: var(--ink-3); margin-top: 6px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.case .meta > span + span:not(.pill)::before { content: '·'; margin-right: 8px; color: var(--line-strong); }

/* --- Case detail --------------------------------------------------------- */

.case-hero { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.case-hero-top { padding: 16px; }
.case-hero h2 { font: 800 17px/1.3 Manrope, 'DM Sans', sans-serif; margin: 8px 0 4px; }
/* The reference code is long; on a narrow phone it takes the full row and the
   Copy/Share buttons drop beneath it rather than squeezing off the edge. */
.case-hero .code-row { display: flex; align-items: center; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.case-hero .code-row code {
  flex: 1 1 100%;
  min-width: 0;
  font: 700 12.5px ui-monospace, SFMono-Regular, Menlo, monospace;
  background: var(--surface-2);
  border: 1px dashed var(--line-strong);
  border-radius: 10px;
  padding: 10px 12px;
  word-break: break-all;
}

.case-hero .code-row .btn { flex: 1 1 0; }

.facts { border-top: 1px solid var(--line); }
.fact { display: flex; gap: 12px; padding: 11px 16px; border-bottom: 1px solid var(--line); font-size: 13px; }
.fact:last-child { border-bottom: 0; }
.fact span { flex: 0 0 104px; color: var(--ink-3); font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; padding-top: 2px; }
.fact div { min-width: 0; color: var(--ink); }
.fact div small { display: block; color: var(--ink-3); font-size: 11.5px; margin-top: 3px; }

.sla {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 12px 16px;
  background: var(--surface-2);
  border-top: 1px solid var(--line);
  font-size: 12.5px;
  color: var(--ink-2);
}

.sla.late { background: var(--bad-soft); color: var(--bad); }
.sla svg { width: 18px; height: 18px; flex: 0 0 18px; }

/* Timeline */
.timeline { list-style: none; margin: 0; padding: 4px 0 0; }
.timeline li { position: relative; padding: 0 0 16px 24px; }
.timeline li::before {
  content: '';
  position: absolute;
  left: 3px;
  top: 5px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--brand-2);
  box-shadow: 0 0 0 3px var(--brand-soft);
}
.timeline li::after {
  content: '';
  position: absolute;
  left: 7px;
  top: 18px;
  bottom: 0;
  width: 1px;
  background: var(--line);
}
.timeline li:last-child { padding-bottom: 0; }
.timeline li:last-child::after { display: none; }
.timeline li.mine::before { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.timeline b { display: block; font: 700 13px Manrope, 'DM Sans', sans-serif; }
.timeline time { display: block; font-size: 11px; color: var(--ink-3); margin-top: 2px; }
.timeline p { margin: 6px 0 0; font-size: 12.5px; color: var(--ink-2); background: var(--surface-2); border-radius: 10px; padding: 9px 11px; }

.evidence img { width: 100%; border-radius: 12px; display: block; border: 1px solid var(--line); }

/* --- Action sheet / accordion -------------------------------------------- */

details.sheet {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  overflow: hidden;
}

details.sheet + details.sheet { margin-top: 10px; }

details.sheet > summary {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 14px;
  cursor: pointer;
  font: 700 13.5px Manrope, 'DM Sans', sans-serif;
  list-style: none;
  min-height: 52px;
}

details.sheet > summary::-webkit-details-marker { display: none; }
details.sheet > summary svg { width: 19px; height: 19px; color: var(--brand-2); flex: 0 0 19px; }
details.sheet > summary small { display: block; font-weight: 500; font-size: 11.5px; color: var(--ink-3); margin-top: 2px; }
details.sheet > summary .chev { margin-left: auto; color: var(--ink-3); transition: transform .18s; }
details.sheet[open] > summary .chev { transform: rotate(180deg); }
details.sheet .sheet-body { padding: 0 14px 14px; border-top: 1px solid var(--line); padding-top: 14px; }
details.sheet.danger > summary svg { color: var(--bad); }

/* Satisfaction rating */
.rating { display: flex; gap: 8px; }
.rating input { position: absolute; opacity: 0; }
.rating label {
  flex: 1;
  min-height: 44px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 14px;
  color: var(--ink-2);
  cursor: pointer;
}
.rating input:checked + label { background: var(--brand-2); border-color: var(--brand-2); color: #fff; }

/* --- Banners, toasts, misc ---------------------------------------------- */

.toasts {
  position: fixed;
  left: 0;
  right: 0;
  top: calc(env(safe-area-inset-top, 0px) + 10px);
  z-index: 60;
  margin: 0 auto;
  max-width: 480px;
  padding: 0 14px;
  display: grid;
  gap: 8px;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  background: #0f2740;
  color: #fff;
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.45;
  box-shadow: 0 12px 30px rgba(8, 20, 32, .3);
  display: flex;
  gap: 10px;
  align-items: flex-start;
  animation: toast-in .22s ease-out;
}

.toast.success { background: #10604a; }
.toast.error { background: #8f2f29; }
.toast button { background: none; border: 0; color: inherit; opacity: .7; font-size: 18px; line-height: 1; cursor: pointer; padding: 0 2px; }

@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

.banner {
  display: flex;
  gap: 11px;
  align-items: flex-start;
  border-radius: var(--radius-sm);
  padding: 12px 13px;
  font-size: 12.5px;
  line-height: 1.5;
  background: var(--warn-soft);
  color: var(--warn);
  border: 1px solid transparent;
}

.banner.info { background: var(--brand-soft); color: var(--brand-ink); }
.banner.ok { background: var(--ok-soft); color: var(--ok); }
.banner.bad { background: var(--bad-soft); color: var(--bad); }
.banner svg { width: 18px; height: 18px; flex: 0 0 18px; margin-top: 1px; }
/* Only the banner's opening bold is its heading. Making every <b> a block
   dropped mid-sentence emphasis onto a line of its own. */
.banner b:first-child { display: block; margin-bottom: 2px; }

.empty {
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 22px 16px;
  text-align: center;
  color: var(--ink-3);
  font-size: 13px;
  background: var(--surface);
}

.empty svg { width: 28px; height: 28px; margin-bottom: 8px; color: var(--line-strong); }

.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 11px 10px;
  text-align: center;
  box-shadow: var(--shadow);
}
.stat b { display: block; font: 800 20px Manrope, 'DM Sans', sans-serif; }
.stat span { display: block; font-size: 10.5px; color: var(--ink-3); line-height: 1.3; margin-top: 2px; }

/* Sticky submit bar inside a form page */
.sticky-actions {
  position: sticky;
  bottom: calc(var(--tab-h) + var(--safe-b) + 8px);
  background: linear-gradient(to top, var(--app-bg) 62%, rgba(0, 0, 0, 0));
  padding: 12px 0 2px;
  margin-top: -4px;
}

.trend { display: flex; align-items: flex-end; gap: 6px; height: 92px; }
.trend-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 5px; justify-content: flex-end; height: 100%; }
.trend-bar { width: 100%; max-width: 26px; border-radius: 6px 6px 3px 3px; background: var(--aqi); min-height: 4px; }
.trend-col span { font-size: 9.5px; color: var(--ink-3); font-weight: 700; }
.trend-col em { font-size: 10px; font-style: normal; font-weight: 800; color: var(--ink-2); }

.provenance {
  font-size: 11px;
  color: var(--ink-3);
  line-height: 1.5;
  border-top: 1px dashed var(--line);
  padding-top: 10px;
  margin-top: 4px;
}

.app-footer {
  padding: 4px 2px 0;
  font-size: 10.5px;
  color: var(--ink-3);
  line-height: 1.55;
}

.app-footer a { color: var(--ink-3); }

.faq { display: grid; gap: 8px; }

table.plain { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.plain th { text-align: left; color: var(--ink-3); font-size: 10px; letter-spacing: .6px; text-transform: uppercase; padding: 8px 10px; background: var(--surface-2); }
table.plain td { padding: 10px; border-top: 1px solid var(--line); vertical-align: top; color: var(--ink-2); }
table.plain td b { color: var(--ink); }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

/* --- App-bar menu ---------------------------------------------------------
   The tab bar carries the four or five places people go constantly. Everything
   else needs somewhere to live, and before this it had nowhere: the department
   portal could not reach the map, the ward directory, ingestion or the audit
   trail at all. Built on <details> so it opens with no JavaScript. */

.menu { position: relative; flex: 0 0 auto; }

.menu > summary {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: rgba(255, 255, 255, .12);
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
  list-style: none;
}

.menu > summary::-webkit-details-marker { display: none; }
.menu > summary:active { background: rgba(255, 255, 255, .24); }
.menu > summary svg { width: 20px; height: 20px; }

.menu-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 50;
  width: 248px;
  max-width: calc(100vw - 28px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 16px 44px rgba(10, 24, 38, .26);
  padding: 6px;
  max-height: 72vh;
  overflow-y: auto;
}

.menu-panel a,
.menu-panel button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 11px;
  border: 0;
  border-radius: 10px;
  background: none;
  color: var(--ink);
  font: 500 13.5px 'DM Sans', sans-serif;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  min-height: 42px;
}

.menu-panel a:hover,
.menu-panel button:hover { background: var(--surface-2); }
.menu-panel a svg,
.menu-panel button svg { width: 17px; height: 17px; flex: 0 0 17px; color: var(--ink-3); }
.menu-panel a.current { color: var(--brand-ink); font-weight: 700; }
.menu-panel a.current svg { color: var(--brand-2); }

.menu-label {
  padding: 9px 11px 5px;
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--ink-3);
}

.menu-panel hr { border: 0; border-top: 1px solid var(--line); margin: 5px 2px; }
.menu-panel form { margin: 0; }


/* Imported names are not prose: "Sanjeevani Hospital - Child
   Specialist,paediatrician,neonatologist,baby Clinic" carries no space after its
   commas, so its min-content width is wider than a phone. Inside a flex row that
   width is a floor, which pushed the status pill clean out of the card and took
   the page 18px past the screen edge. `anywhere` is the one value that lowers the
   min-content contribution, so the flex row can finally shrink; it still only
   breaks a word when the word genuinely does not fit. */
.card,.work,.app-main>div{overflow-wrap:anywhere;min-width:0}
.pill{flex:0 1 auto;min-width:0}

/* ===== media safety net =====
   Any chart, diagram, photo or figure is capped at the width of its column, so a
   520px-wide SVG or a camera photo cannot push the page sideways on a phone.
   Leaflet is deliberately excluded: the library sizes its tile <img>s and its
   vector pane in absolute pixels far wider than the viewport on purpose, and
   clamping those to 100% squeezes the tiles and misplaces every overlay. */
img,svg,canvas,video{max-width:100%}
img,video{height:auto}
.leaflet-container img,.leaflet-container svg,.leaflet-container canvas,
.leaflet-pane img,.leaflet-pane svg,.leaflet-pane canvas{max-width:none}
