/* Nagrik Netra – citizen app */
:root {
  --ink: #0d1b2e;
  --ink-2: #33415c;
  --muted: #6b7a90;
  --line: #e3e7ee;
  --bg: #f5f3ee;
  --card: #ffffff;
  --navy: #0b2545;
  --navy-2: #13315c;
  --saffron: #f2711c;
  --saffron-soft: #fde7d6;
  --green: #138a52;
  --green-soft: #dff3e8;
  --red: #d7263d;
  --red-soft: #fbe1e4;
  --amber: #c98a00;
  --amber-soft: #fbf0d0;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(13,27,46,.06), 0 6px 20px rgba(13,27,46,.06);
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Mukta", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg); color: var(--ink); font-size: 16px; line-height: 1.45;
  min-height: 100vh; overscroll-behavior-y: contain;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--navy-2); }
img, video { max-width: 100%; display: block; }
.hidden { display: none !important; }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30; background: var(--navy); color: #fff;
  display: flex; align-items: center; gap: 10px; padding: 12px 16px; min-height: 56px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 19px; letter-spacing: .2px; user-select: none; }
.brand-mark { width: 30px; height: 30px; border-radius: 9px; background: var(--saffron); display: grid; place-items: center; }
.brand-mark svg { width: 20px; height: 20px; }
.topbar .spacer { flex: 1; }
.icon-btn { position: relative; background: rgba(255,255,255,.08); border: 0; color: #fff; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; cursor: pointer; }
.icon-btn svg { width: 22px; height: 22px; }
.badge { position: absolute; top: 4px; right: 4px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: var(--saffron); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; }
.back-btn { background: transparent; border: 0; color: #fff; display: flex; align-items: center; gap: 4px; padding: 6px 0; cursor: pointer; font-size: 16px; }

/* ---------- Layout ---------- */
main { padding: 16px 16px calc(96px + var(--safe-b)); max-width: 640px; margin: 0 auto; }
.screen-title { font-size: 24px; font-weight: 700; margin: 4px 0 14px; }
.section-title { font-size: 15px; font-weight: 700; color: var(--ink-2); text-transform: uppercase; letter-spacing: .6px; margin: 22px 0 10px; }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.card + .card { margin-top: 12px; }
.stack > * + * { margin-top: 12px; }
.row { display: flex; align-items: center; gap: 10px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }

/* ---------- Bottom nav ---------- */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; background: #fff; border-top: 1px solid var(--line);
  display: grid; grid-template-columns: repeat(5, 1fr); padding: 6px 4px calc(6px + var(--safe-b));
}
.tab { background: none; border: 0; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 12px; color: var(--muted); padding: 4px 0; cursor: pointer; }
.tab svg { width: 24px; height: 24px; }
.tab.active { color: var(--navy); font-weight: 700; }
.tab.report { color: #fff; }
.tab.report .plus { width: 52px; height: 52px; margin-top: -26px; border-radius: 18px; background: var(--saffron); display: grid; place-items: center; box-shadow: 0 6px 16px rgba(242,113,28,.4); }
.tab.report span { color: var(--ink-2); }

/* ---------- Buttons & forms ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 14px; padding: 13px 18px; font-weight: 700; font-size: 16px; cursor: pointer; background: var(--navy); color: #fff; text-decoration: none; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.block { width: 100%; }
.btn.primary { background: var(--saffron); }
.btn.ghost { background: transparent; color: var(--navy); border: 1.5px solid var(--line); }
.btn.danger { background: var(--red); }
.btn.success { background: var(--green); }
.btn.sm { padding: 8px 12px; font-size: 14px; border-radius: 10px; }
.btn svg { width: 20px; height: 20px; }
label.field { display: block; }
label.field > span { display: block; font-weight: 600; font-size: 14px; color: var(--ink-2); margin-bottom: 6px; }
.input, select.input, textarea.input { width: 100%; border: 1.5px solid var(--line); background: #fff; border-radius: 12px; padding: 12px 14px; font-size: 16px; outline: none; }
.input:focus { border-color: var(--navy-2); }
textarea.input { min-height: 110px; resize: vertical; }
.otp-input { letter-spacing: 10px; text-align: center; font-size: 26px; font-weight: 700; }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; }
.switch input { appearance: none; width: 46px; height: 28px; background: var(--line); border-radius: 20px; position: relative; cursor: pointer; transition: .2s; flex-shrink: 0; }
.switch input::after { content: ""; position: absolute; width: 22px; height: 22px; border-radius: 50%; background: #fff; top: 3px; left: 3px; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.switch input:checked { background: var(--green); }
.switch input:checked::after { left: 21px; }
.chip-row { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { border: 1.5px solid var(--line); background: #fff; border-radius: 999px; padding: 6px 12px; font-size: 14px; cursor: pointer; }
.chip.on { background: var(--navy); color: #fff; border-color: var(--navy); }

/* ---------- Login ---------- */
.login-hero { background: var(--navy); color: #fff; padding: 48px 24px 64px; border-radius: 0 0 28px 28px; }
.login-hero h1 { font-size: 32px; margin: 18px 0 6px; line-height: 1.1; }
.login-hero p { margin: 0; opacity: .8; }
.login-card { margin: -40px 16px 0; }
.lang-switch { display: flex; gap: 6px; }
.lang-switch button { background: rgba(255,255,255,.12); border: 0; color: #fff; padding: 6px 10px; border-radius: 8px; cursor: pointer; }
.lang-switch button.on { background: var(--saffron); }

/* ---------- Home ---------- */
.sos-wrap { display: flex; flex-direction: column; align-items: center; padding: 10px 0 4px; }
.sos-btn {
  width: 168px; height: 168px; border-radius: 50%; border: 0; background: radial-gradient(circle at 35% 30%, #ff5a6e, var(--red) 60%, #a5122a);
  color: #fff; font-size: 34px; font-weight: 800; letter-spacing: 2px; cursor: pointer; position: relative;
  box-shadow: 0 10px 30px rgba(215,38,61,.45); touch-action: manipulation; user-select: none;
}
.sos-btn small { display: block; font-size: 13px; font-weight: 600; letter-spacing: .3px; opacity: .9; }
.sos-btn::before, .sos-btn::after { content: ""; position: absolute; inset: -10px; border-radius: 50%; border: 2px solid rgba(215,38,61,.35); animation: ring 2.2s infinite; }
.sos-btn::after { animation-delay: 1.1s; }
.sos-btn.holding { transform: scale(.96); }
.sos-progress { position: absolute; inset: -6px; border-radius: 50%; }
@keyframes ring { 0% { transform: scale(.92); opacity: 1; } 100% { transform: scale(1.25); opacity: 0; } }
.sos-hint { margin-top: 14px; font-size: 13px; color: var(--muted); text-align: center; max-width: 300px; }

.report-cta { display: flex; align-items: center; gap: 14px; background: var(--saffron); color: #fff; border-radius: var(--radius); padding: 16px; border: 0; width: 100%; text-align: left; cursor: pointer; box-shadow: 0 8px 22px rgba(242,113,28,.3); }
.report-cta .ic { width: 48px; height: 48px; border-radius: 14px; background: rgba(255,255,255,.2); display: grid; place-items: center; flex-shrink: 0; }
.report-cta .ic svg { width: 28px; height: 28px; }
.report-cta b { font-size: 18px; display: block; }
.report-cta span { font-size: 14px; opacity: .92; }

.cat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.cat { background: #fff; border-radius: 14px; padding: 12px 4px; text-align: center; border: 1.5px solid transparent; box-shadow: var(--shadow); cursor: pointer; font-size: 12.5px; line-height: 1.2; }
.cat .em { font-size: 26px; display: block; margin-bottom: 6px; }
.cat.on { border-color: var(--saffron); background: var(--saffron-soft); }

.alert-banner { display: flex; gap: 12px; align-items: flex-start; background: var(--red-soft); border-left: 4px solid var(--red); padding: 12px 14px; border-radius: 12px; cursor: pointer; }
.alert-banner.warning { background: var(--amber-soft); border-color: var(--amber); }
.alert-banner.info { background: #e3edf9; border-color: var(--navy-2); }
.alert-banner b { display: block; }

.helplines { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.helpline { display: flex; align-items: center; justify-content: space-between; background: #fff; border-radius: 12px; padding: 10px 12px; text-decoration: none; color: var(--ink); box-shadow: var(--shadow); font-size: 14px; }
.helpline b { color: var(--red); font-size: 17px; }

/* ---------- Complaint list ---------- */
.c-item { display: flex; gap: 12px; align-items: center; cursor: pointer; }
.c-item .em { width: 44px; height: 44px; border-radius: 12px; background: var(--bg); display: grid; place-items: center; font-size: 22px; flex-shrink: 0; }
.c-item .body { flex: 1; min-width: 0; }
.c-item .t { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.c-item .m { font-size: 13px; color: var(--muted); }
.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--bg); color: var(--ink-2); white-space: nowrap; }
.pill.submitted { background: #e3edf9; color: var(--navy-2); }
.pill.verified, .pill.assigned { background: var(--amber-soft); color: #8a5d00; }
.pill.investigating, .pill.dispatched { background: var(--saffron-soft); color: #a3480b; }
.pill.resolved, .pill.closed { background: var(--green-soft); color: var(--green); }
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty .em { font-size: 44px; }

/* ---------- Journey tracker ---------- */
.journey { position: relative; padding-left: 28px; }
.journey::before { content: ""; position: absolute; left: 9px; top: 6px; bottom: 6px; width: 2px; background: var(--line); }
.step { position: relative; padding-bottom: 18px; }
.step:last-child { padding-bottom: 0; }
.step .dot { position: absolute; left: -28px; top: 2px; width: 20px; height: 20px; border-radius: 50%; background: #fff; border: 2px solid var(--line); display: grid; place-items: center; }
.step.done .dot { background: var(--green); border-color: var(--green); }
.step.done .dot::after { content: ""; width: 6px; height: 10px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg) translate(-1px,-1px); }
.step.current .dot { border-color: var(--saffron); background: var(--saffron); box-shadow: 0 0 0 5px var(--saffron-soft); }
.step .lbl { font-weight: 700; }
.step .sub { font-size: 13px; color: var(--muted); }
.step .note { font-size: 14px; margin-top: 4px; background: var(--bg); padding: 8px 10px; border-radius: 10px; }
.sig { font-family: ui-monospace, Menlo, monospace; font-size: 11px; color: var(--green); }

/* ---------- Report flow ---------- */
.stepper { display: flex; gap: 6px; margin-bottom: 16px; }
.stepper i { flex: 1; height: 4px; border-radius: 4px; background: var(--line); }
.stepper i.on { background: var(--saffron); }
.capture-options { display: grid; gap: 12px; }
.capture-opt { display: flex; align-items: center; gap: 14px; background: #fff; border: 1.5px solid var(--line); border-radius: var(--radius); padding: 16px; cursor: pointer; text-align: left; width: 100%; }
.capture-opt .ic { width: 50px; height: 50px; border-radius: 14px; display: grid; place-items: center; flex-shrink: 0; background: var(--navy); color: #fff; }
.capture-opt.alt .ic { background: var(--saffron-soft); color: var(--saffron); }
.capture-opt .ic svg { width: 26px; height: 26px; }
.capture-opt b { display: block; font-size: 17px; }
.capture-opt span { font-size: 14px; color: var(--muted); }

.recorder { position: fixed; inset: 0; background: #000; z-index: 60; display: flex; flex-direction: column; }
.recorder video { flex: 1; width: 100%; height: 100%; object-fit: cover; }
.rec-top { position: absolute; top: 0; left: 0; right: 0; padding: 14px 16px; display: flex; justify-content: space-between; align-items: center; color: #fff; background: linear-gradient(#0009, transparent); }
.rec-time { font-variant-numeric: tabular-nums; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.rec-time .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--red); animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .2; } }
.rec-bottom { position: absolute; bottom: 0; left: 0; right: 0; padding: 18px 16px calc(28px + var(--safe-b)); background: linear-gradient(transparent, #000c); color: #fff; }
.rec-transcript { min-height: 44px; max-height: 96px; overflow: auto; font-size: 15px; margin-bottom: 14px; text-shadow: 0 1px 2px #000; }
.rec-controls { display: flex; align-items: center; justify-content: space-around; }
.rec-btn { width: 76px; height: 76px; border-radius: 50%; border: 4px solid #fff; background: var(--red); cursor: pointer; }
.rec-btn.recording { border-radius: 22px; transform: scale(.8); transition: .2s; }
.rec-side { background: rgba(255,255,255,.15); border: 0; color: #fff; width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; cursor: pointer; }
.rec-side svg { width: 24px; height: 24px; }
.meter { height: 6px; border-radius: 6px; background: rgba(255,255,255,.2); overflow: hidden; margin-bottom: 10px; }
.meter i { display: block; height: 100%; background: linear-gradient(90deg, var(--green), var(--amber), var(--red)); width: 0; transition: width .1s; }

.preview-video { width: 100%; border-radius: 14px; background: #000; max-height: 320px; }
.analysis { margin-top: 12px; }
.an-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: 15px; }
.an-row:last-child { border-bottom: 0; }
.an-row .k { flex: 1; }
.an-row .v { font-weight: 700; }
.an-row.alert .v { color: var(--red); }
.progress { height: 8px; background: var(--line); border-radius: 8px; overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--saffron); width: 0; transition: width .3s; }
.thumbs { display: flex; gap: 6px; overflow-x: auto; padding: 6px 0; }
.thumbs img { width: 64px; height: 64px; object-fit: cover; border-radius: 10px; flex-shrink: 0; filter: blur(4px); }
.mic-btn { display: inline-flex; align-items: center; gap: 6px; border: 1.5px solid var(--line); background: #fff; border-radius: 10px; padding: 6px 10px; font-size: 14px; cursor: pointer; }
.mic-btn.on { background: var(--red); color: #fff; border-color: var(--red); }
.mic-btn svg { width: 18px; height: 18px; }
.map-box { height: 200px; border-radius: 14px; overflow: hidden; margin-top: 8px; border: 1.5px solid var(--line); }
.anon-box { background: var(--navy); color: #fff; border-radius: 14px; padding: 4px 14px; }
.anon-box .muted { color: #b9c6db; }

.success-screen { text-align: center; padding: 36px 8px; }
.success-screen .tick { width: 88px; height: 88px; border-radius: 50%; background: var(--green); margin: 0 auto 18px; display: grid; place-items: center; }
.success-screen .tick svg { width: 46px; height: 46px; color: #fff; }
.ref { font-family: ui-monospace, Menlo, monospace; font-size: 22px; font-weight: 700; background: #fff; display: inline-block; padding: 8px 16px; border-radius: 12px; margin: 10px 0; letter-spacing: 1px; }

/* ---------- SOS active ---------- */
.sos-active { position: fixed; inset: 0; z-index: 70; background: var(--red); color: #fff; display: flex; flex-direction: column; padding: 24px 20px calc(24px + var(--safe-b)); }
.sos-active.silent { background: #111; color: #9aa3ad; }
.sos-active h2 { font-size: 30px; margin: 8px 0; }
.sos-active .pulse { width: 120px; height: 120px; border-radius: 50%; background: rgba(255,255,255,.18); margin: 24px auto; display: grid; place-items: center; animation: pulse 1.4s infinite; }
.sos-active.silent .pulse { animation: none; background: #1d1d1d; }
@keyframes pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.08); } }
.sos-active .pulse svg { width: 56px; height: 56px; }
.sos-list { list-style: none; padding: 0; margin: 0; font-size: 15px; }
.sos-list li { padding: 8px 0; border-bottom: 1px solid rgba(255,255,255,.15); display: flex; justify-content: space-between; }
.sos-actions { margin-top: auto; display: grid; gap: 10px; }
.sos-active .btn.white { background: #fff; color: var(--red); }
.sos-active.silent .btn.white { background: #222; color: #ccc; }
.sos-active .btn.outline { background: transparent; border: 2px solid rgba(255,255,255,.6); color: #fff; }

/* ---------- Toast & sheet ---------- */
.toast { position: fixed; left: 50%; bottom: calc(92px + var(--safe-b)); transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 12px; z-index: 90; font-size: 15px; max-width: 90%; box-shadow: 0 6px 20px rgba(0,0,0,.25); animation: up .25s; }
@keyframes up { from { transform: translate(-50%, 20px); opacity: 0; } }
.overlay { position: fixed; inset: 0; background: rgba(13,27,46,.5); z-index: 80; display: flex; align-items: flex-end; }
.sheet { background: #fff; width: 100%; max-width: 640px; margin: 0 auto; border-radius: 22px 22px 0 0; padding: 20px 18px calc(22px + var(--safe-b)); max-height: 88vh; overflow: auto; }
.sheet h3 { margin: 0 0 6px; font-size: 20px; }
.stars { display: flex; gap: 6px; font-size: 34px; justify-content: center; margin: 10px 0; }
.stars button { background: none; border: 0; cursor: pointer; color: var(--line); padding: 0; }
.stars button.on { color: #f5b301; }
.spinner { width: 22px; height: 22px; border: 3px solid rgba(0,0,0,.12); border-top-color: var(--saffron); border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }
.notif { display: flex; gap: 12px; }
.notif.unread { background: #fffaf5; }
.notif .ic { width: 10px; height: 10px; border-radius: 50%; background: var(--saffron); margin-top: 8px; flex-shrink: 0; }
.notif.read .ic { background: var(--line); }
.offline-bar { background: var(--amber); color: #fff; text-align: center; font-size: 13px; padding: 4px; }
#nearbyMap { height: 260px; border-radius: 14px; overflow: hidden; }
