/* TGSCW citizen app - mobile first. Brand colours are placeholders until the
   Commission's approved palette is available. */
:root {
  --brand: #5b1a45;
  --brand-2: #7c2a61;
  --brand-tint: #f6e9f1;
  --accent: #f97475;          /* coral sampled from the official TSCW logo */
  --ink: #1d1720;
  --muted: #5d5563;
  --line: #e4dde3;
  --canvas: #f7f4f6;
  --surface: #ffffff;
  --sos: #c62828;
  --sos-dark: #a11b1b;
  --sos-tint: #fdecec;
  --ok: #1e7a45;
  --ok-tint: #e6f4ec;
  --warn: #8a5a00;
  --warn-tint: #fff4dc;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(29, 23, 32, .06), 0 4px 14px rgba(29, 23, 32, .06);
  --tabbar-h: 64px;
  --appbar-h: 56px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: "Noto Sans", "Noto Sans Telugu", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 17px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--canvas);
  padding-bottom: calc(var(--tabbar-h) + var(--safe-bottom));
}
a { color: var(--brand); }
h1, h2, h3 { line-height: 1.25; margin: 0 0 8px; }
h1 { font-size: 24px; }
h2 { font-size: 19px; }
h3 { font-size: 17px; }
p { margin: 0 0 12px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.skip-link { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 30; }
.skip-link:focus { left: 8px; }
:focus-visible { outline: 3px solid #2f6fed; outline-offset: 2px; }

/* ---------- app bar ---------- */
.appbar {
  position: sticky; top: 0; z-index: 20;
  height: var(--appbar-h);
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 0 12px 0 14px;
  background: var(--brand); color: #fff;
}
.appbar-logo { width: 36px; height: 36px; border-radius: 50%; background: #fff; object-fit: contain; padding: 2px; flex-shrink: 0; }
.appbar-brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; min-width: 0; }
.appbar-title { font-weight: 700; font-size: 16px; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appbar-title small { display: block; font-weight: 500; font-size: 12px; opacity: .85; }
.appbar-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.lang-toggle {
  min-height: 36px; padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, .55); border-radius: 999px;
  background: rgba(255, 255, 255, .12); color: #fff;
  font: inherit; font-size: 14px; font-weight: 700; cursor: pointer;
}
.exit-btn {
  display: flex; align-items: center; gap: 6px;
  min-height: 36px; padding: 0 12px 0 10px;
  border: 0; border-radius: 999px;
  background: #fff; color: var(--brand);
  font: inherit; font-size: 14px; font-weight: 700; cursor: pointer;
}
.exit-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.lang-toggle:active, .exit-btn:active { opacity: .8; }

/* ---------- layout ---------- */
main { outline: none; }
.page { max-width: 560px; margin: 0 auto; padding: 16px 16px 24px; }
.stack > * + * { margin-top: 12px; }
.card {
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px;
}
.section-title { font-size: 14px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 20px 0 8px; }

/* ---------- buttons ---------- */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; min-height: 52px; padding: 12px 18px;
  border: 0; border-radius: var(--radius-sm);
  font: inherit; font-weight: 700; text-decoration: none; cursor: pointer;
  background: var(--brand); color: #fff;
}
.btn:disabled { opacity: .55; cursor: default; }
.btn-secondary { background: var(--surface); color: var(--brand); border: 2px solid var(--brand); }
.btn-quiet { background: transparent; color: var(--brand); min-height: 44px; }
.btn-sos { background: var(--sos); color: #fff; }
.btn-sos:active { background: var(--sos-dark); }
.btn-row { display: flex; gap: 10px; }
.btn-row .btn { flex: 1; }
.link-btn { background: none; border: 0; padding: 8px 0; color: var(--brand); font: inherit; font-weight: 600; text-decoration: underline; cursor: pointer; }

/* ---------- letterhead card (home) ---------- */
.letterhead-card {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 10px 12px; border-bottom: 4px solid var(--accent);
}
.letterhead-card img { display: block; object-fit: contain; height: 48px; width: auto; flex-shrink: 0; }
.letterhead-card .lh-text { flex: 1; min-width: 0; text-align: center; }
.letterhead-card .lh-name { font-weight: 700; color: var(--brand); font-size: 15px; line-height: 1.25; }
.letterhead-card .lh-sub { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .1em; }
@media (max-width: 359px) { .letterhead-card .lh-govt { display: none; } }

/* ---------- home ---------- */
.hero { background: linear-gradient(160deg, var(--brand) 0%, var(--brand-2) 70%, #a8465f 100%); color: #fff; border-radius: var(--radius); padding: 20px 18px; }
.hero h1 { font-size: 23px; margin-bottom: 4px; }
.hero p { margin: 0; opacity: .92; }
.sos-card { display: flex; flex-direction: column; gap: 10px; background: var(--sos-tint); border: 2px solid var(--sos); border-radius: var(--radius); padding: 16px; }
.sos-card h2 { color: var(--sos-dark); margin: 0; }
.sos-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.call-btn { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 72px; border-radius: var(--radius-sm); background: var(--sos); color: #fff; text-decoration: none; font-weight: 700; }
.call-btn .num { font-size: 26px; line-height: 1.1; }
.call-btn .lbl { font-size: 13px; font-weight: 600; opacity: .95; }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tile {
  display: flex; flex-direction: column; gap: 6px; justify-content: flex-start;
  min-height: 118px; padding: 16px;
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
  color: var(--ink); text-decoration: none; border: 0; text-align: left; font: inherit; cursor: pointer;
}
.tile-icon { font-size: 26px; line-height: 1; }
.tile strong { font-size: 17px; }
.tile span.small { color: var(--muted); }
.tile-wide { grid-column: 1 / -1; min-height: 0; flex-direction: row; align-items: center; gap: 14px; }

/* ---------- list rows (helplines, cases) ---------- */
.row-list { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.row { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-top: 1px solid var(--line); color: var(--ink); text-decoration: none; min-height: 64px; }
.row:first-child { border-top: 0; }
.row-main { flex: 1; min-width: 0; }
.row-main strong { display: block; }
.row-side { flex-shrink: 0; font-weight: 700; color: var(--brand); }
.row-call { min-width: 88px; min-height: 44px; display: flex; align-items: center; justify-content: center; border-radius: 999px; background: var(--brand-tint); color: var(--brand); font-weight: 700; text-decoration: none; }
.row-call.sos { background: var(--sos); color: #fff; }

/* ---------- chips & badges ---------- */
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 13px; font-weight: 700; background: var(--brand-tint); color: var(--brand); }
.badge-warn { background: var(--warn-tint); color: var(--warn); }
.badge-ok { background: var(--ok-tint); color: var(--ok); }
.badge-sos { background: var(--sos-tint); color: var(--sos-dark); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  min-height: 44px; padding: 8px 14px;
  border: 2px solid var(--line); border-radius: 999px;
  background: var(--surface); color: var(--ink);
  font: inherit; font-size: 15px; font-weight: 600; cursor: pointer; text-align: left;
}
.chip[aria-pressed="true"] { border-color: var(--brand); background: var(--brand-tint); color: var(--brand); }
.choice-list { display: flex; flex-direction: column; gap: 10px; }
.choice {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 14px 16px; min-height: 56px;
  border: 2px solid var(--line); border-radius: var(--radius-sm); background: var(--surface);
  font: inherit; text-align: left; cursor: pointer; color: var(--ink); width: 100%;
}
.choice[aria-pressed="true"], .choice[aria-checked="true"] { border-color: var(--brand); background: var(--brand-tint); }
.choice .choice-mark { flex-shrink: 0; width: 22px; height: 22px; margin-top: 2px; border-radius: 50%; border: 2px solid var(--muted); }
.choice[aria-pressed="true"] .choice-mark, .choice[aria-checked="true"] .choice-mark { border-color: var(--brand); background: radial-gradient(var(--brand) 45%, transparent 50%); }
.choice.multi .choice-mark { border-radius: 6px; }
.choice.multi[aria-pressed="true"] .choice-mark { background: var(--brand); box-shadow: inset 0 0 0 3px var(--surface); }
.choice-text strong { display: block; }
.choice-text span { color: var(--muted); font-size: 14px; }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field + .field { margin-top: 14px; }
.field label, .field .label { font-weight: 700; font-size: 15px; }
.field .hint { font-size: 14px; color: var(--muted); margin-top: -2px; }
.field input[type=text], .field input[type=tel], .field input[type=number], .field input[type=date], .field select, .field textarea {
  width: 100%; min-height: 50px; padding: 12px 14px;
  border: 2px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink); font: inherit;
}
.field textarea { min-height: 140px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--brand); outline: none; box-shadow: 0 0 0 3px var(--brand-tint); }
.field.invalid input, .field.invalid select, .field.invalid textarea { border-color: var(--sos); }
.field-error { color: var(--sos-dark); font-size: 14px; font-weight: 600; }
.field.invalid .choice, .field.invalid .chip { border-color: var(--sos); }
.field.invalid > .label, .field.invalid > label { color: var(--sos-dark); }
.counter { font-size: 13px; color: var(--muted); text-align: right; }
.check { display: flex; align-items: flex-start; gap: 12px; padding: 10px 0; font-size: 16px; cursor: pointer; }
.check input { width: 24px; height: 24px; margin: 1px 0 0; flex-shrink: 0; accent-color: var(--brand); }
.otp-input { letter-spacing: .5em; font-size: 26px !important; text-align: center; font-weight: 700; }
.phone-wrap { display: flex; align-items: stretch; }
.phone-wrap .cc { display: flex; align-items: center; padding: 0 12px; border: 2px solid var(--line); border-right: 0; border-radius: var(--radius-sm) 0 0 var(--radius-sm); background: var(--canvas); font-weight: 700; }
.phone-wrap input { border-radius: 0 var(--radius-sm) var(--radius-sm) 0 !important; }

/* ---------- notices ---------- */
.notice { border-radius: var(--radius-sm); padding: 12px 14px; font-size: 15px; }
.notice-info { background: var(--brand-tint); color: var(--ink); }
.notice-warn { background: var(--warn-tint); color: #5a3b00; }
.notice-sos { background: var(--sos-tint); color: var(--sos-dark); font-weight: 600; }
.notice-ok { background: var(--ok-tint); color: #154f2e; }
.notice-error { background: var(--sos-tint); color: var(--sos-dark); }

/* ---------- wizard ---------- */
.wizard-head { position: sticky; top: var(--appbar-h); z-index: 10; background: var(--canvas); padding: 12px 16px 10px; margin: 0 -16px; }
.progress { height: 6px; border-radius: 999px; background: var(--line); overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--brand); transition: width .25s ease; }
.step-label { display: flex; justify-content: space-between; font-size: 14px; color: var(--muted); margin-top: 6px; }
.wizard-nav { position: sticky; bottom: calc(var(--tabbar-h) + var(--safe-bottom)); background: linear-gradient(to top, var(--canvas) 70%, transparent); padding: 16px 0 8px; margin-top: 16px; }
.person-card { border: 2px solid var(--line); border-radius: var(--radius-sm); padding: 14px; background: var(--surface); }
.person-card + .person-card { margin-top: 12px; }
.person-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.review dl { display: grid; grid-template-columns: 38% 1fr; gap: 6px 12px; margin: 0; font-size: 15px; }
.review dt { color: var(--muted); }
.review dd { margin: 0; overflow-wrap: anywhere; }
.review-block + .review-block { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.review-block h3 { display: flex; justify-content: space-between; align-items: center; }

/* ---------- case timeline ---------- */
.case-number { font-size: 26px; font-weight: 800; letter-spacing: .01em; }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { position: relative; padding: 0 0 18px 34px; }
.timeline li::before { content: ""; position: absolute; left: 10px; top: 20px; bottom: 0; width: 2px; background: var(--line); }
.timeline li:last-child::before { display: none; }
.timeline .dot { position: absolute; left: 2px; top: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 4px var(--brand-tint); }
.timeline li.current .dot { background: var(--surface); border: 5px solid var(--brand); }
.timeline li.todo .dot { background: var(--line); box-shadow: none; }
.timeline li.todo { color: var(--muted); }
.timeline .when { font-size: 13px; color: var(--muted); }
.timeline .msg { margin-top: 6px; background: var(--warn-tint); padding: 8px 10px; border-radius: 8px; font-size: 15px; }
.doc-row { display: flex; gap: 10px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); font-size: 15px; }
.doc-row:first-child { border-top: 0; }
.doc-icon { font-size: 22px; }
.upload-progress { height: 8px; background: var(--line); border-radius: 999px; overflow: hidden; margin-top: 8px; }
.upload-progress > span { display: block; height: 100%; width: 0; background: var(--ok); transition: width .2s; }

/* ---------- guidance after filing ---------- */
.success-mark { width: 64px; height: 64px; border-radius: 50%; background: var(--ok-tint); color: var(--ok); display: flex; align-items: center; justify-content: center; font-size: 34px; margin: 4px auto 12px; }
.guidance { display: flex; gap: 12px; align-items: flex-start; }
.guidance + .guidance { margin-top: 12px; }
.guidance .g-icon { font-size: 24px; line-height: 1.2; }

/* ---------- tab bar ----------
   Active tab: filled pill behind the icon + bold label (Material 3 style), so it is
   obvious on every tab. Emergency keeps a red icon but only gets the pill when open. */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  height: calc(var(--tabbar-h) + var(--safe-bottom)); padding-bottom: var(--safe-bottom);
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: var(--surface); border-top: 1px solid var(--line);
  box-shadow: 0 -2px 10px rgba(29, 23, 32, .05);
}
.tabbar a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--muted); text-decoration: none; font-size: 12px; font-weight: 600;
  -webkit-tap-highlight-color: transparent;
}
.tabbar .tab-icon {
  display: flex; align-items: center; justify-content: center;
  width: 60px; height: 30px; border-radius: 999px;
  transition: background-color .15s ease;
}
.tabbar svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tabbar .tab-label { line-height: 1.2; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 2px; }
.tabbar a[aria-current="page"] { color: var(--brand); font-weight: 800; }
.tabbar a[aria-current="page"] .tab-icon { background: var(--brand-tint); }
.tabbar a[aria-current="page"] svg { stroke-width: 2.4; }
.tabbar a.tab-sos .tab-icon { color: var(--sos); }
.tabbar a.tab-sos[aria-current="page"] { color: var(--sos-dark); }
.tabbar a.tab-sos[aria-current="page"] .tab-icon { background: var(--sos-tint); }

/* ---------- talk to someone ---------- */
.tile-talk { background: var(--brand-tint); }
.support-card > * + * { margin-top: 10px; }
.support-card p { margin: 0; }
.support-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.support-head h2 { margin: 0; }

/* ---------- misc ---------- */
.center { text-align: center; }
.spinner { width: 34px; height: 34px; border: 4px solid var(--brand-tint); border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; margin: 40px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty { text-align: center; padding: 28px 16px; }
.empty .e-icon { font-size: 40px; }
.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 12px); transform: translateX(-50%) translateY(20px);
  max-width: calc(100% - 32px); padding: 12px 18px; border-radius: 999px;
  background: var(--ink); color: #fff; font-size: 15px; font-weight: 600;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 40;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
/* ---------- opening screen + leaders ---------- */
.splash {
  position: fixed; inset: 0; z-index: 50; overflow-y: auto;
  display: flex; align-items: center; justify-content: center;
  padding: 24px 16px calc(24px + var(--safe-bottom));
  background: linear-gradient(170deg, var(--brand) 0%, var(--brand-2) 60%, #a8465f 100%); color: #fff;
  text-align: center; cursor: pointer;
  animation: splash-in .3s ease both;
}
.splash.closing { animation: splash-out .25s ease both; }
@keyframes splash-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes splash-out { to { opacity: 0; transform: scale(1.02); } }
.splash-inner { width: 100%; max-width: 400px; }
.splash-logos { display: flex; align-items: center; justify-content: center; gap: 14px; margin-bottom: 12px; }
.splash-logos img { height: 48px; width: auto; background: #fff; border-radius: 10px; padding: 3px; }
.splash-logos img.round { border-radius: 50%; }
.splash h1 { font-size: 21px; margin: 0; }
.splash-govt { font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; opacity: .85; margin: 4px 0 20px; }
.leaders { display: grid; grid-template-columns: 1fr 1.2fr 1fr; grid-template-areas: "min cm chair"; align-items: start; gap: 8px; }
.leader { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 8px; min-width: 0; }
.leader-cm { grid-area: cm; }
.leader-minister { grid-area: min; margin-top: 14px; }
.leader-chair { grid-area: chair; margin-top: 14px; }
.leader img { width: 84px; height: 84px; border-radius: 50%; object-fit: cover; border: 3px solid #fff; box-shadow: 0 4px 14px rgba(0, 0, 0, .25); background: #fff; }
.leader-cm img { width: 104px; height: 104px; border-color: var(--accent); }
.leader figcaption { overflow-wrap: anywhere; display: flex; flex-direction: column; gap: 2px; line-height: 1.25; }
.leader figcaption strong { font-size: 13px; }
.leader figcaption span { font-size: 11px; opacity: .88; }
.splash-tag { margin: 22px 0 16px; font-size: 16px; font-weight: 600; }
.splash-go {
  min-height: 50px; width: 100%; max-width: 280px;
  border: 0; border-radius: 999px; background: #fff; color: var(--brand);
  font: inherit; font-weight: 700; cursor: pointer;
}
.splash-sos { margin: 16px 0 0; font-size: 14px; }
.splash-sos a { color: #fff; font-weight: 800; font-size: 17px; padding: 6px; }
/* The same three on the "What we do" screen */
.leaders-card { color: var(--ink); text-align: center; padding: 16px 10px; }
.leaders-card .leader img { width: 76px; height: 76px; }
.leaders-card .leader-cm img { width: 92px; height: 92px; }
.leaders-card .leader img { border-color: var(--brand-tint); box-shadow: none; }
.leaders-card .leader-cm img { border-color: var(--accent); }
.leaders-card figcaption span { color: var(--muted); opacity: 1; }

/* ---------- phone frame on desktop ----------
   The citizen app is a mobile app: on a wide screen it is shown as a phone-width
   column (app bar, content and tab bar together) instead of stretching. */
@media (min-width: 600px) {
  html { background: #e8e1e6; }
  body { max-width: 440px; margin: 0 auto; min-height: 100vh; box-shadow: 0 0 0 1px var(--line), 0 10px 40px rgba(29, 23, 32, .12); }
  .tabbar { max-width: 440px; margin: 0 auto; }
  .toast { max-width: 408px; }
  .splash { max-width: 440px; margin: 0 auto; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
