/* Saral — mobile-first civic UI.
   Visual language: India tricolor + "India blue" + saffron, Devanagari-friendly.
   No real State Emblem / Ashoka Chakra / department logos are used.
   One CSS file, no raster images (all art is inline SVG) — stays light on 4G. */
:root {
  --saffron: #ff9933;
  --green: #138808;
  --navy: #16357a;        /* "India blue" primary */
  --navy-deep: #0b2358;

  --bg: #eef1f8;
  --bg-2: #e5eaf5;
  --card: #ffffff;
  --ink: #14213d;
  --ink-soft: #5a6a88;
  --line: #dde4f1;
  --primary: var(--navy);
  --primary-ink: #ffffff;
  --primary-soft: #e7edfb;
  --accent: var(--green);
  --warn: #a55a00;
  --warn-soft: #fff3df;
  --danger: #c0392b;

  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 8px 24px rgba(16, 34, 84, .09);
  --shadow-lg: 0 16px 46px rgba(11, 35, 88, .2);
  --font: "Mukta", system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans Devanagari", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1020; --bg-2: #0e1526; --card: #161d30; --ink: #eaf0fb; --ink-soft: #9db0d2;
    --line: #263149; --navy: #4f7ff0; --primary: #4f7ff0; --primary-soft: #16243f;
    --warn: #e0a44a; --warn-soft: #2a2413; --danger: #f0685a;
    --shadow: 0 8px 24px rgba(0,0,0,.4); --shadow-lg: 0 18px 48px rgba(0,0,0,.55);
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; }
body {
  font-family: var(--font);
  background:
    radial-gradient(1200px 480px at 50% -8%, var(--bg-2), transparent 70%),
    var(--bg);
  color: var(--ink); line-height: 1.5; font-size: 17px;
  -webkit-font-smoothing: antialiased;
}

