:root {
  --bg: #f6f7f9; --card: #fff; --text: #1d1f23; --muted: #6b7280; --line: #e5e7eb;
  --red: #d93025; --red-d: #b3261e; --green: #1e8e3e; --soft: #eef4ff; --warn: #fff4e5;
  --nav-h: 62px; --top-h: 52px;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #121417; --card: #1d2025; --text: #eceff3; --muted: #9aa3ae; --line: #30353c; --soft: #1b2638; --warn: #3a2c16; }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text);
  font-family: "Noto Sans Bengali", "Hind Siliguri", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; font-size: 16px; }
button, input, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }

.top { position: fixed; inset: 0 0 auto 0; height: var(--top-h); display: flex; align-items: center; justify-content: space-between;
  padding: 0 14px; background: var(--red); color: #fff; z-index: 20; padding-top: env(safe-area-inset-top); }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 18px; }
.brand img { width: 30px; height: 30px; border-radius: 8px; }
.brand small { font-weight: 400; opacity: .85; }
.top .chip { background: rgba(255,255,255,.2); color: #fff; border-color: transparent; }

main { position: fixed; top: var(--top-h); bottom: var(--nav-h); left: 0; right: 0; }
.view { position: absolute; inset: 0; overflow-y: auto; }
.pad { padding: 14px 16px 24px; max-width: 640px; margin: 0 auto; }

#map { position: absolute; inset: 0; background: #dde3ea; }
.report-bar { position: absolute; left: 12px; right: 12px; bottom: 12px; display: flex; gap: 10px; z-index: 500; }
.big { flex: 1; padding: 16px 8px; border: 0; border-radius: 16px; font-size: 18px; font-weight: 700; color: #fff;
  box-shadow: 0 4px 14px rgba(0,0,0,.25); cursor: pointer; }
.big.jam { background: var(--red); } .big.clear { background: var(--green); }
.big:active { transform: scale(.98); }
.legend { position: absolute; top: 10px; right: 10px; z-index: 500; background: var(--card); border-radius: 12px; padding: 6px 10px;
  font-size: 12px; display: flex; gap: 8px; box-shadow: 0 2px 8px rgba(0,0,0,.15); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 3px; vertical-align: -1px; }
.banner { position: absolute; top: 48px; left: 10px; right: 10px; z-index: 600; background: #1a73e8; color: #fff; border-radius: 12px;
  padding: 10px 12px; display: flex; justify-content: space-between; align-items: center; gap: 8px; box-shadow: 0 4px 12px rgba(0,0,0,.25); }
.banner .chip { background: #fff; color: #1a73e8; }
.map-note { position: absolute; bottom: 84px; left: 12px; right: 12px; z-index: 500; background: var(--card); border-radius: 12px; padding: 8px 12px;
  font-size: 13px; color: var(--muted); box-shadow: 0 2px 8px rgba(0,0,0,.15); }

.tabs { position: fixed; inset: auto 0 0 0; height: var(--nav-h); display: flex; background: var(--card); border-top: 1px solid var(--line);
  z-index: 20; padding-bottom: env(safe-area-inset-bottom); }
.tabs a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-decoration: none; color: var(--muted);
  font-size: 20px; }
.tabs a span { font-size: 12px; margin-top: 2px; }
.tabs a.on { color: var(--red); font-weight: 700; }

.card { background: var(--card); border-radius: 16px; padding: 14px; margin-bottom: 12px; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.card.soft { background: var(--soft); box-shadow: none; }
.card.warn { background: var(--warn); box-shadow: none; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.card h3 { margin: 0 0 6px; font-size: 17px; }
.card p { margin: 6px 0; line-height: 1.55; }
.muted { color: var(--muted); font-size: 13px; }

.chip { border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 6px 12px; font-size: 14px; cursor: pointer; }
.primary { background: var(--red); color: #fff; border: 0; border-radius: 12px; padding: 12px 16px; font-weight: 700; cursor: pointer; }
.primary:disabled { opacity: .5; }
.ghost { background: transparent; border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; cursor: pointer; }
.wide { width: 100%; margin-top: 4px; }

.route .title { font-weight: 700; font-size: 17px; }
.route .meta { color: var(--muted); font-size: 14px; margin: 2px 0 8px; }
.route .res { border-radius: 12px; padding: 10px; font-size: 15px; line-height: 1.5; margin-bottom: 8px; background: var(--soft); }
.route .res.bad { background: #fde8e7; color: #8c1d18; }
.route .res.good { background: #e6f4ea; color: #0d652d; }
@media (prefers-color-scheme: dark) { .route .res.bad { background: #4a1f1c; color: #ffb4ab; } .route .res.good { background: #17351f; color: #a8dab5; } }
.route .acts { display: flex; flex-wrap: wrap; gap: 6px; }
.route.off { opacity: .6; }

.sheet-bg { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 1000; display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: var(--card); width: 100%; max-width: 560px; border-radius: 20px 20px 0 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
  max-height: 92vh; overflow-y: auto; }
.sheet h3 { margin: 0 0 12px; }
.sheet label { display: block; font-size: 14px; color: var(--muted); margin: 12px 0 4px; }
.sheet input:not([type=checkbox]), .sheet select { width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); }
.sheet label.check { display: flex; gap: 8px; align-items: center; color: var(--text); }
.row { display: flex; gap: 10px; margin-top: 14px; } .row > * { flex: 1; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.seg { display: flex; gap: 6px; margin-bottom: 10px; }
.seg button { flex: 1; padding: 12px 4px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); cursor: pointer; }
.seg button.on { background: var(--red); color: #fff; border-color: var(--red); font-weight: 700; }
.days { display: flex; flex-wrap: wrap; gap: 6px; }
.days button { padding: 8px 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg); cursor: pointer; }
.days button.on { background: var(--red); color: #fff; border-color: var(--red); }
.place { position: relative; }
.pbtns { display: flex; gap: 6px; margin-top: 6px; align-items: center; flex-wrap: wrap; }
.pbtns .ok { color: var(--green); font-size: 13px; }
.sugg { position: absolute; left: 0; right: 0; z-index: 5; background: var(--card); border: 1px solid var(--line); border-radius: 10px; overflow: hidden;
  box-shadow: 0 6px 16px rgba(0,0,0,.15); }
.sugg:empty { display: none; }
.sugg div { padding: 10px 12px; border-bottom: 1px solid var(--line); cursor: pointer; }
.sugg div small { display: block; color: var(--muted); }
.err { color: var(--red); min-height: 1em; margin: 8px 0 0; }

#toast { position: fixed; left: 50%; bottom: calc(var(--nav-h) + 90px); transform: translateX(-50%); background: #222; color: #fff; padding: 10px 16px;
  border-radius: 12px; z-index: 2000; max-width: 90vw; text-align: center; box-shadow: 0 4px 12px rgba(0,0,0,.3); }

.pop { font-family: inherit; font-size: 14px; line-height: 1.45; min-width: 160px; color: #1d1f23; }
.pop b { font-size: 15px; }
.pop button { margin-top: 6px; border: 1px solid #ddd; background: #fff; border-radius: 999px; padding: 4px 10px; cursor: pointer; }

/* ---- Google-Maps-like search / live location / directions ---- */
.search { position: absolute; top: 10px; left: 10px; right: 10px; z-index: 700; background: var(--card); border-radius: 999px;
  display: flex; align-items: center; box-shadow: 0 2px 10px rgba(0,0,0,.22); padding: 0 6px 0 14px; height: 48px; }
.search input { flex: 1; border: 0; background: transparent; outline: none; font-size: 16px; padding: 0 8px; min-width: 0; }
.search .sugg { top: 54px; border-radius: 14px; }
.search .sugg div { display: flex; justify-content: space-between; gap: 8px; }
.search .sugg div .km { color: var(--muted); font-size: 13px; white-space: nowrap; }
.s-ico { font-size: 16px; }
.s-x { border: 0; background: transparent; font-size: 18px; width: 38px; height: 38px; border-radius: 50%; cursor: pointer; color: var(--muted); }
.legend { top: 66px !important; }
.fab { position: absolute; right: 12px; bottom: 92px; z-index: 600; width: 50px; height: 50px; border-radius: 50%; border: 0;
  background: var(--card); color: #1a73e8; font-size: 26px; box-shadow: 0 2px 10px rgba(0,0,0,.25); cursor: pointer; }
.fab.on { color: #fff; background: #1a73e8; }
.dir-card { position: absolute; left: 0; right: 0; bottom: 0; z-index: 800; background: var(--card); border-radius: 20px 20px 0 0;
  padding: 12px 16px 14px; box-shadow: 0 -4px 16px rgba(0,0,0,.2); max-height: 55%; overflow-y: auto; }
.dir-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.dir-title { font-size: 22px; font-weight: 700; }
.dir-title small { font-size: 15px; font-weight: 400; color: var(--muted); }
.dir-sub { color: var(--muted); font-size: 14px; margin: 2px 0 8px; }
.dir-late { color: #c62828; font-weight: 700; } .dir-ok { color: var(--green); font-weight: 700; }
.jam-list { margin: 6px 0; padding: 0; list-style: none; }
.jam-list li { padding: 6px 0; border-top: 1px solid var(--line); font-size: 15px; cursor: pointer; }
.alts { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.alts button { border: 1px solid var(--line); background: var(--bg); border-radius: 12px; padding: 6px 10px; cursor: pointer; text-align: left; font-size: 14px; }
.alts button.on { border-color: #1a73e8; background: #e8f0fe; color: #174ea6; }
@media (prefers-color-scheme: dark) { .alts button.on { background: #1b2638; color: #8ab4f8; } }
.dir-card .row { margin-top: 10px; }
body.dir-open .report-bar, body.dir-open .fab, body.dir-open .legend { display: none; }
.banner { top: 66px; }
.leaflet-top { top: 100px !important; }
.leaflet-top, .leaflet-bottom { z-index: 650 !important; }
