/* =====================================================================
   CSMS — City Sanitation Management System, Chilanga City Council
   One shared stylesheet for every mock-up page. No framework, no build.

   Contents
   1. Tokens          5. Tables            9.  Forms
   2. Base            6. Issue type, status 10. Report (public) form
   3. Shell           7. Figures, charts    11. Map and popups
   4. Page furniture  8. Timeline, panels   12. Page-specific layouts
   ===================================================================== */

/* 1. Tokens ---------------------------------------------------------- */
:root {
  /* paper and ink */
  --paper: #F6F2EA;
  --paper-deep: #ECE6D9;
  --sheet: #FCFAF6;
  --ink: #22313A;
  --ink-soft: #45545D;
  --muted: #5E6970;
  --rule: #D6CDBC;
  --rule-soft: #E4DDD0;
  --field-border: #A49B8A;

  /* accents (from the SirWay deck) */
  --teal: #4E8792;
  --teal-ink: #36646D;
  --teal-wash: #E1EBEB;
  --olive: #9A9D3C;
  --olive-ink: #6B6E22;
  --olive-wash: #ECEDD5;
  --ochre: #C9A227;
  --brick: #A63D2F;          /* reserved: overdue, urgent, emergency */
  --brick-wash: #F3DFD8;

  /* issue types: the same six colours on every screen */
  --t-garbage: #DB6A12;
  --t-skip: #C9AE1A;
  --t-dumping: #6A3D9E;
  --t-litter: #E890BB;
  --t-drain: #2D8FC8;
  --t-toilet: #2A9A5C;

  /* cleanliness bands */
  --b-routine: var(--teal);
  --b-scheduled: var(--olive);
  --b-priority: var(--ochre);
  --b-emergency: var(--brick);

  /* type */
  --serif: "Newsreader", Georgia, "Times New Roman", serif;
  --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;

  /* layout */
  --maxw: 1320px;
  --gutter: clamp(16px, 3vw, 40px);
}

/* 2. Base ------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 15px/1.5 var(--sans);
  font-variant-numeric: lining-nums;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0; font-weight: 500; }
h1, h2, h3 { font-family: var(--serif); letter-spacing: -0.01em; }
h1 { font-size: clamp(2rem, 1.5rem + 1.8vw, 3rem); line-height: 1.04; text-wrap: balance; }
h2 { font-size: 1.5rem; line-height: 1.15; }
h3 { font-size: 1.2rem; line-height: 1.2; }
p { margin: 0 0 1em; }

a { color: var(--teal-ink); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--ink); }

img { max-width: 100%; }

:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }

.vh {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.num, .tnum { font-variant-numeric: lining-nums tabular-nums; }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 var(--gutter); }

/* 3. Shell: masthead and navigation ---------------------------------- */
.stripe {
  height: 5px;
  background: linear-gradient(90deg, var(--olive) 0 22%, var(--teal) 22% 100%);
}

.masthead__top {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 8px 32px;
  flex-wrap: wrap;
  padding-top: 16px; padding-bottom: 12px;
}

.brand { display: flex; flex-direction: column; gap: 3px; color: inherit; text-decoration: none; }
.brand__council {
  font: 600 11px/1.2 var(--sans); letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--teal-ink);
}
.brand__name { font: 500 26px/1.05 var(--serif); letter-spacing: -0.01em; }
.brand__name abbr { text-decoration: none; }

.masthead__meta {
  display: flex; flex-wrap: wrap; align-items: baseline; justify-content: flex-end;
  gap: 4px 18px; font-size: 13px; color: var(--muted);
}
.masthead__date { font-family: var(--serif); font-style: italic; font-size: 15px; color: var(--ink-soft); }
.session strong { color: var(--ink); font-weight: 600; }

.nav { border-top: 1px solid var(--ink); border-bottom: 3px double var(--ink); }
.nav .wrap { display: flex; align-items: center; gap: 16px; }
.nav ul {
  display: flex; gap: 28px; margin: 0; padding: 0; list-style: none;
  overflow-x: auto; scrollbar-width: none;
}
.nav ul::-webkit-scrollbar { display: none; }
.nav ul a {
  display: block; padding: 11px 0 8px; white-space: nowrap;
  font: 500 14px/1.2 var(--sans); color: var(--ink-soft); text-decoration: none;
  border-bottom: 3px solid transparent;
}
.nav ul a:hover { color: var(--ink); }
.nav ul a[aria-current="page"] { color: var(--ink); font-weight: 600; border-bottom-color: var(--teal); }
.nav__action { margin-left: auto; flex: none; }

.colophon {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 24px;
  margin-top: 56px; padding-top: 14px; padding-bottom: 32px;
  border-top: 1px solid var(--rule);
  font-size: 12.5px; color: var(--muted);
}

/* 4. Page furniture --------------------------------------------------- */
.page { padding-top: 32px; }

.page-head {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 12px 48px;
  padding-bottom: 22px; margin-bottom: 28px; border-bottom: 1px solid var(--rule);
}
.page-head__aside { text-align: right; font-size: 13px; color: var(--muted); }
.page-head__aside > * + * { margin-top: 8px; }

