/* JalSetu · Fair Water Dispatch — light design system */
:root {
  color-scheme: light;
  --bg: #f3f7fb;
  --surface: #ffffff;
  --ink: #0f1b2d;
  --ink-2: #33415c;
  --muted: #556378;
  --line: #e3eaf3;
  --line-2: #eef3f8;
  --blue: #1f6fd1;
  --blue-soft: #e8f1fc;
  --green: #17784a;
  --green-soft: #e7f4ec;
  --orange: #e8541c;
  --orange-soft: #fdf0ea;
  --amber: #b45309;
  --amber-soft: #fdf3d8;
  --red: #c81e3a;
  --red-soft: #fdecef;
  --violet: #6d3fd1;
  --violet-soft: #f1ecfd;
  --radius: 18px;
  --shadow: 0 1px 2px rgba(15,27,45,.04), 0 8px 24px -12px rgba(15,27,45,.12);
}

html { -webkit-font-smoothing: antialiased; }
body { background: var(--bg); color: var(--ink); font-family: "Plus Jakarta Sans", "Noto Sans Devanagari", system-ui, sans-serif; }
html[lang="hi"] body { font-family: "Noto Sans Devanagari", "Plus Jakarta Sans", system-ui, sans-serif; }
.hi { font-family: "Noto Sans Devanagari", "Plus Jakarta Sans", sans-serif; color: var(--muted); font-weight: 400; }
.muted { color: var(--muted); }
a { color: inherit; }

