/* SMRC Census - admin portal. Dark navy bar, pale page, white cards with a blue accent bar,
   coloured KPI tiles. */
:root {
  --nav1: #0e1c38; --nav2: #17305c; --bg: #e8edf4; --card: #fff; --ink: #0f172a; --ink2: #1e293b;
  --muted: #64748b; --faint: #94a3b8; --line: #e6ebf2; --soft: #f4f7fb;
  --blue: #1d6ae5; --blue-d: #1553bd; --blue-s: #e7f0fe; --green: #16a34a; --green-s: #e3f6ea;
  --amber: #d97706; --amber-s: #fdf1dd; --red: #dc2626; --red-s: #fde8e8; --violet: #7c3aed; --violet-s: #efe8fe;
  --teal: #0d9488; --pink: #db2777; --slate: #64748b;
  --r: 14px; --shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 4px 14px rgba(15, 23, 42, .05);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 14px/1.45 "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", Arial, sans-serif; color: var(--ink); background: var(--bg); }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }

/* ---------- top bar ---------- */
.bar { position: sticky; top: 0; z-index: 1000; background: linear-gradient(90deg, var(--nav1), var(--nav2)); color: #fff; box-shadow: 0 2px 10px rgba(0,0,0,.18); }
.bar-in { display: flex; align-items: center; gap: 14px; height: 54px; padding: 0 18px; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 700; font-size: 15px; white-space: nowrap; }
.brand img { height: 24px; display: block; }
.brand .sep { width: 1px; height: 20px; background: rgba(255,255,255,.28); }
.nav { display: flex; gap: 2px; margin-left: 8px; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a { color: rgba(255,255,255,.78); padding: 7px 11px; border-radius: 9px; font-size: 13.5px; font-weight: 600; white-space: nowrap; position: relative; }
.nav a:hover { color: #fff; background: rgba(255,255,255,.08); text-decoration: none; }
.nav a.on { color: #fff; background: rgba(255,255,255,.14); }
.nav a.on::after { content: ""; position: absolute; left: 11px; right: 11px; bottom: 3px; height: 2px; border-radius: 2px; background: #8fb8ff; }
.who { margin-left: auto; display: flex; align-items: center; gap: 10px; font-size: 13px; white-space: nowrap; }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: rgba(255,255,255,.18); display: grid; place-items: center; font-weight: 700; font-size: 12px; }
.role { font-size: 10px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; padding: 3px 8px; border-radius: 99px; background: rgba(255,255,255,.14); }
.who a { color: rgba(255,255,255,.8); font-weight: 600; }
.who a:hover { color: #fff; }

/* ---------- page ---------- */
.page { max-width: 900px; margin: 0 auto; padding: 22px 16px 60px; }
.page.wide { max-width: 1180px; }
.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin: 4px 0 16px; flex-wrap: wrap; }
.head h1 { margin: 0; font-size: 24px; letter-spacing: -.01em; }
.head p { margin: 4px 0 0; color: var(--muted); max-width: 560px; }
.crumb { font-size: 13px; margin-bottom: 8px; display: inline-block; }

.hero { border-radius: var(--r); padding: 22px 24px; color: #fff; margin-bottom: 14px; box-shadow: var(--shadow);
  background: radial-gradient(120% 140% at 85% 0%, #2c5aa6 0%, rgba(44,90,166,0) 55%), linear-gradient(120deg, #11244a, #1c3b73); }
.hero .eyebrow { font-size: 11px; letter-spacing: .12em; font-weight: 800; opacity: .75; text-transform: uppercase; }
.hero h1 { margin: 6px 0 4px; font-size: 26px; }
.hero p { margin: 0; opacity: .85; }

.card { background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); padding: 18px 20px; margin-bottom: 14px; }
.card > h2, .card-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0 0 12px; padding-bottom: 12px; border-bottom: 1px solid var(--line); font-size: 15px; }
.card > h2 .t, .card-h .t { display: flex; align-items: center; gap: 8px; }
.card > h2 .t::before, .card-h .t::before { content: ""; width: 4px; height: 17px; border-radius: 2px; background: var(--blue); }
.card-h .aside, .card > h2 .aside { font-weight: 400; font-size: 12.5px; color: var(--muted); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid2 > .card { margin-bottom: 0; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 12.5px; }
.sp { height: 14px; }

/* ---------- buttons, inputs, chips ---------- */
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: #fff; color: var(--ink2); padding: 8px 13px; border-radius: 10px; font-weight: 700; font-size: 13px; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: #cfd8e4; background: var(--soft); text-decoration: none; }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; box-shadow: 0 2px 8px rgba(29,106,229,.25); }
.btn.primary:hover { background: var(--blue-d); }
.btn.danger { color: var(--red); }
.btn.sm { padding: 6px 11px; font-size: 12.5px; }
.btn:disabled { opacity: .55; cursor: default; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.input, select.input, textarea.input { width: 100%; border: 1px solid var(--line); background: var(--soft); border-radius: 10px; padding: 10px 12px; outline: none; }
.input:focus { border-color: #9cc0f7; background: #fff; box-shadow: 0 0 0 3px rgba(29,106,229,.12); }
label.lbl { display: block; font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 12px 0 6px; }
.search { position: relative; margin-bottom: 12px; }
.search input { padding-left: 36px; background: #fff; }
.search::before { content: ""; position: absolute; left: 13px; top: 50%; width: 11px; height: 11px; margin-top: -7px; border: 2px solid var(--faint); border-radius: 50%; }
.search::after { content: ""; position: absolute; left: 24px; top: 50%; width: 6px; height: 2px; margin-top: 3px; background: var(--faint); transform: rotate(45deg); }
.chips { display: flex; gap: 7px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; }
.chips .k { font-size: 12.5px; color: var(--muted); margin-right: 2px; }
.chip { border: 1px solid var(--line); background: #fff; border-radius: 99px; padding: 6px 12px; font-size: 12.5px; font-weight: 700; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; color: var(--ink2); }
.chip:hover { border-color: #cfd8e4; }
.chip.on { background: var(--nav1); border-color: var(--nav1); color: #fff; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.msg { font-size: 13px; margin-top: 8px; color: var(--green); }
.msg.err { color: var(--red); }

/* ---------- pills and badges ---------- */
.pill { display: inline-block; font-size: 10.5px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; padding: 3px 8px; border-radius: 99px; background: var(--soft); color: var(--muted); white-space: nowrap; }
.pill.green { background: var(--green-s); color: var(--green); }
.pill.amber { background: var(--amber-s); color: var(--amber); }
.pill.red { background: var(--red-s); color: var(--red); }
.pill.blue { background: var(--blue-s); color: var(--blue); }
.pill.violet { background: var(--violet-s); color: var(--violet); }
.badge { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 12px; flex: none; letter-spacing: -.02em; }

/* ---------- lists ---------- */
.list { display: flex; flex-direction: column; }
.item { display: flex; align-items: center; gap: 12px; padding: 11px 6px; border-bottom: 1px solid var(--line); }
.item:last-child { border-bottom: 0; }
.item .main { flex: 1; min-width: 0; }
.item .name { font-weight: 700; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .sub { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .right { display: flex; align-items: center; gap: 8px; flex: none; }
.item.link { cursor: pointer; border-radius: 10px; }
.item.link:hover { background: var(--soft); }
.empty { text-align: center; padding: 34px 10px; color: var(--muted); }
.empty b { display: block; color: var(--ink2); font-size: 15px; margin-bottom: 4px; }

table.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.tblwrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
table.tbl th { text-align: left; font-size: 10.5px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); background: var(--soft); padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.tbl tr:last-child td { border-bottom: 0; }
table.tbl td.n, table.tbl th.n { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- KPI tiles, charts ---------- */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 14px; }
.kpi { background: #fff; border-radius: var(--r); box-shadow: var(--shadow); padding: 14px 16px; border-left: 4px solid var(--blue); }
.kpi .ic { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: var(--blue-s); color: var(--blue); font-weight: 800; font-size: 13px; }
.kpi .v { font-size: 28px; font-weight: 800; margin-top: 8px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpi .l { font-size: 12.5px; color: var(--muted); }
.kpi.green { border-left-color: var(--green); } .kpi.green .ic { background: var(--green-s); color: var(--green); }
.kpi.amber { border-left-color: var(--amber); } .kpi.amber .ic { background: var(--amber-s); color: var(--amber); }
.kpi.red { border-left-color: var(--red); } .kpi.red .ic { background: var(--red-s); color: var(--red); }
.donutwrap { display: flex; align-items: center; gap: 22px; }
.donut { position: relative; width: 120px; height: 120px; flex: none; }
.donut .c { position: absolute; inset: 0; display: grid; place-items: center; font-size: 22px; font-weight: 800; }
.legend { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.legend b { color: var(--ink); }
.bars { display: flex; flex-direction: column; gap: 9px; }
.barrow { display: grid; grid-template-columns: minmax(120px, 190px) 1fr 64px; align-items: center; gap: 10px; font-size: 13px; }
.barrow .lab { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink2); }
.track { height: 12px; border-radius: 99px; background: #eef2f7; overflow: hidden; }
.fill { height: 100%; border-radius: 99px; background: var(--blue); min-width: 2px; transition: width .6s ease; }
.barrow .val { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.feed .ago { font-size: 12px; color: var(--muted); white-space: nowrap; }
.live { width: 10px; height: 10px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px var(--green-s); animation: pulse 1.8s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 7px rgba(22,163,74,.08); } }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.tile { background: var(--soft); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.tile .t { font-weight: 700; font-size: 13px; }
.tile .v { font-size: 22px; font-weight: 800; margin: 4px 0 6px; }
.tile .v span { font-size: 13px; color: var(--muted); font-weight: 600; }
.tile .f { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-top: 6px; }
.cells { display: flex; flex-wrap: wrap; gap: 4px; }
.cell { width: 16px; height: 16px; border-radius: 4px; background: #eef2f7; border: 1.5px solid #d8e0ea; }
.cell.c1 { background: #fde2e2; border-color: #f4a3a3; } .cell.c2 { background: #fcd9a8; border-color: #e9a24a; }
.cell.c3 { background: #9fe0b5; border-color: #4cbf78; } .cell.c4 { background: #22a355; border-color: #17803f; }
.trend { width: 100%; height: 120px; display: block; }

/* ---------- store detail ---------- */
.shead { display: flex; gap: 16px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; }
.shead h1 { margin: 0 0 4px; font-size: 22px; }
.meta { font-size: 13px; color: var(--muted); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.gps { margin-top: 10px; display: flex; gap: 18px; flex-wrap: wrap; font-size: 13.5px; font-weight: 600; }
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.ph { position: relative; aspect-ratio: 1 / 1; border-radius: 10px; overflow: hidden; background: #dde4ee; cursor: zoom-in; border: 0; padding: 0; max-width: 100%; }
.ph img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ph span { position: absolute; left: 0; right: 0; bottom: 0; padding: 16px 8px 6px; font-size: 11.5px; font-weight: 700; color: #fff; text-align: left; background: linear-gradient(transparent, rgba(0,0,0,.72)); }
.sec { font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--blue); margin: 16px 0 6px; }
.sec:first-child { margin-top: 0; }
.qa { display: grid; grid-template-columns: 44px minmax(160px, 38%) 1fr; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; align-items: baseline; }
.qa .qn { font-size: 10.5px; font-weight: 800; color: var(--blue); background: var(--blue-s); border-radius: 6px; padding: 2px 6px; justify-self: start; }
.qa .ql { color: var(--muted); }
.qa .qv { font-weight: 600; }
.ticks { display: flex; flex-wrap: wrap; gap: 5px; }
.tick { font-size: 12px; font-weight: 600; background: var(--green-s); color: #14632f; border-radius: 6px; padding: 2px 8px; }
.warn { display: flex; gap: 10px; align-items: flex-start; padding: 9px 12px; border-radius: 10px; background: var(--amber-s); color: #8a4b04; font-size: 13px; margin-bottom: 8px; }
.kv { display: grid; grid-template-columns: 170px 1fr; gap: 6px 12px; font-size: 13px; }
.kv div:nth-child(odd) { color: var(--muted); }

/* ---------- map, modal, login ---------- */
#map { height: 620px; border-radius: 12px; overflow: hidden; background: #dde4ee; }
.leaflet-container { font: inherit; }
.lightbox { position: fixed; inset: 0; z-index: 3000; background: rgba(8,14,28,.9); display: grid; place-items: center; padding: 20px; cursor: zoom-out; }
.lightbox img { max-width: 100%; max-height: 88vh; border-radius: 8px; box-shadow: 0 10px 40px rgba(0,0,0,.5); }
.lightbox .cap { color: #fff; text-align: center; margin-top: 10px; font-weight: 600; }
.modal { position: fixed; inset: 0; z-index: 2500; background: rgba(8,14,28,.45); display: grid; place-items: center; padding: 16px; }
.modal .box { background: #fff; border-radius: var(--r); width: 100%; max-width: 440px; padding: 20px 22px; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.modal h3 { margin: 0 0 6px; }
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px;
  background: radial-gradient(90% 70% at 80% 0%, #2c5aa6 0%, rgba(44,90,166,0) 60%), linear-gradient(160deg, #0e1c38, #17305c); }
.login .box { width: 100%; max-width: 380px; background: #fff; border-radius: 18px; padding: 28px; box-shadow: 0 30px 80px rgba(0,0,0,.35); }
.login .logo { background: var(--nav1); border-radius: 12px; padding: 14px; display: grid; place-items: center; margin-bottom: 18px; }
.login .logo img { height: 34px; }
.login h1 { font-size: 20px; margin: 0 0 4px; }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 10px; z-index: 4000; font-weight: 600; box-shadow: 0 8px 30px rgba(0,0,0,.25); }
.spin { display: inline-block; width: 16px; height: 16px; border: 2px solid var(--line); border-top-color: var(--blue); border-radius: 50%; animation: sp .7s linear infinite; vertical-align: -3px; }
@keyframes sp { to { transform: rotate(360deg); } }
.loading { padding: 40px; text-align: center; color: var(--muted); }

@media (max-width: 860px) {
  .kpis { grid-template-columns: 1fr 1fr; }
  .grid2 { grid-template-columns: 1fr; }
  .who .nm { display: none; }
  .qa { grid-template-columns: 38px 1fr; }
  .qa .qv { grid-column: 2; }
  .barrow { grid-template-columns: 110px 1fr 54px; }
  .kv { grid-template-columns: 1fr; }
  #map { height: 480px; }
}
@media (max-width: 560px) {
  .bar-in { gap: 8px; padding: 0 12px; }
  .brand .sep, .brand .word { display: none; }
  .role { display: none; }
}

/* Assign page: tick one or more people */
.picks { display: flex; flex-wrap: wrap; gap: 6px 14px; max-height: 220px; overflow: auto; padding: 8px 10px; border: 1px solid var(--line, #dde2ea); border-radius: 8px; }
.pick { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; cursor: pointer; }