/* tricolor bar pinned to top */
.tricolor { position: sticky; top: 0; z-index: 40; display: flex; height: 5px; }
.tricolor span { flex: 1; }
.tricolor span:nth-child(1) { background: var(--saffron); }
.tricolor span:nth-child(2) { background: #ffffff; }
.tricolor span:nth-child(3) { background: var(--green); }
@media (prefers-color-scheme: dark) { .tricolor span:nth-child(2) { background: #dfe6f5; } }

#app { max-width: 480px; margin: 0 auto; min-height: 100dvh; padding: 16px 16px 44px; position: relative; }

/* ---------- buttons / inputs ---------- */
button { font: inherit; cursor: pointer; border: none; background: none; color: inherit; }
.btn-primary {
  background: linear-gradient(180deg, var(--navy), var(--navy-deep));
  color: #fff; border-radius: 999px; padding: 15px 22px; font-weight: 700; font-size: 17px;
  box-shadow: var(--shadow); transition: transform .05s ease, filter .15s;
}
@media (prefers-color-scheme: dark) { .btn-primary { background: linear-gradient(180deg,#4f7ff0,#2f5ad0); } }
.btn-primary:active { transform: translateY(1px); }
.btn-primary:hover { filter: brightness(1.06); }
.btn-ghost { background: var(--card); color: var(--ink); border: 1.5px solid var(--line); border-radius: 999px; padding: 14px 20px; font-weight: 600; }
.block { display: block; width: 100%; text-align: center; }
.ghost-btn { background: var(--card); border: 1.5px solid var(--line); border-radius: 999px; padding: 8px 14px; font-weight: 700; font-size: 14px; }
.icon-btn { width: 42px; height: 42px; border-radius: 12px; background: var(--card); border: 1.5px solid var(--line); font-size: 20px; display: grid; place-items: center; }
.link-btn { color: var(--primary); text-decoration: underline; font-weight: 700; }
.txt { width: 100%; padding: 15px 16px; font-size: 17px; border-radius: var(--radius-sm); border: 1.5px solid var(--line); background: var(--card); color: var(--ink); font-family: var(--font); }
.txt:focus { outline: 3px solid var(--primary-soft); border-color: var(--primary); }
.txt.area { resize: vertical; }
.txt.err { border-color: var(--danger); }
.txt.otp { letter-spacing: .5em; text-align: center; font-size: 26px; font-weight: 800; }

/* ---------- home: brand ---------- */
.brand-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-top: 6px; }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-mark { display: inline-flex; filter: drop-shadow(0 6px 14px rgba(11,35,88,.28)); }
.brand-mark svg { display: block; border-radius: 13px; }
.brand-name { font-weight: 800; font-size: 22px; letter-spacing: -.02em; line-height: 1.1; }
.brand-deva { font-weight: 700; color: var(--ink-soft); font-size: 17px; }
.brand-tag { font-size: 12px; color: var(--ink-soft); }
.brand-actions { display: flex; gap: 8px; flex: none; }

/* ---------- home: hero ---------- */
.hero {
  position: relative; overflow: hidden; margin-top: 16px;
  background: linear-gradient(165deg, #1c47a3 0%, #0b2358 100%);
  border-radius: 24px; padding: 22px 18px 20px; color: #fff;
  box-shadow: var(--shadow-lg);
}
.hero::after { /* saffron under-glow */
  content: ""; position: absolute; right: -40px; top: -50px; width: 180px; height: 180px;
  background: radial-gradient(circle, rgba(255,153,51,.45), transparent 70%);
}
.civic-svg {
  position: absolute; left: 50%; bottom: 0; transform: translateX(-50%);
  width: 118%; max-width: 460px; height: auto; color: #ffffff; opacity: .1; pointer-events: none;
}
.hero-title { position: relative; margin: 2px 2px 16px; font-size: 21px; font-weight: 700; letter-spacing: -.01em; }

.ask-box {
  position: relative; z-index: 1; display: flex; align-items: center; gap: 6px;
  background: var(--card); border-radius: 16px; padding: 6px 6px 6px 12px;
  box-shadow: 0 10px 30px rgba(4,12,35,.3);
}
.ask-search { font-size: 17px; opacity: .6; }
.ask-input { flex: 1; min-width: 0; border: none; outline: none; background: none; font-size: 17px; color: var(--ink); padding: 12px 4px; font-family: var(--font); }
.ask-input::placeholder { color: var(--ink-soft); }
.mic-btn { font-size: 19px; width: 44px; height: 44px; border-radius: 11px; }
.mic-btn:active { background: var(--primary-soft); }
.go-btn { width: 46px; height: 46px; border-radius: 12px; background: linear-gradient(180deg, var(--saffron), #f07f22); color: #fff; font-size: 20px; display: grid; place-items: center; box-shadow: 0 4px 12px rgba(240,127,34,.4); }
.ask-hint { position: relative; z-index: 1; color: rgba(255,255,255,.82); font-size: 13px; margin: 12px 4px 0; }
.engine-note { position: relative; z-index: 1; font-size: 12.5px; color: rgba(255,255,255,.9); margin: 8px 4px 2px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.engine-note .link-btn { color: #ffd9ac; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.dot-live { background: #43d17f; box-shadow: 0 0 0 3px rgba(67,209,127,.3); }
.dot-off { background: var(--saffron); box-shadow: 0 0 0 3px rgba(255,153,51,.3); }

/* ---------- home: service tiles ---------- */
.popular { margin-top: 24px; }
.popular-label { font-size: 12.5px; font-weight: 800; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .08em; margin-bottom: 12px; }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; }
.tile {
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px; text-align: left;
  background: var(--card); border: 1.5px solid var(--line); border-radius: var(--radius);
  padding: 14px; box-shadow: var(--shadow); transition: transform .06s, border-color .15s;
}
.tile:active { transform: translateY(1px); border-color: var(--primary); }
.tile-ico {
  width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center; font-size: 24px;
  background: color-mix(in srgb, var(--tint) 16%, transparent);
  box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--tint) 30%, transparent);
  margin-bottom: 6px;
}
.tile-label { font-weight: 700; font-size: 15px; line-height: 1.25; }
.tile-dept { font-size: 11.5px; color: var(--ink-soft); font-weight: 600; }

/* ---------- trust strip ---------- */
.trust-strip {
  display: flex; align-items: center; gap: 10px; margin-top: 20px;
  background: var(--card); border: 1.5px solid var(--line); border-radius: 14px;
  padding: 11px 14px; font-size: 12px; color: var(--ink-soft); line-height: 1.35;
}
.flag-dot { width: 22px; height: 15px; border-radius: 3px; flex: none;
  background: linear-gradient(180deg, var(--saffron) 0 33%, #fff 33% 66%, var(--green) 66% 100%);
  box-shadow: 0 0 0 1px var(--line); }

.honesty-link { margin-top: 20px; display: block; width: 100%; text-align: center; color: var(--ink-soft); font-size: 13.5px; padding: 12px; text-decoration: underline; }

/* ---------- thinking / confirm ---------- */
.thinking { text-align: center; padding-top: 20vh; }
.thinking-q { color: var(--ink-soft); font-style: italic; }
.spinner { width: 44px; height: 44px; border-radius: 50%; margin: 0 auto 18px; border: 4px solid var(--line); border-top-color: var(--saffron); border-right-color: var(--navy); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.confirm { padding-top: 12px; }
.back-float { margin-bottom: 18px; }
.confirm-lead { font-size: 15px; color: var(--ink-soft); margin: 4px 0 12px; font-weight: 600; }
.svc-card { display: flex; align-items: center; gap: 14px; width: 100%; text-align: left; background: var(--card); border: 1.5px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 11px; box-shadow: var(--shadow); }
.svc-card:active { border-color: var(--primary); }
.svc-card.big { padding: 20px; border-left: 5px solid var(--saffron); }
.svc-ico { font-size: 30px; }
.svc-title { font-weight: 700; font-size: 17px; }
.svc-desc { font-size: 13.5px; color: var(--ink-soft); }
.svc-dept { font-size: 12px; color: var(--ink-soft); margin-top: 5px; }
.src-badge { font-size: 11px; padding: 2px 8px; border-radius: 999px; font-weight: 800; }
.src-badge.live { background: rgba(19,136,8,.15); color: var(--green); }
.src-badge.off { background: var(--warn-soft); color: var(--warn); }
.ai-reply { color: var(--ink-soft); font-size: 14px; font-style: italic; margin: 4px 2px 14px; }
.confirm-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 18px; }
.svc-list { margin-top: 8px; }

/* ---------- flow shell ---------- */
.flow-top { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; padding-bottom: 14px; border-bottom: 1.5px solid var(--line); position: relative; }
.flow-top::after { content: ""; position: absolute; left: 0; bottom: -1.5px; width: 64px; height: 3px; border-radius: 3px; background: linear-gradient(90deg, var(--saffron), var(--green)); }
.flow-top h2 { font-size: 19px; margin: 0; flex: 1; font-weight: 700; }
.dept-tag { display: inline-flex; }
.dept-tag svg { width: 34px; height: 34px; }
.flow { display: flex; flex-direction: column; gap: 14px; }
.flow-sub { color: var(--ink-soft); font-size: 14.5px; margin: 0; }
.flow-sub.center { text-align: center; }
.field { display: flex; flex-direction: column; gap: 7px; }
.field > span { font-size: 14px; font-weight: 700; color: var(--ink-soft); }
.hint-inline { font-size: 13.5px; color: var(--ink-soft); margin: -4px 2px 0; }
.check { display: flex; align-items: center; gap: 10px; font-size: 15px; }
.check input { width: 20px; height: 20px; accent-color: var(--navy); }
.mock-pill { align-self: flex-start; background: var(--warn-soft); color: var(--warn); border-radius: 999px; padding: 6px 12px; font-size: 12.5px; font-weight: 800; }

/* ---------- PF passbook ---------- */
.balance-card { position: relative; overflow: hidden; background: linear-gradient(150deg, #1c47a3, #0b2358); color: #fff; border-radius: 22px; padding: 22px; box-shadow: var(--shadow-lg); }
.balance-card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 5px; background: linear-gradient(90deg, var(--saffron) 0 33%, #fff 33% 66%, var(--green) 66% 100%); }
.balance-label { font-size: 13.5px; opacity: .85; margin-top: 4px; }
.balance-big { font-size: 40px; font-weight: 800; letter-spacing: -.02em; margin: 2px 0 4px; }
.balance-sub { font-size: 12.5px; opacity: .85; }
.balance-split { display: flex; gap: 8px; margin-top: 18px; }
.balance-split > div { flex: 1; background: rgba(255,255,255,.14); border-radius: 12px; padding: 10px; }
.balance-split span { display: block; font-size: 11px; opacity: .85; }
.balance-split b { font-size: 14.5px; }

.action-row { display: flex; gap: 10px; }
.mini-action { flex: 1; background: var(--card); border: 1.5px solid var(--line); border-radius: 13px; padding: 14px 10px; font-weight: 700; font-size: 14px; }
.mini-action:active { background: var(--primary-soft); }
.section-label { font-size: 12.5px; font-weight: 800; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .06em; margin-top: 6px; }
.ledger { background: var(--card); border: 1.5px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.ledger-row { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.ledger-row:last-child { border-bottom: none; }
.ledger-month { font-weight: 700; font-size: 15px; }
.ledger-note { font-size: 12.5px; color: var(--ink-soft); }
.ledger-amt { font-weight: 800; color: var(--accent); }

/* ---------- summary / kv / claim ---------- */
.summary-card { background: var(--card); border: 1.5px solid var(--line); border-radius: var(--radius); padding: 6px 16px; }
.kv { display: flex; justify-content: space-between; gap: 14px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.kv:last-child { border-bottom: none; }
.kv-k { color: var(--ink-soft); font-size: 14px; }
.kv-v { font-weight: 700; text-align: right; }
.claim-head { background: var(--card); border: 1.5px solid var(--line); border-left: 5px solid var(--saffron); border-radius: var(--radius); padding: 18px; }
.claim-type { font-weight: 800; font-size: 17px; }
.claim-id { font-size: 13px; color: var(--ink-soft); margin: 2px 0; }
.claim-amt { font-size: 14px; color: var(--warn); font-weight: 700; }

/* ---------- tracker ---------- */
.tracker { list-style: none; margin: 8px 0 0; padding: 6px 4px; }
.tk { display: flex; align-items: center; gap: 14px; position: relative; padding: 10px 0; }
.tk::before { content: ""; position: absolute; left: 10px; top: 30px; bottom: -10px; width: 2px; background: var(--line); }
.tk:last-child::before { display: none; }
.tk-dot { width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--line); background: var(--card); z-index: 1; flex: none; }
.tk.done .tk-dot { background: var(--accent); border-color: var(--accent); }
.tk.active .tk-dot { border-color: var(--saffron); box-shadow: 0 0 0 4px rgba(255,153,51,.22); }
.tk-label { font-weight: 700; }
.tk.todo .tk-label { color: var(--ink-soft); font-weight: 500; }

/* ---------- success ---------- */
.success { text-align: center; padding-top: 22px; }
.success-ico { width: 86px; height: 86px; margin: 8px auto 14px; border-radius: 50%; background: rgba(19,136,8,.14); display: grid; place-items: center; font-size: 40px; box-shadow: 0 0 0 6px rgba(19,136,8,.07); animation: pop .35s ease; }
@keyframes pop { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.success h2 { margin: 0 0 14px; }
.id-badge { background: var(--primary-soft); color: var(--primary); border-radius: 12px; padding: 12px; font-size: 15px; margin-bottom: 12px; font-weight: 600; }
.success .summary-card { text-align: left; }

/* ---------- footer cta ---------- */
.footer-cta { margin-top: 26px; text-align: center; }
.footer-q { font-size: 14px; color: var(--ink-soft); margin-bottom: 10px; }

/* ---------- modal ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(8,16,34,.6); display: grid; place-items: end center; z-index: 50; }
.modal { background: var(--card); width: 100%; max-width: 480px; border-radius: 22px 22px 0 0; padding: 10px 18px 30px; box-shadow: var(--shadow-lg); animation: slideup .25s ease; max-height: 88dvh; overflow: auto; }
.modal::before { content: ""; display: block; width: 40px; height: 4px; border-radius: 4px; background: var(--line); margin: 6px auto 14px; }
@keyframes slideup { from { transform: translateY(40px); opacity: .5; } to { transform: none; opacity: 1; } }
.modal h3 { margin: 0 0 10px; }
.modal-p { font-size: 14px; color: var(--ink-soft); }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; }
.honesty-grid { display: flex; gap: 12px; }
.hcol { flex: 1; }
.hhead { font-weight: 800; font-size: 14px; margin-bottom: 6px; }
.hcol ul { margin: 0; padding-left: 18px; font-size: 13px; color: var(--ink-soft); }
.hcol li { margin-bottom: 6px; }
.scale-note { margin-top: 16px; background: var(--primary-soft); border-radius: 12px; padding: 14px; font-size: 13px; line-height: 1.55; }

@media (min-width: 500px) {
  .modal { border-radius: 22px; margin-bottom: 5vh; }
  .modal-backdrop { place-items: center; }
}

/* ============================================================
   PORTAL — responsive layout, categories, service catalog
   ============================================================ */
.brand { background: none; border: none; padding: 0; cursor: pointer; }
.brand-txt { display: flex; flex-direction: column; align-items: flex-start; }

/* hero stats */
.stats { position: relative; z-index: 1; display: flex; gap: 8px; margin-top: 16px; }
.stats span { flex: 1; text-align: center; background: rgba(255,255,255,.12); border-radius: 12px; padding: 9px 6px; font-size: 11.5px; color: rgba(255,255,255,.85); }
.stats b { display: block; font-size: 18px; font-weight: 800; color: #fff; }

/* section wrappers */
.block-sec { margin-top: 24px; }
.sec-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 12px; }
.legend { font-size: 11.5px; color: var(--ink-soft); display: inline-flex; align-items: center; gap: 5px; }
.legend .svc-flag { position: static; }

/* category grid */
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(98px, 1fr)); gap: 10px; }
.cat-card { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; background: var(--card); border: 1.5px solid var(--line); border-radius: 16px; padding: 14px 8px 10px; box-shadow: var(--shadow); position: relative; transition: transform .06s, border-color .15s; }
.cat-card:active { transform: translateY(1px); border-color: var(--primary); }
.cat-ico { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; font-size: 24px; background: color-mix(in srgb, var(--tint) 16%, transparent); box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--tint) 30%, transparent); }
.cat-ico.big { width: 60px; height: 60px; font-size: 32px; border-radius: 18px; }
.cat-label { font-size: 12.5px; font-weight: 700; line-height: 1.2; }
.cat-count { font-size: 11px; color: var(--ink-soft); font-weight: 700; }

/* service list/grid */
.svc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.svc-tile { display: flex; align-items: center; gap: 12px; text-align: left; background: var(--card); border: 1.5px solid var(--line); border-radius: 15px; padding: 12px; box-shadow: var(--shadow); position: relative; transition: transform .06s, border-color .15s; }
.svc-tile:active { transform: translateY(1px); border-color: var(--primary); }
.svc-tile-ico { width: 44px; height: 44px; flex: none; border-radius: 12px; display: grid; place-items: center; font-size: 22px; background: color-mix(in srgb, var(--tint) 16%, transparent); box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--tint) 30%, transparent); }
.svc-tile-ico.big { width: 58px; height: 58px; font-size: 30px; border-radius: 16px; }
.svc-tile-body { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.svc-tile-label { font-weight: 700; font-size: 14.5px; line-height: 1.25; }
.svc-tile-dept { font-size: 11.5px; color: var(--ink-soft); font-weight: 600; }
.svc-flag { position: absolute; top: 10px; right: 10px; font-size: 9px; line-height: 1; }
.svc-flag.live { color: var(--green); }
.svc-flag.road { width: 7px; height: 7px; border-radius: 50%; border: 1.5px solid var(--line); }

/* instant results */
.results-panel { margin-top: 18px; }
.no-results { color: var(--ink-soft); background: var(--card); border: 1.5px dashed var(--line); border-radius: 14px; padding: 16px; font-size: 14px; }
.ask-ai-btn { display: block; width: 100%; margin-top: 12px; background: var(--primary-soft); color: var(--primary); border-radius: 14px; padding: 14px; font-weight: 700; font-size: 14.5px; text-align: left; }

/* browse */
.browse { margin-top: 4px; }
.back-link { color: var(--primary); font-weight: 700; font-size: 14px; padding: 6px 0 14px; }
.browse-head { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.browse-head h2 { margin: 0; font-size: 21px; }
.browse-count { font-size: 12.5px; color: var(--ink-soft); font-weight: 700; }

/* stub / roadmap */
.stub-hero { display: flex; align-items: center; gap: 14px; background: var(--card); border: 1.5px solid var(--line); border-radius: var(--radius); padding: 16px; }
.road-badge { color: var(--warn); font-weight: 700; }

/* ---- desktop portal ---- */
@media (min-width: 760px) {
  #app { max-width: 1060px; padding: 22px 30px 64px; }
  .hero { padding: 34px 30px 28px; border-radius: 28px; }
  .hero-title { font-size: 27px; margin-bottom: 20px; }
  .ask-box { padding: 8px 8px 8px 16px; }
  .ask-input { font-size: 18px; padding: 15px 4px; }
  .stats { max-width: 460px; }
  .civic-svg { max-width: 560px; }
  /* keep task screens in a readable column, centered */
  .flow-top, .flow, .confirm, .success, .thinking { max-width: 600px; margin-left: auto; margin-right: auto; }
  .cat-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 12px; }
}
@media (min-width: 1000px) {
  .hero { display: grid; }
}