/* ---------- App shell: sidebar + main ---------- */
.shell { display: grid; grid-template-columns: 280px 1fr; min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 1.25rem;
  padding: 1.75rem 1rem 1rem; background: linear-gradient(180deg, #f7fafd, #eef4fa); border-right: 1px solid var(--line); overflow: hidden; }
.brand { display: flex; align-items: center; gap: .8rem; padding: 0 .75rem; }
.brand-name { font-size: 1.6rem; font-weight: 800; letter-spacing: -.03em; line-height: 1; }
.brand-sub { font-size: .82rem; color: var(--ink-2); margin-top: .3rem; }
.nav { display: flex; flex-direction: column; gap: .25rem; }
.tab { display: flex; align-items: center; gap: .85rem; width: 100%; text-align: left; padding: .8rem 1rem; border-radius: 12px;
  font-weight: 600; font-size: .98rem; color: var(--ink-2); border-left: 3px solid transparent; transition: background .2s, color .2s; }
.tab svg { width: 20px; height: 20px; flex: none; color: var(--ink-2); }
.tab:hover { background: rgba(31,111,209,.06); }
.tab.active { background: var(--green-soft); color: var(--green); border-left-color: var(--green); }
.tab.active svg { color: var(--green); }
.side-art { position: relative; margin-top: auto; border-radius: 16px; overflow: hidden; min-height: 250px; }
.side-art svg.city { position: absolute; inset: 0 0 auto 0; width: 100%; height: 150px; }
.side-card { position: relative; margin: 110px .5rem .5rem; padding: 1rem 1rem 1.1rem; border-radius: 16px; background: var(--surface);
  box-shadow: var(--shadow); border: 1px solid var(--line); }
.side-card b { display: block; font-size: .98rem; line-height: 1.3; }

.main { min-width: 0; padding: 0 2.25rem 2rem; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding-top: 1.4rem; position: relative; z-index: 2; }
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; font-size: .76rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
.crumbs .c1 { color: var(--blue); } .crumbs .c2 { color: var(--green); } .crumbs .c3 { color: var(--orange); }
.crumbs .sep { color: #9aa8bb; }
.top-actions { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.pill { display: inline-flex; align-items: center; gap: .5rem; padding: .55rem .95rem; border-radius: 12px; font-size: .88rem; font-weight: 600;
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); color: var(--ink); white-space: nowrap; }
.pill.live { color: var(--green); }
.pulse-dot { width: 9px; height: 9px; border-radius: 50%; background: #1f9d55; position: relative; flex: none; }
.pulse-dot::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: inherit; animation: ping 1.8s cubic-bezier(0,0,.2,1) infinite; }
@keyframes ping { 75%, 100% { transform: scale(2.4); opacity: 0; } }

/* ---------- Hero ---------- */
.hero { position: relative; margin: 0 -2.25rem; padding: 2rem 2.25rem 7.5rem; overflow: hidden;
  background: linear-gradient(180deg, #e3eef9 0%, #eef5fb 60%, var(--bg) 100%); }
.hero h1 { position: relative; z-index: 1; font-size: clamp(2.2rem, 5vw, 4.2rem); font-weight: 800; letter-spacing: -.045em; line-height: 1.02; }
.hero h1 .accent { color: var(--blue); }
.hero p.lead { position: relative; z-index: 1; font-size: clamp(1.05rem, 2vw, 1.55rem); color: var(--ink-2); margin-top: .7rem; }
.hero .hero-art { position: absolute; right: 0; bottom: 0; width: min(78%, 980px); height: 100%; pointer-events: none; }
.page { position: relative; z-index: 1; margin-top: -4.5rem; }
.wave-anim { animation: wave 2.4s linear infinite; }
@keyframes wave { to { transform: translateX(-24px); } }
.float { animation: float 6s ease-in-out infinite; }
@keyframes float { 50% { transform: translateY(-6px); } }

/* ---------- Views, cards ---------- */
.view:not([hidden]) { animation: viewIn .45s cubic-bezier(.2,.8,.2,1); }
@keyframes viewIn { from { opacity: 0; transform: translateY(10px); } }
.card { position: relative; border-radius: var(--radius); padding: 1.35rem; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); }
.card-title { display: flex; align-items: center; gap: .6rem; font-weight: 800; font-size: 1.2rem; letter-spacing: -.01em; }
.card-title .hi { font-size: .85rem; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; }
.icon-box { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; flex: none; background: var(--blue-soft); color: var(--blue); }
.icon-box.violet { background: var(--violet-soft); color: var(--violet); }
.icon-box.green { background: var(--green-soft); color: var(--green); }
.icon-box.orange { background: var(--orange-soft); color: var(--orange); }
.icon-box.red { background: var(--red-soft); color: var(--red); }
.link-btn { display: inline-flex; align-items: center; gap: .4rem; padding: .5rem .9rem; border-radius: 10px; font-weight: 700; font-size: .88rem;
  color: var(--blue); border: 1px solid var(--line); background: var(--surface); transition: background .2s; }
.link-btn:hover { background: var(--blue-soft); }
.reveal { animation: fadeUp .5s cubic-bezier(.2,.8,.2,1) both; animation-delay: calc(var(--i, 0) * 60ms); }
.quiet .reveal { animation: none; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } }

/* ---------- KPI cards ---------- */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; }
.kpi { display: flex; align-items: center; gap: 1rem; padding: 1.4rem 1.25rem; }
.kpi .kpi-icon { width: 64px; height: 64px; border-radius: 16px; display: grid; place-items: center; flex: none; }
.kpi .kpi-label { font-size: .95rem; color: var(--ink-2); line-height: 1.3; }
.kpi .kpi-value { font-size: 2rem; font-weight: 800; letter-spacing: -.02em; line-height: 1.15; margin-top: .15rem; }
.kpi .kpi-sub { font-size: .85rem; color: var(--muted); }

/* ---------- Overview grid ---------- */
.ov-grid { display: grid; grid-template-columns: minmax(0, 1.9fr) minmax(300px, 1fr); gap: 1rem; align-items: start; }
.ov-grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1rem; align-items: start; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; }
table.data { width: 100%; border-collapse: collapse; font-size: .92rem; }
table.data th { text-align: left; font-size: .82rem; color: var(--ink-2); font-weight: 600; padding: .8rem 1rem; background: #f7f9fc; border-bottom: 1px solid var(--line); }
table.data td { padding: .9rem 1rem; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
table.data tr:last-child td { border-bottom: 0; }
table.data tr.clickable { cursor: pointer; transition: background .15s; }
table.data tr.clickable:hover { background: #f8fbff; }
table.data tr.top { background: var(--orange-soft); box-shadow: inset 4px 0 0 var(--orange); }
table.data tr.top:hover { background: #fce8df; }
.status-pill { display: inline-block; padding: .45rem .75rem; border-radius: 8px; font-size: .72rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; line-height: 1.3; }
.status-pill.high { background: var(--orange); color: #fff; }
.status-pill.pending { background: var(--amber-soft); color: var(--amber); }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }
.dot.green { background: #1f9d55; } .dot.orange { background: var(--orange); } .dot.grey { background: #94a3b8; }

/* ---------- Next dispatch ---------- */
.next-box { border-radius: 16px; padding: 1.1rem; background: linear-gradient(180deg, #fff6f1, #fdf3ee); border: 1px solid #f7dccf; }
.thumb { width: 72px; height: 72px; border-radius: 12px; overflow: hidden; flex: none; background: #dbeaf8; }
.info-box { display: flex; gap: .6rem; align-items: flex-start; padding: .85rem 1rem; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); font-size: .95rem; color: var(--ink-2); }
.badge-priority { background: var(--orange); color: #fff; font-weight: 800; font-size: .85rem; padding: .35rem .7rem; border-radius: 8px; }

/* ---------- Vertical bar chart ---------- */
.vchart { position: relative; overflow-x: auto; padding-bottom: .25rem; }
.vchart-inner { position: relative; min-width: 520px; }
.vchart-body { display: grid; grid-template-columns: 40px 1fr; }
.vchart-axis { position: relative; height: 240px; }
.vchart-axis span { position: absolute; right: 8px; transform: translateY(50%); font-size: .78rem; color: var(--muted); }
.vchart-plot { position: relative; height: 240px; display: flex; align-items: flex-end; gap: 12px; padding: 0 6px; border-bottom: 1px solid #cbd6e4; }
.vchart-grid { position: absolute; left: 0; right: 0; border-top: 1px solid var(--line-2); }
.vbar { position: relative; z-index: 1; flex: 1; min-width: 46px; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; cursor: default; }
.vbar .v { font-size: .78rem; font-weight: 700; margin-bottom: .3rem; color: var(--ink); }
.vbar .b { width: 100%; max-width: 64px; border-radius: 4px 4px 0 0; transform-origin: bottom; animation: grow .9s cubic-bezier(.2,.8,.2,1) both; transition: filter .2s; }
.vbar:hover .b { filter: brightness(1.12); }
.vbar .zero { width: 100%; max-width: 64px; height: 3px; background: var(--orange); border-radius: 2px; }
.vchart-labels { display: flex; gap: 12px; padding: .45rem 6px 0 46px; }
.vchart-labels div { flex: 1; min-width: 46px; text-align: center; font-size: .76rem; color: var(--ink-2); line-height: 1.25; }
@keyframes grow { from { transform: scaleY(0); } }
.legend-line { width: 22px; height: 3px; border-radius: 2px; background: var(--orange); display: inline-block; }
.vtip { position: absolute; z-index: 5; pointer-events: none; padding: .45rem .65rem; border-radius: 8px; font-size: .78rem; background: var(--ink); color: #fff; white-space: nowrap; transform: translate(-50%, -115%); }

/* ---------- Form controls ---------- */
.field { width: 100%; border-radius: 12px; padding: .8rem 1rem; color: var(--ink); background: var(--surface); border: 1px solid #d5dfeb;
  transition: border-color .2s, box-shadow .2s; outline: none; }
.field::placeholder { color: #94a3b8; }
.field:focus { border-color: var(--blue); box-shadow: 0 0 0 4px rgba(31,111,209,.12); }
select.field { appearance: none; padding-right: 2.5rem; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2333415c' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right .9rem center; background-size: 16px; }
select.field:disabled { opacity: .85; cursor: not-allowed; background-color: #f7f9fc; }

/* ---------- Buttons ---------- */
.btn { position: relative; overflow: hidden; display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  font-weight: 700; border-radius: 12px; padding: .75rem 1.1rem; transition: transform .15s, box-shadow .2s, background .2s, opacity .2s; }
.btn:hover:not(:disabled) { transform: translateY(-1px); }
.btn:active:not(:disabled) { transform: translateY(0) scale(.98); }
.btn:disabled { opacity: .55; cursor: progress; }
.btn-lg { padding: 1rem 1.25rem; font-size: 1.12rem; border-radius: 14px; }
.btn-primary { color: #fff; background: var(--blue); box-shadow: 0 8px 20px -10px rgba(31,111,209,.7); }
.btn-primary:hover:not(:disabled) { background: #1a62bb; }
.btn-success { color: #fff; background: var(--green); box-shadow: 0 8px 20px -10px rgba(23,120,74,.7); }
.btn-success:hover:not(:disabled) { background: #136640; }
.btn-violet { color: #fff; background: var(--violet); box-shadow: 0 8px 20px -10px rgba(109,63,209,.6); }
.btn-ghost { color: var(--blue); background: var(--surface); border: 1px solid #cfdcec; }
.btn-ghost:hover:not(:disabled) { background: var(--blue-soft); }
.btn-danger { color: var(--red); background: var(--surface); border: 1px solid #f3c4cd; }
.btn-danger:hover:not(:disabled) { background: var(--red-soft); }

.mic { position: relative; width: 64px; flex: none; border-radius: 14px; display: grid; place-items: center; color: #fff; background: var(--orange);
  box-shadow: 0 8px 20px -10px rgba(232,84,28,.8); transition: transform .15s; }
.mic:hover { transform: scale(1.04); }
.mic.listening::before, .mic.listening::after { content: ""; position: absolute; inset: 0; border-radius: inherit; border: 2px solid var(--orange); animation: ring 1.4s ease-out infinite; }
.mic.listening::after { animation-delay: .7s; }
@keyframes ring { to { transform: scale(1.6); opacity: 0; } }

/* ---------- Badges, chips, notes ---------- */
.badge { display: inline-flex; align-items: center; gap: .45rem; padding: .35rem .75rem; border-radius: 999px; font-size: .75rem; font-weight: 700; }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge.PENDING { color: var(--amber); background: var(--amber-soft); }
.badge.ASSIGNED { color: #1858a8; background: var(--blue-soft); }
.badge.ON_THE_WAY { color: var(--violet); background: var(--violet-soft); }
.badge.ON_THE_WAY::before { animation: blink 1.2s infinite; }
.badge.DELIVERED { color: var(--green); background: var(--green-soft); }
@keyframes blink { 50% { opacity: .25; } }
.chip { display: inline-flex; align-items: center; gap: .35rem; border-radius: 999px; padding: .25rem .65rem; font-size: .74rem; font-weight: 600; margin: 0 .3rem .3rem 0; }
.chip-red { color: var(--red); background: var(--red-soft); }
.chip-amber { color: var(--amber); background: var(--amber-soft); }
.chip-green { color: var(--green); background: var(--green-soft); }
.chip-violet { color: var(--violet); background: var(--violet-soft); }
.note { display: flex; gap: .6rem; align-items: flex-start; font-size: .92rem; padding: .75rem .9rem; border-radius: 12px; background: #f7f9fc; border: 1px solid var(--line); color: var(--ink-2); }
.note svg { color: var(--blue); flex: none; margin-top: 2px; }
.panel { border-radius: 12px; padding: .85rem 1rem; background: #f8fafd; border: 1px solid var(--line); }
.view-only { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; padding: .8rem 1rem; border-radius: 12px; font-size: .9rem;
  background: var(--blue-soft); border: 1px dashed #b7cfee; color: var(--ink-2); }
.empty { display: flex; flex-direction: column; align-items: center; gap: .5rem; padding: 1.5rem 1rem; text-align: center; color: var(--muted); font-size: .92rem; }
.empty svg { color: var(--blue); opacity: .7; }

/* ---------- Colony status ---------- */
.stepper { position: relative; display: grid; grid-template-columns: repeat(4, 1fr); margin-top: 1.25rem; }
.stepper-track { position: absolute; top: 15px; left: 12.5%; right: 12.5%; height: 3px; border-radius: 3px; background: var(--line); }
.stepper-fill { height: 100%; width: calc(var(--p) * 100%); border-radius: inherit; background: var(--blue); animation: fillIn 1.1s cubic-bezier(.2,.8,.2,1); }
@keyframes fillIn { from { width: 0; } }
.step { position: relative; display: flex; flex-direction: column; align-items: center; text-align: center; gap: .45rem; }
.step-dot { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-size: .8rem; font-weight: 800; background: var(--surface); border: 2px solid #cbd6e4; color: var(--muted); }
.step.done .step-dot { background: var(--blue); border-color: var(--blue); color: #fff; }
.step.current .step-dot { border-color: var(--blue); color: var(--blue); animation: glow 2s infinite; }
@keyframes glow { 0% { box-shadow: 0 0 0 0 rgba(31,111,209,.35); } 70% { box-shadow: 0 0 0 10px rgba(31,111,209,0); } 100% { box-shadow: 0 0 0 0 rgba(31,111,209,0); } }
.step-label { font-size: .74rem; font-weight: 600; color: var(--muted); line-height: 1.25; }
.step.current .step-label, .step.done .step-label { color: var(--ink); }
.eta { display: flex; align-items: center; gap: 1rem; padding: 1rem; border-radius: 14px; margin-top: 1.25rem; background: var(--blue-soft); border: 1px solid #cfe0f6; }
.eta-time { font-size: 2.1rem; font-weight: 800; letter-spacing: -.02em; line-height: 1; color: var(--blue); }

/* ---------- Dispatcher ---------- */
.tanker { position: relative; padding: 1rem; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); transition: transform .2s, box-shadow .2s; }
.tanker:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.tanker.avail { border-color: #bfe3cf; background: linear-gradient(180deg, #f3fbf6, #fff); }
.tanker.off { opacity: .65; border-style: dashed; }
.tanker-icon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: #f1f5f9; color: var(--muted); }
.tanker.avail .tanker-icon { background: var(--green-soft); color: var(--green); }
.tanker-status { font-size: .75rem; font-weight: 700; display: inline-flex; align-items: center; gap: .4rem; color: var(--muted); }
.tanker.avail .tanker-status { color: var(--green); }
.cap { height: 6px; border-radius: 6px; background: var(--line-2); overflow: hidden; margin: .6rem 0 .35rem; }
.cap > div { height: 100%; border-radius: inherit; background: var(--blue); animation: fillIn 1s cubic-bezier(.2,.8,.2,1); }
.q-item { padding: 1rem; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); }
.q-first { background: var(--orange-soft); border-color: #f5cdbc; box-shadow: inset 4px 0 0 var(--orange); }
.rank { width: 38px; height: 38px; flex: none; border-radius: 10px; display: grid; place-items: center; font-weight: 800; background: #f1f5f9; color: var(--ink-2); }
.q-first .rank { background: var(--orange); color: #fff; }
.next-up { display: inline-flex; align-items: center; gap: .35rem; font-size: .68rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--orange); margin-bottom: .2rem; }
.lpp { text-align: right; flex: none; }
.lpp-num { font-size: 1.9rem; font-weight: 800; line-height: 1; letter-spacing: -.02em; }
.lpp.crit .lpp-num { color: var(--orange); }
.lpp-unit { font-size: .72rem; color: var(--muted); margin-top: .25rem; }
.crit-tag { display: inline-block; font-size: .62rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: #fff; background: var(--orange); border-radius: 6px; padding: .15rem .45rem; margin-top: .3rem; }
.meta { display: flex; flex-wrap: wrap; gap: .3rem .9rem; font-size: .82rem; color: var(--muted); margin-top: .25rem; }
.meta span { display: inline-flex; align-items: center; gap: .3rem; }
details.why summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: .35rem; font-size: .85rem; font-weight: 700; color: var(--blue); }
details.why summary::-webkit-details-marker { display: none; }
details.why summary .chev { transition: transform .25s; }
details.why[open] summary .chev { transform: rotate(180deg); }
details.why[open] .why-body { animation: fadeUp .3s ease both; }
.release-panel:not([hidden]) { animation: fadeUp .3s ease both; }
[data-release-toggle][aria-expanded="true"] svg { transform: rotate(180deg); }

/* ---------- Ledger / stats ---------- */
.stat { padding: clamp(.85rem, 2vw, 1.25rem) !important; min-width: 0; }
.stat-num { font-size: clamp(1.25rem, 3.6vw, 1.9rem); font-weight: 800; letter-spacing: -.02em; line-height: 1.1; }
.stat-label { font-size: .8rem; color: var(--muted); margin-top: .25rem; }
.bar { position: relative; height: 14px; border-radius: 999px; background: var(--line-2); margin-top: .45rem; }
.bar-stack { display: flex; gap: 2px; }
.bar-stack .seg { height: 100%; width: 0; border-radius: 999px; transition: width 1.2s cubic-bezier(.2,.8,.2,1); }
.threshold { position: absolute; top: -4px; bottom: -4px; width: 0; border-left: 2px dashed var(--amber); }
.swatch { width: 12px; height: 12px; border-radius: 4px; display: inline-block; }
.trend { display: grid; grid-template-columns: repeat(4, 1fr); gap: .75rem; align-items: end; height: 170px; }
.trend-col { display: flex; flex-direction: column; align-items: center; gap: .35rem; height: 100%; }
.trend-val { font-weight: 800; font-size: .95rem; }
.trend-bar { flex: 1; width: 100%; max-width: 56px; display: flex; align-items: flex-end; border-bottom: 1px solid var(--line); }
.trend-bar > div { width: 100%; border-radius: 4px 4px 0 0; animation: grow .9s cubic-bezier(.2,.8,.2,1); transform-origin: bottom; }
.trend-label { font-size: .74rem; color: var(--muted); }
.alarm-card { border-color: #f3c4cd; }

/* ---------- Heat banner ---------- */
.heat { border-radius: var(--radius); padding: 1rem 1.15rem; display: flex; gap: .9rem; align-items: flex-start; border: 1px solid; font-size: .92rem; background: var(--surface); box-shadow: var(--shadow); }
.heat .heat-icon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex: none; }
.heat-none { border-color: var(--line); }
.heat-none .heat-icon { background: var(--amber-soft); color: #d97706; }
.heat-none .heat-icon svg { animation: spin 18s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.heat-heatwave { background: #fff7ed; border-color: #fed7aa; }
.heat-heatwave .heat-icon { background: #ffedd5; color: #ea580c; }
.heat-severe { background: #fef2f2; border-color: #fecaca; animation: alarm 2s ease-in-out infinite; }
.heat-severe .heat-icon { background: #fee2e2; color: var(--red); }
@keyframes alarm { 50% { box-shadow: 0 0 0 4px rgba(200,30,58,.12); } }
.heat-days { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .6rem; }
.heat-days span { font-size: .74rem; font-weight: 700; padding: .2rem .55rem; border-radius: 8px; background: #f1f5f9; color: var(--ink-2); }

/* ---------- Toast ---------- */
#toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); z-index: 50; transform: translate(-50%, 30px); opacity: 0; pointer-events: none;
  display: flex; align-items: center; gap: .6rem; max-width: calc(100vw - 32px); padding: .85rem 1.1rem; border-radius: 14px; font-size: .92rem; font-weight: 600;
  background: var(--ink); color: #fff; box-shadow: 0 20px 50px -15px rgba(15,27,45,.5); transition: transform .4s cubic-bezier(.2,.9,.3,1.3), opacity .3s; }
#toast.show { transform: translate(-50%, 0); opacity: 1; }
#toast .t-icon { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; flex: none; }
#toast.ok .t-icon { background: #1f9d55; color: #fff; }
#toast.err .t-icon { background: var(--red); color: #fff; }

/* ---------- Misc ---------- */
.skel { border-radius: 12px; background: linear-gradient(90deg, #eef3f8, #f8fafc, #eef3f8); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
.lang-toggle { position: relative; display: grid; grid-template-columns: 1fr 1fr; padding: 4px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); }
.lang-toggle button { position: relative; z-index: 1; min-width: 40px; padding: .35rem .6rem; border-radius: 9px; font-size: .8rem; font-weight: 800; color: var(--ink-2); transition: color .3s; }
.lang-toggle button[aria-pressed="true"] { color: #fff; }
.lang-thumb { position: absolute; top: 4px; bottom: 4px; left: 4px; width: calc(50% - 4px); border-radius: 9px; background: var(--blue); transition: transform .4s cubic-bezier(.65,0,.25,1.25); }
html[lang="hi"] .lang-thumb { transform: translateX(100%); }
.modal { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 16px; background: rgba(15,27,45,.45); backdrop-filter: blur(4px); animation: viewIn .25s ease; }
.modal-card { width: 100%; max-width: 420px; }
.account-btn { display: inline-flex; align-items: center; gap: .5rem; padding: .55rem .95rem; border-radius: 12px; font-size: .88rem; font-weight: 600;
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); color: var(--ink); max-width: 15rem; }
.account-btn:hover { border-color: #b7cfee; }
.account-btn .who { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.role-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.role-dispatcher { background: var(--blue); } .role-driver { background: #1f9d55; } .role-colony { background: #d97706; } .role-officer { background: var(--violet); }
.demo-row { display: flex; justify-content: space-between; gap: .5rem; width: 100%; text-align: left; padding: .5rem .7rem; border-radius: 10px; font-size: .82rem; background: #f8fafd; border: 1px solid var(--line); margin-top: .35rem; }
.demo-row:hover { border-color: #b7cfee; }
.timeline { position: relative; margin: .6rem 0 0 .35rem; padding-left: 1rem; border-left: 2px solid var(--line); }
.timeline li { position: relative; padding: .2rem 0 .55rem; font-size: .82rem; }
.timeline li::before { content: ""; position: absolute; left: calc(-1rem - 5px); top: .5rem; width: 8px; height: 8px; border-radius: 50%; background: var(--blue); }
.timeline .t-when { color: var(--muted); font-size: .74rem; }
.trip-colony { font-size: 1.7rem; font-weight: 800; letter-spacing: -.02em; line-height: 1.15; }
.photo-pick { display: flex; align-items: center; gap: .6rem; padding: .8rem 1rem; border-radius: 12px; cursor: pointer; border: 1px dashed #b7cfee; color: #1858a8; background: var(--blue-soft); font-size: .92rem; }
.evidence { margin-top: .75rem; max-height: 320px; border-radius: 12px; border: 1px solid var(--line); }
.footer { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; font-size: .85rem; color: var(--muted); padding: 2rem 0 .5rem; }
.footer a { text-decoration: underline; }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ov-grid, .ov-grid-2 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: sticky; top: 0; z-index: 30; height: auto; flex-direction: row; align-items: center; gap: .5rem; padding: .6rem 16px; overflow-x: auto;
    border-right: 0; border-bottom: 1px solid var(--line); background: rgba(247,250,253,.96); backdrop-filter: blur(8px); }
  .brand { padding: 0; flex: none; }
  .brand-name { font-size: 1.15rem; } .brand-sub { display: none; }
  .brand svg { width: 28px; height: 28px; }
  .nav { flex-direction: row; gap: .25rem; }
  .tab { padding: .5rem .7rem; font-size: .85rem; white-space: nowrap; border-left: 0; border-bottom: 3px solid transparent; border-radius: 10px; }
  .tab.active { border-bottom-color: var(--green); }
  .tab svg { width: 16px; height: 16px; }
  .side-art { display: none; }
  .main { padding: 0 16px 1.5rem; }
  .hero { margin: 0 -16px; padding: 1.25rem 16px 5.5rem; }
  .hero .hero-art { width: 100%; opacity: .5; }
  .crumbs { font-size: .64rem; letter-spacing: .1em; }
}
@media (max-width: 560px) {
  .kpis { grid-template-columns: minmax(0, 1fr); }
  .kpi { padding: 1rem; }
  .kpi .kpi-icon { width: 52px; height: 52px; }
  .pill.live, .pill.ward { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

.narrow { max-width: 900px; }

/* ---------- Polish ---------- */
.top-actions { margin-left: auto; }
.hero .hero-art { opacity: .72; height: 92%; }
.kpi .kpi-value { font-size: clamp(1.4rem, 2.1vw, 2rem); white-space: nowrap; }
.vchart-inner { padding-top: 14px; }
@media (max-width: 900px) { .hero .hero-art { opacity: .32; } }

/* ---------- Live map ---------- */
.map-card { padding-bottom: 1rem; }
.map { height: 420px; border-radius: 14px; overflow: hidden; border: 1px solid var(--line); z-index: 0; }
.map-legend { display: flex; flex-wrap: wrap; gap: .4rem .9rem; font-size: .8rem; color: var(--ink-2); }
.map-label { background: rgba(255,255,255,.95); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); font: 600 11px "Plus Jakarta Sans", sans-serif; color: var(--ink); padding: 2px 6px; }
.map-label::before { display: none; }
.map-tanker { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px 3px 6px; border-radius: 999px; font: 800 11px "Plus Jakarta Sans", sans-serif;
  color: #fff; border: 2px solid #fff; box-shadow: 0 4px 12px -4px rgba(15,27,45,.5); white-space: nowrap; }
.map-tanker.busy { background: var(--orange); } .map-tanker.free { background: #1f9d55; } .map-tanker.off { background: #94a3b8; }
.map-tanker.mini { padding: 2px 4px; border-width: 1px; }
.map-hydrant { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--blue); color: #fff; border: 2px solid #fff; box-shadow: 0 3px 10px -3px rgba(15,27,45,.5); }
.map-hydrant.mini { width: 16px; height: 16px; border-width: 1px; }
.leaflet-container { font-family: "Plus Jakarta Sans", sans-serif; }

/* ---------- Heat early warning ---------- */
.day-chip { font-size: .8rem; padding: .3rem .65rem; border-radius: 10px; background: #f1f5f9; color: var(--ink-2); }
.day-chip.hot { background: #fff1e8; color: #b4410f; }
.warn-row { padding: .75rem .9rem; border-radius: 12px; border: 1px solid var(--line); background: #fbfcfe; }
.cover-bar { height: 8px; border-radius: 99px; background: var(--line-2); overflow: hidden; }
.cover-bar > div { height: 100%; border-radius: inherit; animation: fillIn 1s cubic-bezier(.2,.8,.2,1); }

/* ---------- Simple mode: bigger, fewer words, for people who find reading hard ---------- */
.simple #view-colony, .simple #view-driver { font-size: 1.15rem; }
.simple #view-colony .card-title, .simple #view-driver .card-title { font-size: 1.45rem; }
.simple #view-colony .btn, .simple #view-driver .btn { font-size: 1.15rem; padding: 1rem 1.3rem; }
.simple #view-colony .btn-lg, .simple #view-driver .btn-lg { font-size: 1.35rem; padding: 1.3rem; }
.simple #view-colony .field, .simple #view-driver .field { font-size: 1.3rem; padding: 1rem 1.1rem; }
.simple #view-colony .mic { width: 84px; }
.simple #view-colony details.why, .simple #view-colony .timeline, .simple #view-colony .text-xs,
.simple #view-colony #colony-complaints, .simple #view-driver details.why { display: none; }
.simple #view-colony .step-label { font-size: .95rem; }
.simple #view-colony .eta-time { font-size: 3rem; }
#btn-simple[aria-pressed="true"] { background: var(--blue); color: #fff; border-color: var(--blue); }
.ov-grid.stretch { align-items: stretch; }
.map-card { display: flex; flex-direction: column; }
.map-card .map { flex: 1; min-height: 420px; }
@media (max-width: 1180px) { .map-card .map { min-height: 360px; } }

/* ---------- Accessibility ---------- */
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; border-radius: 6px; }
.field:focus-visible { outline: none; }
.skip-link { position: absolute; left: 12px; top: -60px; z-index: 100; padding: .6rem 1rem; border-radius: 10px; background: var(--ink); color: #fff; font-weight: 700; }
.skip-link:focus { top: 12px; }
.footer a { display: inline-block; padding: .35rem 0; min-height: 24px; }
.tab[aria-current="page"] { font-weight: 700; }