.kicker {
  margin: 0 0 10px;
  font: 600 12px/1.2 var(--sans); letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--teal-ink);
}
.standfirst {
  max-width: 62ch; margin: 12px 0 0;
  font: 400 1.2rem/1.45 var(--serif); color: var(--ink-soft);
}

/* The "Illustrative data" note: small, quiet, always present on data screens */
.illustrative {
  display: inline-block; padding: 2px 7px;
  border: 1px solid var(--rule); border-radius: 2px;
  font: 500 10.5px/1.5 var(--sans); letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--muted); white-space: nowrap;
}

.section { margin-top: 44px; }
.section:first-child { margin-top: 0; }
.section-head {
  display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 24px;
  margin-bottom: 18px; padding-top: 10px; border-top: 2px solid var(--ink);
}
.section-head p { margin: 0; font-size: 13px; color: var(--muted); }
.label {
  font: 600 11.5px/1.3 var(--sans); letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--muted);
}

.cols { display: grid; gap: 40px; }
.cols--2-1 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.cols--1-2 { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }
.cols--wide-side { grid-template-columns: minmax(0, 5fr) minmax(0, 2fr); }
.cols--1-1 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cols--ruled > * + * { border-left: 1px solid var(--rule); padding-left: 40px; }

.note { font-size: 13px; color: var(--muted); }
.credit { margin-top: 6px; font-size: 11.5px; line-height: 1.4; color: var(--muted); }

/* 5. Tables ----------------------------------------------------------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.table {
  width: 100%; border-collapse: collapse;
  font-size: 14px; font-variant-numeric: lining-nums tabular-nums;
}
.table th {
  padding: 0 14px 8px 0; text-align: left; vertical-align: bottom; white-space: nowrap;
  font: 600 11.5px/1.3 var(--sans); letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--muted); border-bottom: 1px solid var(--ink);
}
.table td {
  padding: 10px 14px 10px 0; vertical-align: top;
  border-bottom: 1px solid var(--rule-soft);
}
.table th:first-child, .table td:first-child { padding-left: 12px; }
.table th:last-child, .table td:last-child { padding-right: 0; }
.table .num { text-align: right; white-space: nowrap; }
.table tbody tr:hover { background: rgba(78, 135, 146, 0.06); }
.table tr.is-overdue td:first-child { box-shadow: inset 3px 0 0 var(--brick); }
.table tr.is-done { color: var(--muted); }
.table tr.is-done .type::before { opacity: 0.35; }
.table tfoot td { border-bottom: 0; border-top: 1px solid var(--ink); font-weight: 600; }

.table tbody th {
  padding: 10px 14px 10px 12px; text-align: left; vertical-align: top; white-space: normal;
  font: 600 14px/1.4 var(--sans); letter-spacing: 0; text-transform: none; color: var(--ink);
  border-bottom: 1px solid var(--rule-soft);
}
.select--inline { width: auto; min-height: 34px; padding-top: 4px; padding-bottom: 4px; font-size: 14px; }

.cell-sub { display: block; margin-top: 2px; font-size: 12.5px; color: var(--muted); }

.ref {
  font-weight: 600; white-space: nowrap; color: var(--ink);
  font-variant-numeric: lining-nums tabular-nums;
}
a.ref { text-decoration: underline; text-decoration-color: var(--rule); }
a.ref:hover { text-decoration-color: var(--ink); }

.table-foot {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px;
  padding-top: 14px; font-size: 13px; color: var(--muted);
}
.pager { display: flex; gap: 14px; }

/* 6. Issue type, status, flags ---------------------------------------- */
.t-garbage { --c: var(--t-garbage); }
.t-skip    { --c: var(--t-skip); }
.t-dumping { --c: var(--t-dumping); }
.t-litter  { --c: var(--t-litter); }
.t-drain   { --c: var(--t-drain); }
.t-toilet  { --c: var(--t-toilet); }

/* coloured dot + type name: the type is never colour alone */
.type { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.type::before {
  content: ""; flex: none; width: 10px; height: 10px; border-radius: 50%;
  background: var(--c); box-shadow: 0 0 0 1px rgba(34, 49, 58, 0.45);
}

/* six-step meter + plain status word; data-step = 1..6 */
.status { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.status__meter { display: inline-grid; grid-template-columns: repeat(6, 5px); gap: 2px; }
.status__meter i { height: 12px; background: var(--rule); }
.status[data-step="1"] i:nth-child(-n+1),
.status[data-step="2"] i:nth-child(-n+2),
.status[data-step="3"] i:nth-child(-n+3),
.status[data-step="4"] i:nth-child(-n+4),
.status[data-step="5"] i:nth-child(-n+5),
.status[data-step="6"] i:nth-child(-n+6) { background: var(--teal); }
.status[data-step="6"] .status__meter i { background: var(--ink-soft); }

.flag-overdue { color: var(--brick); font-weight: 600; white-space: nowrap; }
.flag-overdue::before {
  content: ""; display: inline-block; width: 7px; height: 7px; margin: 0 7px 1px 1px;
  background: var(--brick); transform: rotate(45deg);
}

.priority { font-size: 13px; font-weight: 600; }
.priority--high { color: var(--brick); }

/* facility condition */
.cond { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.cond::before { content: ""; width: 8px; height: 8px; border: 1px solid var(--ink-soft); }
.cond--good::before { background: var(--teal); border-color: var(--teal); }
.cond--fair::before { background: var(--olive); border-color: var(--olive); }
.cond--poor::before { background: var(--ochre); border-color: var(--ochre); }
.cond--bad { color: var(--brick); font-weight: 600; }
.cond--bad::before { background: var(--brick); border-color: var(--brick); }

/* cleanliness bands */
.b-routine   { --band: var(--b-routine); }
.b-scheduled { --band: var(--b-scheduled); }
.b-priority  { --band: var(--b-priority); }
.b-emergency { --band: var(--b-emergency); }
.band { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.band::before { content: ""; width: 10px; height: 10px; background: var(--band); }
.band.b-emergency { color: var(--brick); font-weight: 600; }

/* 7. Figures and charts ----------------------------------------------- */
.figures {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 2px solid var(--ink); border-bottom: 1px solid var(--rule);
}
.figure { padding: 16px 24px 20px; border-left: 1px solid var(--rule); }
.figure:first-child { padding-left: 0; border-left: 0; }
.figure__label { margin: 0 0 6px; font: 600 13px/1.3 var(--sans); }
.figure__value {
  margin: 0; font: 400 clamp(3rem, 2.2rem + 2.6vw, 4.75rem)/1 var(--serif);
  letter-spacing: -0.02em; font-variant-numeric: lining-nums tabular-nums;
}
.figure__unit { font-size: 0.42em; letter-spacing: 0; color: var(--ink-soft); margin-left: 0.12em; }
.figure__note { margin: 8px 0 0; font-size: 13px; color: var(--muted); }
.figure--alert .figure__value { color: var(--brick); }

.hbars + .note { margin-top: 16px; }
.chart-legend {
  display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 0 0 16px; padding: 0;
  list-style: none; font-size: 13px; color: var(--ink-soft);
}

/* horizontal stacked bars: set --max on .hbars, --total per row, --n per segment */
.hbars { display: grid; gap: 7px; margin: 0; padding: 0; list-style: none; }
.hbar {
  display: grid; grid-template-columns: 8.5rem minmax(0, 1fr); align-items: center; gap: 14px;
  font-size: 14px;
}
.hbar__track { display: flex; align-items: center; gap: 10px; min-width: 0; }
.hbar__bar { display: flex; gap: 2px; height: 18px; width: calc((100% - 2.5rem) * var(--total) / var(--max)); }
.seg { flex: var(--n) 1 0; min-width: 3px; background: var(--c); }
.hbar__value { font-weight: 600; font-variant-numeric: tabular-nums; }
.hbars__axis {
  display: grid; grid-template-columns: 8.5rem minmax(0, 1fr); gap: 14px;
  margin-top: 6px; font-size: 12px; color: var(--muted);
}

/* vertical bars with a target line: --max on .vbars, --v per bar, --t for the target */
.vchart { position: relative; padding-left: 2.25rem; }
.vbars {
  position: relative; display: grid; grid-template-columns: repeat(var(--cols, 10), minmax(0, 1fr));
  align-items: end; gap: 10px; height: 230px; margin: 0; padding: 0; list-style: none;
  border-bottom: 1px solid var(--ink);
  background:
    linear-gradient(var(--rule-soft), var(--rule-soft)) 0 calc(100% - 100% * 12 / var(--max)) / 100% 1px no-repeat,
    linear-gradient(var(--rule-soft), var(--rule-soft)) 0 calc(100% - 100% * 36 / var(--max)) / 100% 1px no-repeat,
    linear-gradient(var(--rule-soft), var(--rule-soft)) 0 calc(100% - 100% * 48 / var(--max)) / 100% 1px no-repeat;
}
.vbar { position: relative; justify-self: center; width: min(100%, 64px); height: calc(100% * var(--v) / var(--max)); background: var(--teal); }
.vbar--latest { background: var(--ink); }
.vbar__value {
  position: absolute; left: -6px; right: -6px; bottom: 100%; padding-bottom: 3px;
  text-align: center; font: 400 14px/1 var(--serif); color: var(--ink-soft);
}
.vbar--latest .vbar__value { font-weight: 600; color: var(--ink); }
.vbars__target {
  position: absolute; left: 0; right: 0; bottom: calc(100% * var(--t) / var(--max)); z-index: 1;
  border-top: 2px dashed var(--ink);
}
.vbars__target span {
  position: absolute; left: 0; bottom: 4px; padding: 0 6px 0 0;
  font-size: 12px; font-weight: 600; background: var(--paper);
}
.vchart__y {
  position: absolute; left: 0; top: 0; height: 230px; width: 2rem;
  font-size: 12px; color: var(--muted); text-align: right;
}
.vchart__y span { position: absolute; right: 0; transform: translateY(50%); }
.vbars__x {
  display: grid; grid-template-columns: repeat(var(--cols, 10), minmax(0, 1fr)); gap: 10px;
  margin-top: 6px; font-size: 12px; color: var(--muted); text-align: center;
}

/* ranked bars on 0..100 with band thresholds at 20, 50, 80 */
.rank { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.rank__row {
  display: grid; grid-template-columns: 8.5rem minmax(0, 1fr) 2.25rem; align-items: center; gap: 12px;
  font-size: 14px;
}
.rank__track {
  height: 20px;
  background:
    linear-gradient(var(--field-border), var(--field-border)) 20% 0 / 1px 100% no-repeat,
    linear-gradient(var(--field-border), var(--field-border)) 50% 0 / 1px 100% no-repeat,
    linear-gradient(var(--field-border), var(--field-border)) 80% 0 / 1px 100% no-repeat,
    var(--paper-deep);
}
.rank__bar { display: block; height: 100%; width: calc(1% * var(--v)); background: var(--band); }
.rank__value { font: 500 18px/1 var(--serif); text-align: right; font-variant-numeric: tabular-nums; }
.rank__scale {
  display: grid; grid-template-columns: 8.5rem minmax(0, 1fr) 2.25rem; gap: 12px;
  margin-top: 6px; font-size: 12px; color: var(--muted);
}
.rank__ticks { position: relative; height: 1.2em; }
.rank__ticks span { position: absolute; transform: translateX(-50%); }

/* band scale strip */
.bandscale { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 3px; margin: 0; padding: 0; list-style: none; }
.bandscale li { padding-top: 8px; border-top: 6px solid var(--band); font-size: 13px; }
.bandscale strong { display: block; font: 500 1.15rem/1.2 var(--serif); }

/* 8. Timeline, panels, photos, facts ---------------------------------- */
.timeline { margin: 0; padding: 0; list-style: none; counter-reset: step; }
.timeline > li { position: relative; padding: 0 0 22px 44px; counter-increment: step; }
.timeline > li::before {
  content: counter(step); position: absolute; left: 0; top: -1px;
  width: 28px; height: 28px; border-radius: 50%;
  border: 1px solid var(--field-border); background: var(--paper);
  font: 600 13px/26px var(--sans); text-align: center; color: var(--muted);
}
.timeline > li::after {
  content: ""; position: absolute; left: 14px; top: 31px; bottom: 3px; width: 1px; background: var(--rule);
}
.timeline > li:last-child { padding-bottom: 0; }
.timeline > li:last-child::after { display: none; }
.timeline > li.is-done::before { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.timeline > li.is-done::after { background: var(--ink); }
.timeline > li.is-current::before {
  background: var(--teal); border-color: var(--teal); color: #fff;
  box-shadow: 0 0 0 4px var(--teal-wash);
}
.timeline__step { display: block; font: 500 1.2rem/1.3 var(--serif); }
.timeline__when { display: block; font-size: 13px; color: var(--muted); }
.timeline__detail { margin: 4px 0 0; font-size: 14px; }
.timeline > li.is-todo .timeline__step { color: var(--muted); }

.panel {
  padding: 18px 22px 22px; background: var(--sheet);
  border: 1px solid var(--rule); border-top: 3px solid var(--teal);
}
.panel--verify { border-top-color: var(--olive); }
.panel--clear { border-top-color: var(--ink); }
.panel__head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 14px; }
.panel__head h3 { font-size: 1.35rem; }
.panel__who { font-size: 13px; color: var(--muted); margin: 0 0 14px; }
.panel .actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 6px; }

.photo { margin: 0; }
.photo img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.photo .placeholder { width: 100%; aspect-ratio: 4 / 3; }
.photo figcaption { margin-top: 6px; font-size: 13px; color: var(--ink-soft); }
.placeholder {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  padding: 20px; text-align: center; font-size: 14px; color: var(--muted);
  background: repeating-linear-gradient(135deg, var(--paper-deep) 0 8px, var(--paper) 8px 16px);
  border: 1px solid var(--rule);
}
.placeholder strong { color: var(--ink-soft); }

.facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 0 20px; margin: 0; }
.facts dt, .facts dd { padding: 8px 0; border-top: 1px solid var(--rule-soft); }
.facts dt { font-size: 13px; color: var(--muted); }
.facts dd { margin: 0; }
.facts dt:first-of-type, .facts dt:first-of-type + dd { border-top: 0; }

/* 9. Forms ------------------------------------------------------------ */
.field { display: flex; flex-direction: column; gap: 6px; margin: 0 0 18px; min-width: 0; }
.field__label, .field > label, fieldset > legend { font: 600 14px/1.3 var(--sans); color: var(--ink); }
.field__hint { font-size: 13px; color: var(--muted); }
.optional { font-weight: 400; color: var(--muted); }
fieldset { margin: 0 0 18px; padding: 0; border: 0; min-width: 0; }
fieldset > legend { padding: 0; margin-bottom: 8px; }

.input, select, textarea {
  width: 100%; min-height: 44px; padding: 9px 12px;
  font: 400 16px/1.3 var(--sans); color: var(--ink);
  background: var(--sheet); border: 1px solid var(--field-border); border-radius: 2px;
}
textarea { min-height: 96px; resize: vertical; }
select {
  appearance: none; -webkit-appearance: none; padding-right: 36px;
  background: var(--sheet) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%2322313A' stroke-width='1.6'/%3E%3C/svg%3E") no-repeat right 12px center;
}
.input:focus, select:focus, textarea:focus { outline: 2px solid var(--teal); outline-offset: 0; border-color: var(--teal); }

.row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px;
  font: 600 15px/1 var(--sans); color: var(--paper); text-decoration: none; white-space: nowrap;
  background: var(--ink); border: 1px solid var(--ink); border-radius: 2px; cursor: pointer;
}
.btn:hover { color: var(--paper); background: #14212A; }
.btn--accent { background: var(--teal-ink); border-color: var(--teal-ink); }
.btn--accent:hover { background: #2A5058; }
.btn--ghost { color: var(--ink); background: transparent; }
.btn--ghost:hover { color: var(--ink); background: var(--paper-deep); }
.btn--warn { color: var(--brick); background: transparent; border-color: var(--brick); }
.btn--warn:hover { color: var(--brick); background: var(--brick-wash); }
.btn--small { min-height: 34px; padding: 0 12px; font-size: 13px; }
.btn--block { width: 100%; }

/* filter bars */
.filters {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 16px;
  padding: 14px 0; margin-bottom: 20px;
  border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule);
}
.filters .field { flex: 1 1 150px; max-width: 220px; margin: 0; gap: 4px; }
.filters .field > label { font: 600 11px/1.3 var(--sans); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.filters select, .filters .input { min-height: 38px; font-size: 14px; padding-top: 6px; padding-bottom: 6px; }
.filters--stacked { display: block; padding: 0; border: 0; }
.filters--stacked .field { max-width: none; margin-bottom: 12px; }

/* radio choices as large tap targets (report form, priority) */
.choice-input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.choice {
  display: flex; flex-direction: column; gap: 10px; min-height: 104px; padding: 14px;
  background: var(--sheet); border: 1px solid var(--rule); border-radius: 2px; cursor: pointer;
}
.choice:hover { border-color: var(--ink-soft); }
.choice__dot {
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--c); box-shadow: 0 0 0 1px rgba(34, 49, 58, 0.45);
}
.choice__name { font: 600 16px/1.2 var(--sans); }
.choice__hint { font-size: 13px; line-height: 1.35; color: var(--muted); }
.choice-input:checked + .choice { padding: 13px; border: 2px solid var(--ink); background: #fff; }
.choice-input:checked + .choice .choice__dot { box-shadow: 0 0 0 3px #fff, 0 0 0 5px var(--ink); }
.choice-input:focus-visible + .choice { outline: 2px solid var(--teal); outline-offset: 2px; }

.segmented { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.segmented label {
  display: flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 10px;
  font-weight: 600; background: var(--sheet); border: 1px solid var(--field-border); cursor: pointer;
}
.segmented label:not(:first-of-type) { border-left: 0; }
.segmented .choice-input:checked + label { color: var(--paper); background: var(--ink); border-color: var(--ink); }
.segmented .choice-input:focus-visible + label { outline: 2px solid var(--teal); outline-offset: 2px; position: relative; }

.photo-drop {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  min-height: 150px; padding: 20px; text-align: center; cursor: pointer;
  font: 400 14px/1.4 var(--sans);
  background: var(--sheet); border: 1.5px dashed var(--field-border); border-radius: 2px;
}
.photo-drop:hover { border-color: var(--ink); }
.photo-drop svg { width: 34px; height: 34px; stroke: var(--ink); }
.photo-drop__title { font: 600 16px/1.3 var(--sans); }
.photo-drop__hint { font-size: 13px; color: var(--muted); max-width: 32ch; }
.photo-drop input { position: absolute; opacity: 0; width: 1px; height: 1px; }

/* 10. Public pages ------------------------------------------------------ */
.public-body { font-size: 16px; }
.public-head { border-bottom: 3px double var(--ink); }
.public-head__inner { max-width: 40rem; margin: 0 auto; padding: 14px 16px 12px; }
.public-head .brand__name { font-size: 22px; }
.public { max-width: 40rem; margin: 0 auto; padding: 26px 16px 0; }
.public h1 { font-size: clamp(2rem, 1.6rem + 2vw, 2.6rem); }
.public .standfirst { font-size: 1.15rem; }
.public-foot {
  max-width: 40rem; margin: 48px auto 0; padding: 14px 16px 36px;
  border-top: 1px solid var(--rule); font-size: 13px; color: var(--muted);
}

.q { margin: 0; padding: 24px 0 8px; border-top: 1px solid var(--rule); }
.q:first-of-type { border-top: 2px solid var(--ink); }
.q__title { display: flex; gap: 12px; align-items: baseline; margin-bottom: 14px; font: 500 1.35rem/1.2 var(--serif); }
.q__num { font: 400 1.35rem/1 var(--serif); color: var(--teal-ink); font-variant-numeric: lining-nums; }

.actions-row { display: flex; flex-wrap: wrap; gap: 10px; margin: 28px 0 12px; }
.lookup { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; gap: 0 10px; padding-bottom: 8px; }
.lookup .btn { margin-top: 25px; }
.locate + .field { margin-top: 16px; }
.form-note { margin-top: 12px; }
.pin { border-radius: 50%; background: var(--ink); border: 4px solid #fff; box-shadow: 0 0 0 1px var(--ink), 0 2px 6px rgba(0, 0, 0, 0.3); cursor: grab; }
.locate { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; margin-top: 10px; font-size: 13px; color: var(--muted); }

.refnum {
  margin: 18px 0 6px; padding: 18px 0 16px;
  border-top: 2px solid var(--ink); border-bottom: 1px solid var(--rule);
}
.refnum__value {
  display: block; margin-top: 4px;
  font: 400 clamp(3.4rem, 2.8rem + 4vw, 4.6rem)/1 var(--serif); letter-spacing: 0.01em;
  font-variant-numeric: lining-nums tabular-nums;
}

.officer-note { margin-top: 48px; padding: 18px 20px 22px; border: 1px dashed var(--field-border); background: var(--paper-deep); }
.officer-note .kicker { margin-bottom: 6px; }

/* plain-language progress on the public status page */
.progress { margin: 0; padding: 0; list-style: none; }
.progress > li {
  display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 4px 14px;
  padding: 14px 0; border-top: 1px solid var(--rule-soft);
}
.progress__mark {
  width: 26px; height: 26px; border-radius: 50%; margin-top: 1px;
  border: 1px solid var(--field-border); background: var(--paper);
}
.progress .is-done .progress__mark { background: var(--ink); border-color: var(--ink); }
.progress .is-current .progress__mark { background: var(--teal); border-color: var(--teal); box-shadow: 0 0 0 4px var(--teal-wash); }
.progress__title { font: 500 1.15rem/1.3 var(--serif); }
.progress .is-todo .progress__title { color: var(--muted); }
.progress__when { display: block; font-size: 13px; color: var(--muted); }
.progress__text { margin: 4px 0 0; font-size: 15px; }
.progress .is-current { background: linear-gradient(90deg, var(--teal-wash), transparent 80%); margin: 0 -12px; padding-left: 12px; padding-right: 12px; }

/* 11. Map and popups ------------------------------------------------- */
.leaflet-container { font-family: var(--sans); background: var(--paper-deep); }
.map-muted .leaflet-tile-pane { filter: grayscale(0.85) sepia(0.12) contrast(0.95) brightness(1.04); }
.leaflet-bar { border: 1px solid var(--ink-soft) !important; border-radius: 2px !important; box-shadow: none !important; }
.leaflet-bar a { color: var(--ink) !important; background: var(--sheet) !important; border-radius: 0 !important; }
.leaflet-popup-content-wrapper { border-radius: 2px; background: var(--sheet); box-shadow: 0 3px 18px rgba(34, 49, 58, 0.22); }
.leaflet-popup-tip { background: var(--sheet); }
.leaflet-popup-content { margin: 14px 16px 16px; font-size: 13px; line-height: 1.45; }
.leaflet-container a.leaflet-popup-close-button { top: 6px; right: 6px; color: var(--muted); }
.leaflet-control-attribution { font-size: 10.5px; }

.minimap { height: 240px; border: 1px solid var(--rule); }
.minimap--tall { height: 520px; }
.sticky { position: sticky; top: 16px; }
.sticky .note { margin-top: 14px; }

.pop { width: 100%; }
.pop__head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 2px 10px; padding-right: 14px; }
.pop__ref { font: 500 22px/1 var(--serif); white-space: nowrap; }
.pop__type { margin: 4px 0 2px; }
.pop__place { margin: 0; color: var(--muted); }
.pop__img { display: block; width: 100%; height: 84px; margin: 10px 0 2px; object-fit: cover; }
.pop .placeholder { height: 64px; margin: 10px 0 2px; aspect-ratio: auto; font-size: 12px; }
.pop .facts { margin-top: 8px; font-size: 13px; }
.pop .facts dt, .pop .facts dd { padding: 5px 0; }
.pop__link { display: block; margin-top: 10px; font-weight: 600; }

/* staff map view */
.app-map { display: flex; flex-direction: column; height: 100vh; }
.mapview { flex: 1; min-height: 0; display: grid; grid-template-columns: 300px minmax(0, 1fr); border-top: 0; }
.mapview__panel { overflow-y: auto; padding: 22px 22px 24px var(--gutter); border-right: 1px solid var(--ink); }
.mapview__panel h1 { font-size: 2.1rem; }
.mapview__summary { margin: 8px 0 18px; font: 400 1.05rem/1.4 var(--serif); color: var(--ink-soft); }
.mapview__map { min-height: 420px; }
.mapview .section-head { margin: 22px 0 10px; }
.mapview__note { margin-top: 22px; }

.legend { display: grid; gap: 7px; margin: 0; padding: 0; list-style: none; font-size: 14px; }
.legend li { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.legend .count { color: var(--muted); font-variant-numeric: tabular-nums; }
.legend--keys { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--rule-soft); font-size: 13px; color: var(--ink-soft); }
.key { display: inline-flex; align-items: center; gap: 8px; }
.key::before { content: ""; width: 12px; height: 12px; border-radius: 50%; background: var(--t-garbage); box-shadow: 0 0 0 1px rgba(34, 49, 58, 0.45); }
.key--faded::before { opacity: 0.3; }
.key--overdue::before { box-shadow: 0 0 0 2px var(--paper), 0 0 0 4px var(--brick); }
.key--facility::before { border-radius: 0; background: var(--sheet); box-shadow: 0 0 0 2px var(--ink); width: 9px; height: 9px; }
.key--facility.key--busy::before { background: var(--ink); }

/* facility marker (square) used on the facilities map */
.fac-marker { width: 12px; height: 12px; background: var(--sheet); border: 2px solid var(--ink); }
.fac-marker--busy { background: var(--ink); }

/* 12. Page-specific layouts ------------------------------------------ */

/* issue record */
.issue-head h1 { font-size: clamp(2.4rem, 1.8rem + 2.4vw, 3.6rem); font-variant-numeric: lining-nums; }
.issue-head .standfirst { margin-top: 8px; }
.photos { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.variants { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 32px; }

/* summary line above tables */
.tally { display: flex; flex-wrap: wrap; gap: 0; margin: 0 0 18px; padding: 0; list-style: none; border-top: 2px solid var(--ink); border-bottom: 1px solid var(--rule); }
.tally + .filters { border-top: 0; padding-top: 4px; }
.tally li { padding: 12px 22px 12px 0; margin-right: 22px; border-right: 1px solid var(--rule); font-size: 13px; color: var(--muted); }
.tally li:last-child { border-right: 0; }
.tally strong { display: block; font: 400 2.1rem/1.05 var(--serif); color: var(--ink); font-variant-numeric: lining-nums tabular-nums; }
.tally .is-alert strong { color: var(--brick); }

/* dashboard front page */
.frontpage-head { text-align: center; padding-bottom: 26px; margin-bottom: 0; border-bottom: 0; display: block; }
.frontpage-head h1 { max-width: 24ch; margin: 0 auto; font-size: clamp(2.2rem, 1.6rem + 2.2vw, 3.4rem); }
.frontpage-head .standfirst { margin: 14px auto 0; }
.frontpage-head .dateline { margin-top: 14px; font-size: 13px; color: var(--muted); }

.worst { margin: 0; padding: 0; list-style: none; counter-reset: worst; }
.worst li { display: grid; grid-template-columns: 2.4rem minmax(0, 1fr); gap: 2px 10px; padding: 12px 0 14px; border-top: 1px solid var(--rule); counter-increment: worst; }
.worst li:first-child { border-top: 0; padding-top: 0; }
.worst li::before { content: counter(worst); grid-row: span 2; font: 400 2.4rem/0.9 var(--serif); color: var(--teal-ink); }
.worst h3 { font-size: 1.35rem; }
.worst p { margin: 2px 0 0; font-size: 14px; color: var(--ink-soft); }

.pullquote { margin: 0; padding: 14px 0 0; border-top: 1px solid var(--rule); font: italic 400 1.2rem/1.4 var(--serif); color: var(--ink-soft); }

/* cleanliness table */
.table .score { padding-left: 7px; padding-right: 7px; text-align: center; font-variant-numeric: tabular-nums; }
.score--low { color: var(--brick); font-weight: 600; background: linear-gradient(var(--brick-wash), var(--brick-wash)) center / 2.2em 1.75em no-repeat; }
.table--middle td, .table--middle tbody th { vertical-align: middle; }
.index { font: 500 1.25rem/1 var(--serif); text-align: right; font-variant-numeric: lining-nums tabular-nums; }
.delta { font-size: 13px; color: var(--muted); white-space: nowrap; }

/* role matrix */
.matrix td:not(:first-child), .matrix th:not(:first-child) { text-align: center; }
.matrix td.no { color: var(--rule); }
.matrix td.yes { font-weight: 600; }

/* login */
.login { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); min-height: calc(100vh - 5px); }
.login__intro { padding: 56px var(--gutter) 40px; background: var(--paper-deep); border-right: 1px solid var(--ink); display: flex; flex-direction: column; }
.login__intro h1 { max-width: 15ch; margin-top: auto; font-size: clamp(2.4rem, 1.6rem + 3vw, 4.2rem); }
.login__intro .standfirst { max-width: 40ch; }
.login__loop { display: flex; flex-wrap: wrap; gap: 6px 0; margin: 28px 0 auto; padding: 0; list-style: none; font: 500 14px/1.2 var(--sans); }
.login__loop li { padding: 0 12px; border-left: 1px solid var(--field-border); }
.login__loop li:first-child { padding-left: 0; border-left: 0; }
.login__form { padding: 56px var(--gutter) 40px; max-width: 46rem; width: 100%; }
.demo-accounts { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--ink); }
.demo-accounts + .note, .table-wrap + .note { margin-top: 12px; }
.demo-accounts li { border-bottom: 1px solid var(--rule); }
.demo-accounts a { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; padding: 12px 4px; color: inherit; text-decoration: none; }
.demo-accounts a:hover { background: var(--sheet); }
.demo-accounts strong { font-weight: 600; }
.demo-accounts .role { font: 500 1.1rem/1.2 var(--serif); }
.demo-accounts .go { grid-row: span 2; align-self: center; font-size: 13px; font-weight: 600; color: var(--teal-ink); }
.demo-accounts small { font-size: 13px; color: var(--muted); }

/* contact sheet (index) */
.sheet { margin: 0; padding: 0; list-style: none; counter-reset: sheet; }
.sheet li { display: grid; grid-template-columns: 3.2rem minmax(0, 1fr) auto; gap: 4px 18px; align-items: baseline; padding: 16px 0; border-top: 1px solid var(--rule); counter-increment: sheet; }
.sheet li::before { content: counter(sheet, decimal-leading-zero); font: 400 1.6rem/1 var(--serif); color: var(--teal-ink); }
.sheet--from-4 { counter-reset: sheet 3; }
.sheet h3 { font-size: 1.4rem; }
.sheet h3 a { color: var(--ink); text-decoration-color: var(--rule); }
.sheet p { grid-column: 2; margin: 0; color: var(--ink-soft); }
.sheet code { grid-column: 3; grid-row: 1; font-size: 12.5px; color: var(--muted); }

/* Responsive ----------------------------------------------------------- */
@media (max-width: 1100px) {
  .cols--3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cols--3.cols--ruled > :nth-child(3) { border-left: 0; padding-left: 0; }
}
@media (max-width: 900px) {
  .cols--2-1, .cols--1-2, .cols--1-1, .cols--3, .cols--wide-side, .variants { grid-template-columns: minmax(0, 1fr); }
  .cols--ruled > * + * { border-left: 0; padding-left: 0; border-top: 1px solid var(--rule); padding-top: 24px; }
  .page-head { grid-template-columns: minmax(0, 1fr); }
  .page-head__aside { text-align: left; }
  .figures { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .figure:nth-child(3) { padding-left: 0; border-left: 0; }
  .figure:nth-child(n+3) { border-top: 1px solid var(--rule); }
  .app-map { height: auto; }
  .mapview { grid-template-columns: minmax(0, 1fr); }
  .mapview__map { height: 560px; order: -1; }
  .mapview__panel { border-right: 0; border-top: 1px solid var(--ink); padding-right: var(--gutter); }
  .login { grid-template-columns: minmax(0, 1fr); }
  .login__intro { border-right: 0; border-bottom: 1px solid var(--ink); padding-top: 32px; }
  .login__intro h1 { margin-top: 24px; }
}
@media (max-width: 640px) {
  body { font-size: 15px; }
  .masthead__top { flex-direction: column; align-items: flex-start; }
  .masthead__meta { justify-content: flex-start; }
  .brand__name { font-size: 21px; }
  .nav .wrap { gap: 10px; }
  .nav ul { gap: 20px; }
  .nav__action .btn { padding: 0 10px; }
  .photos { grid-template-columns: minmax(0, 1fr); }
  .row { grid-template-columns: minmax(0, 1fr); }
  .hbar, .hbars__axis { grid-template-columns: 6.5rem minmax(0, 1fr); gap: 10px; }
  .rank__row, .rank__scale { grid-template-columns: 6.5rem minmax(0, 1fr) 2rem; gap: 8px; }
  .vbars, .vbars__x { gap: 4px; }
  .vbar__value { font-size: 11px; }
  .bandscale { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 12px; }
  .sheet li { grid-template-columns: 2.4rem minmax(0, 1fr); }
  .sheet code { grid-column: 2; grid-row: auto; }
  .tally + .filters { border-top: 0; padding-top: 4px; }
.tally li { padding-right: 14px; margin-right: 14px; }
}
@media (min-width: 560px) {
  .choices { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* Map popups open to the east of the marker (see the offset in map.html)
   so they do not cover the town centre along the Kafue Road. */
.popup--east .leaflet-popup-tip-container { left: 30px; }

/* Revision 2 ------------------------------------------------------------ */

/* view-only demo session marker in the masthead */
.viewonly {
  display: inline-block; padding: 2px 8px; border: 1px solid var(--olive); border-radius: 2px;
  background: var(--olive-wash); color: var(--olive-ink);
  font: 600 10.5px/1.5 var(--sans); letter-spacing: 0.08em; text-transform: uppercase; white-space: nowrap;
}

/* map: town / district switch, ward boundaries and labels */
.viewswitch { display: flex; gap: 8px; margin: 0 0 8px; }
.btn[aria-pressed="true"] { color: var(--paper); background: var(--ink); }
.ward-label {
  font: 600 10.5px/16px var(--sans); letter-spacing: 0.1em; text-transform: uppercase; text-align: center;
  color: var(--ink-soft); white-space: nowrap;
  text-shadow: 0 0 3px var(--paper), 0 0 3px var(--paper), 0 0 2px var(--paper);
}
.key--ward::before { width: 14px; height: 0; border-radius: 0; background: none; box-shadow: none; border-top: 1.5px dashed var(--ink); }

/* read-only ward readout under a map pin */
.readout { display: block; padding: 10px 12px; background: var(--paper-deep); border: 1px solid var(--rule); font-weight: 600; }

/* disabled action (view-only session) */
.panel__locked {
  margin-top: 16px; padding: 12px 14px; border: 1px dashed var(--field-border);
  font-size: 13px; color: var(--ink-soft); background: var(--paper);
}
.panel__locked strong { display: block; margin-bottom: 2px; color: var(--ink); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; }

/* before / after side by side inside a panel */
.compare { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.compare figure { margin: 0; }
.compare img, .compare .placeholder { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.compare figcaption { margin-top: 4px; font-size: 12.5px; color: var(--muted); }

.variants--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 1100px) { .variants--3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 900px) {
  .variants--3 { grid-template-columns: minmax(0, 1fr); }
  /* on a phone the action panel comes before the photos and timeline */
  .issue-layout > aside { display: contents; }
  .issue-layout .action-section { order: -1; }
}
